Introduce methods for the initial calibration and the new PA calibration

routines.

These are needed for the AR9285/AR2427 and AR9287 calibration routines
which will be introducecd in a later commit.
This commit is contained in:
Adrian Chadd 2011-03-11 11:35:36 +00:00
parent e8a217e075
commit c0b9002dcb
4 changed files with 41 additions and 10 deletions

View File

@ -74,6 +74,12 @@ struct ath_hal_5416 {
void (*ah_spurMitigate)(struct ath_hal *,
const struct ieee80211_channel *);
/* calibration ops */
HAL_BOOL (*ah_cal_initcal)(struct ath_hal *,
const struct ieee80211_channel *);
void (*ah_cal_pacal)(struct ath_hal *,
HAL_BOOL is_reset);
/* optional open-loop tx power control related methods */
void (*ah_olcInit)(struct ath_hal *);
void (*ah_olcTempCompensation)(struct ath_hal *);

View File

@ -178,6 +178,9 @@ ar5416InitState(struct ath_hal_5416 *ahp5416, uint16_t devid, HAL_SOFTC sc,
AH5416(ah)->ah_writeIni = ar5416WriteIni;
AH5416(ah)->ah_spurMitigate = ar5416SpurMitigate;
/* Internal calibration ops */
AH5416(ah)->ah_cal_initcal = ar5416InitCalHardware;
/* Internal TX power control related operations */
AH5416(ah)->ah_olcInit = ar5416olcInit;
AH5416(ah)->ah_olcTempCompensation = ar5416olcTempCompensation;

View File

@ -183,18 +183,9 @@ ar5416RunInitCals(struct ath_hal *ah, int init_cal_count)
}
#endif
/*
* Initialize Calibration infrastructure.
*/
HAL_BOOL
ar5416InitCal(struct ath_hal *ah, const struct ieee80211_channel *chan)
ar5416InitCalHardware(struct ath_hal *ah, const struct ieee80211_channel *chan)
{
struct ar5416PerCal *cal = &AH5416(ah)->ah_cal;
HAL_CHANNEL_INTERNAL *ichan;
ichan = ath_hal_checkchannel(ah, chan);
HALASSERT(ichan != AH_NULL);
if (AR_SREV_MERLIN_10_OR_LATER(ah)) {
/* Enable Rx Filter Cal */
OS_REG_CLR_BIT(ah, AR_PHY_ADC_CTL, AR_PHY_ADC_CTL_OFF_PWDADC);
@ -235,6 +226,32 @@ ar5416InitCal(struct ath_hal *ah, const struct ieee80211_channel *chan)
return AH_FALSE;
}
return AH_TRUE;
}
/*
* Initialize Calibration infrastructure.
*/
HAL_BOOL
ar5416InitCal(struct ath_hal *ah, const struct ieee80211_channel *chan)
{
struct ar5416PerCal *cal = &AH5416(ah)->ah_cal;
HAL_CHANNEL_INTERNAL *ichan;
ichan = ath_hal_checkchannel(ah, chan);
HALASSERT(ichan != AH_NULL);
/* Do initial chipset-specific calibration */
if (! AH5416(ah)->ah_cal_initcal(ah, chan)) {
HALDEBUG(ah, HAL_DEBUG_ANY, "%s: initial chipset calibration did "
"not complete in time; noisy environment?\n", __func__);
return AH_FALSE;
}
/* If there's PA Cal, do it */
if (AH5416(ah)->ah_cal_pacal)
AH5416(ah)->ah_cal_pacal(ah, AH_TRUE);
/*
* Do NF calibration after DC offset and other CALs.
* Per system engineers, noise floor value can sometimes be 20 dB
@ -468,6 +485,10 @@ ar5416PerCalibrationN(struct ath_hal *ah, struct ieee80211_channel *chan,
/* Do NF cal only at longer intervals */
if (longcal) {
/* Do PA calibration if the chipset supports */
if (AH5416(ah)->ah_cal_pacal)
AH5416(ah)->ah_cal_pacal(ah, AH_FALSE);
/* Do temperature compensation if the chipset needs it */
AH5416(ah)->ah_olcTempCompensation(ah);

View File

@ -102,6 +102,7 @@ struct ar5416PerCal {
} \
} while (0)
HAL_BOOL ar5416InitCalHardware(struct ath_hal *ah, const struct ieee80211_channel *chan);
HAL_BOOL ar5416InitCal(struct ath_hal *, const struct ieee80211_channel *);
HAL_BOOL ar5416PerCalibration(struct ath_hal *, struct ieee80211_channel *,
HAL_BOOL *isIQdone);