aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless
diff options
context:
space:
mode:
authorVasanthakumar Thiagarajan <vasanth@atheros.com>2010-01-21 00:47:27 -0500
committerJohn W. Linville <linville@tuxdriver.com>2010-01-22 16:11:32 -0500
commit58da1318ee92ad3fe7917278d596768bbe441850 (patch)
tree67f775dfd29596e814057aea851adb119d341814 /drivers/net/wireless
parenta951ae2176b982574ffa197455db6c89359fd5eb (diff)
ath9k: Fix wifi disconnection when collocated bt scan is active
As all bt packets are priority traffic during bt scan, wifi will get disconnected when bt scan lasts for few seconds. Fix this by allocating 10% of bt period time (4.5ms) to wifi fully. Signed-off-by: Vasanthakumar Thiagarajan <vasanth@atheros.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless')
-rw-r--r--drivers/net/wireless/ath/ath9k/ath9k.h2
-rw-r--r--drivers/net/wireless/ath/ath9k/btcoex.h2
-rw-r--r--drivers/net/wireless/ath/ath9k/gpio.c30
-rw-r--r--drivers/net/wireless/ath/ath9k/reg.h6
4 files changed, 29 insertions, 11 deletions
diff --git a/drivers/net/wireless/ath/ath9k/ath9k.h b/drivers/net/wireless/ath/ath9k/ath9k.h
index bf3d4c4bfa52..bdbcc70df075 100644
--- a/drivers/net/wireless/ath/ath9k/ath9k.h
+++ b/drivers/net/wireless/ath/ath9k/ath9k.h
@@ -364,6 +364,7 @@ struct ath_btcoex {
364 int bt_stomp_type; /* Types of BT stomping */ 364 int bt_stomp_type; /* Types of BT stomping */
365 u32 btcoex_no_stomp; /* in usec */ 365 u32 btcoex_no_stomp; /* in usec */
366 u32 btcoex_period; /* in usec */ 366 u32 btcoex_period; /* in usec */
367 u32 btscan_no_stomp; /* in usec */
367 struct ath_gen_timer *no_stomp_timer; /* Timer for no BT stomping */ 368 struct ath_gen_timer *no_stomp_timer; /* Timer for no BT stomping */
368}; 369};
369 370
@@ -429,6 +430,7 @@ void ath_deinit_leds(struct ath_softc *sc);
429#define SC_OP_SCANNING BIT(10) 430#define SC_OP_SCANNING BIT(10)
430#define SC_OP_TSF_RESET BIT(11) 431#define SC_OP_TSF_RESET BIT(11)
431#define SC_OP_BT_PRIORITY_DETECTED BIT(12) 432#define SC_OP_BT_PRIORITY_DETECTED BIT(12)
433#define SC_OP_BT_SCAN BIT(13)
432 434
433/* Powersave flags */ 435/* Powersave flags */
434#define PS_WAIT_FOR_BEACON BIT(0) 436#define PS_WAIT_FOR_BEACON BIT(0)
diff --git a/drivers/net/wireless/ath/ath9k/btcoex.h b/drivers/net/wireless/ath/ath9k/btcoex.h
index 1ba31a73317c..1ee5a15ccbb1 100644
--- a/drivers/net/wireless/ath/ath9k/btcoex.h
+++ b/drivers/net/wireless/ath/ath9k/btcoex.h
@@ -25,10 +25,12 @@
25 25
26#define ATH_BTCOEX_DEF_BT_PERIOD 45 26#define ATH_BTCOEX_DEF_BT_PERIOD 45
27#define ATH_BTCOEX_DEF_DUTY_CYCLE 55 27#define ATH_BTCOEX_DEF_DUTY_CYCLE 55
28#define ATH_BTCOEX_BTSCAN_DUTY_CYCLE 90
28#define ATH_BTCOEX_BMISS_THRESH 50 29#define ATH_BTCOEX_BMISS_THRESH 50
29 30
30#define ATH_BT_PRIORITY_TIME_THRESHOLD 1000 /* ms */ 31#define ATH_BT_PRIORITY_TIME_THRESHOLD 1000 /* ms */
31#define ATH_BT_CNT_THRESHOLD 3 32#define ATH_BT_CNT_THRESHOLD 3
33#define ATH_BT_CNT_SCAN_THRESHOLD 15
32 34
33enum ath_btcoex_scheme { 35enum ath_btcoex_scheme {
34 ATH_BTCOEX_CFG_NONE, 36 ATH_BTCOEX_CFG_NONE,
diff --git a/drivers/net/wireless/ath/ath9k/gpio.c b/drivers/net/wireless/ath/ath9k/gpio.c
index e204bd25ff65..deab8beb0680 100644
--- a/drivers/net/wireless/ath/ath9k/gpio.c
+++ b/drivers/net/wireless/ath/ath9k/gpio.c
@@ -230,12 +230,17 @@ static void ath_detect_bt_priority(struct ath_softc *sc)
230 230
231 if (time_after(jiffies, btcoex->bt_priority_time + 231 if (time_after(jiffies, btcoex->bt_priority_time +
232 msecs_to_jiffies(ATH_BT_PRIORITY_TIME_THRESHOLD))) { 232 msecs_to_jiffies(ATH_BT_PRIORITY_TIME_THRESHOLD))) {
233 if (btcoex->bt_priority_cnt >= ATH_BT_CNT_THRESHOLD) { 233 sc->sc_flags &= ~(SC_OP_BT_PRIORITY_DETECTED | SC_OP_BT_SCAN);
234 /* Detect if colocated bt started scanning */
235 if (btcoex->bt_priority_cnt >= ATH_BT_CNT_SCAN_THRESHOLD) {
236 ath_print(ath9k_hw_common(sc->sc_ah), ATH_DBG_BTCOEX,
237 "BT scan detected");
238 sc->sc_flags |= (SC_OP_BT_SCAN |
239 SC_OP_BT_PRIORITY_DETECTED);
240 } else if (btcoex->bt_priority_cnt >= ATH_BT_CNT_THRESHOLD) {
234 ath_print(ath9k_hw_common(sc->sc_ah), ATH_DBG_BTCOEX, 241 ath_print(ath9k_hw_common(sc->sc_ah), ATH_DBG_BTCOEX,
235 "BT priority traffic detected"); 242 "BT priority traffic detected");
236 sc->sc_flags |= SC_OP_BT_PRIORITY_DETECTED; 243 sc->sc_flags |= SC_OP_BT_PRIORITY_DETECTED;
237 } else {
238 sc->sc_flags &= ~SC_OP_BT_PRIORITY_DETECTED;
239 } 244 }
240 245
241 btcoex->bt_priority_cnt = 0; 246 btcoex->bt_priority_cnt = 0;
@@ -316,12 +321,17 @@ static void ath_btcoex_period_timer(unsigned long data)
316 struct ath_softc *sc = (struct ath_softc *) data; 321 struct ath_softc *sc = (struct ath_softc *) data;
317 struct ath_hw *ah = sc->sc_ah; 322 struct ath_hw *ah = sc->sc_ah;
318 struct ath_btcoex *btcoex = &sc->btcoex; 323 struct ath_btcoex *btcoex = &sc->btcoex;
324 u32 timer_period;
325 bool is_btscan;
319 326
320 ath_detect_bt_priority(sc); 327 ath_detect_bt_priority(sc);
321 328
329 is_btscan = sc->sc_flags & SC_OP_BT_SCAN;
330
322 spin_lock_bh(&btcoex->btcoex_lock); 331 spin_lock_bh(&btcoex->btcoex_lock);
323 332
324 ath9k_btcoex_bt_stomp(sc, btcoex->bt_stomp_type); 333 ath9k_btcoex_bt_stomp(sc, is_btscan ? ATH_BTCOEX_STOMP_ALL :
334 btcoex->bt_stomp_type);
325 335
326 spin_unlock_bh(&btcoex->btcoex_lock); 336 spin_unlock_bh(&btcoex->btcoex_lock);
327 337
@@ -329,11 +339,12 @@ static void ath_btcoex_period_timer(unsigned long data)
329 if (btcoex->hw_timer_enabled) 339 if (btcoex->hw_timer_enabled)
330 ath9k_gen_timer_stop(ah, btcoex->no_stomp_timer); 340 ath9k_gen_timer_stop(ah, btcoex->no_stomp_timer);
331 341
342 timer_period = is_btscan ? btcoex->btscan_no_stomp :
343 btcoex->btcoex_no_stomp;
332 ath9k_gen_timer_start(ah, 344 ath9k_gen_timer_start(ah,
333 btcoex->no_stomp_timer, 345 btcoex->no_stomp_timer,
334 (ath9k_hw_gettsf32(ah) + 346 (ath9k_hw_gettsf32(ah) +
335 btcoex->btcoex_no_stomp), 347 timer_period), timer_period * 10);
336 btcoex->btcoex_no_stomp * 10);
337 btcoex->hw_timer_enabled = true; 348 btcoex->hw_timer_enabled = true;
338 } 349 }
339 350
@@ -350,13 +361,14 @@ static void ath_btcoex_no_stomp_timer(void *arg)
350 struct ath_softc *sc = (struct ath_softc *)arg; 361 struct ath_softc *sc = (struct ath_softc *)arg;
351 struct ath_hw *ah = sc->sc_ah; 362 struct ath_hw *ah = sc->sc_ah;
352 struct ath_btcoex *btcoex = &sc->btcoex; 363 struct ath_btcoex *btcoex = &sc->btcoex;
364 bool is_btscan = sc->sc_flags & SC_OP_BT_SCAN;
353 365
354 ath_print(ath9k_hw_common(ah), ATH_DBG_BTCOEX, 366 ath_print(ath9k_hw_common(ah), ATH_DBG_BTCOEX,
355 "no stomp timer running \n"); 367 "no stomp timer running \n");
356 368
357 spin_lock_bh(&btcoex->btcoex_lock); 369 spin_lock_bh(&btcoex->btcoex_lock);
358 370
359 if (btcoex->bt_stomp_type == ATH_BTCOEX_STOMP_LOW) 371 if (btcoex->bt_stomp_type == ATH_BTCOEX_STOMP_LOW || is_btscan)
360 ath9k_btcoex_bt_stomp(sc, ATH_BTCOEX_STOMP_NONE); 372 ath9k_btcoex_bt_stomp(sc, ATH_BTCOEX_STOMP_NONE);
361 else if (btcoex->bt_stomp_type == ATH_BTCOEX_STOMP_ALL) 373 else if (btcoex->bt_stomp_type == ATH_BTCOEX_STOMP_ALL)
362 ath9k_btcoex_bt_stomp(sc, ATH_BTCOEX_STOMP_LOW); 374 ath9k_btcoex_bt_stomp(sc, ATH_BTCOEX_STOMP_LOW);
@@ -371,6 +383,8 @@ int ath_init_btcoex_timer(struct ath_softc *sc)
371 btcoex->btcoex_period = ATH_BTCOEX_DEF_BT_PERIOD * 1000; 383 btcoex->btcoex_period = ATH_BTCOEX_DEF_BT_PERIOD * 1000;
372 btcoex->btcoex_no_stomp = (100 - ATH_BTCOEX_DEF_DUTY_CYCLE) * 384 btcoex->btcoex_no_stomp = (100 - ATH_BTCOEX_DEF_DUTY_CYCLE) *
373 btcoex->btcoex_period / 100; 385 btcoex->btcoex_period / 100;
386 btcoex->btscan_no_stomp = (100 - ATH_BTCOEX_BTSCAN_DUTY_CYCLE) *
387 btcoex->btcoex_period / 100;
374 388
375 setup_timer(&btcoex->period_timer, ath_btcoex_period_timer, 389 setup_timer(&btcoex->period_timer, ath_btcoex_period_timer,
376 (unsigned long) sc); 390 (unsigned long) sc);
@@ -405,7 +419,7 @@ void ath9k_btcoex_timer_resume(struct ath_softc *sc)
405 419
406 btcoex->bt_priority_cnt = 0; 420 btcoex->bt_priority_cnt = 0;
407 btcoex->bt_priority_time = jiffies; 421 btcoex->bt_priority_time = jiffies;
408 sc->sc_flags &= ~SC_OP_BT_PRIORITY_DETECTED; 422 sc->sc_flags &= ~(SC_OP_BT_PRIORITY_DETECTED | SC_OP_BT_SCAN);
409 423
410 mod_timer(&btcoex->period_timer, jiffies); 424 mod_timer(&btcoex->period_timer, jiffies);
411} 425}
diff --git a/drivers/net/wireless/ath/ath9k/reg.h b/drivers/net/wireless/ath/ath9k/reg.h
index 8e653fb937a1..72cfa8ebd9ae 100644
--- a/drivers/net/wireless/ath/ath9k/reg.h
+++ b/drivers/net/wireless/ath/ath9k/reg.h
@@ -1547,9 +1547,9 @@ enum {
1547 1547
1548#define AR_BT_COEX_WEIGHT 0x8174 1548#define AR_BT_COEX_WEIGHT 0x8174
1549#define AR_BT_COEX_WGHT 0xff55 1549#define AR_BT_COEX_WGHT 0xff55
1550#define AR_STOMP_ALL_WLAN_WGHT 0xffcc 1550#define AR_STOMP_ALL_WLAN_WGHT 0xfcfc
1551#define AR_STOMP_LOW_WLAN_WGHT 0xaaa8 1551#define AR_STOMP_LOW_WLAN_WGHT 0xa8a8
1552#define AR_STOMP_NONE_WLAN_WGHT 0xaa00 1552#define AR_STOMP_NONE_WLAN_WGHT 0x0000
1553#define AR_BTCOEX_BT_WGHT 0x0000ffff 1553#define AR_BTCOEX_BT_WGHT 0x0000ffff
1554#define AR_BTCOEX_BT_WGHT_S 0 1554#define AR_BTCOEX_BT_WGHT_S 0
1555#define AR_BTCOEX_WL_WGHT 0xffff0000 1555#define AR_BTCOEX_WL_WGHT 0xffff0000