ath9k: fix invalid noisefloor measurement values in ht20 mode
[openwrt/openwrt.git] / package / mac80211 / patches / 530-ath9k_nf_fix.patch
1 --- a/drivers/net/wireless/ath/ath9k/ar5008_phy.c
2 +++ b/drivers/net/wireless/ath/ath9k/ar5008_phy.c
3 @@ -1508,6 +1508,9 @@ static void ar5008_hw_do_getnf(struct at
4 nf = MS(REG_READ(ah, AR_PHY_CH2_CCA), AR_PHY_CH2_MINCCA_PWR);
5 nfarray[2] = sign_extend(nf, 9);
6
7 + if (!IS_CHAN_HT40(ah->curchan))
8 + return;
9 +
10 nf = MS(REG_READ(ah, AR_PHY_EXT_CCA), AR_PHY_EXT_MINCCA_PWR);
11 nfarray[3] = sign_extend(nf, 9);
12
13 --- a/drivers/net/wireless/ath/ath9k/ar9002_phy.c
14 +++ b/drivers/net/wireless/ath/ath9k/ar9002_phy.c
15 @@ -477,7 +477,8 @@ static void ar9002_hw_do_getnf(struct at
16 nfarray[0] = sign_extend(nf, 9);
17
18 nf = MS(REG_READ(ah, AR_PHY_EXT_CCA), AR9280_PHY_EXT_MINCCA_PWR);
19 - nfarray[3] = sign_extend(nf, 9);
20 + if (IS_CHAN_HT40(ah->curchan))
21 + nfarray[3] = sign_extend(nf, 9);
22
23 if (AR_SREV_9285(ah) || AR_SREV_9271(ah))
24 return;
25 @@ -486,7 +487,8 @@ static void ar9002_hw_do_getnf(struct at
26 nfarray[1] = sign_extend(nf, 9);
27
28 nf = MS(REG_READ(ah, AR_PHY_CH1_EXT_CCA), AR9280_PHY_CH1_EXT_MINCCA_PWR);
29 - nfarray[4] = sign_extend(nf, 9);
30 + if (IS_CHAN_HT40(ah->curchan))
31 + nfarray[4] = sign_extend(nf, 9);
32 }
33
34 static void ar9002_hw_set_nf_limits(struct ath_hw *ah)
35 --- a/drivers/net/wireless/ath/ath9k/ar9003_phy.c
36 +++ b/drivers/net/wireless/ath/ath9k/ar9003_phy.c
37 @@ -1029,6 +1029,9 @@ static void ar9003_hw_do_getnf(struct at
38 nf = MS(REG_READ(ah, AR_PHY_CCA_2), AR_PHY_CH2_MINCCA_PWR);
39 nfarray[2] = sign_extend(nf, 9);
40
41 + if (!IS_CHAN_HT40(ah->curchan))
42 + return;
43 +
44 nf = MS(REG_READ(ah, AR_PHY_EXT_CCA), AR_PHY_EXT_MINCCA_PWR);
45 nfarray[3] = sign_extend(nf, 9);
46