Commit 28327fd0 authored by Felix Fietkau's avatar Felix Fietkau Committed by John W. Linville

ath9k_hw: set ANI cycpwr_thr1 as absolute values instead of relative

The table was copied from the ANI implementation of AR9300. It assumes
that the INI values contain a baseline value that is usable as reference
from which to increase/decrease based on the noise immunity value.

On older chips, the differences are bigger and especially AR5008/AR9001
are configured to much more sensitive values than what is useful.

Improve ANI behavior by reverting to the absolute values used in the
previous implementation (expressed as a simple formula instead of the
old table).
Signed-off-by: default avatarFelix Fietkau <nbd@openwrt.org>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent afdc05f0
...@@ -26,10 +26,6 @@ static const int firstep_table[] = ...@@ -26,10 +26,6 @@ static const int firstep_table[] =
/* level: 0 1 2 3 4 5 6 7 8 */ /* level: 0 1 2 3 4 5 6 7 8 */
{ -4, -2, 0, 2, 4, 6, 8, 10, 12 }; /* lvl 0-8, default 2 */ { -4, -2, 0, 2, 4, 6, 8, 10, 12 }; /* lvl 0-8, default 2 */
static const int cycpwrThr1_table[] =
/* level: 0 1 2 3 4 5 6 7 8 */
{ -6, -4, -2, 0, 2, 4, 6, 8 }; /* lvl 0-7, default 3 */
/* /*
* register values to turn OFDM weak signal detection OFF * register values to turn OFDM weak signal detection OFF
*/ */
...@@ -1073,41 +1069,13 @@ static bool ar5008_hw_ani_control_new(struct ath_hw *ah, ...@@ -1073,41 +1069,13 @@ static bool ar5008_hw_ani_control_new(struct ath_hw *ah,
case ATH9K_ANI_SPUR_IMMUNITY_LEVEL:{ case ATH9K_ANI_SPUR_IMMUNITY_LEVEL:{
u32 level = param; u32 level = param;
if (level >= ARRAY_SIZE(cycpwrThr1_table)) { value = (level + 1) * 2;
ath_dbg(common, ANI,
"ATH9K_ANI_SPUR_IMMUNITY_LEVEL: level out of range (%u > %zu)\n",
level, ARRAY_SIZE(cycpwrThr1_table));
return false;
}
/*
* make register setting relative to default
* from INI file & cap value
*/
value = cycpwrThr1_table[level] -
cycpwrThr1_table[ATH9K_ANI_SPUR_IMMUNE_LVL] +
aniState->iniDef.cycpwrThr1;
if (value < ATH9K_SIG_SPUR_IMM_SETTING_MIN)
value = ATH9K_SIG_SPUR_IMM_SETTING_MIN;
if (value > ATH9K_SIG_SPUR_IMM_SETTING_MAX)
value = ATH9K_SIG_SPUR_IMM_SETTING_MAX;
REG_RMW_FIELD(ah, AR_PHY_TIMING5, REG_RMW_FIELD(ah, AR_PHY_TIMING5,
AR_PHY_TIMING5_CYCPWR_THR1, AR_PHY_TIMING5_CYCPWR_THR1, value);
value);
/* if (IS_CHAN_HT40(ah->curchan))
* set AR_PHY_EXT_CCA for extension channel REG_RMW_FIELD(ah, AR_PHY_EXT_CCA,
* make register setting relative to default AR_PHY_EXT_TIMING5_CYCPWR_THR1, value);
* from INI file & cap value
*/
value2 = cycpwrThr1_table[level] -
cycpwrThr1_table[ATH9K_ANI_SPUR_IMMUNE_LVL] +
aniState->iniDef.cycpwrThr1Ext;
if (value2 < ATH9K_SIG_SPUR_IMM_SETTING_MIN)
value2 = ATH9K_SIG_SPUR_IMM_SETTING_MIN;
if (value2 > ATH9K_SIG_SPUR_IMM_SETTING_MAX)
value2 = ATH9K_SIG_SPUR_IMM_SETTING_MAX;
REG_RMW_FIELD(ah, AR_PHY_EXT_CCA,
AR_PHY_EXT_TIMING5_CYCPWR_THR1, value2);
if (level != aniState->spurImmunityLevel) { if (level != aniState->spurImmunityLevel) {
ath_dbg(common, ANI, ath_dbg(common, ANI,
...@@ -1124,7 +1092,7 @@ static bool ar5008_hw_ani_control_new(struct ath_hw *ah, ...@@ -1124,7 +1092,7 @@ static bool ar5008_hw_ani_control_new(struct ath_hw *ah,
aniState->spurImmunityLevel, aniState->spurImmunityLevel,
level, level,
ATH9K_ANI_SPUR_IMMUNE_LVL, ATH9K_ANI_SPUR_IMMUNE_LVL,
value2, value,
aniState->iniDef.cycpwrThr1Ext); aniState->iniDef.cycpwrThr1Ext);
if (level > aniState->spurImmunityLevel) if (level > aniState->spurImmunityLevel)
ah->stats.ast_ani_spurup++; ah->stats.ast_ani_spurup++;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment