aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSujith Manoharan <c_manoha@qca.qualcomm.com>2012-02-22 02:10:27 -0500
committerJohn W. Linville <linville@tuxdriver.com>2012-02-27 14:06:34 -0500
commitdf198b172f7a14ecf7aefaadb3761c273600333e (patch)
tree1c2618700d7d5c7194b573fbb1dfee575e65eb99
parent5908120fdc2aac0cb1be4059b40ec256d55934bc (diff)
ath9k: Use proper start/stop routines for BTCOEX
Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r--drivers/net/wireless/ath/ath9k/ath9k.h3
-rw-r--r--drivers/net/wireless/ath/ath9k/gpio.c31
-rw-r--r--drivers/net/wireless/ath/ath9k/main.c19
3 files changed, 34 insertions, 19 deletions
diff --git a/drivers/net/wireless/ath/ath9k/ath9k.h b/drivers/net/wireless/ath/ath9k/ath9k.h
index aa609832e06f..2ede8977406d 100644
--- a/drivers/net/wireless/ath/ath9k/ath9k.h
+++ b/drivers/net/wireless/ath/ath9k/ath9k.h
@@ -456,7 +456,8 @@ struct ath_btcoex {
456 456
457int ath9k_init_btcoex(struct ath_softc *sc); 457int ath9k_init_btcoex(struct ath_softc *sc);
458void ath9k_deinit_btcoex(struct ath_softc *sc); 458void ath9k_deinit_btcoex(struct ath_softc *sc);
459int ath_init_btcoex_timer(struct ath_softc *sc); 459void ath9k_start_btcoex(struct ath_softc *sc);
460void ath9k_stop_btcoex(struct ath_softc *sc);
460void ath9k_btcoex_timer_resume(struct ath_softc *sc); 461void ath9k_btcoex_timer_resume(struct ath_softc *sc);
461void ath9k_btcoex_timer_pause(struct ath_softc *sc); 462void ath9k_btcoex_timer_pause(struct ath_softc *sc);
462 463
diff --git a/drivers/net/wireless/ath/ath9k/gpio.c b/drivers/net/wireless/ath/ath9k/gpio.c
index ef23624518b5..1ca2ca54f0e1 100644
--- a/drivers/net/wireless/ath/ath9k/gpio.c
+++ b/drivers/net/wireless/ath/ath9k/gpio.c
@@ -245,7 +245,7 @@ static void ath_btcoex_no_stomp_timer(void *arg)
245 ath9k_ps_restore(sc); 245 ath9k_ps_restore(sc);
246} 246}
247 247
248int ath_init_btcoex_timer(struct ath_softc *sc) 248static int ath_init_btcoex_timer(struct ath_softc *sc)
249{ 249{
250 struct ath_btcoex *btcoex = &sc->btcoex; 250 struct ath_btcoex *btcoex = &sc->btcoex;
251 251
@@ -318,6 +318,35 @@ void ath9k_btcoex_timer_pause(struct ath_softc *sc)
318 btcoex->hw_timer_enabled = false; 318 btcoex->hw_timer_enabled = false;
319} 319}
320 320
321void ath9k_start_btcoex(struct ath_softc *sc)
322{
323 struct ath_hw *ah = sc->sc_ah;
324
325 if ((ath9k_hw_get_btcoex_scheme(ah) != ATH_BTCOEX_CFG_NONE) &&
326 !ah->btcoex_hw.enabled) {
327 if (!(sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_MCI))
328 ath9k_hw_btcoex_set_weight(ah, AR_BT_COEX_WGHT,
329 AR_STOMP_LOW_WLAN_WGHT);
330 ath9k_hw_btcoex_enable(ah);
331
332 if (ath9k_hw_get_btcoex_scheme(ah) == ATH_BTCOEX_CFG_3WIRE)
333 ath9k_btcoex_timer_resume(sc);
334 }
335}
336
337void ath9k_stop_btcoex(struct ath_softc *sc)
338{
339 struct ath_hw *ah = sc->sc_ah;
340
341 if (ah->btcoex_hw.enabled &&
342 ath9k_hw_get_btcoex_scheme(ah) != ATH_BTCOEX_CFG_NONE) {
343 ath9k_hw_btcoex_disable(ah);
344 if (ath9k_hw_get_btcoex_scheme(ah) == ATH_BTCOEX_CFG_3WIRE)
345 ath9k_btcoex_timer_pause(sc);
346 ath_mci_flush_profile(&sc->btcoex.mci);
347 }
348}
349
321void ath9k_deinit_btcoex(struct ath_softc *sc) 350void ath9k_deinit_btcoex(struct ath_softc *sc)
322{ 351{
323 if ((sc->btcoex.no_stomp_timer) && 352 if ((sc->btcoex.no_stomp_timer) &&
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c
index c81304d3ef14..82c36a918946 100644
--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
@@ -1075,16 +1075,7 @@ static int ath9k_start(struct ieee80211_hw *hw)
1075 1075
1076 spin_unlock_bh(&sc->sc_pcu_lock); 1076 spin_unlock_bh(&sc->sc_pcu_lock);
1077 1077
1078 if ((ath9k_hw_get_btcoex_scheme(ah) != ATH_BTCOEX_CFG_NONE) && 1078 ath9k_start_btcoex(sc);
1079 !ah->btcoex_hw.enabled) {
1080 if (!(sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_MCI))
1081 ath9k_hw_btcoex_set_weight(ah, AR_BT_COEX_WGHT,
1082 AR_STOMP_LOW_WLAN_WGHT);
1083 ath9k_hw_btcoex_enable(ah);
1084
1085 if (ath9k_hw_get_btcoex_scheme(ah) == ATH_BTCOEX_CFG_3WIRE)
1086 ath9k_btcoex_timer_resume(sc);
1087 }
1088 1079
1089 if (ah->caps.pcie_lcr_extsync_en && common->bus_ops->extn_synch_en) 1080 if (ah->caps.pcie_lcr_extsync_en && common->bus_ops->extn_synch_en)
1090 common->bus_ops->extn_synch_en(common); 1081 common->bus_ops->extn_synch_en(common);
@@ -1185,13 +1176,7 @@ static void ath9k_stop(struct ieee80211_hw *hw)
1185 /* Ensure HW is awake when we try to shut it down. */ 1176 /* Ensure HW is awake when we try to shut it down. */
1186 ath9k_ps_wakeup(sc); 1177 ath9k_ps_wakeup(sc);
1187 1178
1188 if (ah->btcoex_hw.enabled && 1179 ath9k_stop_btcoex(sc);
1189 ath9k_hw_get_btcoex_scheme(ah) != ATH_BTCOEX_CFG_NONE) {
1190 ath9k_hw_btcoex_disable(ah);
1191 if (ath9k_hw_get_btcoex_scheme(ah) == ATH_BTCOEX_CFG_3WIRE)
1192 ath9k_btcoex_timer_pause(sc);
1193 ath_mci_flush_profile(&sc->btcoex.mci);
1194 }
1195 1180
1196 spin_lock_bh(&sc->sc_pcu_lock); 1181 spin_lock_bh(&sc->sc_pcu_lock);
1197 1182