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

ath9k_hw: do not run NF and periodic calibration at the same time

It can cause inconsistent calibration results or in some cases turn the
radio deaf.
Signed-off-by: default avatarFelix Fietkau <nbd@openwrt.org>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 7b8aaead
...@@ -660,27 +660,26 @@ static void ar9002_hw_olc_temp_compensation(struct ath_hw *ah) ...@@ -660,27 +660,26 @@ static void ar9002_hw_olc_temp_compensation(struct ath_hw *ah)
static int ar9002_hw_calibrate(struct ath_hw *ah, struct ath9k_channel *chan, static int ar9002_hw_calibrate(struct ath_hw *ah, struct ath9k_channel *chan,
u8 rxchainmask, bool longcal) u8 rxchainmask, bool longcal)
{ {
bool iscaldone = true;
struct ath9k_cal_list *currCal = ah->cal_list_curr; struct ath9k_cal_list *currCal = ah->cal_list_curr;
bool nfcal, nfcal_pending = false; bool nfcal, nfcal_pending = false, percal_pending;
int ret; int ret;
nfcal = !!(REG_READ(ah, AR_PHY_AGC_CONTROL) & AR_PHY_AGC_CONTROL_NF); nfcal = !!(REG_READ(ah, AR_PHY_AGC_CONTROL) & AR_PHY_AGC_CONTROL_NF);
if (ah->caldata) if (ah->caldata)
nfcal_pending = test_bit(NFCAL_PENDING, &ah->caldata->cal_flags); nfcal_pending = test_bit(NFCAL_PENDING, &ah->caldata->cal_flags);
if (currCal && !nfcal && percal_pending = (currCal &&
(currCal->calState == CAL_RUNNING || (currCal->calState == CAL_RUNNING ||
currCal->calState == CAL_WAITING)) { currCal->calState == CAL_WAITING));
iscaldone = ar9002_hw_per_calibration(ah, chan,
rxchainmask, currCal); if (percal_pending && !nfcal) {
if (iscaldone) { if (!ar9002_hw_per_calibration(ah, chan, rxchainmask, currCal))
ah->cal_list_curr = currCal = currCal->calNext; return 0;
if (currCal->calState == CAL_WAITING) { ah->cal_list_curr = currCal = currCal->calNext;
iscaldone = false; if (currCal->calState == CAL_WAITING) {
ath9k_hw_reset_calibration(ah, currCal); ath9k_hw_reset_calibration(ah, currCal);
} return 0;
} }
} }
...@@ -710,7 +709,7 @@ static int ar9002_hw_calibrate(struct ath_hw *ah, struct ath9k_channel *chan, ...@@ -710,7 +709,7 @@ static int ar9002_hw_calibrate(struct ath_hw *ah, struct ath9k_channel *chan,
} }
} }
return iscaldone; return !percal_pending;
} }
/* Carrier leakage Calibration fix */ /* Carrier leakage Calibration fix */
......
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