ath9k_hw: Do fast channel change based on reusable calibration results
authorRajkumar Manoharan <rmanohar@qca.qualcomm.com>
Thu, 13 Oct 2011 05:30:42 +0000 (11:00 +0530)
committerJohn W. Linville <linville@tuxdriver.com>
Fri, 14 Oct 2011 18:48:23 +0000 (14:48 -0400)
Support the fast channel change across band switch only when there
are available of reusable cabliration results. And also observed that
doing agc control calibration on fastcc, sometimes causing calibration
timeout. Hence changing agc control to be run only on full chip reset.

Signed-off-by: Rajkumar Manoharan <rmanohar@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/ath/ath9k/ar9003_calib.c
drivers/net/wireless/ath/ath9k/hw.c
drivers/net/wireless/ath/ath9k/hw.h

index 47f140ce00d2a051ccc258fe071544dc95da02bd..16851cb109a6302d492e6b4ce1a5f6f143d3433e 100644 (file)
@@ -1008,8 +1008,7 @@ static bool ar9003_hw_init_cal(struct ath_hw *ah,
        REG_WRITE(ah, AR_PHY_ACTIVE, AR_PHY_ACTIVE_EN);
 
 skip_tx_iqcal:
-
-       if (run_agc_cal) {
+       if (run_agc_cal || !(ah->ah_flags & AH_FASTCC)) {
                /* Calibrate the AGC */
                REG_WRITE(ah, AR_PHY_AGC_CONTROL,
                          REG_READ(ah, AR_PHY_AGC_CONTROL) |
index 0eb0b3bcb74e623ca8b92ba5ddcf919285f298c6..67831a3fca6b4190100ff730e01dab7767e6fa46 100644 (file)
@@ -1445,6 +1445,7 @@ static bool ath9k_hw_channel_change(struct ath_hw *ah,
        ath9k_hw_spur_mitigate_freq(ah, chan);
 
        if (edma && (band_switch || mode_diff)) {
+               ah->ah_flags |= AH_FASTCC;
                if (band_switch || ini_reloaded)
                        ah->eep_ops->set_board_values(ah, chan);
 
@@ -1452,6 +1453,7 @@ static bool ath9k_hw_channel_change(struct ath_hw *ah,
 
                if (band_switch || ini_reloaded)
                        ath9k_hw_init_cal(ah, chan);
+               ah->ah_flags &= ~AH_FASTCC;
        }
 
        return true;
@@ -1509,6 +1511,7 @@ int ath9k_hw_reset(struct ath_hw *ah, struct ath9k_channel *chan,
        u32 macStaId1;
        u64 tsf = 0;
        int i, r;
+       bool allow_fbs = false;
 
        if (!ath9k_hw_setpower(ah, ATH9K_PM_AWAKE))
                return -EIO;
@@ -1530,12 +1533,19 @@ int ath9k_hw_reset(struct ath_hw *ah, struct ath9k_channel *chan,
        if (AR_SREV_9280(ah) && common->bus_ops->ath_bus_type == ATH_PCI)
                bChannelChange = false;
 
+       if (caldata &&
+           caldata->done_txiqcal_once &&
+           caldata->done_txclcal_once &&
+           caldata->rtt_hist.num_readings)
+               allow_fbs = true;
+
        if (bChannelChange &&
            (ah->chip_fullsleep != true) &&
            (ah->curchan != NULL) &&
            (chan->channel != ah->curchan->channel) &&
-           ((chan->channelFlags & CHANNEL_ALL) ==
-            (ah->curchan->channelFlags & CHANNEL_ALL))) {
+           (allow_fbs ||
+            ((chan->channelFlags & CHANNEL_ALL) ==
+             (ah->curchan->channelFlags & CHANNEL_ALL)))) {
                if (ath9k_hw_channel_change(ah, chan)) {
                        ath9k_hw_loadnf(ah, ah->curchan);
                        ath9k_hw_start_nfcal(ah, true);
index 0f6fc25bfb1f8d5ef6aefc26395a5a5e0ad1a26e..156c57ad4f0c07433d0b5bd83dfe7ef2d4b29526 100644 (file)
@@ -652,6 +652,7 @@ enum ath_cal_list {
 /* ah_flags */
 #define AH_USE_EEPROM   0x1
 #define AH_UNPLUGGED    0x2 /* The card has been physically removed. */
+#define AH_FASTCC       0x4
 
 struct ath_hw {
        struct ath_ops reg_ops;