Commit c9e27d94 authored by Luis R. Rodriguez's avatar Luis R. Rodriguez Committed by John W. Linville

ath9k: use ieee80211_conf on ath9k_hw_iscal_supported()

ath9k_hw_iscal_supported() just needs to be aware of your band
and if HT20 is being used so lets abandon our internal channel,
HT appended values and internal mode values and use ieee80211_conf
which already carries this information. This works as calibration
is being done for the currently configured channel.
Signed-off-by: default avatarLuis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 76061abb
...@@ -949,8 +949,7 @@ void ath9k_hw_ani_detach(struct ath_hal *ah); ...@@ -949,8 +949,7 @@ void ath9k_hw_ani_detach(struct ath_hal *ah);
/* Calibration */ /* Calibration */
void ath9k_hw_reset_calvalid(struct ath_hal *ah, struct ath9k_channel *chan, bool ath9k_hw_reset_calvalid(struct ath_hal *ah);
bool *isCalDone);
void ath9k_hw_start_nfcal(struct ath_hal *ah); void ath9k_hw_start_nfcal(struct ath_hal *ah);
void ath9k_hw_loadnf(struct ath_hal *ah, struct ath9k_channel *chan); void ath9k_hw_loadnf(struct ath_hal *ah, struct ath9k_channel *chan);
int16_t ath9k_hw_getnf(struct ath_hal *ah, int16_t ath9k_hw_getnf(struct ath_hal *ah,
......
...@@ -277,27 +277,24 @@ static void ath9k_hw_per_calibration(struct ath_hal *ah, ...@@ -277,27 +277,24 @@ static void ath9k_hw_per_calibration(struct ath_hal *ah,
} }
} }
/* Assumes you are talking about the currently configured channel */
static bool ath9k_hw_iscal_supported(struct ath_hal *ah, static bool ath9k_hw_iscal_supported(struct ath_hal *ah,
struct ath9k_channel *chan,
enum hal_cal_types calType) enum hal_cal_types calType)
{ {
struct ath_hal_5416 *ahp = AH5416(ah); struct ath_hal_5416 *ahp = AH5416(ah);
bool retval = false; struct ieee80211_conf *conf = &ah->ah_sc->hw->conf;
switch (calType & ahp->ah_suppCals) { switch (calType & ahp->ah_suppCals) {
case IQ_MISMATCH_CAL: case IQ_MISMATCH_CAL: /* Both 2 GHz and 5 GHz support OFDM */
if (!IS_CHAN_B(chan)) return true;
retval = true;
break;
case ADC_GAIN_CAL: case ADC_GAIN_CAL:
case ADC_DC_CAL: case ADC_DC_CAL:
if (!IS_CHAN_B(chan) if (conf->channel->band == IEEE80211_BAND_5GHZ &&
&& !(IS_CHAN_2GHZ(chan) && IS_CHAN_HT20(chan))) conf_is_ht20(conf))
retval = true; return true;
break; break;
} }
return false;
return retval;
} }
static void ath9k_hw_iqcal_collect(struct ath_hal *ah) static void ath9k_hw_iqcal_collect(struct ath_hal *ah)
...@@ -565,50 +562,40 @@ static void ath9k_hw_adc_dccal_calibrate(struct ath_hal *ah, u8 numChains) ...@@ -565,50 +562,40 @@ static void ath9k_hw_adc_dccal_calibrate(struct ath_hal *ah, u8 numChains)
AR_PHY_NEW_ADC_DC_OFFSET_CORR_ENABLE); AR_PHY_NEW_ADC_DC_OFFSET_CORR_ENABLE);
} }
void ath9k_hw_reset_calvalid(struct ath_hal *ah, struct ath9k_channel *chan, /* This is done for the currently configured channel */
bool *isCalDone) bool ath9k_hw_reset_calvalid(struct ath_hal *ah)
{ {
struct ath_hal_5416 *ahp = AH5416(ah); struct ath_hal_5416 *ahp = AH5416(ah);
struct ath9k_channel *ichan = struct ieee80211_conf *conf = &ah->ah_sc->hw->conf;
ath9k_regd_check_channel(ah, chan);
struct hal_cal_list *currCal = ahp->ah_cal_list_curr; struct hal_cal_list *currCal = ahp->ah_cal_list_curr;
*isCalDone = true; if (!ah->ah_curchan)
return true;
if (!AR_SREV_9100(ah) && !AR_SREV_9160_10_OR_LATER(ah)) if (!AR_SREV_9100(ah) && !AR_SREV_9160_10_OR_LATER(ah))
return; return true;
if (currCal == NULL) if (currCal == NULL)
return; return true;
if (ichan == NULL) {
DPRINTF(ah->ah_sc, ATH_DBG_CALIBRATE,
"invalid channel %u/0x%x; no mapping\n",
chan->channel, chan->channelFlags);
return;
}
if (currCal->calState != CAL_DONE) { if (currCal->calState != CAL_DONE) {
DPRINTF(ah->ah_sc, ATH_DBG_CALIBRATE, DPRINTF(ah->ah_sc, ATH_DBG_CALIBRATE,
"Calibration state incorrect, %d\n", "Calibration state incorrect, %d\n",
currCal->calState); currCal->calState);
return; return true;
} }
if (!ath9k_hw_iscal_supported(ah, currCal->calData->calType))
if (!ath9k_hw_iscal_supported(ah, chan, currCal->calData->calType)) return true;
return;
DPRINTF(ah->ah_sc, ATH_DBG_CALIBRATE, DPRINTF(ah->ah_sc, ATH_DBG_CALIBRATE,
"Resetting Cal %d state for channel %u/0x%x\n", "Resetting Cal %d state for channel %u\n",
currCal->calData->calType, chan->channel, currCal->calData->calType, conf->channel->center_freq);
chan->channelFlags);
ichan->CalValid &= ~currCal->calData->calType; ah->ah_curchan->CalValid &= ~currCal->calData->calType;
currCal->calState = CAL_WAITING; currCal->calState = CAL_WAITING;
*isCalDone = false; return false;
} }
void ath9k_hw_start_nfcal(struct ath_hal *ah) void ath9k_hw_start_nfcal(struct ath_hal *ah)
...@@ -933,19 +920,19 @@ bool ath9k_hw_init_cal(struct ath_hal *ah, ...@@ -933,19 +920,19 @@ bool ath9k_hw_init_cal(struct ath_hal *ah,
ahp->ah_cal_list = ahp->ah_cal_list_last = ahp->ah_cal_list_curr = NULL; ahp->ah_cal_list = ahp->ah_cal_list_last = ahp->ah_cal_list_curr = NULL;
if (AR_SREV_9100(ah) || AR_SREV_9160_10_OR_LATER(ah)) { if (AR_SREV_9100(ah) || AR_SREV_9160_10_OR_LATER(ah)) {
if (ath9k_hw_iscal_supported(ah, chan, ADC_GAIN_CAL)) { if (ath9k_hw_iscal_supported(ah, ADC_GAIN_CAL)) {
INIT_CAL(&ahp->ah_adcGainCalData); INIT_CAL(&ahp->ah_adcGainCalData);
INSERT_CAL(ahp, &ahp->ah_adcGainCalData); INSERT_CAL(ahp, &ahp->ah_adcGainCalData);
DPRINTF(ah->ah_sc, ATH_DBG_CALIBRATE, DPRINTF(ah->ah_sc, ATH_DBG_CALIBRATE,
"enabling ADC Gain Calibration.\n"); "enabling ADC Gain Calibration.\n");
} }
if (ath9k_hw_iscal_supported(ah, chan, ADC_DC_CAL)) { if (ath9k_hw_iscal_supported(ah, ADC_DC_CAL)) {
INIT_CAL(&ahp->ah_adcDcCalData); INIT_CAL(&ahp->ah_adcDcCalData);
INSERT_CAL(ahp, &ahp->ah_adcDcCalData); INSERT_CAL(ahp, &ahp->ah_adcDcCalData);
DPRINTF(ah->ah_sc, ATH_DBG_CALIBRATE, DPRINTF(ah->ah_sc, ATH_DBG_CALIBRATE,
"enabling ADC DC Calibration.\n"); "enabling ADC DC Calibration.\n");
} }
if (ath9k_hw_iscal_supported(ah, chan, IQ_MISMATCH_CAL)) { if (ath9k_hw_iscal_supported(ah, IQ_MISMATCH_CAL)) {
INIT_CAL(&ahp->ah_iqCalData); INIT_CAL(&ahp->ah_iqCalData);
INSERT_CAL(ahp, &ahp->ah_iqCalData); INSERT_CAL(ahp, &ahp->ah_iqCalData);
DPRINTF(ah->ah_sc, ATH_DBG_CALIBRATE, DPRINTF(ah->ah_sc, ATH_DBG_CALIBRATE,
......
...@@ -372,8 +372,7 @@ static void ath_ani_calibrate(unsigned long data) ...@@ -372,8 +372,7 @@ static void ath_ani_calibrate(unsigned long data)
} else { } else {
if ((timestamp - sc->sc_ani.sc_resetcal_timer) >= if ((timestamp - sc->sc_ani.sc_resetcal_timer) >=
ATH_RESTART_CALINTERVAL) { ATH_RESTART_CALINTERVAL) {
ath9k_hw_reset_calvalid(ah, ah->ah_curchan, sc->sc_ani.sc_caldone = ath9k_hw_reset_calvalid(ah);
&sc->sc_ani.sc_caldone);
if (sc->sc_ani.sc_caldone) if (sc->sc_ani.sc_caldone)
sc->sc_ani.sc_resetcal_timer = timestamp; sc->sc_ani.sc_resetcal_timer = timestamp;
} }
......
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