2020-04-24 00:50:29

by Sergey Ryazanov

[permalink] [raw]
Subject: [PATCH 1/6] ath9k: fix AR9002 ADC and NF calibrations

ADC calibration is only required for a 80 MHz sampling rate (i.e. for
40 MHz channels), when the chip utilizes the pair of ADCs in interleved
mode. Calibration on a 20 MHz channel will never be completed.

Previous channel check is trying to exclude all channels where the
calibration will get stuck. It effectively blocks the calibration run
for HT20 channels, but fails to exclude 20 MHz channels without HT (e.g.
legacy mode channels).

Fix this issue by reworking the channel check to explicitly allow ADCs
gain & DC offset calibrations for HT40 channels only. Also update the
complicated comment to make it clear that these calibrations are for
multi-ADC mode only.

Stuck ADCs calibration blocks the NF calibration, what could make it
impossible to work in a noisy evironment: too big Rx attentuation,
invalid RSSI value, etc. So this change is actually more of a NF
calibration fix rather then the ADC calibration fix.

Run tested with AR9220.

Signed-off-by: Sergey Ryazanov <[email protected]>
---
drivers/net/wireless/ath/ath9k/ar9002_calib.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/ar9002_calib.c b/drivers/net/wireless/ath/ath9k/ar9002_calib.c
index fd9db8ca99d7..14eee06744ed 100644
--- a/drivers/net/wireless/ath/ath9k/ar9002_calib.c
+++ b/drivers/net/wireless/ath/ath9k/ar9002_calib.c
@@ -37,9 +37,8 @@ static bool ar9002_hw_is_cal_supported(struct ath_hw *ah,
break;
case ADC_GAIN_CAL:
case ADC_DC_CAL:
- /* Run ADC Gain Cal for non-CCK & non 2GHz-HT20 only */
- if (!((IS_CHAN_2GHZ(chan) || IS_CHAN_A_FAST_CLOCK(ah, chan)) &&
- IS_CHAN_HT20(chan)))
+ /* Run even/odd ADCs calibrations for HT40 channels only */
+ if (IS_CHAN_HT40(chan))
supported = true;
break;
}
--
2.24.1


2020-04-28 09:09:27

by Kalle Valo

[permalink] [raw]
Subject: Re: [PATCH 1/6] ath9k: fix AR9002 ADC and NF calibrations

Sergey Ryazanov <[email protected]> wrote:

> ADC calibration is only required for a 80 MHz sampling rate (i.e. for
> 40 MHz channels), when the chip utilizes the pair of ADCs in interleved
> mode. Calibration on a 20 MHz channel will never be completed.
>
> Previous channel check is trying to exclude all channels where the
> calibration will get stuck. It effectively blocks the calibration run
> for HT20 channels, but fails to exclude 20 MHz channels without HT (e.g.
> legacy mode channels).
>
> Fix this issue by reworking the channel check to explicitly allow ADCs
> gain & DC offset calibrations for HT40 channels only. Also update the
> complicated comment to make it clear that these calibrations are for
> multi-ADC mode only.
>
> Stuck ADCs calibration blocks the NF calibration, what could make it
> impossible to work in a noisy evironment: too big Rx attentuation,
> invalid RSSI value, etc. So this change is actually more of a NF
> calibration fix rather then the ADC calibration fix.
>
> Run tested with AR9220.
>
> Signed-off-by: Sergey Ryazanov <[email protected]>
> Signed-off-by: Kalle Valo <[email protected]>

6 patches applied to ath-next branch of ath.git, thanks.

d6cae2bc195b ath9k: fix AR9002 ADC and NF calibrations
93f8d4223163 ath9k: remove needless NFCAL_PENDING flag setting
41ba50fd6cac ath9k: do not miss longcal on AR9002
2bb7027b64b6 ath9k: interleaved NF calibration on AR9002
ded6ff15a191 ath9k: invalidate all calibrations at once
d8d20845c7f1 ath9k: add calibration timeout for AR9002

--
https://patchwork.kernel.org/patch/11506891/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches