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

ath9k_hw: Fix signal strength / channel noise reporting

While AR_PHY_CCA_NOM_VAL_* does contain the expected internal noise floor
for a chip measured in clean air, it refers to the lowest expected reading.

Depending on the frequency, this measurement can vary by about 6db, thus
causing a higher reported channel noise and signal strength.

Factor in the 6db offset when converting internal noisefloor to channel noise.

This patch makes the reported values more accurate for all chips without
affecting NF calibration behavior.
Signed-off-by: default avatarFelix Fietkau <nbd@openwrt.org>
Cc: stable@vger.kernel.org
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent cbbc0138
...@@ -69,6 +69,7 @@ s16 ath9k_hw_getchan_noise(struct ath_hw *ah, struct ath9k_channel *chan) ...@@ -69,6 +69,7 @@ s16 ath9k_hw_getchan_noise(struct ath_hw *ah, struct ath9k_channel *chan)
if (chan && chan->noisefloor) { if (chan && chan->noisefloor) {
s8 delta = chan->noisefloor - s8 delta = chan->noisefloor -
ATH9K_NF_CAL_NOISE_THRESH -
ath9k_hw_get_default_nf(ah, chan); ath9k_hw_get_default_nf(ah, chan);
if (delta > 0) if (delta > 0)
noise += delta; noise += delta;
......
...@@ -21,6 +21,9 @@ ...@@ -21,6 +21,9 @@
#define AR_PHY_CCA_FILTERWINDOW_LENGTH 5 #define AR_PHY_CCA_FILTERWINDOW_LENGTH 5
/* Internal noise floor can vary by about 6db depending on the frequency */
#define ATH9K_NF_CAL_NOISE_THRESH 6
#define NUM_NF_READINGS 6 #define NUM_NF_READINGS 6
#define ATH9K_NF_CAL_HIST_MAX 5 #define ATH9K_NF_CAL_HIST_MAX 5
......
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