aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2014-03-11 11:10:33 -0400
committerJohn W. Linville <linville@tuxdriver.com>2014-03-14 14:49:15 -0400
commit28327fd096248ad1153e455ca8ffa205927b4b89 (patch)
treeae57ae8a0ec7266af482494d0479aaa03d62b670 /drivers
parentafdc05f09df633546da70c92f5d1557687331789 (diff)
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: Felix Fietkau <nbd@openwrt.org> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/wireless/ath/ath9k/ar5008_phy.c44
1 files changed, 6 insertions, 38 deletions
diff --git a/drivers/net/wireless/ath/ath9k/ar5008_phy.c b/drivers/net/wireless/ath/ath9k/ar5008_phy.c
index ff415e863ee9..504e189728cd 100644
--- a/drivers/net/wireless/ath/ath9k/ar5008_phy.c
+++ b/drivers/net/wireless/ath/ath9k/ar5008_phy.c
@@ -26,10 +26,6 @@ static const int firstep_table[] =
26/* level: 0 1 2 3 4 5 6 7 8 */ 26/* level: 0 1 2 3 4 5 6 7 8 */
27 { -4, -2, 0, 2, 4, 6, 8, 10, 12 }; /* lvl 0-8, default 2 */ 27 { -4, -2, 0, 2, 4, 6, 8, 10, 12 }; /* lvl 0-8, default 2 */
28 28
29static const int cycpwrThr1_table[] =
30/* level: 0 1 2 3 4 5 6 7 8 */
31 { -6, -4, -2, 0, 2, 4, 6, 8 }; /* lvl 0-7, default 3 */
32
33/* 29/*
34 * register values to turn OFDM weak signal detection OFF 30 * register values to turn OFDM weak signal detection OFF
35 */ 31 */
@@ -1073,41 +1069,13 @@ static bool ar5008_hw_ani_control_new(struct ath_hw *ah,
1073 case ATH9K_ANI_SPUR_IMMUNITY_LEVEL:{ 1069 case ATH9K_ANI_SPUR_IMMUNITY_LEVEL:{
1074 u32 level = param; 1070 u32 level = param;
1075 1071
1076 if (level >= ARRAY_SIZE(cycpwrThr1_table)) { 1072 value = (level + 1) * 2;
1077 ath_dbg(common, ANI,
1078 "ATH9K_ANI_SPUR_IMMUNITY_LEVEL: level out of range (%u > %zu)\n",
1079 level, ARRAY_SIZE(cycpwrThr1_table));
1080 return false;
1081 }
1082 /*
1083 * make register setting relative to default
1084 * from INI file & cap value
1085 */
1086 value = cycpwrThr1_table[level] -
1087 cycpwrThr1_table[ATH9K_ANI_SPUR_IMMUNE_LVL] +
1088 aniState->iniDef.cycpwrThr1;
1089 if (value < ATH9K_SIG_SPUR_IMM_SETTING_MIN)
1090 value = ATH9K_SIG_SPUR_IMM_SETTING_MIN;
1091 if (value > ATH9K_SIG_SPUR_IMM_SETTING_MAX)
1092 value = ATH9K_SIG_SPUR_IMM_SETTING_MAX;
1093 REG_RMW_FIELD(ah, AR_PHY_TIMING5, 1073 REG_RMW_FIELD(ah, AR_PHY_TIMING5,
1094 AR_PHY_TIMING5_CYCPWR_THR1, 1074 AR_PHY_TIMING5_CYCPWR_THR1, value);
1095 value);
1096 1075
1097 /* 1076 if (IS_CHAN_HT40(ah->curchan))
1098 * set AR_PHY_EXT_CCA for extension channel 1077 REG_RMW_FIELD(ah, AR_PHY_EXT_CCA,
1099 * make register setting relative to default 1078 AR_PHY_EXT_TIMING5_CYCPWR_THR1, value);
1100 * from INI file & cap value
1101 */
1102 value2 = cycpwrThr1_table[level] -
1103 cycpwrThr1_table[ATH9K_ANI_SPUR_IMMUNE_LVL] +
1104 aniState->iniDef.cycpwrThr1Ext;
1105 if (value2 < ATH9K_SIG_SPUR_IMM_SETTING_MIN)
1106 value2 = ATH9K_SIG_SPUR_IMM_SETTING_MIN;
1107 if (value2 > ATH9K_SIG_SPUR_IMM_SETTING_MAX)
1108 value2 = ATH9K_SIG_SPUR_IMM_SETTING_MAX;
1109 REG_RMW_FIELD(ah, AR_PHY_EXT_CCA,
1110 AR_PHY_EXT_TIMING5_CYCPWR_THR1, value2);
1111 1079
1112 if (level != aniState->spurImmunityLevel) { 1080 if (level != aniState->spurImmunityLevel) {
1113 ath_dbg(common, ANI, 1081 ath_dbg(common, ANI,
@@ -1124,7 +1092,7 @@ static bool ar5008_hw_ani_control_new(struct ath_hw *ah,
1124 aniState->spurImmunityLevel, 1092 aniState->spurImmunityLevel,
1125 level, 1093 level,
1126 ATH9K_ANI_SPUR_IMMUNE_LVL, 1094 ATH9K_ANI_SPUR_IMMUNE_LVL,
1127 value2, 1095 value,
1128 aniState->iniDef.cycpwrThr1Ext); 1096 aniState->iniDef.cycpwrThr1Ext);
1129 if (level > aniState->spurImmunityLevel) 1097 if (level > aniState->spurImmunityLevel)
1130 ah->stats.ast_ani_spurup++; 1098 ah->stats.ast_ani_spurup++;