aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath/ath9k/btcoex.c
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2011-12-17 10:47:56 -0500
committerJohn W. Linville <linville@tuxdriver.com>2011-12-19 14:46:55 -0500
commit8a30930563521c9dba73c93b5631be1d0993f78f (patch)
tree859d5bd92689fc934aa6c7eea98f1d37891fb293 /drivers/net/wireless/ath/ath9k/btcoex.c
parent104cfa881006c18af9b118e1631dcf1f8378994a (diff)
ath9k_hw: make bluetooth coexistence support optional at compile time
Many systems (e.g. embedded systems) do not have wifi modules connected to bluetooth modules, so bluetooth coexistence is irrelevant there. With the addition of MCI support, ath9k picked up quite a bit of extra code that can be compiled out this way. This patch redefines ATH9K_HW_CAP_MCI and adds an inline wrapper for querying the bluetooth coexistence scheme, allowing the compiler to eliminate code that uses it, with only very little use of #ifdef. On MIPS this reduces the total size for the modules by about 20k. Signed-off-by: Felix Fietkau <nbd@openwrt.org> 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.c25
1 files changed, 23 insertions, 2 deletions
diff --git a/drivers/net/wireless/ath/ath9k/btcoex.c b/drivers/net/wireless/ath/ath9k/btcoex.c
index 553d279cc5ee..a6712a95d76a 100644
--- a/drivers/net/wireless/ath/ath9k/btcoex.c
+++ b/drivers/net/wireless/ath/ath9k/btcoex.c
@@ -68,6 +68,9 @@ void ath9k_hw_init_btcoex_hw(struct ath_hw *ah, int qnum)
68 u32 i, idx; 68 u32 i, idx;
69 bool rxclear_polarity = ath_bt_config.bt_rxclear_polarity; 69 bool rxclear_polarity = ath_bt_config.bt_rxclear_polarity;
70 70
71 if (ath9k_hw_get_btcoex_scheme(ah) == ATH_BTCOEX_CFG_NONE)
72 return;
73
71 if (AR_SREV_9300_20_OR_LATER(ah)) 74 if (AR_SREV_9300_20_OR_LATER(ah))
72 rxclear_polarity = !ath_bt_config.bt_rxclear_polarity; 75 rxclear_polarity = !ath_bt_config.bt_rxclear_polarity;
73 76
@@ -99,6 +102,9 @@ void ath9k_hw_btcoex_init_2wire(struct ath_hw *ah)
99{ 102{
100 struct ath_btcoex_hw *btcoex_hw = &ah->btcoex_hw; 103 struct ath_btcoex_hw *btcoex_hw = &ah->btcoex_hw;
101 104
105 if (ath9k_hw_get_btcoex_scheme(ah) == ATH_BTCOEX_CFG_NONE)
106 return;
107
102 /* connect bt_active to baseband */ 108 /* connect bt_active to baseband */
103 REG_CLR_BIT(ah, AR_GPIO_INPUT_EN_VAL, 109 REG_CLR_BIT(ah, AR_GPIO_INPUT_EN_VAL,
104 (AR_GPIO_INPUT_EN_VAL_BT_PRIORITY_DEF | 110 (AR_GPIO_INPUT_EN_VAL_BT_PRIORITY_DEF |
@@ -121,6 +127,9 @@ void ath9k_hw_btcoex_init_3wire(struct ath_hw *ah)
121{ 127{
122 struct ath_btcoex_hw *btcoex_hw = &ah->btcoex_hw; 128 struct ath_btcoex_hw *btcoex_hw = &ah->btcoex_hw;
123 129
130 if (ath9k_hw_get_btcoex_scheme(ah) == ATH_BTCOEX_CFG_NONE)
131 return;
132
124 /* btcoex 3-wire */ 133 /* btcoex 3-wire */
125 REG_SET_BIT(ah, AR_GPIO_INPUT_EN_VAL, 134 REG_SET_BIT(ah, AR_GPIO_INPUT_EN_VAL,
126 (AR_GPIO_INPUT_EN_VAL_BT_PRIORITY_BB | 135 (AR_GPIO_INPUT_EN_VAL_BT_PRIORITY_BB |
@@ -147,6 +156,9 @@ static void ath9k_hw_btcoex_enable_2wire(struct ath_hw *ah)
147{ 156{
148 struct ath_btcoex_hw *btcoex_hw = &ah->btcoex_hw; 157 struct ath_btcoex_hw *btcoex_hw = &ah->btcoex_hw;
149 158
159 if (ath9k_hw_get_btcoex_scheme(ah) == ATH_BTCOEX_CFG_NONE)
160 return;
161
150 /* Configure the desired GPIO port for TX_FRAME output */ 162 /* Configure the desired GPIO port for TX_FRAME output */
151 ath9k_hw_cfg_output(ah, btcoex_hw->wlanactive_gpio, 163 ath9k_hw_cfg_output(ah, btcoex_hw->wlanactive_gpio,
152 AR_GPIO_OUTPUT_MUX_AS_TX_FRAME); 164 AR_GPIO_OUTPUT_MUX_AS_TX_FRAME);
@@ -158,6 +170,9 @@ void ath9k_hw_btcoex_set_weight(struct ath_hw *ah,
158{ 170{
159 struct ath_btcoex_hw *btcoex_hw = &ah->btcoex_hw; 171 struct ath_btcoex_hw *btcoex_hw = &ah->btcoex_hw;
160 172
173 if (ath9k_hw_get_btcoex_scheme(ah) == ATH_BTCOEX_CFG_NONE)
174 return;
175
161 btcoex_hw->bt_coex_weights = SM(bt_weight, AR_BTCOEX_BT_WGHT) | 176 btcoex_hw->bt_coex_weights = SM(bt_weight, AR_BTCOEX_BT_WGHT) |
162 SM(wlan_weight, AR_BTCOEX_WL_WGHT); 177 SM(wlan_weight, AR_BTCOEX_WL_WGHT);
163} 178}
@@ -219,9 +234,9 @@ void ath9k_hw_btcoex_enable(struct ath_hw *ah)
219{ 234{
220 struct ath_btcoex_hw *btcoex_hw = &ah->btcoex_hw; 235 struct ath_btcoex_hw *btcoex_hw = &ah->btcoex_hw;
221 236
222 switch (btcoex_hw->scheme) { 237 switch (ath9k_hw_get_btcoex_scheme(ah)) {
223 case ATH_BTCOEX_CFG_NONE: 238 case ATH_BTCOEX_CFG_NONE:
224 break; 239 return;
225 case ATH_BTCOEX_CFG_2WIRE: 240 case ATH_BTCOEX_CFG_2WIRE:
226 ath9k_hw_btcoex_enable_2wire(ah); 241 ath9k_hw_btcoex_enable_2wire(ah);
227 break; 242 break;
@@ -246,6 +261,9 @@ void ath9k_hw_btcoex_disable(struct ath_hw *ah)
246 struct ath_btcoex_hw *btcoex_hw = &ah->btcoex_hw; 261 struct ath_btcoex_hw *btcoex_hw = &ah->btcoex_hw;
247 int i; 262 int i;
248 263
264 if (ath9k_hw_get_btcoex_scheme(ah) == ATH_BTCOEX_CFG_NONE)
265 return;
266
249 btcoex_hw->enabled = false; 267 btcoex_hw->enabled = false;
250 if (btcoex_hw->scheme == ATH_BTCOEX_CFG_MCI) { 268 if (btcoex_hw->scheme == ATH_BTCOEX_CFG_MCI) {
251 ath9k_hw_btcoex_bt_stomp(ah, ATH_BTCOEX_STOMP_NONE); 269 ath9k_hw_btcoex_bt_stomp(ah, ATH_BTCOEX_STOMP_NONE);
@@ -294,6 +312,9 @@ static void ar9003_btcoex_bt_stomp(struct ath_hw *ah,
294void ath9k_hw_btcoex_bt_stomp(struct ath_hw *ah, 312void ath9k_hw_btcoex_bt_stomp(struct ath_hw *ah,
295 enum ath_stomp_type stomp_type) 313 enum ath_stomp_type stomp_type)
296{ 314{
315 if (ath9k_hw_get_btcoex_scheme(ah) == ATH_BTCOEX_CFG_NONE)
316 return;
317
297 if (AR_SREV_9300_20_OR_LATER(ah)) { 318 if (AR_SREV_9300_20_OR_LATER(ah)) {
298 ar9003_btcoex_bt_stomp(ah, stomp_type); 319 ar9003_btcoex_bt_stomp(ah, stomp_type);
299 return; 320 return;