btcoex.c (54f10b059e6592598a9b66fabf0cde8be1d2780c) | btcoex.c (8227bf455469a153d5fa2a810653a669a2595ebd) |
---|---|
1/* 2 * Copyright (c) 2009-2011 Atheros Communications Inc. 3 * 4 * Permission to use, copy, modify, and/or distribute this software for any 5 * purpose with or without fee is hereby granted, provided that the above 6 * copyright notice and this permission notice appear in all copies. 7 * 8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES --- 28 unchanged lines hidden (view full) --- 37 38static const u32 ar9003_wlan_weights[ATH_BTCOEX_STOMP_MAX] 39 [AR9300_NUM_WLAN_WEIGHTS] = { 40 { 0xfffffff0, 0xfffffff0, 0xfffffff0, 0xfffffff0 }, /* STOMP_ALL */ 41 { 0x88888880, 0x88888880, 0x88888880, 0x88888880 }, /* STOMP_LOW */ 42 { 0x00000000, 0x00000000, 0x00000000, 0x00000000 }, /* STOMP_NONE */ 43}; 44 | 1/* 2 * Copyright (c) 2009-2011 Atheros Communications Inc. 3 * 4 * Permission to use, copy, modify, and/or distribute this software for any 5 * purpose with or without fee is hereby granted, provided that the above 6 * copyright notice and this permission notice appear in all copies. 7 * 8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES --- 28 unchanged lines hidden (view full) --- 37 38static const u32 ar9003_wlan_weights[ATH_BTCOEX_STOMP_MAX] 39 [AR9300_NUM_WLAN_WEIGHTS] = { 40 { 0xfffffff0, 0xfffffff0, 0xfffffff0, 0xfffffff0 }, /* STOMP_ALL */ 41 { 0x88888880, 0x88888880, 0x88888880, 0x88888880 }, /* STOMP_LOW */ 42 { 0x00000000, 0x00000000, 0x00000000, 0x00000000 }, /* STOMP_NONE */ 43}; 44 |
45static const u32 ar9462_wlan_weights[ATH_BTCOEX_STOMP_MAX] 46 [AR9300_NUM_WLAN_WEIGHTS] = { 47 { 0x01017d01, 0x41414101, 0x41414101, 0x41414141 }, /* STOMP_ALL */ 48 { 0x01017d01, 0x3b3b3b01, 0x3b3b3b01, 0x3b3b3b3b }, /* STOMP_LOW */ 49 { 0x01017d01, 0x01010101, 0x01010101, 0x01010101 }, /* STOMP_NONE */ 50 { 0x01017d01, 0x013b0101, 0x3b3b0101, 0x3b3b013b }, /* STOMP_LOW_FTP */ 51}; 52 |
|
45void ath9k_hw_init_btcoex_hw(struct ath_hw *ah, int qnum) 46{ 47 struct ath_btcoex_hw *btcoex_hw = &ah->btcoex_hw; 48 const struct ath_btcoex_config ath_bt_config = { 49 .bt_time_extend = 0, 50 .bt_txstate_extend = true, 51 .bt_txframe_extend = true, 52 .bt_mode = ATH_BT_COEX_MODE_SLOTTED, --- 135 unchanged lines hidden (view full) --- 188 189 REG_RMW_FIELD(ah, AR_QUIET1, AR_QUIET1_QUIET_ACK_CTS_ENABLE, 1); 190 REG_RMW_FIELD(ah, AR_PCU_MISC, AR_PCU_BT_ANT_PREVENT_RX, 0); 191 192 ath9k_hw_cfg_output(ah, btcoex->wlanactive_gpio, 193 AR_GPIO_OUTPUT_MUX_AS_RX_CLEAR_EXTERNAL); 194} 195 | 53void ath9k_hw_init_btcoex_hw(struct ath_hw *ah, int qnum) 54{ 55 struct ath_btcoex_hw *btcoex_hw = &ah->btcoex_hw; 56 const struct ath_btcoex_config ath_bt_config = { 57 .bt_time_extend = 0, 58 .bt_txstate_extend = true, 59 .bt_txframe_extend = true, 60 .bt_mode = ATH_BT_COEX_MODE_SLOTTED, --- 135 unchanged lines hidden (view full) --- 196 197 REG_RMW_FIELD(ah, AR_QUIET1, AR_QUIET1_QUIET_ACK_CTS_ENABLE, 1); 198 REG_RMW_FIELD(ah, AR_PCU_MISC, AR_PCU_BT_ANT_PREVENT_RX, 0); 199 200 ath9k_hw_cfg_output(ah, btcoex->wlanactive_gpio, 201 AR_GPIO_OUTPUT_MUX_AS_RX_CLEAR_EXTERNAL); 202} 203 |
204static void ath9k_hw_btcoex_enable_mci(struct ath_hw *ah) 205{ 206 struct ath_btcoex_hw *btcoex = &ah->btcoex_hw; 207 int i; 208 209 for (i = 0; i < AR9300_NUM_BT_WEIGHTS; i++) 210 REG_WRITE(ah, AR_MCI_COEX_WL_WEIGHTS(i), 211 btcoex->wlan_weight[i]); 212 213 REG_RMW_FIELD(ah, AR_QUIET1, AR_QUIET1_QUIET_ACK_CTS_ENABLE, 1); 214 btcoex->enabled = true; 215} 216 |
|
196void ath9k_hw_btcoex_enable(struct ath_hw *ah) 197{ 198 struct ath_btcoex_hw *btcoex_hw = &ah->btcoex_hw; 199 200 switch (btcoex_hw->scheme) { 201 case ATH_BTCOEX_CFG_NONE: 202 break; 203 case ATH_BTCOEX_CFG_2WIRE: 204 ath9k_hw_btcoex_enable_2wire(ah); 205 break; 206 case ATH_BTCOEX_CFG_3WIRE: 207 ath9k_hw_btcoex_enable_3wire(ah); 208 break; | 217void ath9k_hw_btcoex_enable(struct ath_hw *ah) 218{ 219 struct ath_btcoex_hw *btcoex_hw = &ah->btcoex_hw; 220 221 switch (btcoex_hw->scheme) { 222 case ATH_BTCOEX_CFG_NONE: 223 break; 224 case ATH_BTCOEX_CFG_2WIRE: 225 ath9k_hw_btcoex_enable_2wire(ah); 226 break; 227 case ATH_BTCOEX_CFG_3WIRE: 228 ath9k_hw_btcoex_enable_3wire(ah); 229 break; |
230 case ATH_BTCOEX_CFG_MCI: 231 ath9k_hw_btcoex_enable_mci(ah); 232 return; |
|
209 } 210 211 REG_RMW(ah, AR_GPIO_PDPU, 212 (0x2 << (btcoex_hw->btactive_gpio * 2)), 213 (0x3 << (btcoex_hw->btactive_gpio * 2))); 214 215 ah->btcoex_hw.enabled = true; 216} 217EXPORT_SYMBOL(ath9k_hw_btcoex_enable); 218 219void ath9k_hw_btcoex_disable(struct ath_hw *ah) 220{ 221 struct ath_btcoex_hw *btcoex_hw = &ah->btcoex_hw; 222 int i; 223 | 233 } 234 235 REG_RMW(ah, AR_GPIO_PDPU, 236 (0x2 << (btcoex_hw->btactive_gpio * 2)), 237 (0x3 << (btcoex_hw->btactive_gpio * 2))); 238 239 ah->btcoex_hw.enabled = true; 240} 241EXPORT_SYMBOL(ath9k_hw_btcoex_enable); 242 243void ath9k_hw_btcoex_disable(struct ath_hw *ah) 244{ 245 struct ath_btcoex_hw *btcoex_hw = &ah->btcoex_hw; 246 int i; 247 |
248 btcoex_hw->enabled = false; 249 if (btcoex_hw->scheme == ATH_BTCOEX_CFG_MCI) { 250 ath9k_hw_btcoex_bt_stomp(ah, ATH_BTCOEX_STOMP_NONE); 251 for (i = 0; i < AR9300_NUM_BT_WEIGHTS; i++) 252 REG_WRITE(ah, AR_MCI_COEX_WL_WEIGHTS(i), 253 btcoex_hw->wlan_weight[i]); 254 } |
|
224 ath9k_hw_set_gpio(ah, btcoex_hw->wlanactive_gpio, 0); 225 226 ath9k_hw_cfg_output(ah, btcoex_hw->wlanactive_gpio, 227 AR_GPIO_OUTPUT_MUX_AS_OUTPUT); 228 229 if (btcoex_hw->scheme == ATH_BTCOEX_CFG_3WIRE) { 230 REG_WRITE(ah, AR_BT_COEX_MODE, AR_BT_QUIET | AR_BT_MODE); 231 REG_WRITE(ah, AR_BT_COEX_MODE2, 0); 232 233 if (AR_SREV_9300_20_OR_LATER(ah)) { 234 REG_WRITE(ah, AR_BT_COEX_WL_WEIGHTS0, 0); 235 REG_WRITE(ah, AR_BT_COEX_WL_WEIGHTS1, 0); 236 for (i = 0; i < AR9300_NUM_BT_WEIGHTS; i++) 237 REG_WRITE(ah, AR_BT_COEX_BT_WEIGHTS(i), 0); 238 } else 239 REG_WRITE(ah, AR_BT_COEX_WEIGHT, 0); 240 241 } | 255 ath9k_hw_set_gpio(ah, btcoex_hw->wlanactive_gpio, 0); 256 257 ath9k_hw_cfg_output(ah, btcoex_hw->wlanactive_gpio, 258 AR_GPIO_OUTPUT_MUX_AS_OUTPUT); 259 260 if (btcoex_hw->scheme == ATH_BTCOEX_CFG_3WIRE) { 261 REG_WRITE(ah, AR_BT_COEX_MODE, AR_BT_QUIET | AR_BT_MODE); 262 REG_WRITE(ah, AR_BT_COEX_MODE2, 0); 263 264 if (AR_SREV_9300_20_OR_LATER(ah)) { 265 REG_WRITE(ah, AR_BT_COEX_WL_WEIGHTS0, 0); 266 REG_WRITE(ah, AR_BT_COEX_WL_WEIGHTS1, 0); 267 for (i = 0; i < AR9300_NUM_BT_WEIGHTS; i++) 268 REG_WRITE(ah, AR_BT_COEX_BT_WEIGHTS(i), 0); 269 } else 270 REG_WRITE(ah, AR_BT_COEX_WEIGHT, 0); 271 272 } |
242 243 ah->btcoex_hw.enabled = false; | |
244} 245EXPORT_SYMBOL(ath9k_hw_btcoex_disable); 246 247static void ar9003_btcoex_bt_stomp(struct ath_hw *ah, 248 enum ath_stomp_type stomp_type) 249{ 250 struct ath_btcoex_hw *btcoex = &ah->btcoex_hw; | 273} 274EXPORT_SYMBOL(ath9k_hw_btcoex_disable); 275 276static void ar9003_btcoex_bt_stomp(struct ath_hw *ah, 277 enum ath_stomp_type stomp_type) 278{ 279 struct ath_btcoex_hw *btcoex = &ah->btcoex_hw; |
280 const u32 *weight = AR_SREV_9462(ah) ? ar9003_wlan_weights[stomp_type] : 281 ar9462_wlan_weights[stomp_type]; |
|
251 int i; 252 253 for (i = 0; i < AR9300_NUM_WLAN_WEIGHTS; i++) { 254 btcoex->bt_weight[i] = AR9300_BT_WGHT; | 282 int i; 283 284 for (i = 0; i < AR9300_NUM_WLAN_WEIGHTS; i++) { 285 btcoex->bt_weight[i] = AR9300_BT_WGHT; |
255 btcoex->wlan_weight[i] = ar9003_wlan_weights[stomp_type][i]; | 286 btcoex->wlan_weight[i] = weight[i]; |
256 } 257} 258 259/* 260 * Configures appropriate weight based on stomp type. 261 */ 262void ath9k_hw_btcoex_bt_stomp(struct ath_hw *ah, 263 enum ath_stomp_type stomp_type) --- 26 unchanged lines hidden --- | 287 } 288} 289 290/* 291 * Configures appropriate weight based on stomp type. 292 */ 293void ath9k_hw_btcoex_bt_stomp(struct ath_hw *ah, 294 enum ath_stomp_type stomp_type) --- 26 unchanged lines hidden --- |