From: Felix Fietkau Date: Fri, 23 Jul 2010 02:07:48 +0000 (+0200) Subject: ath9k_hw: fix invalid extension channel noisefloor readings in HT20 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=866b7780fce95989dfc85f3e372635f5147e0d90;p=GitHub%2Fmt8127%2Fandroid_kernel_alcatel_ttab.git ath9k_hw: fix invalid extension channel noisefloor readings in HT20 When the hardware is configured in HT20 mode, noise floor readings for the extension channel often return invalid values, which keep the values in the NF history buffer at the hardware-specific maximum limit. Fix this by discarding the extension channel values when in HT20 mode. Signed-off-by: Felix Fietkau Signed-off-by: John W. Linville --- diff --git a/drivers/net/wireless/ath/ath9k/ar5008_phy.c b/drivers/net/wireless/ath/ath9k/ar5008_phy.c index 4a910b78de52..3d2c8679bc85 100644 --- a/drivers/net/wireless/ath/ath9k/ar5008_phy.c +++ b/drivers/net/wireless/ath/ath9k/ar5008_phy.c @@ -1506,6 +1506,9 @@ static void ar5008_hw_do_getnf(struct ath_hw *ah, nf = MS(REG_READ(ah, AR_PHY_CH2_CCA), AR_PHY_CH2_MINCCA_PWR); nfarray[2] = sign_extend(nf, 9); + if (!IS_CHAN_HT40(ah->curchan)) + return; + nf = MS(REG_READ(ah, AR_PHY_EXT_CCA), AR_PHY_EXT_MINCCA_PWR); nfarray[3] = sign_extend(nf, 9); diff --git a/drivers/net/wireless/ath/ath9k/ar9002_phy.c b/drivers/net/wireless/ath/ath9k/ar9002_phy.c index 4922b8d4a938..adbf031fbc5a 100644 --- a/drivers/net/wireless/ath/ath9k/ar9002_phy.c +++ b/drivers/net/wireless/ath/ath9k/ar9002_phy.c @@ -477,7 +477,8 @@ static void ar9002_hw_do_getnf(struct ath_hw *ah, nfarray[0] = sign_extend(nf, 9); nf = MS(REG_READ(ah, AR_PHY_EXT_CCA), AR9280_PHY_EXT_MINCCA_PWR); - nfarray[3] = sign_extend(nf, 9); + if (IS_CHAN_HT40(ah->curchan)) + nfarray[3] = sign_extend(nf, 9); if (AR_SREV_9285(ah) || AR_SREV_9271(ah)) return; @@ -486,7 +487,8 @@ static void ar9002_hw_do_getnf(struct ath_hw *ah, nfarray[1] = sign_extend(nf, 9); nf = MS(REG_READ(ah, AR_PHY_CH1_EXT_CCA), AR9280_PHY_CH1_EXT_MINCCA_PWR); - nfarray[4] = sign_extend(nf, 9); + if (IS_CHAN_HT40(ah->curchan)) + nfarray[4] = sign_extend(nf, 9); } static void ar9002_hw_set_nf_limits(struct ath_hw *ah) diff --git a/drivers/net/wireless/ath/ath9k/ar9003_phy.c b/drivers/net/wireless/ath/ath9k/ar9003_phy.c index 7c93338540ae..a753a431bb13 100644 --- a/drivers/net/wireless/ath/ath9k/ar9003_phy.c +++ b/drivers/net/wireless/ath/ath9k/ar9003_phy.c @@ -1029,6 +1029,9 @@ static void ar9003_hw_do_getnf(struct ath_hw *ah, nf = MS(REG_READ(ah, AR_PHY_CCA_2), AR_PHY_CH2_MINCCA_PWR); nfarray[2] = sign_extend(nf, 9); + if (!IS_CHAN_HT40(ah->curchan)) + return; + nf = MS(REG_READ(ah, AR_PHY_EXT_CCA), AR_PHY_EXT_MINCCA_PWR); nfarray[3] = sign_extend(nf, 9);