aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath/ath9k/calib.c
diff options
context:
space:
mode:
authorLuis R. Rodriguez <lrodriguez@atheros.com>2010-04-15 17:38:51 -0400
committerJohn W. Linville <linville@tuxdriver.com>2010-04-16 15:43:28 -0400
commit4d001d18f2e738f3b53bfd1cd493987e3e61421a (patch)
tree17715c0b81be4b69e13a4f49355bbcc3dc745fc8 /drivers/net/wireless/ath/ath9k/calib.c
parent939ad86de538d23533d2f9dd43f80725789d43ba (diff)
ath9k_hw: add a helper for Power Amplifier calibration for AR9002
The code can be simplified and shared between two locations if we bring this into a helper. During reset we do not account for the skip count. Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/ath/ath9k/calib.c')
-rw-r--r--drivers/net/wireless/ath/ath9k/calib.c32
1 files changed, 17 insertions, 15 deletions
diff --git a/drivers/net/wireless/ath/ath9k/calib.c b/drivers/net/wireless/ath/ath9k/calib.c
index eed2c76f56c6..26bc3819bdde 100644
--- a/drivers/net/wireless/ath/ath9k/calib.c
+++ b/drivers/net/wireless/ath/ath9k/calib.c
@@ -949,6 +949,21 @@ static inline void ath9k_hw_9285_pa_cal(struct ath_hw *ah, bool is_reset)
949 949
950} 950}
951 951
952static void ar9002_hw_pa_cal(struct ath_hw *ah, bool is_reset)
953{
954 if (AR_SREV_9271(ah)) {
955 if (is_reset || !ah->pacal_info.skipcount)
956 ath9k_hw_9271_pa_cal(ah, is_reset);
957 else
958 ah->pacal_info.skipcount--;
959 } else if (AR_SREV_9285_11_OR_LATER(ah)) {
960 if (is_reset || !ah->pacal_info.skipcount)
961 ath9k_hw_9285_pa_cal(ah, is_reset);
962 else
963 ah->pacal_info.skipcount--;
964 }
965}
966
952bool ath9k_hw_calibrate(struct ath_hw *ah, struct ath9k_channel *chan, 967bool ath9k_hw_calibrate(struct ath_hw *ah, struct ath9k_channel *chan,
953 u8 rxchainmask, bool longcal) 968 u8 rxchainmask, bool longcal)
954{ 969{
@@ -973,17 +988,7 @@ bool ath9k_hw_calibrate(struct ath_hw *ah, struct ath9k_channel *chan,
973 /* Do NF cal only at longer intervals */ 988 /* Do NF cal only at longer intervals */
974 if (longcal) { 989 if (longcal) {
975 /* Do periodic PAOffset Cal */ 990 /* Do periodic PAOffset Cal */
976 if (AR_SREV_9271(ah)) { 991 ar9002_hw_pa_cal(ah, false);
977 if (!ah->pacal_info.skipcount)
978 ath9k_hw_9271_pa_cal(ah, false);
979 else
980 ah->pacal_info.skipcount--;
981 } else if (AR_SREV_9285_11_OR_LATER(ah)) {
982 if (!ah->pacal_info.skipcount)
983 ath9k_hw_9285_pa_cal(ah, false);
984 else
985 ah->pacal_info.skipcount--;
986 }
987 992
988 if (OLC_FOR_AR9280_20_LATER || OLC_FOR_AR9287_10_LATER) 993 if (OLC_FOR_AR9280_20_LATER || OLC_FOR_AR9287_10_LATER)
989 ath9k_olc_temp_compensation(ah); 994 ath9k_olc_temp_compensation(ah);
@@ -1142,10 +1147,7 @@ bool ath9k_hw_init_cal(struct ath_hw *ah, struct ath9k_channel *chan)
1142 } 1147 }
1143 1148
1144 /* Do PA Calibration */ 1149 /* Do PA Calibration */
1145 if (AR_SREV_9271(ah)) 1150 ar9002_hw_pa_cal(ah, true);
1146 ath9k_hw_9271_pa_cal(ah, true);
1147 else if (AR_SREV_9285_11_OR_LATER(ah))
1148 ath9k_hw_9285_pa_cal(ah, true);
1149 1151
1150 /* Do NF Calibration after DC offset and other calibrations */ 1152 /* Do NF Calibration after DC offset and other calibrations */
1151 REG_WRITE(ah, AR_PHY_AGC_CONTROL, 1153 REG_WRITE(ah, AR_PHY_AGC_CONTROL,