Lines Matching refs:sc

25 static void ath_fill_led_pin(struct ath_softc *sc)  in ath_fill_led_pin()  argument
27 struct ath_hw *ah = sc->sc_ah; in ath_fill_led_pin()
54 struct ath_softc *sc = container_of(led_cdev, struct ath_softc, led_cdev); in ath_led_brightness() local
57 if (sc->sc_ah->config.led_active_high) in ath_led_brightness()
60 ath9k_hw_set_gpio(sc->sc_ah, sc->sc_ah->led_pin, val); in ath_led_brightness()
63 void ath_deinit_leds(struct ath_softc *sc) in ath_deinit_leds() argument
65 if (!sc->led_registered) in ath_deinit_leds()
68 ath_led_brightness(&sc->led_cdev, LED_OFF); in ath_deinit_leds()
69 led_classdev_unregister(&sc->led_cdev); in ath_deinit_leds()
71 ath9k_hw_gpio_free(sc->sc_ah, sc->sc_ah->led_pin); in ath_deinit_leds()
74 void ath_init_leds(struct ath_softc *sc) in ath_init_leds() argument
78 if (AR_SREV_9100(sc->sc_ah)) in ath_init_leds()
81 ath_fill_led_pin(sc); in ath_init_leds()
84 sc->led_cdev.default_trigger = in ath_init_leds()
85 ieee80211_get_radio_led_name(sc->hw); in ath_init_leds()
87 snprintf(sc->led_name, sizeof(sc->led_name), in ath_init_leds()
88 "ath9k-%s", wiphy_name(sc->hw->wiphy)); in ath_init_leds()
89 sc->led_cdev.name = sc->led_name; in ath_init_leds()
90 sc->led_cdev.brightness_set = ath_led_brightness; in ath_init_leds()
92 ret = led_classdev_register(wiphy_dev(sc->hw->wiphy), &sc->led_cdev); in ath_init_leds()
96 sc->led_registered = true; in ath_init_leds()
104 static bool ath_is_rfkill_set(struct ath_softc *sc) in ath_is_rfkill_set() argument
106 struct ath_hw *ah = sc->sc_ah; in ath_is_rfkill_set()
109 ath9k_ps_wakeup(sc); in ath_is_rfkill_set()
112 ath9k_ps_restore(sc); in ath_is_rfkill_set()
119 struct ath_softc *sc = hw->priv; in ath9k_rfkill_poll_state() local
120 bool blocked = !!ath_is_rfkill_set(sc); in ath9k_rfkill_poll_state()
125 void ath_start_rfkill_poll(struct ath_softc *sc) in ath_start_rfkill_poll() argument
127 struct ath_hw *ah = sc->sc_ah; in ath_start_rfkill_poll()
130 wiphy_rfkill_start_polling(sc->hw->wiphy); in ath_start_rfkill_poll()
142 static void ath_detect_bt_priority(struct ath_softc *sc) in ath_detect_bt_priority() argument
144 struct ath_btcoex *btcoex = &sc->btcoex; in ath_detect_bt_priority()
145 struct ath_hw *ah = sc->sc_ah; in ath_detect_bt_priority()
147 if (ath9k_hw_gpio_get(sc->sc_ah, ah->btcoex_hw.btpriority_gpio)) in ath_detect_bt_priority()
156 ath_dbg(ath9k_hw_common(sc->sc_ah), BTCOEX, in ath_detect_bt_priority()
161 ath_dbg(ath9k_hw_common(sc->sc_ah), BTCOEX, in ath_detect_bt_priority()
171 static void ath_mci_ftp_adjust(struct ath_softc *sc) in ath_mci_ftp_adjust() argument
173 struct ath_btcoex *btcoex = &sc->btcoex; in ath_mci_ftp_adjust()
175 struct ath_hw *ah = sc->sc_ah; in ath_mci_ftp_adjust()
181 (sc->rx.num_pkts < ATH_BTCOEX_STOMP_FTP_THRESH); in ath_mci_ftp_adjust()
185 sc->rx.num_pkts = 0; in ath_mci_ftp_adjust()
196 struct ath_softc *sc = from_timer(sc, t, btcoex.period_timer); in ath_btcoex_period_timer() local
197 struct ath_hw *ah = sc->sc_ah; in ath_btcoex_period_timer()
198 struct ath_btcoex *btcoex = &sc->btcoex; in ath_btcoex_period_timer()
203 spin_lock_irqsave(&sc->sc_pm_lock, flags); in ath_btcoex_period_timer()
204 if (sc->sc_ah->power_mode == ATH9K_PM_NETWORK_SLEEP) { in ath_btcoex_period_timer()
206 spin_unlock_irqrestore(&sc->sc_pm_lock, flags); in ath_btcoex_period_timer()
209 spin_unlock_irqrestore(&sc->sc_pm_lock, flags); in ath_btcoex_period_timer()
211 ath9k_ps_wakeup(sc); in ath_btcoex_period_timer()
215 ath9k_mci_update_rssi(sc); in ath_btcoex_period_timer()
216 ath_mci_ftp_adjust(sc); in ath_btcoex_period_timer()
220 ath_detect_bt_priority(sc); in ath_btcoex_period_timer()
244 ath9k_ps_restore(sc); in ath_btcoex_period_timer()
257 struct ath_softc *sc = from_timer(sc, t, btcoex.no_stomp_timer); in ath_btcoex_no_stomp_timer() local
258 struct ath_hw *ah = sc->sc_ah; in ath_btcoex_no_stomp_timer()
259 struct ath_btcoex *btcoex = &sc->btcoex; in ath_btcoex_no_stomp_timer()
261 ath9k_ps_wakeup(sc); in ath_btcoex_no_stomp_timer()
273 ath9k_ps_restore(sc); in ath_btcoex_no_stomp_timer()
276 static void ath_init_btcoex_timer(struct ath_softc *sc) in ath_init_btcoex_timer() argument
278 struct ath_btcoex *btcoex = &sc->btcoex; in ath_init_btcoex_timer()
296 void ath9k_btcoex_timer_resume(struct ath_softc *sc) in ath9k_btcoex_timer_resume() argument
298 struct ath_btcoex *btcoex = &sc->btcoex; in ath9k_btcoex_timer_resume()
299 struct ath_hw *ah = sc->sc_ah; in ath9k_btcoex_timer_resume()
321 void ath9k_btcoex_timer_pause(struct ath_softc *sc) in ath9k_btcoex_timer_pause() argument
323 struct ath_btcoex *btcoex = &sc->btcoex; in ath9k_btcoex_timer_pause()
324 struct ath_hw *ah = sc->sc_ah; in ath9k_btcoex_timer_pause()
336 void ath9k_btcoex_stop_gen_timer(struct ath_softc *sc) in ath9k_btcoex_stop_gen_timer() argument
338 struct ath_btcoex *btcoex = &sc->btcoex; in ath9k_btcoex_stop_gen_timer()
343 u16 ath9k_btcoex_aggr_limit(struct ath_softc *sc, u32 max_4ms_framelen) in ath9k_btcoex_aggr_limit() argument
345 struct ath_btcoex *btcoex = &sc->btcoex; in ath9k_btcoex_aggr_limit()
346 struct ath_mci_profile *mci = &sc->btcoex.mci; in ath9k_btcoex_aggr_limit()
349 if ((sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_MCI) && mci->aggr_limit) in ath9k_btcoex_aggr_limit()
358 void ath9k_btcoex_handle_interrupt(struct ath_softc *sc, u32 status) in ath9k_btcoex_handle_interrupt() argument
361 ath_mci_intr(sc); in ath9k_btcoex_handle_interrupt()
364 void ath9k_start_btcoex(struct ath_softc *sc) in ath9k_start_btcoex() argument
366 struct ath_hw *ah = sc->sc_ah; in ath9k_start_btcoex()
379 ath9k_btcoex_timer_resume(sc); in ath9k_start_btcoex()
382 void ath9k_stop_btcoex(struct ath_softc *sc) in ath9k_stop_btcoex() argument
384 struct ath_hw *ah = sc->sc_ah; in ath9k_stop_btcoex()
390 ath9k_btcoex_timer_pause(sc); in ath9k_stop_btcoex()
394 ath_mci_flush_profile(&sc->btcoex.mci); in ath9k_stop_btcoex()
397 void ath9k_deinit_btcoex(struct ath_softc *sc) in ath9k_deinit_btcoex() argument
399 struct ath_hw *ah = sc->sc_ah; in ath9k_deinit_btcoex()
402 ath_mci_cleanup(sc); in ath9k_deinit_btcoex()
408 ath9k_hw_btcoex_deinit(sc->sc_ah); in ath9k_deinit_btcoex()
412 int ath9k_init_btcoex(struct ath_softc *sc) in ath9k_init_btcoex() argument
415 struct ath_hw *ah = sc->sc_ah; in ath9k_init_btcoex()
420 switch (ath9k_hw_get_btcoex_scheme(sc->sc_ah)) { in ath9k_init_btcoex()
424 ath9k_hw_btcoex_init_2wire(sc->sc_ah); in ath9k_init_btcoex()
427 ath9k_hw_btcoex_init_3wire(sc->sc_ah); in ath9k_init_btcoex()
428 ath_init_btcoex_timer(sc); in ath9k_init_btcoex()
429 txq = sc->tx.txq_map[IEEE80211_AC_BE]; in ath9k_init_btcoex()
430 ath9k_hw_init_btcoex_hw(sc->sc_ah, txq->axq_qnum); in ath9k_init_btcoex()
433 ath_init_btcoex_timer(sc); in ath9k_init_btcoex()
435 sc->btcoex.duty_cycle = ATH_BTCOEX_DEF_DUTY_CYCLE; in ath9k_init_btcoex()
436 INIT_LIST_HEAD(&sc->btcoex.mci.info); in ath9k_init_btcoex()
439 r = ath_mci_setup(sc); in ath9k_init_btcoex()
452 static int ath9k_dump_mci_btcoex(struct ath_softc *sc, u8 *buf, u32 size) in ath9k_dump_mci_btcoex() argument
454 struct ath_btcoex *btcoex = &sc->btcoex; in ath9k_dump_mci_btcoex()
456 struct ath_hw *ah = sc->sc_ah; in ath9k_dump_mci_btcoex()
497 static int ath9k_dump_legacy_btcoex(struct ath_softc *sc, u8 *buf, u32 size) in ath9k_dump_legacy_btcoex() argument
500 struct ath_btcoex *btcoex = &sc->btcoex; in ath9k_dump_legacy_btcoex()
511 int ath9k_dump_btcoex(struct ath_softc *sc, u8 *buf, u32 size) in ath9k_dump_btcoex() argument
513 if (ath9k_hw_mci_is_enabled(sc->sc_ah)) in ath9k_dump_btcoex()
514 return ath9k_dump_mci_btcoex(sc, buf, size); in ath9k_dump_btcoex()
516 return ath9k_dump_legacy_btcoex(sc, buf, size); in ath9k_dump_btcoex()