Lines Matching refs:priv

30 static void ath_detect_bt_priority(struct ath9k_htc_priv *priv)  in ath_detect_bt_priority()  argument
32 struct ath_btcoex *btcoex = &priv->btcoex; in ath_detect_bt_priority()
33 struct ath_hw *ah = priv->ah; in ath_detect_bt_priority()
40 clear_bit(OP_BT_PRIORITY_DETECTED, &priv->op_flags); in ath_detect_bt_priority()
41 clear_bit(OP_BT_SCAN, &priv->op_flags); in ath_detect_bt_priority()
46 set_bit(OP_BT_PRIORITY_DETECTED, &priv->op_flags); in ath_detect_bt_priority()
47 set_bit(OP_BT_SCAN, &priv->op_flags); in ath_detect_bt_priority()
51 set_bit(OP_BT_PRIORITY_DETECTED, &priv->op_flags); in ath_detect_bt_priority()
66 struct ath9k_htc_priv *priv = container_of(work, struct ath9k_htc_priv, in ath_btcoex_period_work() local
68 struct ath_btcoex *btcoex = &priv->btcoex; in ath_btcoex_period_work()
69 struct ath_common *common = ath9k_hw_common(priv->ah); in ath_btcoex_period_work()
73 ath_detect_bt_priority(priv); in ath_btcoex_period_work()
75 ret = ath9k_htc_update_cap_target(priv, in ath_btcoex_period_work()
76 test_bit(OP_BT_PRIORITY_DETECTED, &priv->op_flags)); in ath_btcoex_period_work()
82 ath9k_hw_btcoex_bt_stomp(priv->ah, test_bit(OP_BT_SCAN, &priv->op_flags) ? in ath_btcoex_period_work()
85 ath9k_hw_btcoex_enable(priv->ah); in ath_btcoex_period_work()
86 timer_period = test_bit(OP_BT_SCAN, &priv->op_flags) ? in ath_btcoex_period_work()
88 ieee80211_queue_delayed_work(priv->hw, &priv->duty_cycle_work, in ath_btcoex_period_work()
90 ieee80211_queue_delayed_work(priv->hw, &priv->coex_period_work, in ath_btcoex_period_work()
100 struct ath9k_htc_priv *priv = container_of(work, struct ath9k_htc_priv, in ath_btcoex_duty_cycle_work() local
102 struct ath_hw *ah = priv->ah; in ath_btcoex_duty_cycle_work()
103 struct ath_btcoex *btcoex = &priv->btcoex; in ath_btcoex_duty_cycle_work()
109 test_bit(OP_BT_SCAN, &priv->op_flags)) in ath_btcoex_duty_cycle_work()
114 ath9k_hw_btcoex_enable(priv->ah); in ath_btcoex_duty_cycle_work()
117 static void ath_htc_init_btcoex_work(struct ath9k_htc_priv *priv) in ath_htc_init_btcoex_work() argument
119 struct ath_btcoex *btcoex = &priv->btcoex; in ath_htc_init_btcoex_work()
126 INIT_DELAYED_WORK(&priv->coex_period_work, ath_btcoex_period_work); in ath_htc_init_btcoex_work()
127 INIT_DELAYED_WORK(&priv->duty_cycle_work, ath_btcoex_duty_cycle_work); in ath_htc_init_btcoex_work()
134 static void ath_htc_resume_btcoex_work(struct ath9k_htc_priv *priv) in ath_htc_resume_btcoex_work() argument
136 struct ath_btcoex *btcoex = &priv->btcoex; in ath_htc_resume_btcoex_work()
137 struct ath_hw *ah = priv->ah; in ath_htc_resume_btcoex_work()
143 clear_bit(OP_BT_PRIORITY_DETECTED, &priv->op_flags); in ath_htc_resume_btcoex_work()
144 clear_bit(OP_BT_SCAN, &priv->op_flags); in ath_htc_resume_btcoex_work()
145 ieee80211_queue_delayed_work(priv->hw, &priv->coex_period_work, 0); in ath_htc_resume_btcoex_work()
152 static void ath_htc_cancel_btcoex_work(struct ath9k_htc_priv *priv) in ath_htc_cancel_btcoex_work() argument
154 cancel_delayed_work_sync(&priv->coex_period_work); in ath_htc_cancel_btcoex_work()
155 cancel_delayed_work_sync(&priv->duty_cycle_work); in ath_htc_cancel_btcoex_work()
158 void ath9k_htc_start_btcoex(struct ath9k_htc_priv *priv) in ath9k_htc_start_btcoex() argument
160 struct ath_hw *ah = priv->ah; in ath9k_htc_start_btcoex()
166 ath_htc_resume_btcoex_work(priv); in ath9k_htc_start_btcoex()
170 void ath9k_htc_stop_btcoex(struct ath9k_htc_priv *priv) in ath9k_htc_stop_btcoex() argument
172 struct ath_hw *ah = priv->ah; in ath9k_htc_stop_btcoex()
177 ath_htc_cancel_btcoex_work(priv); in ath9k_htc_stop_btcoex()
182 void ath9k_htc_init_btcoex(struct ath9k_htc_priv *priv, char *product) in ath9k_htc_init_btcoex() argument
184 struct ath_hw *ah = priv->ah; in ath9k_htc_init_btcoex()
200 switch (ath9k_hw_get_btcoex_scheme(priv->ah)) { in ath9k_htc_init_btcoex()
204 priv->ah->btcoex_hw.btactive_gpio = 7; in ath9k_htc_init_btcoex()
205 priv->ah->btcoex_hw.btpriority_gpio = 6; in ath9k_htc_init_btcoex()
206 priv->ah->btcoex_hw.wlanactive_gpio = 8; in ath9k_htc_init_btcoex()
207 priv->btcoex.bt_stomp_type = ATH_BTCOEX_STOMP_LOW; in ath9k_htc_init_btcoex()
208 ath9k_hw_btcoex_init_3wire(priv->ah); in ath9k_htc_init_btcoex()
209 ath_htc_init_btcoex_work(priv); in ath9k_htc_init_btcoex()
210 qnum = priv->hwq_map[IEEE80211_AC_BE]; in ath9k_htc_init_btcoex()
211 ath9k_hw_init_btcoex_hw(priv->ah, qnum); in ath9k_htc_init_btcoex()
228 struct ath9k_htc_priv *priv = container_of(work, in ath9k_led_work() local
232 ath9k_hw_set_gpio(priv->ah, priv->ah->led_pin, in ath9k_led_work()
233 (priv->brightness == LED_OFF)); in ath9k_led_work()
239 struct ath9k_htc_priv *priv = container_of(led_cdev, in ath9k_led_brightness() local
244 priv->brightness = brightness; in ath9k_led_brightness()
245 ieee80211_queue_work(priv->hw, &priv->led_work); in ath9k_led_brightness()
248 void ath9k_deinit_leds(struct ath9k_htc_priv *priv) in ath9k_deinit_leds() argument
250 if (!priv->led_registered) in ath9k_deinit_leds()
253 ath9k_led_brightness(&priv->led_cdev, LED_OFF); in ath9k_deinit_leds()
254 led_classdev_unregister(&priv->led_cdev); in ath9k_deinit_leds()
255 cancel_work_sync(&priv->led_work); in ath9k_deinit_leds()
259 void ath9k_configure_leds(struct ath9k_htc_priv *priv) in ath9k_configure_leds() argument
262 ath9k_hw_cfg_output(priv->ah, priv->ah->led_pin, in ath9k_configure_leds()
265 ath9k_hw_set_gpio(priv->ah, priv->ah->led_pin, 1); in ath9k_configure_leds()
269 void ath9k_init_leds(struct ath9k_htc_priv *priv) in ath9k_init_leds() argument
273 if (AR_SREV_9287(priv->ah)) in ath9k_init_leds()
274 priv->ah->led_pin = ATH_LED_PIN_9287; in ath9k_init_leds()
275 else if (AR_SREV_9271(priv->ah)) in ath9k_init_leds()
276 priv->ah->led_pin = ATH_LED_PIN_9271; in ath9k_init_leds()
277 else if (AR_DEVID_7010(priv->ah)) in ath9k_init_leds()
278 priv->ah->led_pin = ATH_LED_PIN_7010; in ath9k_init_leds()
280 priv->ah->led_pin = ATH_LED_PIN_DEF; in ath9k_init_leds()
283 priv->led_cdev.default_trigger = in ath9k_init_leds()
284 ieee80211_get_radio_led_name(priv->hw); in ath9k_init_leds()
286 ath9k_configure_leds(priv); in ath9k_init_leds()
288 snprintf(priv->led_name, sizeof(priv->led_name), in ath9k_init_leds()
289 "ath9k_htc-%s", wiphy_name(priv->hw->wiphy)); in ath9k_init_leds()
290 priv->led_cdev.name = priv->led_name; in ath9k_init_leds()
291 priv->led_cdev.brightness_set = ath9k_led_brightness; in ath9k_init_leds()
293 ret = led_classdev_register(wiphy_dev(priv->hw->wiphy), &priv->led_cdev); in ath9k_init_leds()
297 INIT_WORK(&priv->led_work, ath9k_led_work); in ath9k_init_leds()
298 priv->led_registered = true; in ath9k_init_leds()
308 static bool ath_is_rfkill_set(struct ath9k_htc_priv *priv) in ath_is_rfkill_set() argument
312 ath9k_htc_ps_wakeup(priv); in ath_is_rfkill_set()
313 is_blocked = ath9k_hw_gpio_get(priv->ah, priv->ah->rfkill_gpio) == in ath_is_rfkill_set()
314 priv->ah->rfkill_polarity; in ath_is_rfkill_set()
315 ath9k_htc_ps_restore(priv); in ath_is_rfkill_set()
322 struct ath9k_htc_priv *priv = hw->priv; in ath9k_htc_rfkill_poll_state() local
323 bool blocked = !!ath_is_rfkill_set(priv); in ath9k_htc_rfkill_poll_state()
328 void ath9k_start_rfkill_poll(struct ath9k_htc_priv *priv) in ath9k_start_rfkill_poll() argument
330 if (priv->ah->caps.hw_caps & ATH9K_HW_CAP_RFSILENT) in ath9k_start_rfkill_poll()
331 wiphy_rfkill_start_polling(priv->hw->wiphy); in ath9k_start_rfkill_poll()