diff options
author | Luis R. Rodriguez <lrodriguez@atheros.com> | 2008-12-23 18:58:42 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-01-29 15:59:31 -0500 |
commit | c9e27d94f5fc726f88897914025619fbfc18b23c (patch) | |
tree | e20d606c6d98a76b77f2bd3737ea58acf1cd335e | |
parent | 76061abbbb39ba4bdf42fe28aa3157df8bb03d38 (diff) |
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: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r-- | drivers/net/wireless/ath9k/ath9k.h | 3 | ||||
-rw-r--r-- | drivers/net/wireless/ath9k/calib.c | 63 | ||||
-rw-r--r-- | drivers/net/wireless/ath9k/main.c | 3 |
3 files changed, 27 insertions, 42 deletions
diff --git a/drivers/net/wireless/ath9k/ath9k.h b/drivers/net/wireless/ath9k/ath9k.h index 78fffdf9339f..adcd34249a8b 100644 --- a/drivers/net/wireless/ath9k/ath9k.h +++ b/drivers/net/wireless/ath9k/ath9k.h | |||
@@ -949,8 +949,7 @@ void ath9k_hw_ani_detach(struct ath_hal *ah); | |||
949 | 949 | ||
950 | /* Calibration */ | 950 | /* Calibration */ |
951 | 951 | ||
952 | void ath9k_hw_reset_calvalid(struct ath_hal *ah, struct ath9k_channel *chan, | 952 | bool ath9k_hw_reset_calvalid(struct ath_hal *ah); |
953 | bool *isCalDone); | ||
954 | void ath9k_hw_start_nfcal(struct ath_hal *ah); | 953 | void ath9k_hw_start_nfcal(struct ath_hal *ah); |
955 | void ath9k_hw_loadnf(struct ath_hal *ah, struct ath9k_channel *chan); | 954 | void ath9k_hw_loadnf(struct ath_hal *ah, struct ath9k_channel *chan); |
956 | int16_t ath9k_hw_getnf(struct ath_hal *ah, | 955 | int16_t ath9k_hw_getnf(struct ath_hal *ah, |
diff --git a/drivers/net/wireless/ath9k/calib.c b/drivers/net/wireless/ath9k/calib.c index 2a6b8a4d6e9e..707289685b41 100644 --- a/drivers/net/wireless/ath9k/calib.c +++ b/drivers/net/wireless/ath9k/calib.c | |||
@@ -277,27 +277,24 @@ static void ath9k_hw_per_calibration(struct ath_hal *ah, | |||
277 | } | 277 | } |
278 | } | 278 | } |
279 | 279 | ||
280 | /* Assumes you are talking about the currently configured channel */ | ||
280 | static bool ath9k_hw_iscal_supported(struct ath_hal *ah, | 281 | static bool ath9k_hw_iscal_supported(struct ath_hal *ah, |
281 | struct ath9k_channel *chan, | ||
282 | enum hal_cal_types calType) | 282 | enum hal_cal_types calType) |
283 | { | 283 | { |
284 | struct ath_hal_5416 *ahp = AH5416(ah); | 284 | struct ath_hal_5416 *ahp = AH5416(ah); |
285 | bool retval = false; | 285 | struct ieee80211_conf *conf = &ah->ah_sc->hw->conf; |
286 | 286 | ||
287 | switch (calType & ahp->ah_suppCals) { | 287 | switch (calType & ahp->ah_suppCals) { |
288 | case IQ_MISMATCH_CAL: | 288 | case IQ_MISMATCH_CAL: /* Both 2 GHz and 5 GHz support OFDM */ |
289 | if (!IS_CHAN_B(chan)) | 289 | return true; |
290 | retval = true; | ||
291 | break; | ||
292 | case ADC_GAIN_CAL: | 290 | case ADC_GAIN_CAL: |
293 | case ADC_DC_CAL: | 291 | case ADC_DC_CAL: |
294 | if (!IS_CHAN_B(chan) | 292 | if (conf->channel->band == IEEE80211_BAND_5GHZ && |
295 | && !(IS_CHAN_2GHZ(chan) && IS_CHAN_HT20(chan))) | 293 | conf_is_ht20(conf)) |
296 | retval = true; | 294 | return true; |
297 | break; | 295 | break; |
298 | } | 296 | } |
299 | 297 | return false; | |
300 | return retval; | ||
301 | } | 298 | } |
302 | 299 | ||
303 | static void ath9k_hw_iqcal_collect(struct ath_hal *ah) | 300 | 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 | AR_PHY_NEW_ADC_DC_OFFSET_CORR_ENABLE); | 562 | AR_PHY_NEW_ADC_DC_OFFSET_CORR_ENABLE); |
566 | } | 563 | } |
567 | 564 | ||
568 | void ath9k_hw_reset_calvalid(struct ath_hal *ah, struct ath9k_channel *chan, | 565 | /* This is done for the currently configured channel */ |
569 | bool *isCalDone) | 566 | bool ath9k_hw_reset_calvalid(struct ath_hal *ah) |
570 | { | 567 | { |
571 | struct ath_hal_5416 *ahp = AH5416(ah); | 568 | struct ath_hal_5416 *ahp = AH5416(ah); |
572 | struct ath9k_channel *ichan = | 569 | struct ieee80211_conf *conf = &ah->ah_sc->hw->conf; |
573 | ath9k_regd_check_channel(ah, chan); | ||
574 | struct hal_cal_list *currCal = ahp->ah_cal_list_curr; | 570 | struct hal_cal_list *currCal = ahp->ah_cal_list_curr; |
575 | 571 | ||
576 | *isCalDone = true; | 572 | if (!ah->ah_curchan) |
573 | return true; | ||
577 | 574 | ||
578 | if (!AR_SREV_9100(ah) && !AR_SREV_9160_10_OR_LATER(ah)) | 575 | if (!AR_SREV_9100(ah) && !AR_SREV_9160_10_OR_LATER(ah)) |
579 | return; | 576 | return true; |
580 | 577 | ||
581 | if (currCal == NULL) | 578 | if (currCal == NULL) |
582 | return; | 579 | return true; |
583 | |||
584 | if (ichan == NULL) { | ||
585 | DPRINTF(ah->ah_sc, ATH_DBG_CALIBRATE, | ||
586 | "invalid channel %u/0x%x; no mapping\n", | ||
587 | chan->channel, chan->channelFlags); | ||
588 | return; | ||
589 | } | ||
590 | |||
591 | 580 | ||
592 | if (currCal->calState != CAL_DONE) { | 581 | if (currCal->calState != CAL_DONE) { |
593 | DPRINTF(ah->ah_sc, ATH_DBG_CALIBRATE, | 582 | DPRINTF(ah->ah_sc, ATH_DBG_CALIBRATE, |
594 | "Calibration state incorrect, %d\n", | 583 | "Calibration state incorrect, %d\n", |
595 | currCal->calState); | 584 | currCal->calState); |
596 | return; | 585 | return true; |
597 | } | 586 | } |
598 | 587 | ||
599 | 588 | if (!ath9k_hw_iscal_supported(ah, currCal->calData->calType)) | |
600 | if (!ath9k_hw_iscal_supported(ah, chan, currCal->calData->calType)) | 589 | return true; |
601 | return; | ||
602 | 590 | ||
603 | DPRINTF(ah->ah_sc, ATH_DBG_CALIBRATE, | 591 | DPRINTF(ah->ah_sc, ATH_DBG_CALIBRATE, |
604 | "Resetting Cal %d state for channel %u/0x%x\n", | 592 | "Resetting Cal %d state for channel %u\n", |
605 | currCal->calData->calType, chan->channel, | 593 | currCal->calData->calType, conf->channel->center_freq); |
606 | chan->channelFlags); | ||
607 | 594 | ||
608 | ichan->CalValid &= ~currCal->calData->calType; | 595 | ah->ah_curchan->CalValid &= ~currCal->calData->calType; |
609 | currCal->calState = CAL_WAITING; | 596 | currCal->calState = CAL_WAITING; |
610 | 597 | ||
611 | *isCalDone = false; | 598 | return false; |
612 | } | 599 | } |
613 | 600 | ||
614 | void ath9k_hw_start_nfcal(struct ath_hal *ah) | 601 | void ath9k_hw_start_nfcal(struct ath_hal *ah) |
@@ -933,19 +920,19 @@ bool ath9k_hw_init_cal(struct ath_hal *ah, | |||
933 | ahp->ah_cal_list = ahp->ah_cal_list_last = ahp->ah_cal_list_curr = NULL; | 920 | ahp->ah_cal_list = ahp->ah_cal_list_last = ahp->ah_cal_list_curr = NULL; |
934 | 921 | ||
935 | if (AR_SREV_9100(ah) || AR_SREV_9160_10_OR_LATER(ah)) { | 922 | if (AR_SREV_9100(ah) || AR_SREV_9160_10_OR_LATER(ah)) { |
936 | if (ath9k_hw_iscal_supported(ah, chan, ADC_GAIN_CAL)) { | 923 | if (ath9k_hw_iscal_supported(ah, ADC_GAIN_CAL)) { |
937 | INIT_CAL(&ahp->ah_adcGainCalData); | 924 | INIT_CAL(&ahp->ah_adcGainCalData); |
938 | INSERT_CAL(ahp, &ahp->ah_adcGainCalData); | 925 | INSERT_CAL(ahp, &ahp->ah_adcGainCalData); |
939 | DPRINTF(ah->ah_sc, ATH_DBG_CALIBRATE, | 926 | DPRINTF(ah->ah_sc, ATH_DBG_CALIBRATE, |
940 | "enabling ADC Gain Calibration.\n"); | 927 | "enabling ADC Gain Calibration.\n"); |
941 | } | 928 | } |
942 | if (ath9k_hw_iscal_supported(ah, chan, ADC_DC_CAL)) { | 929 | if (ath9k_hw_iscal_supported(ah, ADC_DC_CAL)) { |
943 | INIT_CAL(&ahp->ah_adcDcCalData); | 930 | INIT_CAL(&ahp->ah_adcDcCalData); |
944 | INSERT_CAL(ahp, &ahp->ah_adcDcCalData); | 931 | INSERT_CAL(ahp, &ahp->ah_adcDcCalData); |
945 | DPRINTF(ah->ah_sc, ATH_DBG_CALIBRATE, | 932 | DPRINTF(ah->ah_sc, ATH_DBG_CALIBRATE, |
946 | "enabling ADC DC Calibration.\n"); | 933 | "enabling ADC DC Calibration.\n"); |
947 | } | 934 | } |
948 | if (ath9k_hw_iscal_supported(ah, chan, IQ_MISMATCH_CAL)) { | 935 | if (ath9k_hw_iscal_supported(ah, IQ_MISMATCH_CAL)) { |
949 | INIT_CAL(&ahp->ah_iqCalData); | 936 | INIT_CAL(&ahp->ah_iqCalData); |
950 | INSERT_CAL(ahp, &ahp->ah_iqCalData); | 937 | INSERT_CAL(ahp, &ahp->ah_iqCalData); |
951 | DPRINTF(ah->ah_sc, ATH_DBG_CALIBRATE, | 938 | DPRINTF(ah->ah_sc, ATH_DBG_CALIBRATE, |
diff --git a/drivers/net/wireless/ath9k/main.c b/drivers/net/wireless/ath9k/main.c index 12c5b9a44904..7d9a263ea0a7 100644 --- a/drivers/net/wireless/ath9k/main.c +++ b/drivers/net/wireless/ath9k/main.c | |||
@@ -372,8 +372,7 @@ static void ath_ani_calibrate(unsigned long data) | |||
372 | } else { | 372 | } else { |
373 | if ((timestamp - sc->sc_ani.sc_resetcal_timer) >= | 373 | if ((timestamp - sc->sc_ani.sc_resetcal_timer) >= |
374 | ATH_RESTART_CALINTERVAL) { | 374 | ATH_RESTART_CALINTERVAL) { |
375 | ath9k_hw_reset_calvalid(ah, ah->ah_curchan, | 375 | sc->sc_ani.sc_caldone = ath9k_hw_reset_calvalid(ah); |
376 | &sc->sc_ani.sc_caldone); | ||
377 | if (sc->sc_ani.sc_caldone) | 376 | if (sc->sc_ani.sc_caldone) |
378 | sc->sc_ani.sc_resetcal_timer = timestamp; | 377 | sc->sc_ani.sc_resetcal_timer = timestamp; |
379 | } | 378 | } |