Lines Matching +full:bt +full:- +full:sco
2 * Copyright (c) 2008-2011 Atheros Communications Inc.
27 struct ath_hw *ah = sc->sc_ah; in ath_fill_led_pin()
30 if (ah->led_pin < 0) { in ath_fill_led_pin()
32 ah->led_pin = ATH_LED_PIN_9287; in ath_fill_led_pin()
34 ah->led_pin = ATH_LED_PIN_9485; in ath_fill_led_pin()
36 ah->led_pin = ATH_LED_PIN_9300; in ath_fill_led_pin()
38 ah->led_pin = ATH_LED_PIN_9462; in ath_fill_led_pin()
40 ah->led_pin = ATH_LED_PIN_DEF; in ath_fill_led_pin()
44 ath9k_hw_gpio_request_out(ah, ah->led_pin, "ath9k-led", in ath_fill_led_pin()
48 ath9k_hw_set_gpio(ah, ah->led_pin, ah->config.led_active_high ? 0 : 1); in ath_fill_led_pin()
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()
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()
78 if (AR_SREV_9100(sc->sc_ah)) 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()
106 struct ath_hw *ah = sc->sc_ah; in ath_is_rfkill_set()
110 is_blocked = ath9k_hw_gpio_get(ah, ah->rfkill_gpio) == in ath_is_rfkill_set()
111 ah->rfkill_polarity; in ath_is_rfkill_set()
119 struct ath_softc *sc = hw->priv; in ath9k_rfkill_poll_state()
122 wiphy_rfkill_set_hw_state(hw->wiphy, blocked); in ath9k_rfkill_poll_state()
127 struct ath_hw *ah = sc->sc_ah; in ath_start_rfkill_poll()
129 if (ah->caps.hw_caps & ATH9K_HW_CAP_RFSILENT) in ath_start_rfkill_poll()
130 wiphy_rfkill_start_polling(sc->hw->wiphy); in ath_start_rfkill_poll()
140 * Detects if there is any priority bt traffic
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()
148 btcoex->bt_priority_cnt++; in ath_detect_bt_priority()
150 if (time_after(jiffies, btcoex->bt_priority_time + in ath_detect_bt_priority()
152 clear_bit(BT_OP_PRIORITY_DETECTED, &btcoex->op_flags); in ath_detect_bt_priority()
153 clear_bit(BT_OP_SCAN, &btcoex->op_flags); in ath_detect_bt_priority()
154 /* Detect if colocated bt started scanning */ in ath_detect_bt_priority()
155 if (btcoex->bt_priority_cnt >= ATH_BT_CNT_SCAN_THRESHOLD) { in ath_detect_bt_priority()
156 ath_dbg(ath9k_hw_common(sc->sc_ah), BTCOEX, in ath_detect_bt_priority()
157 "BT scan detected\n"); in ath_detect_bt_priority()
158 set_bit(BT_OP_PRIORITY_DETECTED, &btcoex->op_flags); in ath_detect_bt_priority()
159 set_bit(BT_OP_SCAN, &btcoex->op_flags); in ath_detect_bt_priority()
160 } else if (btcoex->bt_priority_cnt >= ATH_BT_CNT_THRESHOLD) { in ath_detect_bt_priority()
161 ath_dbg(ath9k_hw_common(sc->sc_ah), BTCOEX, in ath_detect_bt_priority()
162 "BT priority traffic detected\n"); in ath_detect_bt_priority()
163 set_bit(BT_OP_PRIORITY_DETECTED, &btcoex->op_flags); in ath_detect_bt_priority()
166 btcoex->bt_priority_cnt = 0; in ath_detect_bt_priority()
167 btcoex->bt_priority_time = jiffies; in ath_detect_bt_priority()
173 struct ath_btcoex *btcoex = &sc->btcoex; in ath_mci_ftp_adjust()
174 struct ath_mci_profile *mci = &btcoex->mci; in ath_mci_ftp_adjust()
175 struct ath_hw *ah = sc->sc_ah; in ath_mci_ftp_adjust()
177 if (btcoex->bt_wait_time > ATH_BTCOEX_RX_WAIT_TIME) { in ath_mci_ftp_adjust()
179 (mci->num_pan || mci->num_other_acl)) in ath_mci_ftp_adjust()
180 ah->btcoex_hw.mci.stomp_ftp = in ath_mci_ftp_adjust()
181 (sc->rx.num_pkts < ATH_BTCOEX_STOMP_FTP_THRESH); in ath_mci_ftp_adjust()
183 ah->btcoex_hw.mci.stomp_ftp = false; in ath_mci_ftp_adjust()
184 btcoex->bt_wait_time = 0; in ath_mci_ftp_adjust()
185 sc->rx.num_pkts = 0; in ath_mci_ftp_adjust()
190 * This is the master bt coex timer which runs for every
191 * 45ms, bt traffic will be given priority during 55% of this
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()
205 btcoex->bt_wait_time += btcoex->btcoex_period; 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()
212 spin_lock_bh(&btcoex->btcoex_lock); in ath_btcoex_period_timer()
214 if (ah->caps.hw_caps & ATH9K_HW_CAP_MCI) { in ath_btcoex_period_timer()
219 if (!(ah->caps.hw_caps & ATH9K_HW_CAP_MCI)) in ath_btcoex_period_timer()
222 stomp_type = btcoex->bt_stomp_type; in ath_btcoex_period_timer()
223 timer_period = btcoex->btcoex_no_stomp; in ath_btcoex_period_timer()
225 if (!(ah->caps.hw_caps & ATH9K_HW_CAP_MCI)) { in ath_btcoex_period_timer()
226 if (test_bit(BT_OP_SCAN, &btcoex->op_flags)) { in ath_btcoex_period_timer()
228 timer_period = btcoex->btscan_no_stomp; in ath_btcoex_period_timer()
230 } else if (btcoex->stomp_audio >= 5) { in ath_btcoex_period_timer()
232 btcoex->stomp_audio = 0; in ath_btcoex_period_timer()
238 spin_unlock_bh(&btcoex->btcoex_lock); in ath_btcoex_period_timer()
240 if (btcoex->btcoex_period != btcoex->btcoex_no_stomp) in ath_btcoex_period_timer()
241 mod_timer(&btcoex->no_stomp_timer, in ath_btcoex_period_timer()
247 mod_timer(&btcoex->period_timer, in ath_btcoex_period_timer()
248 jiffies + msecs_to_jiffies(btcoex->btcoex_period)); in ath_btcoex_period_timer()
253 * registers to time slice between wlan and bt traffic
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()
262 spin_lock_bh(&btcoex->btcoex_lock); in ath_btcoex_no_stomp_timer()
264 if (btcoex->bt_stomp_type == ATH_BTCOEX_STOMP_LOW || in ath_btcoex_no_stomp_timer()
265 (!(ah->caps.hw_caps & ATH9K_HW_CAP_MCI) && in ath_btcoex_no_stomp_timer()
266 test_bit(BT_OP_SCAN, &btcoex->op_flags))) in ath_btcoex_no_stomp_timer()
268 else if (btcoex->bt_stomp_type == ATH_BTCOEX_STOMP_ALL) in ath_btcoex_no_stomp_timer()
272 spin_unlock_bh(&btcoex->btcoex_lock); in ath_btcoex_no_stomp_timer()
278 struct ath_btcoex *btcoex = &sc->btcoex; in ath_init_btcoex_timer()
280 btcoex->btcoex_period = ATH_BTCOEX_DEF_BT_PERIOD; in ath_init_btcoex_timer()
281 btcoex->btcoex_no_stomp = (100 - ATH_BTCOEX_DEF_DUTY_CYCLE) * in ath_init_btcoex_timer()
282 btcoex->btcoex_period / 100; in ath_init_btcoex_timer()
283 btcoex->btscan_no_stomp = (100 - ATH_BTCOEX_BTSCAN_DUTY_CYCLE) * in ath_init_btcoex_timer()
284 btcoex->btcoex_period / 100; in ath_init_btcoex_timer()
285 btcoex->bt_stomp_type = ATH_BTCOEX_STOMP_LOW; in ath_init_btcoex_timer()
287 timer_setup(&btcoex->period_timer, ath_btcoex_period_timer, 0); in ath_init_btcoex_timer()
288 timer_setup(&btcoex->no_stomp_timer, ath_btcoex_no_stomp_timer, 0); in ath_init_btcoex_timer()
290 spin_lock_init(&btcoex->btcoex_lock); in ath_init_btcoex_timer()
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()
308 del_timer_sync(&btcoex->no_stomp_timer); in ath9k_btcoex_timer_resume()
310 btcoex->bt_priority_cnt = 0; in ath9k_btcoex_timer_resume()
311 btcoex->bt_priority_time = jiffies; in ath9k_btcoex_timer_resume()
312 clear_bit(BT_OP_PRIORITY_DETECTED, &btcoex->op_flags); in ath9k_btcoex_timer_resume()
313 clear_bit(BT_OP_SCAN, &btcoex->op_flags); in ath9k_btcoex_timer_resume()
315 mod_timer(&btcoex->period_timer, jiffies); in ath9k_btcoex_timer_resume()
319 * Pause btcoex timer and bt duty cycle timer
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()
332 del_timer_sync(&btcoex->period_timer); in ath9k_btcoex_timer_pause()
333 del_timer_sync(&btcoex->no_stomp_timer); in ath9k_btcoex_timer_pause()
338 struct ath_btcoex *btcoex = &sc->btcoex; in ath9k_btcoex_stop_gen_timer()
340 del_timer_sync(&btcoex->no_stomp_timer); in ath9k_btcoex_stop_gen_timer()
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()
350 aggr_limit = (max_4ms_framelen * mci->aggr_limit) >> 4; in ath9k_btcoex_aggr_limit()
351 else if (test_bit(BT_OP_PRIORITY_DETECTED, &btcoex->op_flags)) in ath9k_btcoex_aggr_limit()
366 struct ath_hw *ah = sc->sc_ah; in ath9k_start_btcoex()
368 if (ah->btcoex_hw.enabled || in ath9k_start_btcoex()
372 if (!(ah->caps.hw_caps & ATH9K_HW_CAP_MCI)) in ath9k_start_btcoex()
384 struct ath_hw *ah = sc->sc_ah; in ath9k_stop_btcoex()
386 if (!ah->btcoex_hw.enabled || in ath9k_stop_btcoex()
393 if (ah->caps.hw_caps & ATH9K_HW_CAP_MCI) in ath9k_stop_btcoex()
394 ath_mci_flush_profile(&sc->btcoex.mci); in ath9k_stop_btcoex()
399 struct ath_hw *ah = sc->sc_ah; in ath9k_deinit_btcoex()
408 ath9k_hw_btcoex_deinit(sc->sc_ah); in ath9k_deinit_btcoex()
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()
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()
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()
454 struct ath_btcoex *btcoex = &sc->btcoex; in ath9k_dump_mci_btcoex()
455 struct ath_mci_profile *mci = &btcoex->mci; in ath9k_dump_mci_btcoex()
456 struct ath_hw *ah = sc->sc_ah; in ath9k_dump_mci_btcoex()
457 struct ath_btcoex_hw *btcoex_hw = &ah->btcoex_hw; in ath9k_dump_mci_btcoex()
461 ATH_DUMP_BTCOEX("Total BT profiles", NUM_PROF(mci)); in ath9k_dump_mci_btcoex()
462 ATH_DUMP_BTCOEX("MGMT", mci->num_mgmt); in ath9k_dump_mci_btcoex()
463 ATH_DUMP_BTCOEX("SCO", mci->num_sco); in ath9k_dump_mci_btcoex()
464 ATH_DUMP_BTCOEX("A2DP", mci->num_a2dp); in ath9k_dump_mci_btcoex()
465 ATH_DUMP_BTCOEX("HID", mci->num_hid); in ath9k_dump_mci_btcoex()
466 ATH_DUMP_BTCOEX("PAN", mci->num_pan); in ath9k_dump_mci_btcoex()
467 ATH_DUMP_BTCOEX("ACL", mci->num_other_acl); in ath9k_dump_mci_btcoex()
468 ATH_DUMP_BTCOEX("BDR", mci->num_bdr); in ath9k_dump_mci_btcoex()
469 ATH_DUMP_BTCOEX("Aggr. Limit", mci->aggr_limit); in ath9k_dump_mci_btcoex()
470 ATH_DUMP_BTCOEX("Stomp Type", btcoex->bt_stomp_type); in ath9k_dump_mci_btcoex()
471 ATH_DUMP_BTCOEX("BTCoex Period (msec)", btcoex->btcoex_period); in ath9k_dump_mci_btcoex()
472 ATH_DUMP_BTCOEX("Duty Cycle", btcoex->duty_cycle); in ath9k_dump_mci_btcoex()
473 ATH_DUMP_BTCOEX("BT Wait time", btcoex->bt_wait_time); in ath9k_dump_mci_btcoex()
474 ATH_DUMP_BTCOEX("Concurrent Tx", btcoex_hw->mci.concur_tx); in ath9k_dump_mci_btcoex()
475 ATH_DUMP_BTCOEX("Concurrent RSSI cnt", btcoex->rssi_count); in ath9k_dump_mci_btcoex()
477 len += scnprintf(buf + len, size - len, "BT Weights: "); in ath9k_dump_mci_btcoex()
479 len += scnprintf(buf + len, size - len, "%08x ", in ath9k_dump_mci_btcoex()
480 btcoex_hw->bt_weight[i]); in ath9k_dump_mci_btcoex()
481 len += scnprintf(buf + len, size - len, "\n"); in ath9k_dump_mci_btcoex()
482 len += scnprintf(buf + len, size - len, "WLAN Weights: "); in ath9k_dump_mci_btcoex()
484 len += scnprintf(buf + len, size - len, "%08x ", in ath9k_dump_mci_btcoex()
485 btcoex_hw->wlan_weight[i]); in ath9k_dump_mci_btcoex()
486 len += scnprintf(buf + len, size - len, "\n"); in ath9k_dump_mci_btcoex()
487 len += scnprintf(buf + len, size - len, "Tx Priorities: "); in ath9k_dump_mci_btcoex()
489 len += scnprintf(buf + len, size - len, "%08x ", in ath9k_dump_mci_btcoex()
490 btcoex_hw->tx_prio[i]); in ath9k_dump_mci_btcoex()
492 len += scnprintf(buf + len, size - len, "\n"); in ath9k_dump_mci_btcoex()
500 struct ath_btcoex *btcoex = &sc->btcoex; in ath9k_dump_legacy_btcoex()
503 ATH_DUMP_BTCOEX("Stomp Type", btcoex->bt_stomp_type); in ath9k_dump_legacy_btcoex()
504 ATH_DUMP_BTCOEX("BTCoex Period (msec)", btcoex->btcoex_period); in ath9k_dump_legacy_btcoex()
505 ATH_DUMP_BTCOEX("Duty Cycle", btcoex->duty_cycle); in ath9k_dump_legacy_btcoex()
506 ATH_DUMP_BTCOEX("BT Wait time", btcoex->bt_wait_time); in ath9k_dump_legacy_btcoex()
513 if (ath9k_hw_mci_is_enabled(sc->sc_ah)) in ath9k_dump_btcoex()