aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath/ath9k/btcoex.c
diff options
context:
space:
mode:
authorLuis R. Rodriguez <lrodriguez@atheros.com>2009-09-09 05:33:11 -0400
committerJohn W. Linville <linville@tuxdriver.com>2009-10-07 16:39:20 -0400
commitaf03abecd8e3646736904431f3335dad5e28cb8d (patch)
treef3522e1dac8916ec7fabcf40f5577cabac3eb43a /drivers/net/wireless/ath/ath9k/btcoex.c
parent2e20250a2ce1f4a7ba7c83ccb62d9b7b9b96c736 (diff)
ath9k: move hw specific btcoex info to ath_hw
Since we now access it via the ath_hw declare the ath_hw pointer at the header of some routines and se it. ath9k.h no longer needs to access btcoex.h and to adjust for this move ath_btcoex_set_weight() into btcoex.h and instead give main.c a helper for setting initial values upon drv_start() 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/btcoex.c')
-rw-r--r--drivers/net/wireless/ath/ath9k/btcoex.c57
1 files changed, 38 insertions, 19 deletions
diff --git a/drivers/net/wireless/ath/ath9k/btcoex.c b/drivers/net/wireless/ath/ath9k/btcoex.c
index e88a0a3f68f0..dfbcbd0969e6 100644
--- a/drivers/net/wireless/ath/ath9k/btcoex.c
+++ b/drivers/net/wireless/ath/ath9k/btcoex.c
@@ -43,14 +43,29 @@ bool ath_btcoex_supported(u16 subsysid)
43 return false; 43 return false;
44} 44}
45 45
46static void ath_btcoex_set_weight(struct ath_btcoex_info *btcoex_info,
47 u32 bt_weight,
48 u32 wlan_weight)
49{
50 btcoex_info->bt_coex_weights = SM(bt_weight, AR_BTCOEX_BT_WGHT) |
51 SM(wlan_weight, AR_BTCOEX_WL_WGHT);
52}
53
54void ath9k_hw_btcoex_init_weight(struct ath_hw *ah)
55{
56 ath_btcoex_set_weight(&ah->btcoex_info, AR_BT_COEX_WGHT,
57 AR_STOMP_LOW_WLAN_WGHT);
58}
59
46/* 60/*
47 * Detects if there is any priority bt traffic 61 * Detects if there is any priority bt traffic
48 */ 62 */
49static void ath_detect_bt_priority(struct ath_softc *sc) 63static void ath_detect_bt_priority(struct ath_softc *sc)
50{ 64{
51 struct ath_btcoex *btcoex = &sc->btcoex; 65 struct ath_btcoex *btcoex = &sc->btcoex;
66 struct ath_hw *ah = sc->sc_ah;
52 67
53 if (ath9k_hw_gpio_get(sc->sc_ah, sc->btcoex_info.btpriority_gpio)) 68 if (ath9k_hw_gpio_get(sc->sc_ah, ah->btcoex_info.btpriority_gpio))
54 btcoex->bt_priority_cnt++; 69 btcoex->bt_priority_cnt++;
55 70
56 if (time_after(jiffies, btcoex->bt_priority_time + 71 if (time_after(jiffies, btcoex->bt_priority_time +
@@ -106,8 +121,9 @@ static void ath_btcoex_bt_stomp(struct ath_softc *sc,
106static void ath_btcoex_period_timer(unsigned long data) 121static void ath_btcoex_period_timer(unsigned long data)
107{ 122{
108 struct ath_softc *sc = (struct ath_softc *) data; 123 struct ath_softc *sc = (struct ath_softc *) data;
124 struct ath_hw *ah = sc->sc_ah;
109 struct ath_btcoex *btcoex = &sc->btcoex; 125 struct ath_btcoex *btcoex = &sc->btcoex;
110 struct ath_btcoex_info *btinfo = &sc->btcoex_info; 126 struct ath_btcoex_info *btinfo = &ah->btcoex_info;
111 127
112 ath_detect_bt_priority(sc); 128 ath_detect_bt_priority(sc);
113 129
@@ -119,9 +135,9 @@ static void ath_btcoex_period_timer(unsigned long data)
119 135
120 if (btcoex->btcoex_period != btcoex->btcoex_no_stomp) { 136 if (btcoex->btcoex_period != btcoex->btcoex_no_stomp) {
121 if (btcoex->hw_timer_enabled) 137 if (btcoex->hw_timer_enabled)
122 ath_gen_timer_stop(sc->sc_ah, btinfo->no_stomp_timer); 138 ath_gen_timer_stop(ah, btinfo->no_stomp_timer);
123 139
124 ath_gen_timer_start(sc->sc_ah, 140 ath_gen_timer_start(ah,
125 btinfo->no_stomp_timer, 141 btinfo->no_stomp_timer,
126 (ath9k_hw_gettsf32(sc->sc_ah) + 142 (ath9k_hw_gettsf32(sc->sc_ah) +
127 btcoex->btcoex_no_stomp), 143 btcoex->btcoex_no_stomp),
@@ -141,10 +157,11 @@ static void ath_btcoex_period_timer(unsigned long data)
141static void ath_btcoex_no_stomp_timer(void *arg) 157static void ath_btcoex_no_stomp_timer(void *arg)
142{ 158{
143 struct ath_softc *sc = (struct ath_softc *)arg; 159 struct ath_softc *sc = (struct ath_softc *)arg;
160 struct ath_hw *ah = sc->sc_ah;
144 struct ath_btcoex *btcoex = &sc->btcoex; 161 struct ath_btcoex *btcoex = &sc->btcoex;
145 struct ath_btcoex_info *btinfo = &sc->btcoex_info; 162 struct ath_btcoex_info *btinfo = &ah->btcoex_info;
146 163
147 DPRINTF(sc->sc_ah, ATH_DBG_BTCOEX, "no stomp timer running \n"); 164 DPRINTF(ah, ATH_DBG_BTCOEX, "no stomp timer running \n");
148 165
149 spin_lock_bh(&btcoex->btcoex_lock); 166 spin_lock_bh(&btcoex->btcoex_lock);
150 167
@@ -156,14 +173,14 @@ static void ath_btcoex_no_stomp_timer(void *arg)
156 spin_unlock_bh(&btcoex->btcoex_lock); 173 spin_unlock_bh(&btcoex->btcoex_lock);
157} 174}
158 175
159static int ath_init_btcoex_info(struct ath_hw *hw, 176static int ath_init_btcoex_info(struct ath_hw *ah,
160 struct ath_btcoex_info *btcoex_info) 177 struct ath_btcoex_info *btcoex_info)
161{ 178{
162 struct ath_btcoex *btcoex = &hw->ah_sc->btcoex; 179 struct ath_btcoex *btcoex = &ah->ah_sc->btcoex;
163 u32 i; 180 u32 i;
164 int qnum; 181 int qnum;
165 182
166 qnum = ath_tx_get_qnum(hw->ah_sc, ATH9K_TX_QUEUE_DATA, ATH9K_WME_AC_BE); 183 qnum = ath_tx_get_qnum(ah->ah_sc, ATH9K_TX_QUEUE_DATA, ATH9K_WME_AC_BE);
167 184
168 btcoex_info->bt_coex_mode = 185 btcoex_info->bt_coex_mode =
169 (btcoex_info->bt_coex_mode & AR_BT_QCU_THRESH) | 186 (btcoex_info->bt_coex_mode & AR_BT_QCU_THRESH) |
@@ -190,15 +207,15 @@ static int ath_init_btcoex_info(struct ath_hw *hw,
190 btcoex->btcoex_period / 100; 207 btcoex->btcoex_period / 100;
191 208
192 for (i = 0; i < 32; i++) 209 for (i = 0; i < 32; i++)
193 hw->hw_gen_timers.gen_timer_index[(debruijn32 << i) >> 27] = i; 210 ah->hw_gen_timers.gen_timer_index[(debruijn32 << i) >> 27] = i;
194 211
195 setup_timer(&btcoex->period_timer, ath_btcoex_period_timer, 212 setup_timer(&btcoex->period_timer, ath_btcoex_period_timer,
196 (unsigned long) hw->ah_sc); 213 (unsigned long) ah->ah_sc);
197 214
198 btcoex_info->no_stomp_timer = ath_gen_timer_alloc(hw, 215 btcoex_info->no_stomp_timer = ath_gen_timer_alloc(ah,
199 ath_btcoex_no_stomp_timer, 216 ath_btcoex_no_stomp_timer,
200 ath_btcoex_no_stomp_timer, 217 ath_btcoex_no_stomp_timer,
201 (void *)hw->ah_sc, AR_FIRST_NDP_TIMER); 218 (void *)ah->ah_sc, AR_FIRST_NDP_TIMER);
202 219
203 if (btcoex_info->no_stomp_timer == NULL) 220 if (btcoex_info->no_stomp_timer == NULL)
204 return -ENOMEM; 221 return -ENOMEM;
@@ -210,7 +227,7 @@ static int ath_init_btcoex_info(struct ath_hw *hw,
210 227
211int ath9k_hw_btcoex_init(struct ath_hw *ah) 228int ath9k_hw_btcoex_init(struct ath_hw *ah)
212{ 229{
213 struct ath_btcoex_info *btcoex_info = &ah->ah_sc->btcoex_info; 230 struct ath_btcoex_info *btcoex_info = &ah->btcoex_info;
214 int ret = 0; 231 int ret = 0;
215 232
216 if (btcoex_info->btcoex_scheme == ATH_BTCOEX_CFG_2WIRE) { 233 if (btcoex_info->btcoex_scheme == ATH_BTCOEX_CFG_2WIRE) {
@@ -258,7 +275,7 @@ int ath9k_hw_btcoex_init(struct ath_hw *ah)
258 275
259void ath9k_hw_btcoex_enable(struct ath_hw *ah) 276void ath9k_hw_btcoex_enable(struct ath_hw *ah)
260{ 277{
261 struct ath_btcoex_info *btcoex_info = &ah->ah_sc->btcoex_info; 278 struct ath_btcoex_info *btcoex_info = &ah->btcoex_info;
262 279
263 if (btcoex_info->btcoex_scheme == ATH_BTCOEX_CFG_2WIRE) { 280 if (btcoex_info->btcoex_scheme == ATH_BTCOEX_CFG_2WIRE) {
264 /* Configure the desired GPIO port for TX_FRAME output */ 281 /* Configure the desired GPIO port for TX_FRAME output */
@@ -291,7 +308,7 @@ void ath9k_hw_btcoex_enable(struct ath_hw *ah)
291 308
292void ath9k_hw_btcoex_disable(struct ath_hw *ah) 309void ath9k_hw_btcoex_disable(struct ath_hw *ah)
293{ 310{
294 struct ath_btcoex_info *btcoex_info = &ah->ah_sc->btcoex_info; 311 struct ath_btcoex_info *btcoex_info = &ah->btcoex_info;
295 312
296 ath9k_hw_set_gpio(ah, btcoex_info->wlanactive_gpio, 0); 313 ath9k_hw_set_gpio(ah, btcoex_info->wlanactive_gpio, 0);
297 314
@@ -313,11 +330,12 @@ void ath9k_hw_btcoex_disable(struct ath_hw *ah)
313void ath_btcoex_timer_pause(struct ath_softc *sc) 330void ath_btcoex_timer_pause(struct ath_softc *sc)
314{ 331{
315 struct ath_btcoex *btcoex = &sc->btcoex; 332 struct ath_btcoex *btcoex = &sc->btcoex;
333 struct ath_hw *ah = sc->sc_ah;
316 334
317 del_timer_sync(&btcoex->period_timer); 335 del_timer_sync(&btcoex->period_timer);
318 336
319 if (btcoex->hw_timer_enabled) 337 if (btcoex->hw_timer_enabled)
320 ath_gen_timer_stop(sc->sc_ah, sc->btcoex_info.no_stomp_timer); 338 ath_gen_timer_stop(ah, ah->btcoex_info.no_stomp_timer);
321 339
322 btcoex->hw_timer_enabled = false; 340 btcoex->hw_timer_enabled = false;
323} 341}
@@ -328,12 +346,13 @@ void ath_btcoex_timer_pause(struct ath_softc *sc)
328void ath_btcoex_timer_resume(struct ath_softc *sc) 346void ath_btcoex_timer_resume(struct ath_softc *sc)
329{ 347{
330 struct ath_btcoex *btcoex = &sc->btcoex; 348 struct ath_btcoex *btcoex = &sc->btcoex;
349 struct ath_hw *ah = sc->sc_ah;
331 350
332 DPRINTF(sc->sc_ah, ATH_DBG_BTCOEX, "Starting btcoex timers"); 351 DPRINTF(ah, ATH_DBG_BTCOEX, "Starting btcoex timers");
333 352
334 /* make sure duty cycle timer is also stopped when resuming */ 353 /* make sure duty cycle timer is also stopped when resuming */
335 if (btcoex->hw_timer_enabled) 354 if (btcoex->hw_timer_enabled)
336 ath_gen_timer_stop(sc->sc_ah, sc->btcoex_info.no_stomp_timer); 355 ath_gen_timer_stop(sc->sc_ah, ah->btcoex_info.no_stomp_timer);
337 356
338 btcoex->bt_priority_cnt = 0; 357 btcoex->bt_priority_cnt = 0;
339 btcoex->bt_priority_time = jiffies; 358 btcoex->bt_priority_time = jiffies;