ath9k_hw: tweak noise immunity thresholds for older chipsets
authorFelix Fietkau <nbd@openwrt.org>
Fri, 28 Feb 2014 18:02:25 +0000 (19:02 +0100)
committerJohn W. Linville <linville@tuxdriver.com>
Mon, 3 Mar 2014 20:35:55 +0000 (15:35 -0500)
Older chipsets are more sensitive to high PHY error counts, and the
current noise immunity thresholds were based on tests run at QCA with
newer chipsets.

This patch brings back the values from the old ANI implementation for
old chipsets, and it also disables weak signal detection on an earlier
noise immunity level, to improve overall radio stability on affected
devices.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/ath/ath9k/ani.c
drivers/net/wireless/ath/ath9k/ani.h

index 3227ee059813f5772ca030a46fecad3eca0cee5e..2ce5079007b6800e331da1eb20eca8b45692b83e 100644 (file)
@@ -185,10 +185,18 @@ static void ath9k_hw_set_ofdm_nil(struct ath_hw *ah, u8 immunityLevel,
                 ah->opmode != NL80211_IFTYPE_STATION)
                weak_sig = true;
 
+       /* Older chipsets are more sensitive to high PHY error counts */
+       else if (!AR_SREV_9300_20_OR_LATER(ah) &&
+                aniState->ofdmNoiseImmunityLevel >= 8)
+               weak_sig = false;
+
        if (aniState->ofdmWeakSigDetect != weak_sig)
                ath9k_hw_ani_control(ah, ATH9K_ANI_OFDM_WEAK_SIGNAL_DETECTION,
                                     weak_sig);
 
+       if (!AR_SREV_9300_20_OR_LATER(ah))
+               return;
+
        if (aniState->ofdmNoiseImmunityLevel >= ATH9K_ANI_OFDM_DEF_LEVEL) {
                ah->config.ofdm_trig_high = ATH9K_ANI_OFDM_TRIG_HIGH;
                ah->config.ofdm_trig_low = ATH9K_ANI_OFDM_TRIG_LOW_ABOVE_INI;
@@ -485,10 +493,17 @@ void ath9k_hw_ani_init(struct ath_hw *ah)
 
        ath_dbg(common, ANI, "Initialize ANI\n");
 
-       ah->config.ofdm_trig_high = ATH9K_ANI_OFDM_TRIG_HIGH;
-       ah->config.ofdm_trig_low = ATH9K_ANI_OFDM_TRIG_LOW;
-       ah->config.cck_trig_high = ATH9K_ANI_CCK_TRIG_HIGH;
-       ah->config.cck_trig_low = ATH9K_ANI_CCK_TRIG_LOW;
+       if (AR_SREV_9300_20_OR_LATER(ah)) {
+               ah->config.ofdm_trig_high = ATH9K_ANI_OFDM_TRIG_HIGH;
+               ah->config.ofdm_trig_low = ATH9K_ANI_OFDM_TRIG_LOW;
+               ah->config.cck_trig_high = ATH9K_ANI_CCK_TRIG_HIGH;
+               ah->config.cck_trig_low = ATH9K_ANI_CCK_TRIG_LOW;
+       } else {
+               ah->config.ofdm_trig_high = ATH9K_ANI_OFDM_TRIG_HIGH_OLD;
+               ah->config.ofdm_trig_low = ATH9K_ANI_OFDM_TRIG_LOW_OLD;
+               ah->config.cck_trig_high = ATH9K_ANI_CCK_TRIG_HIGH_OLD;
+               ah->config.cck_trig_low = ATH9K_ANI_CCK_TRIG_LOW_OLD;
+       }
 
        ani->spurImmunityLevel = ATH9K_ANI_SPUR_IMMUNE_LVL;
        ani->firstepLevel = ATH9K_ANI_FIRSTEP_LVL;
index 21e7b83c3f6ac85e881b49b315256e931728ec7e..c40965b4c1e2982859cc2fff8f1e7f4747f376e7 100644 (file)
 /* units are errors per second */
 #define ATH9K_ANI_OFDM_TRIG_HIGH           3500
 #define ATH9K_ANI_OFDM_TRIG_HIGH_BELOW_INI 1000
+#define ATH9K_ANI_OFDM_TRIG_HIGH_OLD       500
 
 #define ATH9K_ANI_OFDM_TRIG_LOW           400
 #define ATH9K_ANI_OFDM_TRIG_LOW_ABOVE_INI 900
+#define ATH9K_ANI_OFDM_TRIG_LOW_OLD       200
 
 #define ATH9K_ANI_CCK_TRIG_HIGH           600
+#define ATH9K_ANI_CCK_TRIG_HIGH_OLD       200
 #define ATH9K_ANI_CCK_TRIG_LOW            300
+#define ATH9K_ANI_CCK_TRIG_LOW_OLD        100
 
 #define ATH9K_ANI_SPUR_IMMUNE_LVL         3
 #define ATH9K_ANI_FIRSTEP_LVL             2