diff options
author | Vivek Natarajan <vnatarajan@atheros.com> | 2010-08-18 10:27:48 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2010-08-24 16:32:05 -0400 |
commit | d99eeb87420a6da1f87064c7fa70bdf299699d90 (patch) | |
tree | e09db7a8d7e990837141711482948243d27e53e2 /drivers | |
parent | 2a5fb7b088f8418958775774dda9427d6c73c522 (diff) |
ath9k_common: Move bt_stomp to common for sharing with ath9k_htc.
Signed-off-by: Vivek Natarajan <vnatarajan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/wireless/ath/ath9k/ath9k.h | 8 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath9k/common.c | 31 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath9k/common.h | 10 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath9k/gpio.c | 40 |
4 files changed, 47 insertions, 42 deletions
diff --git a/drivers/net/wireless/ath/ath9k/ath9k.h b/drivers/net/wireless/ath/ath9k/ath9k.h index def0cd308fdd..f0197a6046ab 100644 --- a/drivers/net/wireless/ath/ath9k/ath9k.h +++ b/drivers/net/wireless/ath/ath9k/ath9k.h | |||
@@ -437,14 +437,6 @@ void ath_ani_calibrate(unsigned long data); | |||
437 | /* BTCOEX */ | 437 | /* BTCOEX */ |
438 | /**********/ | 438 | /**********/ |
439 | 439 | ||
440 | /* Defines the BT AR_BT_COEX_WGHT used */ | ||
441 | enum ath_stomp_type { | ||
442 | ATH_BTCOEX_NO_STOMP, | ||
443 | ATH_BTCOEX_STOMP_ALL, | ||
444 | ATH_BTCOEX_STOMP_LOW, | ||
445 | ATH_BTCOEX_STOMP_NONE | ||
446 | }; | ||
447 | |||
448 | struct ath_btcoex { | 440 | struct ath_btcoex { |
449 | bool hw_timer_enabled; | 441 | bool hw_timer_enabled; |
450 | spinlock_t btcoex_lock; | 442 | spinlock_t btcoex_lock; |
diff --git a/drivers/net/wireless/ath/ath9k/common.c b/drivers/net/wireless/ath/ath9k/common.c index 3100c87a4fcd..31cfe468e3fc 100644 --- a/drivers/net/wireless/ath/ath9k/common.c +++ b/drivers/net/wireless/ath/ath9k/common.c | |||
@@ -420,6 +420,37 @@ int ath9k_cmn_count_streams(unsigned int chainmask, int max) | |||
420 | } | 420 | } |
421 | EXPORT_SYMBOL(ath9k_cmn_count_streams); | 421 | EXPORT_SYMBOL(ath9k_cmn_count_streams); |
422 | 422 | ||
423 | /* | ||
424 | * Configures appropriate weight based on stomp type. | ||
425 | */ | ||
426 | void ath9k_cmn_btcoex_bt_stomp(struct ath_common *common, | ||
427 | enum ath_stomp_type stomp_type) | ||
428 | { | ||
429 | struct ath_hw *ah = common->ah; | ||
430 | |||
431 | switch (stomp_type) { | ||
432 | case ATH_BTCOEX_STOMP_ALL: | ||
433 | ath9k_hw_btcoex_set_weight(ah, AR_BT_COEX_WGHT, | ||
434 | AR_STOMP_ALL_WLAN_WGHT); | ||
435 | break; | ||
436 | case ATH_BTCOEX_STOMP_LOW: | ||
437 | ath9k_hw_btcoex_set_weight(ah, AR_BT_COEX_WGHT, | ||
438 | AR_STOMP_LOW_WLAN_WGHT); | ||
439 | break; | ||
440 | case ATH_BTCOEX_STOMP_NONE: | ||
441 | ath9k_hw_btcoex_set_weight(ah, AR_BT_COEX_WGHT, | ||
442 | AR_STOMP_NONE_WLAN_WGHT); | ||
443 | break; | ||
444 | default: | ||
445 | ath_print(common, ATH_DBG_BTCOEX, | ||
446 | "Invalid Stomptype\n"); | ||
447 | break; | ||
448 | } | ||
449 | |||
450 | ath9k_hw_btcoex_enable(ah); | ||
451 | } | ||
452 | EXPORT_SYMBOL(ath9k_cmn_btcoex_bt_stomp); | ||
453 | |||
423 | static int __init ath9k_cmn_init(void) | 454 | static int __init ath9k_cmn_init(void) |
424 | { | 455 | { |
425 | return 0; | 456 | return 0; |
diff --git a/drivers/net/wireless/ath/ath9k/common.h b/drivers/net/wireless/ath/ath9k/common.h index 97809d39c73f..4aa4e7dbe4d2 100644 --- a/drivers/net/wireless/ath/ath9k/common.h +++ b/drivers/net/wireless/ath/ath9k/common.h | |||
@@ -52,6 +52,14 @@ | |||
52 | #define ATH_EP_RND(x, mul) \ | 52 | #define ATH_EP_RND(x, mul) \ |
53 | ((((x)%(mul)) >= ((mul)/2)) ? ((x) + ((mul) - 1)) / (mul) : (x)/(mul)) | 53 | ((((x)%(mul)) >= ((mul)/2)) ? ((x) + ((mul) - 1)) / (mul) : (x)/(mul)) |
54 | 54 | ||
55 | /* Defines the BT AR_BT_COEX_WGHT used */ | ||
56 | enum ath_stomp_type { | ||
57 | ATH_BTCOEX_NO_STOMP, | ||
58 | ATH_BTCOEX_STOMP_ALL, | ||
59 | ATH_BTCOEX_STOMP_LOW, | ||
60 | ATH_BTCOEX_STOMP_NONE | ||
61 | }; | ||
62 | |||
55 | int ath9k_cmn_padpos(__le16 frame_control); | 63 | int ath9k_cmn_padpos(__le16 frame_control); |
56 | int ath9k_cmn_get_hw_crypto_keytype(struct sk_buff *skb); | 64 | int ath9k_cmn_get_hw_crypto_keytype(struct sk_buff *skb); |
57 | void ath9k_cmn_update_ichannel(struct ieee80211_hw *hw, | 65 | void ath9k_cmn_update_ichannel(struct ieee80211_hw *hw, |
@@ -65,3 +73,5 @@ int ath9k_cmn_key_config(struct ath_common *common, | |||
65 | void ath9k_cmn_key_delete(struct ath_common *common, | 73 | void ath9k_cmn_key_delete(struct ath_common *common, |
66 | struct ieee80211_key_conf *key); | 74 | struct ieee80211_key_conf *key); |
67 | int ath9k_cmn_count_streams(unsigned int chainmask, int max); | 75 | int ath9k_cmn_count_streams(unsigned int chainmask, int max); |
76 | void ath9k_cmn_btcoex_bt_stomp(struct ath_common *common, | ||
77 | enum ath_stomp_type stomp_type); | ||
diff --git a/drivers/net/wireless/ath/ath9k/gpio.c b/drivers/net/wireless/ath/ath9k/gpio.c index 3a8ee999da5d..4a9a68bba324 100644 --- a/drivers/net/wireless/ath/ath9k/gpio.c +++ b/drivers/net/wireless/ath/ath9k/gpio.c | |||
@@ -251,36 +251,6 @@ static void ath_detect_bt_priority(struct ath_softc *sc) | |||
251 | } | 251 | } |
252 | } | 252 | } |
253 | 253 | ||
254 | /* | ||
255 | * Configures appropriate weight based on stomp type. | ||
256 | */ | ||
257 | static void ath9k_btcoex_bt_stomp(struct ath_softc *sc, | ||
258 | enum ath_stomp_type stomp_type) | ||
259 | { | ||
260 | struct ath_hw *ah = sc->sc_ah; | ||
261 | |||
262 | switch (stomp_type) { | ||
263 | case ATH_BTCOEX_STOMP_ALL: | ||
264 | ath9k_hw_btcoex_set_weight(ah, AR_BT_COEX_WGHT, | ||
265 | AR_STOMP_ALL_WLAN_WGHT); | ||
266 | break; | ||
267 | case ATH_BTCOEX_STOMP_LOW: | ||
268 | ath9k_hw_btcoex_set_weight(ah, AR_BT_COEX_WGHT, | ||
269 | AR_STOMP_LOW_WLAN_WGHT); | ||
270 | break; | ||
271 | case ATH_BTCOEX_STOMP_NONE: | ||
272 | ath9k_hw_btcoex_set_weight(ah, AR_BT_COEX_WGHT, | ||
273 | AR_STOMP_NONE_WLAN_WGHT); | ||
274 | break; | ||
275 | default: | ||
276 | ath_print(ath9k_hw_common(ah), ATH_DBG_BTCOEX, | ||
277 | "Invalid Stomptype\n"); | ||
278 | break; | ||
279 | } | ||
280 | |||
281 | ath9k_hw_btcoex_enable(ah); | ||
282 | } | ||
283 | |||
284 | static void ath9k_gen_timer_start(struct ath_hw *ah, | 254 | static void ath9k_gen_timer_start(struct ath_hw *ah, |
285 | struct ath_gen_timer *timer, | 255 | struct ath_gen_timer *timer, |
286 | u32 timer_next, | 256 | u32 timer_next, |
@@ -319,6 +289,7 @@ static void ath_btcoex_period_timer(unsigned long data) | |||
319 | struct ath_softc *sc = (struct ath_softc *) data; | 289 | struct ath_softc *sc = (struct ath_softc *) data; |
320 | struct ath_hw *ah = sc->sc_ah; | 290 | struct ath_hw *ah = sc->sc_ah; |
321 | struct ath_btcoex *btcoex = &sc->btcoex; | 291 | struct ath_btcoex *btcoex = &sc->btcoex; |
292 | struct ath_common *common = ath9k_hw_common(ah); | ||
322 | u32 timer_period; | 293 | u32 timer_period; |
323 | bool is_btscan; | 294 | bool is_btscan; |
324 | 295 | ||
@@ -328,7 +299,7 @@ static void ath_btcoex_period_timer(unsigned long data) | |||
328 | 299 | ||
329 | spin_lock_bh(&btcoex->btcoex_lock); | 300 | spin_lock_bh(&btcoex->btcoex_lock); |
330 | 301 | ||
331 | ath9k_btcoex_bt_stomp(sc, is_btscan ? ATH_BTCOEX_STOMP_ALL : | 302 | ath9k_cmn_btcoex_bt_stomp(common, is_btscan ? ATH_BTCOEX_STOMP_ALL : |
332 | btcoex->bt_stomp_type); | 303 | btcoex->bt_stomp_type); |
333 | 304 | ||
334 | spin_unlock_bh(&btcoex->btcoex_lock); | 305 | spin_unlock_bh(&btcoex->btcoex_lock); |
@@ -359,17 +330,18 @@ static void ath_btcoex_no_stomp_timer(void *arg) | |||
359 | struct ath_softc *sc = (struct ath_softc *)arg; | 330 | struct ath_softc *sc = (struct ath_softc *)arg; |
360 | struct ath_hw *ah = sc->sc_ah; | 331 | struct ath_hw *ah = sc->sc_ah; |
361 | struct ath_btcoex *btcoex = &sc->btcoex; | 332 | struct ath_btcoex *btcoex = &sc->btcoex; |
333 | struct ath_common *common = ath9k_hw_common(ah); | ||
362 | bool is_btscan = sc->sc_flags & SC_OP_BT_SCAN; | 334 | bool is_btscan = sc->sc_flags & SC_OP_BT_SCAN; |
363 | 335 | ||
364 | ath_print(ath9k_hw_common(ah), ATH_DBG_BTCOEX, | 336 | ath_print(common, ATH_DBG_BTCOEX, |
365 | "no stomp timer running\n"); | 337 | "no stomp timer running\n"); |
366 | 338 | ||
367 | spin_lock_bh(&btcoex->btcoex_lock); | 339 | spin_lock_bh(&btcoex->btcoex_lock); |
368 | 340 | ||
369 | if (btcoex->bt_stomp_type == ATH_BTCOEX_STOMP_LOW || is_btscan) | 341 | if (btcoex->bt_stomp_type == ATH_BTCOEX_STOMP_LOW || is_btscan) |
370 | ath9k_btcoex_bt_stomp(sc, ATH_BTCOEX_STOMP_NONE); | 342 | ath9k_cmn_btcoex_bt_stomp(common, ATH_BTCOEX_STOMP_NONE); |
371 | else if (btcoex->bt_stomp_type == ATH_BTCOEX_STOMP_ALL) | 343 | else if (btcoex->bt_stomp_type == ATH_BTCOEX_STOMP_ALL) |
372 | ath9k_btcoex_bt_stomp(sc, ATH_BTCOEX_STOMP_LOW); | 344 | ath9k_cmn_btcoex_bt_stomp(common, ATH_BTCOEX_STOMP_LOW); |
373 | 345 | ||
374 | spin_unlock_bh(&btcoex->btcoex_lock); | 346 | spin_unlock_bh(&btcoex->btcoex_lock); |
375 | } | 347 | } |