ath9k: fix ANI weak signal detection handling
[openwrt.git] / package / mac80211 / patches / 571-ath9k_ani_fix_weak_sig.patch
1 --- a/drivers/net/wireless/ath/ath9k/ani.c
2 +++ b/drivers/net/wireless/ath/ath9k/ani.c
3 @@ -265,6 +265,7 @@ static void ath9k_hw_set_ofdm_nil(struct
4         struct ath_common *common = ath9k_hw_common(ah);
5         const struct ani_ofdm_level_entry *entry_ofdm;
6         const struct ani_cck_level_entry *entry_cck;
7 +       bool weak_sig;
8  
9         ath_dbg(common, ANI, "**** ofdmlevel %d=>%d, rssi=%d[lo=%d hi=%d]\n",
10                 aniState->ofdmNoiseImmunityLevel,
11 @@ -290,13 +291,15 @@ static void ath9k_hw_set_ofdm_nil(struct
12                                      ATH9K_ANI_FIRSTEP_LEVEL,
13                                      entry_ofdm->fir_step_level);
14  
15 -       if (BEACON_RSSI(ah) >= aniState->rssiThrHigh &&
16 -           (!aniState->ofdmWeakSigDetectOff !=
17 -            entry_ofdm->ofdm_weak_signal_on)) {
18 +       weak_sig = entry_ofdm->ofdm_weak_signal_on;
19 +       if (ah->opmode == NL80211_IFTYPE_STATION &&
20 +           BEACON_RSSI(ah) >= aniState->rssiThrHigh)
21 +               weak_sig = true;
22 +
23 +       if (!aniState->ofdmWeakSigDetectOff != weak_sig)
24                         ath9k_hw_ani_control(ah,
25                                 ATH9K_ANI_OFDM_WEAK_SIGNAL_DETECTION,
26                                 entry_ofdm->ofdm_weak_signal_on);
27 -       }
28  }
29  
30  static void ath9k_hw_ani_ofdm_err_trigger(struct ath_hw *ah)