diff options
author | Sujith <Sujith.Manoharan@atheros.com> | 2009-08-25 23:09:40 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-08-28 14:40:46 -0400 |
commit | a13883b0bfcc435e4b7fbbde6334339aac8b1dc4 (patch) | |
tree | 6bafacad9aba09ed27bcc14df432cd9fddc50d75 /drivers/net/wireless/ath | |
parent | b8ecd988b1670035a05035c553c08331214d6603 (diff) |
ath9k: Reduce the frequency of PA offset calibration
PA calibration need not be done if the offset is not varying.
The current logic does PA calibration even if the offset is the
same.
Signed-off-by: Sujith <Sujith.Manoharan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/ath')
-rw-r--r-- | drivers/net/wireless/ath/ath9k/calib.c | 25 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath9k/calib.h | 7 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath9k/hw.h | 1 |
3 files changed, 29 insertions, 4 deletions
diff --git a/drivers/net/wireless/ath/ath9k/calib.c b/drivers/net/wireless/ath/ath9k/calib.c index 20f74b5b5703..47a024da29c9 100644 --- a/drivers/net/wireless/ath/ath9k/calib.c +++ b/drivers/net/wireless/ath/ath9k/calib.c | |||
@@ -861,7 +861,7 @@ static void ath9k_hw_9271_pa_cal(struct ath_hw *ah) | |||
861 | REG_WRITE(ah, regList[i][0], regList[i][1]); | 861 | REG_WRITE(ah, regList[i][0], regList[i][1]); |
862 | } | 862 | } |
863 | 863 | ||
864 | static inline void ath9k_hw_9285_pa_cal(struct ath_hw *ah) | 864 | static inline void ath9k_hw_9285_pa_cal(struct ath_hw *ah, bool is_reset) |
865 | { | 865 | { |
866 | 866 | ||
867 | u32 regVal; | 867 | u32 regVal; |
@@ -877,6 +877,8 @@ static inline void ath9k_hw_9285_pa_cal(struct ath_hw *ah) | |||
877 | { 0x7838, 0 }, | 877 | { 0x7838, 0 }, |
878 | }; | 878 | }; |
879 | 879 | ||
880 | DPRINTF(ah->ah_sc, ATH_DBG_CALIBRATE, "Running PA Calibration\n"); | ||
881 | |||
880 | if (AR_SREV_9285_11(ah)) { | 882 | if (AR_SREV_9285_11(ah)) { |
881 | REG_WRITE(ah, AR9285_AN_TOP4, (AR9285_AN_TOP4_DEFAULT | 0x14)); | 883 | REG_WRITE(ah, AR9285_AN_TOP4, (AR9285_AN_TOP4_DEFAULT | 0x14)); |
882 | udelay(10); | 884 | udelay(10); |
@@ -936,6 +938,17 @@ static inline void ath9k_hw_9285_pa_cal(struct ath_hw *ah) | |||
936 | offs_6_1 = offset>>1; | 938 | offs_6_1 = offset>>1; |
937 | offs_0 = offset & 1; | 939 | offs_0 = offset & 1; |
938 | 940 | ||
941 | if ((!is_reset) && (ah->pacal_info.prev_offset == offset)) { | ||
942 | if (ah->pacal_info.max_skipcount < MAX_PACAL_SKIPCOUNT) | ||
943 | ah->pacal_info.max_skipcount = | ||
944 | 2 * ah->pacal_info.max_skipcount; | ||
945 | ah->pacal_info.skipcount = ah->pacal_info.max_skipcount; | ||
946 | } else { | ||
947 | ah->pacal_info.max_skipcount = 1; | ||
948 | ah->pacal_info.skipcount = 0; | ||
949 | ah->pacal_info.prev_offset = offset; | ||
950 | } | ||
951 | |||
939 | REG_RMW_FIELD(ah, AR9285_AN_RF2G6, AR9285_AN_RF2G6_OFFS, offs_6_1); | 952 | REG_RMW_FIELD(ah, AR9285_AN_RF2G6, AR9285_AN_RF2G6_OFFS, offs_6_1); |
940 | REG_RMW_FIELD(ah, AR9285_AN_RF2G3, AR9285_AN_RF2G3_PDVCCOMP, offs_0); | 953 | REG_RMW_FIELD(ah, AR9285_AN_RF2G3, AR9285_AN_RF2G3_PDVCCOMP, offs_0); |
941 | 954 | ||
@@ -982,8 +995,12 @@ bool ath9k_hw_calibrate(struct ath_hw *ah, struct ath9k_channel *chan, | |||
982 | /* Do periodic PAOffset Cal */ | 995 | /* Do periodic PAOffset Cal */ |
983 | if (AR_SREV_9271(ah)) | 996 | if (AR_SREV_9271(ah)) |
984 | ath9k_hw_9271_pa_cal(ah); | 997 | ath9k_hw_9271_pa_cal(ah); |
985 | else if (AR_SREV_9285_11_OR_LATER(ah)) | 998 | else if (AR_SREV_9285_11_OR_LATER(ah)) { |
986 | ath9k_hw_9285_pa_cal(ah); | 999 | if (!ah->pacal_info.skipcount) |
1000 | ath9k_hw_9285_pa_cal(ah, false); | ||
1001 | else | ||
1002 | ah->pacal_info.skipcount--; | ||
1003 | } | ||
987 | 1004 | ||
988 | if (OLC_FOR_AR9280_20_LATER || OLC_FOR_AR9287_10_LATER) | 1005 | if (OLC_FOR_AR9280_20_LATER || OLC_FOR_AR9287_10_LATER) |
989 | ath9k_olc_temp_compensation(ah); | 1006 | ath9k_olc_temp_compensation(ah); |
@@ -1081,7 +1098,7 @@ bool ath9k_hw_init_cal(struct ath_hw *ah, struct ath9k_channel *chan) | |||
1081 | 1098 | ||
1082 | /* Do PA Calibration */ | 1099 | /* Do PA Calibration */ |
1083 | if (AR_SREV_9285_11_OR_LATER(ah)) | 1100 | if (AR_SREV_9285_11_OR_LATER(ah)) |
1084 | ath9k_hw_9285_pa_cal(ah); | 1101 | ath9k_hw_9285_pa_cal(ah, true); |
1085 | 1102 | ||
1086 | /* Do NF Calibration after DC offset and other calibrations */ | 1103 | /* Do NF Calibration after DC offset and other calibrations */ |
1087 | REG_WRITE(ah, AR_PHY_AGC_CONTROL, | 1104 | REG_WRITE(ah, AR_PHY_AGC_CONTROL, |
diff --git a/drivers/net/wireless/ath/ath9k/calib.h b/drivers/net/wireless/ath/ath9k/calib.h index 547e697b9055..019bcbba40ed 100644 --- a/drivers/net/wireless/ath/ath9k/calib.h +++ b/drivers/net/wireless/ath/ath9k/calib.h | |||
@@ -110,6 +110,13 @@ struct ath9k_nfcal_hist { | |||
110 | u8 invalidNFcount; | 110 | u8 invalidNFcount; |
111 | }; | 111 | }; |
112 | 112 | ||
113 | #define MAX_PACAL_SKIPCOUNT 8 | ||
114 | struct ath9k_pacal_info{ | ||
115 | int32_t prev_offset; /* Previous value of PA offset value */ | ||
116 | int8_t max_skipcount; /* Max No. of times PACAL can be skipped */ | ||
117 | int8_t skipcount; /* No. of times the PACAL to be skipped */ | ||
118 | }; | ||
119 | |||
113 | bool ath9k_hw_reset_calvalid(struct ath_hw *ah); | 120 | bool ath9k_hw_reset_calvalid(struct ath_hw *ah); |
114 | void ath9k_hw_start_nfcal(struct ath_hw *ah); | 121 | void ath9k_hw_start_nfcal(struct ath_hw *ah); |
115 | void ath9k_hw_loadnf(struct ath_hw *ah, struct ath9k_channel *chan); | 122 | void ath9k_hw_loadnf(struct ath_hw *ah, struct ath9k_channel *chan); |
diff --git a/drivers/net/wireless/ath/ath9k/hw.h b/drivers/net/wireless/ath/ath9k/hw.h index 24b30631d93e..b24150a1b4ad 100644 --- a/drivers/net/wireless/ath/ath9k/hw.h +++ b/drivers/net/wireless/ath/ath9k/hw.h | |||
@@ -424,6 +424,7 @@ struct ath_hw { | |||
424 | enum ath9k_power_mode power_mode; | 424 | enum ath9k_power_mode power_mode; |
425 | 425 | ||
426 | struct ath9k_nfcal_hist nfCalHist[NUM_NF_READINGS]; | 426 | struct ath9k_nfcal_hist nfCalHist[NUM_NF_READINGS]; |
427 | struct ath9k_pacal_info pacal_info; | ||
427 | struct ar5416Stats stats; | 428 | struct ar5416Stats stats; |
428 | struct ath9k_tx_queue_info txq[ATH9K_NUM_TX_QUEUES]; | 429 | struct ath9k_tx_queue_info txq[ATH9K_NUM_TX_QUEUES]; |
429 | 430 | ||