Skip to content

Commit

Permalink
ath9k_hw: run ath9k_hw_9271_pa_cal() initial calibration
Browse files Browse the repository at this point in the history
The PA calibration for ar9271 ath9k_hw_9271_pa_cal() can run during
reset or initial calibration, update the PA calibration to account
for that and initialize PA calibration variables for both conditions.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
  • Loading branch information
Luis R. Rodriguez authored and John W. Linville committed Oct 27, 2009
1 parent b57df12 commit 6226811
Showing 1 changed file with 18 additions and 7 deletions.
25 changes: 18 additions & 7 deletions drivers/net/wireless/ath/ath9k/calib.c
Original file line number Diff line number Diff line change
Expand Up @@ -813,7 +813,7 @@ static void ath9k_olc_temp_compensation(struct ath_hw *ah)
}
}

static void ath9k_hw_9271_pa_cal(struct ath_hw *ah)
static void ath9k_hw_9271_pa_cal(struct ath_hw *ah, bool is_reset)
{
u32 regVal;
unsigned int i;
Expand Down Expand Up @@ -889,10 +889,19 @@ static void ath9k_hw_9271_pa_cal(struct ath_hw *ah)
REG_WRITE(ah, 0x7834, regVal);
}

/* Empirical offset correction */
#if 0
REG_RMW_FIELD(ah, AR9285_AN_RF2G6, AR9271_AN_RF2G6_OFFS, 0x20);
#endif
regVal = (regVal >>20) & 0x7f;

/* Update PA cal info */
if ((!is_reset) && (ah->pacal_info.prev_offset == regVal)) {
if (ah->pacal_info.max_skipcount < MAX_PACAL_SKIPCOUNT)
ah->pacal_info.max_skipcount =
2 * ah->pacal_info.max_skipcount;
ah->pacal_info.skipcount = ah->pacal_info.max_skipcount;
} else {
ah->pacal_info.max_skipcount = 1;
ah->pacal_info.skipcount = 0;
ah->pacal_info.prev_offset = regVal;
}

regVal = REG_READ(ah, 0x7834);
regVal |= 0x1;
Expand Down Expand Up @@ -1043,7 +1052,7 @@ bool ath9k_hw_calibrate(struct ath_hw *ah, struct ath9k_channel *chan,
if (longcal) {
/* Do periodic PAOffset Cal */
if (AR_SREV_9271(ah))
ath9k_hw_9271_pa_cal(ah);
ath9k_hw_9271_pa_cal(ah, false);
else if (AR_SREV_9285_11_OR_LATER(ah)) {
if (!ah->pacal_info.skipcount)
ath9k_hw_9285_pa_cal(ah, false);
Expand Down Expand Up @@ -1152,7 +1161,9 @@ bool ath9k_hw_init_cal(struct ath_hw *ah, struct ath9k_channel *chan)
}

/* Do PA Calibration */
if (AR_SREV_9285_11_OR_LATER(ah))
if (AR_SREV_9271(ah))
ath9k_hw_9271_pa_cal(ah, true);
else if (AR_SREV_9285_11_OR_LATER(ah))
ath9k_hw_9285_pa_cal(ah, true);

/* Do NF Calibration after DC offset and other calibrations */
Expand Down

0 comments on commit 6226811

Please sign in to comment.