ath9k: add some more ani fixes
[openwrt/openwrt.git] / package / mac80211 / patches / 572-ath9k_ani_cleanup_weak_signal_detect.patch
1 --- a/drivers/net/wireless/ath/ath9k/ani.c
2 +++ b/drivers/net/wireless/ath/ath9k/ani.c
3 @@ -185,7 +185,7 @@ static void ath9k_hw_ani_ofdm_err_trigge
4 }
5 rssi = BEACON_RSSI(ah);
6 if (rssi > aniState->rssiThrHigh) {
7 - if (!aniState->ofdmWeakSigDetectOff) {
8 + if (aniState->ofdmWeakSigDetect) {
9 if (ath9k_hw_ani_control(ah,
10 ATH9K_ANI_OFDM_WEAK_SIGNAL_DETECTION,
11 false)) {
12 @@ -200,7 +200,7 @@ static void ath9k_hw_ani_ofdm_err_trigge
13 return;
14 }
15 } else if (rssi > aniState->rssiThrLow) {
16 - if (aniState->ofdmWeakSigDetectOff)
17 + if (!aniState->ofdmWeakSigDetect)
18 ath9k_hw_ani_control(ah,
19 ATH9K_ANI_OFDM_WEAK_SIGNAL_DETECTION,
20 true);
21 @@ -211,7 +211,7 @@ static void ath9k_hw_ani_ofdm_err_trigge
22 } else {
23 if ((conf->channel->band == IEEE80211_BAND_2GHZ) &&
24 !conf_is_ht(conf)) {
25 - if (!aniState->ofdmWeakSigDetectOff)
26 + if (aniState->ofdmWeakSigDetect)
27 ath9k_hw_ani_control(ah,
28 ATH9K_ANI_OFDM_WEAK_SIGNAL_DETECTION,
29 false);
30 @@ -296,7 +296,7 @@ static void ath9k_hw_set_ofdm_nil(struct
31 BEACON_RSSI(ah) <= aniState->rssiThrHigh)
32 weak_sig = true;
33
34 - if (!aniState->ofdmWeakSigDetectOff != weak_sig)
35 + if (aniState->ofdmWeakSigDetect != weak_sig)
36 ath9k_hw_ani_control(ah,
37 ATH9K_ANI_OFDM_WEAK_SIGNAL_DETECTION,
38 entry_ofdm->ofdm_weak_signal_on);
39 @@ -401,7 +401,7 @@ static void ath9k_hw_ani_lower_immunity_
40 if (rssi > aniState->rssiThrHigh) {
41 /* XXX: Handle me */
42 } else if (rssi > aniState->rssiThrLow) {
43 - if (aniState->ofdmWeakSigDetectOff) {
44 + if (!aniState->ofdmWeakSigDetect) {
45 if (ath9k_hw_ani_control(ah,
46 ATH9K_ANI_OFDM_WEAK_SIGNAL_DETECTION,
47 true))
48 @@ -509,9 +509,9 @@ static void ath9k_ani_reset_old(struct a
49 if (aniState->spurImmunityLevel != 0)
50 ath9k_hw_ani_control(ah, ATH9K_ANI_SPUR_IMMUNITY_LEVEL,
51 aniState->spurImmunityLevel);
52 - if (aniState->ofdmWeakSigDetectOff)
53 + if (!aniState->ofdmWeakSigDetect)
54 ath9k_hw_ani_control(ah, ATH9K_ANI_OFDM_WEAK_SIGNAL_DETECTION,
55 - !aniState->ofdmWeakSigDetectOff);
56 + aniState->ofdmWeakSigDetect);
57 if (aniState->cckWeakSigThreshold)
58 ath9k_hw_ani_control(ah, ATH9K_ANI_CCK_WEAK_SIGNAL_THR,
59 aniState->cckWeakSigThreshold);
60 @@ -887,8 +887,7 @@ void ath9k_hw_ani_init(struct ath_hw *ah
61
62 ani->rssiThrHigh = ATH9K_ANI_RSSI_THR_HIGH;
63 ani->rssiThrLow = ATH9K_ANI_RSSI_THR_LOW;
64 - ani->ofdmWeakSigDetectOff =
65 - !ATH9K_ANI_USE_OFDM_WEAK_SIG;
66 + ani->ofdmWeakSigDetect = ATH9K_ANI_USE_OFDM_WEAK_SIG;
67 ani->cckNoiseImmunityLevel = ATH9K_ANI_CCK_DEF_LEVEL;
68 ani->ofdmNoiseImmunityLevel = ATH9K_ANI_OFDM_DEF_LEVEL;
69 ani->update_ani = false;
70 --- a/drivers/net/wireless/ath/ath9k/ani.h
71 +++ b/drivers/net/wireless/ath/ath9k/ani.h
72 @@ -122,7 +122,7 @@ struct ar5416AniState {
73 u8 mrcCCKOff;
74 u8 spurImmunityLevel;
75 u8 firstepLevel;
76 - u8 ofdmWeakSigDetectOff;
77 + u8 ofdmWeakSigDetect;
78 u8 cckWeakSigThreshold;
79 bool update_ani;
80 u32 listenTime;
81 --- a/drivers/net/wireless/ath/ath9k/ar5008_phy.c
82 +++ b/drivers/net/wireless/ath/ath9k/ar5008_phy.c
83 @@ -1042,12 +1042,12 @@ static bool ar5008_hw_ani_control_old(st
84 REG_CLR_BIT(ah, AR_PHY_SFCORR_LOW,
85 AR_PHY_SFCORR_LOW_USE_SELF_CORR_LOW);
86
87 - if (!on != aniState->ofdmWeakSigDetectOff) {
88 + if (on != aniState->ofdmWeakSigDetect) {
89 if (on)
90 ah->stats.ast_ani_ofdmon++;
91 else
92 ah->stats.ast_ani_ofdmoff++;
93 - aniState->ofdmWeakSigDetectOff = !on;
94 + aniState->ofdmWeakSigDetect = on;
95 }
96 break;
97 }
98 @@ -1114,10 +1114,10 @@ static bool ar5008_hw_ani_control_old(st
99
100 ath_dbg(common, ANI, "ANI parameters:\n");
101 ath_dbg(common, ANI,
102 - "noiseImmunityLevel=%d, spurImmunityLevel=%d, ofdmWeakSigDetectOff=%d\n",
103 + "noiseImmunityLevel=%d, spurImmunityLevel=%d, ofdmWeakSigDetect=%d\n",
104 aniState->noiseImmunityLevel,
105 aniState->spurImmunityLevel,
106 - !aniState->ofdmWeakSigDetectOff);
107 + aniState->ofdmWeakSigDetect);
108 ath_dbg(common, ANI,
109 "cckWeakSigThreshold=%d, firstepLevel=%d, listenTime=%d\n",
110 aniState->cckWeakSigThreshold,
111 @@ -1206,18 +1206,18 @@ static bool ar5008_hw_ani_control_new(st
112 REG_CLR_BIT(ah, AR_PHY_SFCORR_LOW,
113 AR_PHY_SFCORR_LOW_USE_SELF_CORR_LOW);
114
115 - if (!on != aniState->ofdmWeakSigDetectOff) {
116 + if (on != aniState->ofdmWeakSigDetect) {
117 ath_dbg(common, ANI,
118 "** ch %d: ofdm weak signal: %s=>%s\n",
119 chan->channel,
120 - !aniState->ofdmWeakSigDetectOff ?
121 + aniState->ofdmWeakSigDetect ?
122 "on" : "off",
123 on ? "on" : "off");
124 if (on)
125 ah->stats.ast_ani_ofdmon++;
126 else
127 ah->stats.ast_ani_ofdmoff++;
128 - aniState->ofdmWeakSigDetectOff = !on;
129 + aniState->ofdmWeakSigDetect = on;
130 }
131 break;
132 }
133 @@ -1367,7 +1367,7 @@ static bool ar5008_hw_ani_control_new(st
134 ath_dbg(common, ANI,
135 "ANI parameters: SI=%d, ofdmWS=%s FS=%d MRCcck=%s listenTime=%d ofdmErrs=%d cckErrs=%d\n",
136 aniState->spurImmunityLevel,
137 - !aniState->ofdmWeakSigDetectOff ? "on" : "off",
138 + aniState->ofdmWeakSigDetect ? "on" : "off",
139 aniState->firstepLevel,
140 !aniState->mrcCCKOff ? "on" : "off",
141 aniState->listenTime,
142 @@ -1456,7 +1456,7 @@ static void ar5008_hw_ani_cache_ini_regs
143 /* these levels just got reset to defaults by the INI */
144 aniState->spurImmunityLevel = ATH9K_ANI_SPUR_IMMUNE_LVL_NEW;
145 aniState->firstepLevel = ATH9K_ANI_FIRSTEP_LVL_NEW;
146 - aniState->ofdmWeakSigDetectOff = !ATH9K_ANI_USE_OFDM_WEAK_SIG;
147 + aniState->ofdmWeakSigDetect = ATH9K_ANI_USE_OFDM_WEAK_SIG;
148 aniState->mrcCCKOff = true; /* not available on pre AR9003 */
149 }
150
151 --- a/drivers/net/wireless/ath/ath9k/ar9003_phy.c
152 +++ b/drivers/net/wireless/ath/ath9k/ar9003_phy.c
153 @@ -821,18 +821,18 @@ static bool ar9003_hw_ani_control(struct
154 REG_CLR_BIT(ah, AR_PHY_SFCORR_LOW,
155 AR_PHY_SFCORR_LOW_USE_SELF_CORR_LOW);
156
157 - if (!on != aniState->ofdmWeakSigDetectOff) {
158 + if (on != aniState->ofdmWeakSigDetect) {
159 ath_dbg(common, ANI,
160 "** ch %d: ofdm weak signal: %s=>%s\n",
161 chan->channel,
162 - !aniState->ofdmWeakSigDetectOff ?
163 + aniState->ofdmWeakSigDetect ?
164 "on" : "off",
165 on ? "on" : "off");
166 if (on)
167 ah->stats.ast_ani_ofdmon++;
168 else
169 ah->stats.ast_ani_ofdmoff++;
170 - aniState->ofdmWeakSigDetectOff = !on;
171 + aniState->ofdmWeakSigDetect = on;
172 }
173 break;
174 }
175 @@ -998,7 +998,7 @@ static bool ar9003_hw_ani_control(struct
176 ath_dbg(common, ANI,
177 "ANI parameters: SI=%d, ofdmWS=%s FS=%d MRCcck=%s listenTime=%d ofdmErrs=%d cckErrs=%d\n",
178 aniState->spurImmunityLevel,
179 - !aniState->ofdmWeakSigDetectOff ? "on" : "off",
180 + aniState->ofdmWeakSigDetect ? "on" : "off",
181 aniState->firstepLevel,
182 !aniState->mrcCCKOff ? "on" : "off",
183 aniState->listenTime,
184 @@ -1109,7 +1109,7 @@ static void ar9003_hw_ani_cache_ini_regs
185 /* these levels just got reset to defaults by the INI */
186 aniState->spurImmunityLevel = ATH9K_ANI_SPUR_IMMUNE_LVL_NEW;
187 aniState->firstepLevel = ATH9K_ANI_FIRSTEP_LVL_NEW;
188 - aniState->ofdmWeakSigDetectOff = !ATH9K_ANI_USE_OFDM_WEAK_SIG;
189 + aniState->ofdmWeakSigDetect = ATH9K_ANI_USE_OFDM_WEAK_SIG;
190 aniState->mrcCCKOff = !ATH9K_ANI_ENABLE_MRC_CCK;
191 }
192