1 --- a/drivers/net/wireless/ath/ath9k/hw.h
2 +++ b/drivers/net/wireless/ath/ath9k/hw.h
3 @@ -535,8 +535,6 @@ struct ath_hw_private_ops {
4 bool (*macversion_supported)(u32 macversion);
5 void (*setup_calibration)(struct ath_hw *ah,
6 struct ath9k_cal_list *currCal);
7 - bool (*iscal_supported)(struct ath_hw *ah,
8 - enum ath9k_cal_types calType);
11 int (*rf_set_freq)(struct ath_hw *ah,
12 @@ -689,7 +687,7 @@ struct ath_hw {
16 - enum ath9k_cal_types supp_cals;
18 struct ath9k_cal_list iq_caldata;
19 struct ath9k_cal_list adcgain_caldata;
20 struct ath9k_cal_list adcdc_caldata;
21 --- a/drivers/net/wireless/ath/ath9k/ar9002_calib.c
22 +++ b/drivers/net/wireless/ath/ath9k/ar9002_calib.c
25 #define AR9285_CLCAL_REDO_THRESH 1
27 +enum ar9002_cal_types {
28 + ADC_GAIN_CAL = BIT(0),
29 + ADC_DC_CAL = BIT(1),
30 + IQ_MISMATCH_CAL = BIT(2),
34 static void ar9002_hw_setup_calibration(struct ath_hw *ah,
35 struct ath9k_cal_list *currCal)
37 @@ -45,8 +52,6 @@ static void ar9002_hw_setup_calibration(
38 ath_print(common, ATH_DBG_CALIBRATE,
39 "starting ADC DC Calibration\n");
42 - break; /* Not supported */
45 REG_SET_BIT(ah, AR_PHY_TIMING_CTRL4(0),
46 @@ -91,25 +96,6 @@ static bool ar9002_hw_per_calibration(st
50 -/* Assumes you are talking about the currently configured channel */
51 -static bool ar9002_hw_iscal_supported(struct ath_hw *ah,
52 - enum ath9k_cal_types calType)
54 - struct ieee80211_conf *conf = &ath9k_hw_common(ah)->hw->conf;
56 - switch (calType & ah->supp_cals) {
57 - case IQ_MISMATCH_CAL: /* Both 2 GHz and 5 GHz support OFDM */
61 - if (!(conf->channel->band == IEEE80211_BAND_2GHZ &&
62 - conf_is_ht20(conf)))
69 static void ar9002_hw_iqcal_collect(struct ath_hw *ah)
72 @@ -872,24 +858,28 @@ static bool ar9002_hw_init_cal(struct at
74 /* Enable IQ, ADC Gain and ADC DC offset CALs */
75 if (AR_SREV_9100(ah) || AR_SREV_9160_10_OR_LATER(ah)) {
76 - if (ar9002_hw_iscal_supported(ah, ADC_GAIN_CAL)) {
77 + ah->supp_cals = IQ_MISMATCH_CAL;
79 + if (AR_SREV_9160_10_OR_LATER(ah) &&
80 + !(IS_CHAN_2GHZ(chan) && IS_CHAN_HT20(chan))) {
81 + ah->supp_cals |= ADC_GAIN_CAL | ADC_DC_CAL;
84 INIT_CAL(&ah->adcgain_caldata);
85 INSERT_CAL(ah, &ah->adcgain_caldata);
86 ath_print(common, ATH_DBG_CALIBRATE,
87 "enabling ADC Gain Calibration.\n");
89 - if (ar9002_hw_iscal_supported(ah, ADC_DC_CAL)) {
91 INIT_CAL(&ah->adcdc_caldata);
92 INSERT_CAL(ah, &ah->adcdc_caldata);
93 ath_print(common, ATH_DBG_CALIBRATE,
94 "enabling ADC DC Calibration.\n");
96 - if (ar9002_hw_iscal_supported(ah, IQ_MISMATCH_CAL)) {
97 - INIT_CAL(&ah->iq_caldata);
98 - INSERT_CAL(ah, &ah->iq_caldata);
99 - ath_print(common, ATH_DBG_CALIBRATE,
100 - "enabling IQ Calibration.\n");
103 + INIT_CAL(&ah->iq_caldata);
104 + INSERT_CAL(ah, &ah->iq_caldata);
105 + ath_print(common, ATH_DBG_CALIBRATE,
106 + "enabling IQ Calibration.\n");
108 ah->cal_list_curr = ah->cal_list;
110 @@ -980,7 +970,6 @@ void ar9002_hw_attach_calib_ops(struct a
111 priv_ops->init_cal_settings = ar9002_hw_init_cal_settings;
112 priv_ops->init_cal = ar9002_hw_init_cal;
113 priv_ops->setup_calibration = ar9002_hw_setup_calibration;
114 - priv_ops->iscal_supported = ar9002_hw_iscal_supported;
116 ops->calibrate = ar9002_hw_calibrate;
118 --- a/drivers/net/wireless/ath/ath9k/ar9003_calib.c
119 +++ b/drivers/net/wireless/ath/ath9k/ar9003_calib.c
122 #include "ar9003_phy.h"
124 +enum ar9003_cal_types {
125 + IQ_MISMATCH_CAL = BIT(0),
126 + TEMP_COMP_CAL = BIT(1),
129 static void ar9003_hw_setup_calibration(struct ath_hw *ah,
130 struct ath9k_cal_list *currCal)
132 @@ -50,10 +55,6 @@ static void ar9003_hw_setup_calibration(
133 ath_print(common, ATH_DBG_CALIBRATE,
134 "starting Temperature Compensation Calibration\n");
143 @@ -313,27 +314,6 @@ static const struct ath9k_percal_data iq
144 static void ar9003_hw_init_cal_settings(struct ath_hw *ah)
146 ah->iq_caldata.calData = &iq_cal_single_sample;
147 - ah->supp_cals = IQ_MISMATCH_CAL;
150 -static bool ar9003_hw_iscal_supported(struct ath_hw *ah,
151 - enum ath9k_cal_types calType)
153 - switch (calType & ah->supp_cals) {
154 - case IQ_MISMATCH_CAL:
156 - * XXX: Run IQ Mismatch for non-CCK only
157 - * Note that CHANNEL_B is never set though.
163 - case TEMP_COMP_CAL:
171 @@ -772,15 +752,16 @@ static bool ar9003_hw_init_cal(struct at
173 /* Initialize list pointers */
174 ah->cal_list = ah->cal_list_last = ah->cal_list_curr = NULL;
175 + ah->supp_cals = IQ_MISMATCH_CAL;
177 - if (ar9003_hw_iscal_supported(ah, IQ_MISMATCH_CAL)) {
178 + if (ah->supp_cals & IQ_MISMATCH_CAL) {
179 INIT_CAL(&ah->iq_caldata);
180 INSERT_CAL(ah, &ah->iq_caldata);
181 ath_print(common, ATH_DBG_CALIBRATE,
182 "enabling IQ Calibration.\n");
185 - if (ar9003_hw_iscal_supported(ah, TEMP_COMP_CAL)) {
186 + if (ah->supp_cals & TEMP_COMP_CAL) {
187 INIT_CAL(&ah->tempCompCalData);
188 INSERT_CAL(ah, &ah->tempCompCalData);
189 ath_print(common, ATH_DBG_CALIBRATE,
190 @@ -807,7 +788,6 @@ void ar9003_hw_attach_calib_ops(struct a
191 priv_ops->init_cal_settings = ar9003_hw_init_cal_settings;
192 priv_ops->init_cal = ar9003_hw_init_cal;
193 priv_ops->setup_calibration = ar9003_hw_setup_calibration;
194 - priv_ops->iscal_supported = ar9003_hw_iscal_supported;
196 ops->calibrate = ar9003_hw_calibrate;
198 --- a/drivers/net/wireless/ath/ath9k/calib.h
199 +++ b/drivers/net/wireless/ath/ath9k/calib.h
200 @@ -58,13 +58,6 @@ struct ar5416IniArray {
204 -enum ath9k_cal_types {
205 - ADC_GAIN_CAL = 0x2,
207 - IQ_MISMATCH_CAL = 0x8,
208 - TEMP_COMP_CAL = 0x10,
211 enum ath9k_cal_state {
214 @@ -79,7 +72,7 @@ enum ath9k_cal_state {
215 #define PER_MAX_LOG_COUNT 10
217 struct ath9k_percal_data {
218 - enum ath9k_cal_types calType;
222 void (*calCollect) (struct ath_hw *);
223 --- a/drivers/net/wireless/ath/ath9k/hw-ops.h
224 +++ b/drivers/net/wireless/ath/ath9k/hw-ops.h
225 @@ -276,12 +276,6 @@ static inline void ath9k_hw_setup_calibr
226 ath9k_hw_private_ops(ah)->setup_calibration(ah, currCal);
229 -static inline bool ath9k_hw_iscal_supported(struct ath_hw *ah,
230 - enum ath9k_cal_types calType)
232 - return ath9k_hw_private_ops(ah)->iscal_supported(ah, calType);
235 static inline void ath9k_ani_reset(struct ath_hw *ah, bool is_scanning)
237 ath9k_hw_private_ops(ah)->ani_reset(ah, is_scanning);
238 --- a/drivers/net/wireless/ath/ath9k/calib.c
239 +++ b/drivers/net/wireless/ath/ath9k/calib.c
240 @@ -186,7 +186,7 @@ bool ath9k_hw_reset_calvalid(struct ath_
244 - if (!ath9k_hw_iscal_supported(ah, currCal->calData->calType))
245 + if (!(ah->supp_cals & currCal->calData->calType))
248 ath_print(common, ATH_DBG_CALIBRATE,