aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath/ath9k/main.c
diff options
context:
space:
mode:
authorLuis R. Rodriguez <lrodriguez@atheros.com>2009-09-13 05:08:34 -0400
committerJohn W. Linville <linville@tuxdriver.com>2009-10-07 16:39:28 -0400
commitcd9bf689600e62d84449d65b3d25fb6d2757589e (patch)
treef9d0569c8b37ccd0a380c75bfbd528e511cd5ceb /drivers/net/wireless/ath/ath9k/main.c
parentb002a4a950e41326310795cf4a0c74d0e90fa70a (diff)
ath9k: separate core driver and hw timer code
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/ath/ath9k/main.c')
-rw-r--r--drivers/net/wireless/ath/ath9k/main.c44
1 files changed, 36 insertions, 8 deletions
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c
index 693555728eab..571a0d9c8605 100644
--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
@@ -1408,6 +1408,34 @@ static void ath9k_btcoex_bt_stomp(struct ath_softc *sc,
1408 ath9k_hw_btcoex_enable(ah); 1408 ath9k_hw_btcoex_enable(ah);
1409} 1409}
1410 1410
1411static void ath9k_gen_timer_start(struct ath_hw *ah,
1412 struct ath_gen_timer *timer,
1413 u32 timer_next,
1414 u32 timer_period)
1415{
1416 ath9k_hw_gen_timer_start(ah, timer, timer_next, timer_period);
1417
1418 if ((ah->ah_sc->imask & ATH9K_INT_GENTIMER) == 0) {
1419 ath9k_hw_set_interrupts(ah, 0);
1420 ah->ah_sc->imask |= ATH9K_INT_GENTIMER;
1421 ath9k_hw_set_interrupts(ah, ah->ah_sc->imask);
1422 }
1423}
1424
1425static void ath9k_gen_timer_stop(struct ath_hw *ah, struct ath_gen_timer *timer)
1426{
1427 struct ath_gen_timer_table *timer_table = &ah->hw_gen_timers;
1428
1429 ath9k_hw_gen_timer_stop(ah, timer);
1430
1431 /* if no timer is enabled, turn off interrupt mask */
1432 if (timer_table->timer_mask.val == 0) {
1433 ath9k_hw_set_interrupts(ah, 0);
1434 ah->ah_sc->imask &= ~ATH9K_INT_GENTIMER;
1435 ath9k_hw_set_interrupts(ah, ah->ah_sc->imask);
1436 }
1437}
1438
1411/* 1439/*
1412 * This is the master bt coex timer which runs for every 1440 * This is the master bt coex timer which runs for every
1413 * 45ms, bt traffic will be given priority during 55% of this 1441 * 45ms, bt traffic will be given priority during 55% of this
@@ -1429,13 +1457,13 @@ static void ath_btcoex_period_timer(unsigned long data)
1429 1457
1430 if (btcoex->btcoex_period != btcoex->btcoex_no_stomp) { 1458 if (btcoex->btcoex_period != btcoex->btcoex_no_stomp) {
1431 if (btcoex->hw_timer_enabled) 1459 if (btcoex->hw_timer_enabled)
1432 ath_gen_timer_stop(ah, btcoex->no_stomp_timer); 1460 ath9k_gen_timer_stop(ah, btcoex->no_stomp_timer);
1433 1461
1434 ath_gen_timer_start(ah, 1462 ath9k_gen_timer_start(ah,
1435 btcoex->no_stomp_timer, 1463 btcoex->no_stomp_timer,
1436 (ath9k_hw_gettsf32(ah) + 1464 (ath9k_hw_gettsf32(ah) +
1437 btcoex->btcoex_no_stomp), 1465 btcoex->btcoex_no_stomp),
1438 btcoex->btcoex_no_stomp * 10); 1466 btcoex->btcoex_no_stomp * 10);
1439 btcoex->hw_timer_enabled = true; 1467 btcoex->hw_timer_enabled = true;
1440 } 1468 }
1441 1469
@@ -2165,7 +2193,7 @@ static void ath9k_btcoex_timer_resume(struct ath_softc *sc)
2165 2193
2166 /* make sure duty cycle timer is also stopped when resuming */ 2194 /* make sure duty cycle timer is also stopped when resuming */
2167 if (btcoex->hw_timer_enabled) 2195 if (btcoex->hw_timer_enabled)
2168 ath_gen_timer_stop(sc->sc_ah, btcoex->no_stomp_timer); 2196 ath9k_gen_timer_stop(sc->sc_ah, btcoex->no_stomp_timer);
2169 2197
2170 btcoex->bt_priority_cnt = 0; 2198 btcoex->bt_priority_cnt = 0;
2171 btcoex->bt_priority_time = jiffies; 2199 btcoex->bt_priority_time = jiffies;
@@ -2407,7 +2435,7 @@ static void ath9k_btcoex_timer_pause(struct ath_softc *sc)
2407 del_timer_sync(&btcoex->period_timer); 2435 del_timer_sync(&btcoex->period_timer);
2408 2436
2409 if (btcoex->hw_timer_enabled) 2437 if (btcoex->hw_timer_enabled)
2410 ath_gen_timer_stop(ah, btcoex->no_stomp_timer); 2438 ath9k_gen_timer_stop(ah, btcoex->no_stomp_timer);
2411 2439
2412 btcoex->hw_timer_enabled = false; 2440 btcoex->hw_timer_enabled = false;
2413} 2441}