Skip to content

Commit 5160b46

Browse files
Sujith Manoharanlinvjw
authored andcommitted
ath9k: Fix BTCOEX weight initialization
The WLAN/BT weights have to set correctly before BTCOEX is initialized. Currently, this is not done for all chips in the AR9003 family. This patch fixes this issue by setting the weights in the init path. While at it, rename ar9462_wlan_weights to mci_wlan_weights since it is common to both AR9462 and AR9565. Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
1 parent 5570a91 commit 5160b46

File tree

4 files changed

+39
-32
lines changed

4 files changed

+39
-32
lines changed

drivers/net/wireless/ath/ath9k/btcoex.c

Lines changed: 32 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ static const u32 ar9003_wlan_weights[ATH_BTCOEX_STOMP_MAX]
4343
{ 0x00000000, 0x00000000, 0x00000000, 0x00000000 }, /* STOMP_NONE */
4444
};
4545

46-
static const u32 ar9462_wlan_weights[ATH_BTCOEX_STOMP_MAX]
47-
[AR9300_NUM_WLAN_WEIGHTS] = {
46+
static const u32 mci_wlan_weights[ATH_BTCOEX_STOMP_MAX]
47+
[AR9300_NUM_WLAN_WEIGHTS] = {
4848
{ 0x01017d01, 0x41414101, 0x41414101, 0x41414141 }, /* STOMP_ALL */
4949
{ 0x01017d01, 0x3b3b3b01, 0x3b3b3b01, 0x3b3b3b3b }, /* STOMP_LOW */
5050
{ 0x01017d01, 0x01010101, 0x01010101, 0x01010101 }, /* STOMP_NONE */
@@ -208,14 +208,37 @@ static void ath9k_hw_btcoex_enable_2wire(struct ath_hw *ah)
208208
AR_GPIO_OUTPUT_MUX_AS_TX_FRAME);
209209
}
210210

211+
/*
212+
* For AR9002, bt_weight/wlan_weight are used.
213+
* For AR9003 and above, stomp_type is used.
214+
*/
211215
void ath9k_hw_btcoex_set_weight(struct ath_hw *ah,
212216
u32 bt_weight,
213-
u32 wlan_weight)
217+
u32 wlan_weight,
218+
enum ath_stomp_type stomp_type)
214219
{
215220
struct ath_btcoex_hw *btcoex_hw = &ah->btcoex_hw;
216221

217-
btcoex_hw->bt_coex_weights = SM(bt_weight, AR_BTCOEX_BT_WGHT) |
218-
SM(wlan_weight, AR_BTCOEX_WL_WGHT);
222+
if (AR_SREV_9300_20_OR_LATER(ah)) {
223+
const u32 *weight = ar9003_wlan_weights[stomp_type];
224+
int i;
225+
226+
if (AR_SREV_9462(ah) || AR_SREV_9565(ah)) {
227+
if ((stomp_type == ATH_BTCOEX_STOMP_LOW) &&
228+
btcoex_hw->mci.stomp_ftp)
229+
stomp_type = ATH_BTCOEX_STOMP_LOW_FTP;
230+
weight = mci_wlan_weights[stomp_type];
231+
}
232+
233+
for (i = 0; i < AR9300_NUM_WLAN_WEIGHTS; i++) {
234+
btcoex_hw->bt_weight[i] = AR9300_BT_WGHT;
235+
btcoex_hw->wlan_weight[i] = weight[i];
236+
}
237+
} else {
238+
btcoex_hw->bt_coex_weights =
239+
SM(bt_weight, AR_BTCOEX_BT_WGHT) |
240+
SM(wlan_weight, AR_BTCOEX_WL_WGHT);
241+
}
219242
}
220243
EXPORT_SYMBOL(ath9k_hw_btcoex_set_weight);
221244

@@ -332,49 +355,29 @@ void ath9k_hw_btcoex_disable(struct ath_hw *ah)
332355
}
333356
EXPORT_SYMBOL(ath9k_hw_btcoex_disable);
334357

335-
static void ar9003_btcoex_bt_stomp(struct ath_hw *ah,
336-
enum ath_stomp_type stomp_type)
337-
{
338-
struct ath_btcoex_hw *btcoex = &ah->btcoex_hw;
339-
const u32 *weight = ar9003_wlan_weights[stomp_type];
340-
int i;
341-
342-
if (AR_SREV_9462(ah) || AR_SREV_9565(ah)) {
343-
if ((stomp_type == ATH_BTCOEX_STOMP_LOW) &&
344-
btcoex->mci.stomp_ftp)
345-
stomp_type = ATH_BTCOEX_STOMP_LOW_FTP;
346-
weight = ar9462_wlan_weights[stomp_type];
347-
}
348-
349-
for (i = 0; i < AR9300_NUM_WLAN_WEIGHTS; i++) {
350-
btcoex->bt_weight[i] = AR9300_BT_WGHT;
351-
btcoex->wlan_weight[i] = weight[i];
352-
}
353-
}
354-
355358
/*
356359
* Configures appropriate weight based on stomp type.
357360
*/
358361
void ath9k_hw_btcoex_bt_stomp(struct ath_hw *ah,
359362
enum ath_stomp_type stomp_type)
360363
{
361364
if (AR_SREV_9300_20_OR_LATER(ah)) {
362-
ar9003_btcoex_bt_stomp(ah, stomp_type);
365+
ath9k_hw_btcoex_set_weight(ah, 0, 0, stomp_type);
363366
return;
364367
}
365368

366369
switch (stomp_type) {
367370
case ATH_BTCOEX_STOMP_ALL:
368371
ath9k_hw_btcoex_set_weight(ah, AR_BT_COEX_WGHT,
369-
AR_STOMP_ALL_WLAN_WGHT);
372+
AR_STOMP_ALL_WLAN_WGHT, 0);
370373
break;
371374
case ATH_BTCOEX_STOMP_LOW:
372375
ath9k_hw_btcoex_set_weight(ah, AR_BT_COEX_WGHT,
373-
AR_STOMP_LOW_WLAN_WGHT);
376+
AR_STOMP_LOW_WLAN_WGHT, 0);
374377
break;
375378
case ATH_BTCOEX_STOMP_NONE:
376379
ath9k_hw_btcoex_set_weight(ah, AR_BT_COEX_WGHT,
377-
AR_STOMP_NONE_WLAN_WGHT);
380+
AR_STOMP_NONE_WLAN_WGHT, 0);
378381
break;
379382
default:
380383
ath_dbg(ath9k_hw_common(ah), BTCOEX, "Invalid Stomptype\n");

drivers/net/wireless/ath/ath9k/btcoex.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,8 @@ void ath9k_hw_btcoex_init_mci(struct ath_hw *ah);
107107
void ath9k_hw_init_btcoex_hw(struct ath_hw *ah, int qnum);
108108
void ath9k_hw_btcoex_set_weight(struct ath_hw *ah,
109109
u32 bt_weight,
110-
u32 wlan_weight);
110+
u32 wlan_weight,
111+
enum ath_stomp_type stomp_type);
111112
void ath9k_hw_btcoex_disable(struct ath_hw *ah);
112113
void ath9k_hw_btcoex_bt_stomp(struct ath_hw *ah,
113114
enum ath_stomp_type stomp_type);

drivers/net/wireless/ath/ath9k/gpio.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,10 @@ void ath9k_start_btcoex(struct ath_softc *sc)
395395
!ah->btcoex_hw.enabled) {
396396
if (!(sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_MCI))
397397
ath9k_hw_btcoex_set_weight(ah, AR_BT_COEX_WGHT,
398-
AR_STOMP_LOW_WLAN_WGHT);
398+
AR_STOMP_LOW_WLAN_WGHT, 0);
399+
else
400+
ath9k_hw_btcoex_set_weight(ah, 0, 0,
401+
ATH_BTCOEX_STOMP_NONE);
399402
ath9k_hw_btcoex_enable(ah);
400403

401404
if (ath9k_hw_get_btcoex_scheme(ah) == ATH_BTCOEX_CFG_3WIRE)

drivers/net/wireless/ath/ath9k/htc_drv_gpio.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ void ath9k_htc_start_btcoex(struct ath9k_htc_priv *priv)
161161

162162
if (ath9k_hw_get_btcoex_scheme(ah) == ATH_BTCOEX_CFG_3WIRE) {
163163
ath9k_hw_btcoex_set_weight(ah, AR_BT_COEX_WGHT,
164-
AR_STOMP_LOW_WLAN_WGHT);
164+
AR_STOMP_LOW_WLAN_WGHT, 0);
165165
ath9k_hw_btcoex_enable(ah);
166166
ath_htc_resume_btcoex_work(priv);
167167
}

0 commit comments

Comments
 (0)