2 * Copyright (c) 2008-2009 Atheros Communications Inc.
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
19 /* We can tune this as we go by monitoring really low values */
20 #define ATH9K_NF_TOO_LOW -60
22 /* AR5416 may return very high value (like -31 dBm), in those cases the nf
23 * is incorrect and we should use the static NF value. Later we can try to
24 * find out why they are reporting these values */
26 static bool ath9k_hw_nf_in_range(struct ath_hw *ah, s16 nf)
28 if (nf > ATH9K_NF_TOO_LOW) {
29 ath_print(ath9k_hw_common(ah), ATH_DBG_CALIBRATE,
30 "noise floor value detected (%d) is "
31 "lower than what we think is a "
32 "reasonable value (%d)\n",
33 nf, ATH9K_NF_TOO_LOW);
39 static int16_t ath9k_hw_get_nf_hist_mid(int16_t *nfCalBuffer)
42 int16_t sort[ATH9K_NF_CAL_HIST_MAX];
45 for (i = 0; i < ATH9K_NF_CAL_HIST_MAX; i++)
46 sort[i] = nfCalBuffer[i];
48 for (i = 0; i < ATH9K_NF_CAL_HIST_MAX - 1; i++) {
49 for (j = 1; j < ATH9K_NF_CAL_HIST_MAX - i; j++) {
50 if (sort[j] > sort[j - 1]) {
52 sort[j] = sort[j - 1];
57 nfval = sort[(ATH9K_NF_CAL_HIST_MAX - 1) >> 1];
62 static void ath9k_hw_update_nfcal_hist_buffer(struct ath9k_nfcal_hist *h,
67 for (i = 0; i < NUM_NF_READINGS; i++) {
68 h[i].nfCalBuffer[h[i].currIndex] = nfarray[i];
70 if (++h[i].currIndex >= ATH9K_NF_CAL_HIST_MAX)
73 if (h[i].invalidNFcount > 0) {
74 if (nfarray[i] < AR_PHY_CCA_MIN_BAD_VALUE ||
75 nfarray[i] > AR_PHY_CCA_MAX_HIGH_VALUE) {
76 h[i].invalidNFcount = ATH9K_NF_CAL_HIST_MAX;
78 h[i].invalidNFcount--;
79 h[i].privNF = nfarray[i];
83 ath9k_hw_get_nf_hist_mid(h[i].nfCalBuffer);
89 static void ath9k_hw_do_getnf(struct ath_hw *ah,
90 int16_t nfarray[NUM_NF_READINGS])
92 struct ath_common *common = ath9k_hw_common(ah);
95 if (AR_SREV_9280_10_OR_LATER(ah))
96 nf = MS(REG_READ(ah, AR_PHY_CCA), AR9280_PHY_MINCCA_PWR);
98 nf = MS(REG_READ(ah, AR_PHY_CCA), AR_PHY_MINCCA_PWR);
101 nf = 0 - ((nf ^ 0x1ff) + 1);
102 ath_print(common, ATH_DBG_CALIBRATE,
103 "NF calibrated [ctl] [chain 0] is %d\n", nf);
106 if (!AR_SREV_9285(ah)) {
107 if (AR_SREV_9280_10_OR_LATER(ah))
108 nf = MS(REG_READ(ah, AR_PHY_CH1_CCA),
109 AR9280_PHY_CH1_MINCCA_PWR);
111 nf = MS(REG_READ(ah, AR_PHY_CH1_CCA),
112 AR_PHY_CH1_MINCCA_PWR);
115 nf = 0 - ((nf ^ 0x1ff) + 1);
116 ath_print(common, ATH_DBG_CALIBRATE,
117 "NF calibrated [ctl] [chain 1] is %d\n", nf);
120 if (!AR_SREV_9280(ah) && !AR_SREV_9287(ah)) {
121 nf = MS(REG_READ(ah, AR_PHY_CH2_CCA),
122 AR_PHY_CH2_MINCCA_PWR);
124 nf = 0 - ((nf ^ 0x1ff) + 1);
125 ath_print(common, ATH_DBG_CALIBRATE,
126 "NF calibrated [ctl] [chain 2] is %d\n", nf);
131 if (AR_SREV_9280_10_OR_LATER(ah))
132 nf = MS(REG_READ(ah, AR_PHY_EXT_CCA),
133 AR9280_PHY_EXT_MINCCA_PWR);
135 nf = MS(REG_READ(ah, AR_PHY_EXT_CCA),
136 AR_PHY_EXT_MINCCA_PWR);
139 nf = 0 - ((nf ^ 0x1ff) + 1);
140 ath_print(common, ATH_DBG_CALIBRATE,
141 "NF calibrated [ext] [chain 0] is %d\n", nf);
144 if (!AR_SREV_9285(ah)) {
145 if (AR_SREV_9280_10_OR_LATER(ah))
146 nf = MS(REG_READ(ah, AR_PHY_CH1_EXT_CCA),
147 AR9280_PHY_CH1_EXT_MINCCA_PWR);
149 nf = MS(REG_READ(ah, AR_PHY_CH1_EXT_CCA),
150 AR_PHY_CH1_EXT_MINCCA_PWR);
153 nf = 0 - ((nf ^ 0x1ff) + 1);
154 ath_print(common, ATH_DBG_CALIBRATE,
155 "NF calibrated [ext] [chain 1] is %d\n", nf);
158 if (!AR_SREV_9280(ah) && !AR_SREV_9287(ah)) {
159 nf = MS(REG_READ(ah, AR_PHY_CH2_EXT_CCA),
160 AR_PHY_CH2_EXT_MINCCA_PWR);
162 nf = 0 - ((nf ^ 0x1ff) + 1);
163 ath_print(common, ATH_DBG_CALIBRATE,
164 "NF calibrated [ext] [chain 2] is %d\n", nf);
170 static bool getNoiseFloorThresh(struct ath_hw *ah,
171 enum ieee80211_band band,
175 case IEEE80211_BAND_5GHZ:
176 *nft = (int8_t)ah->eep_ops->get_eeprom(ah, EEP_NFTHRESH_5);
178 case IEEE80211_BAND_2GHZ:
179 *nft = (int8_t)ah->eep_ops->get_eeprom(ah, EEP_NFTHRESH_2);
189 static void ath9k_hw_setup_calibration(struct ath_hw *ah,
190 struct ath9k_cal_list *currCal)
192 struct ath_common *common = ath9k_hw_common(ah);
194 REG_RMW_FIELD(ah, AR_PHY_TIMING_CTRL4(0),
195 AR_PHY_TIMING_CTRL4_IQCAL_LOG_COUNT_MAX,
196 currCal->calData->calCountMax);
198 switch (currCal->calData->calType) {
199 case IQ_MISMATCH_CAL:
200 REG_WRITE(ah, AR_PHY_CALMODE, AR_PHY_CALMODE_IQ);
201 ath_print(common, ATH_DBG_CALIBRATE,
202 "starting IQ Mismatch Calibration\n");
205 REG_WRITE(ah, AR_PHY_CALMODE, AR_PHY_CALMODE_ADC_GAIN);
206 ath_print(common, ATH_DBG_CALIBRATE,
207 "starting ADC Gain Calibration\n");
210 REG_WRITE(ah, AR_PHY_CALMODE, AR_PHY_CALMODE_ADC_DC_PER);
211 ath_print(common, ATH_DBG_CALIBRATE,
212 "starting ADC DC Calibration\n");
214 case ADC_DC_INIT_CAL:
215 REG_WRITE(ah, AR_PHY_CALMODE, AR_PHY_CALMODE_ADC_DC_INIT);
216 ath_print(common, ATH_DBG_CALIBRATE,
217 "starting Init ADC DC Calibration\n");
221 REG_SET_BIT(ah, AR_PHY_TIMING_CTRL4(0),
222 AR_PHY_TIMING_CTRL4_DO_CAL);
225 static void ath9k_hw_reset_calibration(struct ath_hw *ah,
226 struct ath9k_cal_list *currCal)
230 ath9k_hw_setup_calibration(ah, currCal);
232 currCal->calState = CAL_RUNNING;
234 for (i = 0; i < AR5416_MAX_CHAINS; i++) {
235 ah->meas0.sign[i] = 0;
236 ah->meas1.sign[i] = 0;
237 ah->meas2.sign[i] = 0;
238 ah->meas3.sign[i] = 0;
244 static bool ath9k_hw_per_calibration(struct ath_hw *ah,
245 struct ath9k_channel *ichan,
247 struct ath9k_cal_list *currCal)
249 bool iscaldone = false;
251 if (currCal->calState == CAL_RUNNING) {
252 if (!(REG_READ(ah, AR_PHY_TIMING_CTRL4(0)) &
253 AR_PHY_TIMING_CTRL4_DO_CAL)) {
255 currCal->calData->calCollect(ah);
258 if (ah->cal_samples >= currCal->calData->calNumSamples) {
259 int i, numChains = 0;
260 for (i = 0; i < AR5416_MAX_CHAINS; i++) {
261 if (rxchainmask & (1 << i))
265 currCal->calData->calPostProc(ah, numChains);
266 ichan->CalValid |= currCal->calData->calType;
267 currCal->calState = CAL_DONE;
270 ath9k_hw_setup_calibration(ah, currCal);
273 } else if (!(ichan->CalValid & currCal->calData->calType)) {
274 ath9k_hw_reset_calibration(ah, currCal);
280 /* Assumes you are talking about the currently configured channel */
281 static bool ath9k_hw_iscal_supported(struct ath_hw *ah,
282 enum ath9k_cal_types calType)
284 struct ieee80211_conf *conf = &ath9k_hw_common(ah)->hw->conf;
286 switch (calType & ah->supp_cals) {
287 case IQ_MISMATCH_CAL: /* Both 2 GHz and 5 GHz support OFDM */
291 if (!(conf->channel->band == IEEE80211_BAND_2GHZ &&
299 static void ath9k_hw_iqcal_collect(struct ath_hw *ah)
303 for (i = 0; i < AR5416_MAX_CHAINS; i++) {
304 ah->totalPowerMeasI[i] +=
305 REG_READ(ah, AR_PHY_CAL_MEAS_0(i));
306 ah->totalPowerMeasQ[i] +=
307 REG_READ(ah, AR_PHY_CAL_MEAS_1(i));
308 ah->totalIqCorrMeas[i] +=
309 (int32_t) REG_READ(ah, AR_PHY_CAL_MEAS_2(i));
310 ath_print(ath9k_hw_common(ah), ATH_DBG_CALIBRATE,
311 "%d: Chn %d pmi=0x%08x;pmq=0x%08x;iqcm=0x%08x;\n",
312 ah->cal_samples, i, ah->totalPowerMeasI[i],
313 ah->totalPowerMeasQ[i],
314 ah->totalIqCorrMeas[i]);
318 static void ath9k_hw_adc_gaincal_collect(struct ath_hw *ah)
322 for (i = 0; i < AR5416_MAX_CHAINS; i++) {
323 ah->totalAdcIOddPhase[i] +=
324 REG_READ(ah, AR_PHY_CAL_MEAS_0(i));
325 ah->totalAdcIEvenPhase[i] +=
326 REG_READ(ah, AR_PHY_CAL_MEAS_1(i));
327 ah->totalAdcQOddPhase[i] +=
328 REG_READ(ah, AR_PHY_CAL_MEAS_2(i));
329 ah->totalAdcQEvenPhase[i] +=
330 REG_READ(ah, AR_PHY_CAL_MEAS_3(i));
332 ath_print(ath9k_hw_common(ah), ATH_DBG_CALIBRATE,
333 "%d: Chn %d oddi=0x%08x; eveni=0x%08x; "
334 "oddq=0x%08x; evenq=0x%08x;\n",
336 ah->totalAdcIOddPhase[i],
337 ah->totalAdcIEvenPhase[i],
338 ah->totalAdcQOddPhase[i],
339 ah->totalAdcQEvenPhase[i]);
343 static void ath9k_hw_adc_dccal_collect(struct ath_hw *ah)
347 for (i = 0; i < AR5416_MAX_CHAINS; i++) {
348 ah->totalAdcDcOffsetIOddPhase[i] +=
349 (int32_t) REG_READ(ah, AR_PHY_CAL_MEAS_0(i));
350 ah->totalAdcDcOffsetIEvenPhase[i] +=
351 (int32_t) REG_READ(ah, AR_PHY_CAL_MEAS_1(i));
352 ah->totalAdcDcOffsetQOddPhase[i] +=
353 (int32_t) REG_READ(ah, AR_PHY_CAL_MEAS_2(i));
354 ah->totalAdcDcOffsetQEvenPhase[i] +=
355 (int32_t) REG_READ(ah, AR_PHY_CAL_MEAS_3(i));
357 ath_print(ath9k_hw_common(ah), ATH_DBG_CALIBRATE,
358 "%d: Chn %d oddi=0x%08x; eveni=0x%08x; "
359 "oddq=0x%08x; evenq=0x%08x;\n",
361 ah->totalAdcDcOffsetIOddPhase[i],
362 ah->totalAdcDcOffsetIEvenPhase[i],
363 ah->totalAdcDcOffsetQOddPhase[i],
364 ah->totalAdcDcOffsetQEvenPhase[i]);
368 static void ath9k_hw_iqcalibrate(struct ath_hw *ah, u8 numChains)
370 struct ath_common *common = ath9k_hw_common(ah);
371 u32 powerMeasQ, powerMeasI, iqCorrMeas;
372 u32 qCoffDenom, iCoffDenom;
373 int32_t qCoff, iCoff;
376 for (i = 0; i < numChains; i++) {
377 powerMeasI = ah->totalPowerMeasI[i];
378 powerMeasQ = ah->totalPowerMeasQ[i];
379 iqCorrMeas = ah->totalIqCorrMeas[i];
381 ath_print(common, ATH_DBG_CALIBRATE,
382 "Starting IQ Cal and Correction for Chain %d\n",
385 ath_print(common, ATH_DBG_CALIBRATE,
386 "Orignal: Chn %diq_corr_meas = 0x%08x\n",
387 i, ah->totalIqCorrMeas[i]);
391 if (iqCorrMeas > 0x80000000) {
392 iqCorrMeas = (0xffffffff - iqCorrMeas) + 1;
396 ath_print(common, ATH_DBG_CALIBRATE,
397 "Chn %d pwr_meas_i = 0x%08x\n", i, powerMeasI);
398 ath_print(common, ATH_DBG_CALIBRATE,
399 "Chn %d pwr_meas_q = 0x%08x\n", i, powerMeasQ);
400 ath_print(common, ATH_DBG_CALIBRATE, "iqCorrNeg is 0x%08x\n",
403 iCoffDenom = (powerMeasI / 2 + powerMeasQ / 2) / 128;
404 qCoffDenom = powerMeasQ / 64;
406 if (powerMeasQ != 0) {
407 iCoff = iqCorrMeas / iCoffDenom;
408 qCoff = powerMeasI / qCoffDenom - 64;
409 ath_print(common, ATH_DBG_CALIBRATE,
410 "Chn %d iCoff = 0x%08x\n", i, iCoff);
411 ath_print(common, ATH_DBG_CALIBRATE,
412 "Chn %d qCoff = 0x%08x\n", i, qCoff);
414 iCoff = iCoff & 0x3f;
415 ath_print(common, ATH_DBG_CALIBRATE,
416 "New: Chn %d iCoff = 0x%08x\n", i, iCoff);
417 if (iqCorrNeg == 0x0)
418 iCoff = 0x40 - iCoff;
422 else if (qCoff <= -16)
425 ath_print(common, ATH_DBG_CALIBRATE,
426 "Chn %d : iCoff = 0x%x qCoff = 0x%x\n",
429 REG_RMW_FIELD(ah, AR_PHY_TIMING_CTRL4(i),
430 AR_PHY_TIMING_CTRL4_IQCORR_Q_I_COFF,
432 REG_RMW_FIELD(ah, AR_PHY_TIMING_CTRL4(i),
433 AR_PHY_TIMING_CTRL4_IQCORR_Q_Q_COFF,
435 ath_print(common, ATH_DBG_CALIBRATE,
436 "IQ Cal and Correction done for Chain %d\n",
441 REG_SET_BIT(ah, AR_PHY_TIMING_CTRL4(0),
442 AR_PHY_TIMING_CTRL4_IQCORR_ENABLE);
445 static void ath9k_hw_adc_gaincal_calibrate(struct ath_hw *ah, u8 numChains)
447 struct ath_common *common = ath9k_hw_common(ah);
448 u32 iOddMeasOffset, iEvenMeasOffset, qOddMeasOffset, qEvenMeasOffset;
449 u32 qGainMismatch, iGainMismatch, val, i;
451 for (i = 0; i < numChains; i++) {
452 iOddMeasOffset = ah->totalAdcIOddPhase[i];
453 iEvenMeasOffset = ah->totalAdcIEvenPhase[i];
454 qOddMeasOffset = ah->totalAdcQOddPhase[i];
455 qEvenMeasOffset = ah->totalAdcQEvenPhase[i];
457 ath_print(common, ATH_DBG_CALIBRATE,
458 "Starting ADC Gain Cal for Chain %d\n", i);
460 ath_print(common, ATH_DBG_CALIBRATE,
461 "Chn %d pwr_meas_odd_i = 0x%08x\n", i,
463 ath_print(common, ATH_DBG_CALIBRATE,
464 "Chn %d pwr_meas_even_i = 0x%08x\n", i,
466 ath_print(common, ATH_DBG_CALIBRATE,
467 "Chn %d pwr_meas_odd_q = 0x%08x\n", i,
469 ath_print(common, ATH_DBG_CALIBRATE,
470 "Chn %d pwr_meas_even_q = 0x%08x\n", i,
473 if (iOddMeasOffset != 0 && qEvenMeasOffset != 0) {
475 ((iEvenMeasOffset * 32) /
476 iOddMeasOffset) & 0x3f;
478 ((qOddMeasOffset * 32) /
479 qEvenMeasOffset) & 0x3f;
481 ath_print(common, ATH_DBG_CALIBRATE,
482 "Chn %d gain_mismatch_i = 0x%08x\n", i,
484 ath_print(common, ATH_DBG_CALIBRATE,
485 "Chn %d gain_mismatch_q = 0x%08x\n", i,
488 val = REG_READ(ah, AR_PHY_NEW_ADC_DC_GAIN_CORR(i));
490 val |= (qGainMismatch) | (iGainMismatch << 6);
491 REG_WRITE(ah, AR_PHY_NEW_ADC_DC_GAIN_CORR(i), val);
493 ath_print(common, ATH_DBG_CALIBRATE,
494 "ADC Gain Cal done for Chain %d\n", i);
498 REG_WRITE(ah, AR_PHY_NEW_ADC_DC_GAIN_CORR(0),
499 REG_READ(ah, AR_PHY_NEW_ADC_DC_GAIN_CORR(0)) |
500 AR_PHY_NEW_ADC_GAIN_CORR_ENABLE);
503 static void ath9k_hw_adc_dccal_calibrate(struct ath_hw *ah, u8 numChains)
505 struct ath_common *common = ath9k_hw_common(ah);
506 u32 iOddMeasOffset, iEvenMeasOffset, val, i;
507 int32_t qOddMeasOffset, qEvenMeasOffset, qDcMismatch, iDcMismatch;
508 const struct ath9k_percal_data *calData =
509 ah->cal_list_curr->calData;
511 (1 << (calData->calCountMax + 5)) * calData->calNumSamples;
513 for (i = 0; i < numChains; i++) {
514 iOddMeasOffset = ah->totalAdcDcOffsetIOddPhase[i];
515 iEvenMeasOffset = ah->totalAdcDcOffsetIEvenPhase[i];
516 qOddMeasOffset = ah->totalAdcDcOffsetQOddPhase[i];
517 qEvenMeasOffset = ah->totalAdcDcOffsetQEvenPhase[i];
519 ath_print(common, ATH_DBG_CALIBRATE,
520 "Starting ADC DC Offset Cal for Chain %d\n", i);
522 ath_print(common, ATH_DBG_CALIBRATE,
523 "Chn %d pwr_meas_odd_i = %d\n", i,
525 ath_print(common, ATH_DBG_CALIBRATE,
526 "Chn %d pwr_meas_even_i = %d\n", i,
528 ath_print(common, ATH_DBG_CALIBRATE,
529 "Chn %d pwr_meas_odd_q = %d\n", i,
531 ath_print(common, ATH_DBG_CALIBRATE,
532 "Chn %d pwr_meas_even_q = %d\n", i,
535 iDcMismatch = (((iEvenMeasOffset - iOddMeasOffset) * 2) /
537 qDcMismatch = (((qOddMeasOffset - qEvenMeasOffset) * 2) /
540 ath_print(common, ATH_DBG_CALIBRATE,
541 "Chn %d dc_offset_mismatch_i = 0x%08x\n", i,
543 ath_print(common, ATH_DBG_CALIBRATE,
544 "Chn %d dc_offset_mismatch_q = 0x%08x\n", i,
547 val = REG_READ(ah, AR_PHY_NEW_ADC_DC_GAIN_CORR(i));
549 val |= (qDcMismatch << 12) | (iDcMismatch << 21);
550 REG_WRITE(ah, AR_PHY_NEW_ADC_DC_GAIN_CORR(i), val);
552 ath_print(common, ATH_DBG_CALIBRATE,
553 "ADC DC Offset Cal done for Chain %d\n", i);
556 REG_WRITE(ah, AR_PHY_NEW_ADC_DC_GAIN_CORR(0),
557 REG_READ(ah, AR_PHY_NEW_ADC_DC_GAIN_CORR(0)) |
558 AR_PHY_NEW_ADC_DC_OFFSET_CORR_ENABLE);
561 /* This is done for the currently configured channel */
562 bool ath9k_hw_reset_calvalid(struct ath_hw *ah)
564 struct ath_common *common = ath9k_hw_common(ah);
565 struct ieee80211_conf *conf = &common->hw->conf;
566 struct ath9k_cal_list *currCal = ah->cal_list_curr;
571 if (!AR_SREV_9100(ah) && !AR_SREV_9160_10_OR_LATER(ah))
577 if (currCal->calState != CAL_DONE) {
578 ath_print(common, ATH_DBG_CALIBRATE,
579 "Calibration state incorrect, %d\n",
584 if (!ath9k_hw_iscal_supported(ah, currCal->calData->calType))
587 ath_print(common, ATH_DBG_CALIBRATE,
588 "Resetting Cal %d state for channel %u\n",
589 currCal->calData->calType, conf->channel->center_freq);
591 ah->curchan->CalValid &= ~currCal->calData->calType;
592 currCal->calState = CAL_WAITING;
597 void ath9k_hw_start_nfcal(struct ath_hw *ah)
599 REG_SET_BIT(ah, AR_PHY_AGC_CONTROL,
600 AR_PHY_AGC_CONTROL_ENABLE_NF);
601 REG_SET_BIT(ah, AR_PHY_AGC_CONTROL,
602 AR_PHY_AGC_CONTROL_NO_UPDATE_NF);
603 REG_SET_BIT(ah, AR_PHY_AGC_CONTROL, AR_PHY_AGC_CONTROL_NF);
606 void ath9k_hw_loadnf(struct ath_hw *ah, struct ath9k_channel *chan)
608 struct ath9k_nfcal_hist *h;
611 const u32 ar5416_cca_regs[6] = {
619 u8 chainmask, rx_chain_status;
621 rx_chain_status = REG_READ(ah, AR_PHY_RX_CHAINMASK);
622 if (AR_SREV_9285(ah))
624 else if (AR_SREV_9280(ah) || AR_SREV_9287(ah)) {
625 if ((rx_chain_status & 0x2) || (rx_chain_status & 0x4))
630 if (rx_chain_status & 0x4)
632 else if (rx_chain_status & 0x2)
640 for (i = 0; i < NUM_NF_READINGS; i++) {
641 if (chainmask & (1 << i)) {
642 val = REG_READ(ah, ar5416_cca_regs[i]);
644 val |= (((u32) (h[i].privNF) << 1) & 0x1ff);
645 REG_WRITE(ah, ar5416_cca_regs[i], val);
649 REG_CLR_BIT(ah, AR_PHY_AGC_CONTROL,
650 AR_PHY_AGC_CONTROL_ENABLE_NF);
651 REG_CLR_BIT(ah, AR_PHY_AGC_CONTROL,
652 AR_PHY_AGC_CONTROL_NO_UPDATE_NF);
653 REG_SET_BIT(ah, AR_PHY_AGC_CONTROL, AR_PHY_AGC_CONTROL_NF);
655 for (j = 0; j < 1000; j++) {
656 if ((REG_READ(ah, AR_PHY_AGC_CONTROL) &
657 AR_PHY_AGC_CONTROL_NF) == 0)
662 for (i = 0; i < NUM_NF_READINGS; i++) {
663 if (chainmask & (1 << i)) {
664 val = REG_READ(ah, ar5416_cca_regs[i]);
666 val |= (((u32) (-50) << 1) & 0x1ff);
667 REG_WRITE(ah, ar5416_cca_regs[i], val);
672 int16_t ath9k_hw_getnf(struct ath_hw *ah,
673 struct ath9k_channel *chan)
675 struct ath_common *common = ath9k_hw_common(ah);
676 int16_t nf, nfThresh;
677 int16_t nfarray[NUM_NF_READINGS] = { 0 };
678 struct ath9k_nfcal_hist *h;
679 struct ieee80211_channel *c = chan->chan;
681 chan->channelFlags &= (~CHANNEL_CW_INT);
682 if (REG_READ(ah, AR_PHY_AGC_CONTROL) & AR_PHY_AGC_CONTROL_NF) {
683 ath_print(common, ATH_DBG_CALIBRATE,
684 "NF did not complete in calibration window\n");
686 chan->rawNoiseFloor = nf;
687 return chan->rawNoiseFloor;
689 ath9k_hw_do_getnf(ah, nfarray);
691 if (getNoiseFloorThresh(ah, c->band, &nfThresh)
693 ath_print(common, ATH_DBG_CALIBRATE,
694 "noise floor failed detected; "
695 "detected %d, threshold %d\n",
697 chan->channelFlags |= CHANNEL_CW_INT;
703 ath9k_hw_update_nfcal_hist_buffer(h, nfarray);
704 chan->rawNoiseFloor = h[0].privNF;
706 return chan->rawNoiseFloor;
709 void ath9k_init_nfcal_hist_buffer(struct ath_hw *ah)
714 if (AR_SREV_9280(ah))
715 noise_floor = AR_PHY_CCA_MAX_AR9280_GOOD_VALUE;
716 else if (AR_SREV_9285(ah))
717 noise_floor = AR_PHY_CCA_MAX_AR9285_GOOD_VALUE;
718 else if (AR_SREV_9287(ah))
719 noise_floor = AR_PHY_CCA_MAX_AR9287_GOOD_VALUE;
721 noise_floor = AR_PHY_CCA_MAX_AR5416_GOOD_VALUE;
723 for (i = 0; i < NUM_NF_READINGS; i++) {
724 ah->nfCalHist[i].currIndex = 0;
725 ah->nfCalHist[i].privNF = noise_floor;
726 ah->nfCalHist[i].invalidNFcount =
727 AR_PHY_CCA_FILTERWINDOW_LENGTH;
728 for (j = 0; j < ATH9K_NF_CAL_HIST_MAX; j++) {
729 ah->nfCalHist[i].nfCalBuffer[j] = noise_floor;
734 s16 ath9k_hw_getchan_noise(struct ath_hw *ah, struct ath9k_channel *chan)
738 if (chan->rawNoiseFloor == 0)
741 nf = chan->rawNoiseFloor;
743 if (!ath9k_hw_nf_in_range(ah, nf))
744 nf = ATH_DEFAULT_NOISE_FLOOR;
749 static void ath9k_olc_temp_compensation(struct ath_hw *ah)
752 int delta, currPDADC, regval, slope;
754 rddata = REG_READ(ah, AR_PHY_TX_PWRCTRL4);
755 currPDADC = MS(rddata, AR_PHY_TX_PWRCTRL_PD_AVG_OUT);
758 if (OLC_FOR_AR9287_10_LATER) {
759 if (ah->initPDADC == 0 || currPDADC == 0) {
762 slope = ah->eep_ops->get_eeprom(ah, EEP_TEMPSENSE_SLOPE);
766 delta = ((currPDADC - ah->initPDADC)*4) / slope;
767 REG_RMW_FIELD(ah, AR_PHY_CH0_TX_PWRCTRL11,
768 AR_PHY_TX_PWRCTRL_OLPC_TEMP_COMP, delta);
769 REG_RMW_FIELD(ah, AR_PHY_CH1_TX_PWRCTRL11,
770 AR_PHY_TX_PWRCTRL_OLPC_TEMP_COMP, delta);
773 if (ah->eep_ops->get_eeprom(ah, EEP_DAC_HPWR_5G))
774 delta = (currPDADC - ah->initPDADC + 4) / 8;
776 delta = (currPDADC - ah->initPDADC + 5) / 10;
778 if (delta != ah->PDADCdelta) {
779 ah->PDADCdelta = delta;
780 for (i = 1; i < AR9280_TX_GAIN_TABLE_SIZE; i++) {
781 regval = ah->originalGain[i] - delta;
785 REG_RMW_FIELD(ah, AR_PHY_TX_GAIN_TBL1 + i * 4,
786 AR_PHY_TX_GAIN, regval);
792 static void ath9k_hw_9271_pa_cal(struct ath_hw *ah)
796 u32 regList [][2] = {
807 for (i = 0; i < ARRAY_SIZE(regList); i++)
808 regList[i][1] = REG_READ(ah, regList[i][0]);
810 regVal = REG_READ(ah, 0x7834);
812 REG_WRITE(ah, 0x7834, regVal);
813 regVal = REG_READ(ah, 0x9808);
814 regVal |= (0x1 << 27);
815 REG_WRITE(ah, 0x9808, regVal);
817 /* 786c,b23,1, pwddac=1 */
818 REG_RMW_FIELD(ah, AR9285_AN_TOP3, AR9285_AN_TOP3_PWDDAC, 1);
819 /* 7854, b5,1, pdrxtxbb=1 */
820 REG_RMW_FIELD(ah, AR9285_AN_RXTXBB1, AR9285_AN_RXTXBB1_PDRXTXBB1, 1);
821 /* 7854, b7,1, pdv2i=1 */
822 REG_RMW_FIELD(ah, AR9285_AN_RXTXBB1, AR9285_AN_RXTXBB1_PDV2I, 1);
823 /* 7854, b8,1, pddacinterface=1 */
824 REG_RMW_FIELD(ah, AR9285_AN_RXTXBB1, AR9285_AN_RXTXBB1_PDDACIF, 1);
825 /* 7824,b12,0, offcal=0 */
826 REG_RMW_FIELD(ah, AR9285_AN_RF2G2, AR9285_AN_RF2G2_OFFCAL, 0);
827 /* 7838, b1,0, pwddb=0 */
828 REG_RMW_FIELD(ah, AR9285_AN_RF2G7, AR9285_AN_RF2G7_PWDDB, 0);
829 /* 7820,b11,0, enpacal=0 */
830 REG_RMW_FIELD(ah, AR9285_AN_RF2G1, AR9285_AN_RF2G1_ENPACAL, 0);
831 /* 7820,b25,1, pdpadrv1=0 */
832 REG_RMW_FIELD(ah, AR9285_AN_RF2G1, AR9285_AN_RF2G1_PDPADRV1, 0);
833 /* 7820,b24,0, pdpadrv2=0 */
834 REG_RMW_FIELD(ah, AR9285_AN_RF2G1,AR9285_AN_RF2G1_PDPADRV2,0);
835 /* 7820,b23,0, pdpaout=0 */
836 REG_RMW_FIELD(ah, AR9285_AN_RF2G1, AR9285_AN_RF2G1_PDPAOUT, 0);
837 /* 783c,b14-16,7, padrvgn2tab_0=7 */
838 REG_RMW_FIELD(ah, AR9285_AN_RF2G8,AR9285_AN_RF2G8_PADRVGN2TAB0, 7);
840 * 7838,b29-31,0, padrvgn1tab_0=0
841 * does not matter since we turn it off
843 REG_RMW_FIELD(ah, AR9285_AN_RF2G7,AR9285_AN_RF2G7_PADRVGN2TAB0, 0);
845 REG_RMW_FIELD(ah, AR9285_AN_RF2G3, AR9271_AN_RF2G3_CCOMP, 0xfff);
848 * localmode=1,bmode=1,bmoderxtx=1,synthon=1,
849 * txon=1,paon=1,oscon=1,synthon_force=1
851 REG_WRITE(ah, AR9285_AN_TOP2, 0xca0358a0);
853 REG_RMW_FIELD(ah, AR9285_AN_RF2G6, AR9271_AN_RF2G6_OFFS, 0);
856 for (i = 6; i >= 0; i--) {
857 regVal = REG_READ(ah, 0x7834);
858 regVal |= (1 << (20 + i));
859 REG_WRITE(ah, 0x7834, regVal);
861 //regVal = REG_READ(ah, 0x7834);
862 regVal &= (~(0x1 << (20 + i)));
863 regVal |= (MS(REG_READ(ah, 0x7840), AR9285_AN_RXTXBB1_SPARE9)
865 REG_WRITE(ah, 0x7834, regVal);
868 /* Empirical offset correction */
870 REG_RMW_FIELD(ah, AR9285_AN_RF2G6, AR9271_AN_RF2G6_OFFS, 0x20);
873 regVal = REG_READ(ah, 0x7834);
875 REG_WRITE(ah, 0x7834, regVal);
876 regVal = REG_READ(ah, 0x9808);
877 regVal &= (~(0x1 << 27));
878 REG_WRITE(ah, 0x9808, regVal);
880 for (i = 0; i < ARRAY_SIZE(regList); i++)
881 REG_WRITE(ah, regList[i][0], regList[i][1]);
884 static inline void ath9k_hw_9285_pa_cal(struct ath_hw *ah, bool is_reset)
886 struct ath_common *common = ath9k_hw_common(ah);
888 int i, offset, offs_6_1, offs_0;
889 u32 ccomp_org, reg_field;
900 ath_print(common, ATH_DBG_CALIBRATE, "Running PA Calibration\n");
902 /* PA CAL is not needed for high power solution */
903 if (ah->eep_ops->get_eeprom(ah, EEP_TXGAIN_TYPE) ==
904 AR5416_EEP_TXGAIN_HIGH_POWER)
907 if (AR_SREV_9285_11(ah)) {
908 REG_WRITE(ah, AR9285_AN_TOP4, (AR9285_AN_TOP4_DEFAULT | 0x14));
912 for (i = 0; i < ARRAY_SIZE(regList); i++)
913 regList[i][1] = REG_READ(ah, regList[i][0]);
915 regVal = REG_READ(ah, 0x7834);
917 REG_WRITE(ah, 0x7834, regVal);
918 regVal = REG_READ(ah, 0x9808);
919 regVal |= (0x1 << 27);
920 REG_WRITE(ah, 0x9808, regVal);
922 REG_RMW_FIELD(ah, AR9285_AN_TOP3, AR9285_AN_TOP3_PWDDAC, 1);
923 REG_RMW_FIELD(ah, AR9285_AN_RXTXBB1, AR9285_AN_RXTXBB1_PDRXTXBB1, 1);
924 REG_RMW_FIELD(ah, AR9285_AN_RXTXBB1, AR9285_AN_RXTXBB1_PDV2I, 1);
925 REG_RMW_FIELD(ah, AR9285_AN_RXTXBB1, AR9285_AN_RXTXBB1_PDDACIF, 1);
926 REG_RMW_FIELD(ah, AR9285_AN_RF2G2, AR9285_AN_RF2G2_OFFCAL, 0);
927 REG_RMW_FIELD(ah, AR9285_AN_RF2G7, AR9285_AN_RF2G7_PWDDB, 0);
928 REG_RMW_FIELD(ah, AR9285_AN_RF2G1, AR9285_AN_RF2G1_ENPACAL, 0);
929 REG_RMW_FIELD(ah, AR9285_AN_RF2G1, AR9285_AN_RF2G1_PDPADRV1, 0);
930 REG_RMW_FIELD(ah, AR9285_AN_RF2G1, AR9285_AN_RF2G1_PDPADRV2, 0);
931 REG_RMW_FIELD(ah, AR9285_AN_RF2G1, AR9285_AN_RF2G1_PDPAOUT, 0);
932 REG_RMW_FIELD(ah, AR9285_AN_RF2G8, AR9285_AN_RF2G8_PADRVGN2TAB0, 7);
933 REG_RMW_FIELD(ah, AR9285_AN_RF2G7, AR9285_AN_RF2G7_PADRVGN2TAB0, 0);
934 ccomp_org = MS(REG_READ(ah, AR9285_AN_RF2G6), AR9285_AN_RF2G6_CCOMP);
935 REG_RMW_FIELD(ah, AR9285_AN_RF2G6, AR9285_AN_RF2G6_CCOMP, 0xf);
937 REG_WRITE(ah, AR9285_AN_TOP2, 0xca0358a0);
939 REG_RMW_FIELD(ah, AR9285_AN_RF2G6, AR9285_AN_RF2G6_OFFS, 0);
940 REG_RMW_FIELD(ah, AR9285_AN_RF2G3, AR9285_AN_RF2G3_PDVCCOMP, 0);
942 for (i = 6; i > 0; i--) {
943 regVal = REG_READ(ah, 0x7834);
944 regVal |= (1 << (19 + i));
945 REG_WRITE(ah, 0x7834, regVal);
947 regVal = REG_READ(ah, 0x7834);
948 regVal &= (~(0x1 << (19 + i)));
949 reg_field = MS(REG_READ(ah, 0x7840), AR9285_AN_RXTXBB1_SPARE9);
950 regVal |= (reg_field << (19 + i));
951 REG_WRITE(ah, 0x7834, regVal);
954 REG_RMW_FIELD(ah, AR9285_AN_RF2G3, AR9285_AN_RF2G3_PDVCCOMP, 1);
956 reg_field = MS(REG_READ(ah, AR9285_AN_RF2G9), AR9285_AN_RXTXBB1_SPARE9);
957 REG_RMW_FIELD(ah, AR9285_AN_RF2G3, AR9285_AN_RF2G3_PDVCCOMP, reg_field);
958 offs_6_1 = MS(REG_READ(ah, AR9285_AN_RF2G6), AR9285_AN_RF2G6_OFFS);
959 offs_0 = MS(REG_READ(ah, AR9285_AN_RF2G3), AR9285_AN_RF2G3_PDVCCOMP);
961 offset = (offs_6_1<<1) | offs_0;
963 offs_6_1 = offset>>1;
966 if ((!is_reset) && (ah->pacal_info.prev_offset == offset)) {
967 if (ah->pacal_info.max_skipcount < MAX_PACAL_SKIPCOUNT)
968 ah->pacal_info.max_skipcount =
969 2 * ah->pacal_info.max_skipcount;
970 ah->pacal_info.skipcount = ah->pacal_info.max_skipcount;
972 ah->pacal_info.max_skipcount = 1;
973 ah->pacal_info.skipcount = 0;
974 ah->pacal_info.prev_offset = offset;
977 REG_RMW_FIELD(ah, AR9285_AN_RF2G6, AR9285_AN_RF2G6_OFFS, offs_6_1);
978 REG_RMW_FIELD(ah, AR9285_AN_RF2G3, AR9285_AN_RF2G3_PDVCCOMP, offs_0);
980 regVal = REG_READ(ah, 0x7834);
982 REG_WRITE(ah, 0x7834, regVal);
983 regVal = REG_READ(ah, 0x9808);
984 regVal &= (~(0x1 << 27));
985 REG_WRITE(ah, 0x9808, regVal);
987 for (i = 0; i < ARRAY_SIZE(regList); i++)
988 REG_WRITE(ah, regList[i][0], regList[i][1]);
990 REG_RMW_FIELD(ah, AR9285_AN_RF2G6, AR9285_AN_RF2G6_CCOMP, ccomp_org);
992 if (AR_SREV_9285_11(ah))
993 REG_WRITE(ah, AR9285_AN_TOP4, AR9285_AN_TOP4_DEFAULT);
997 bool ath9k_hw_calibrate(struct ath_hw *ah, struct ath9k_channel *chan,
998 u8 rxchainmask, bool longcal)
1000 bool iscaldone = true;
1001 struct ath9k_cal_list *currCal = ah->cal_list_curr;
1004 (currCal->calState == CAL_RUNNING ||
1005 currCal->calState == CAL_WAITING)) {
1006 iscaldone = ath9k_hw_per_calibration(ah, chan,
1007 rxchainmask, currCal);
1009 ah->cal_list_curr = currCal = currCal->calNext;
1011 if (currCal->calState == CAL_WAITING) {
1013 ath9k_hw_reset_calibration(ah, currCal);
1018 /* Do NF cal only at longer intervals */
1020 /* Do periodic PAOffset Cal */
1021 if (AR_SREV_9271(ah))
1022 ath9k_hw_9271_pa_cal(ah);
1023 else if (AR_SREV_9285_11_OR_LATER(ah)) {
1024 if (!ah->pacal_info.skipcount)
1025 ath9k_hw_9285_pa_cal(ah, false);
1027 ah->pacal_info.skipcount--;
1030 if (OLC_FOR_AR9280_20_LATER || OLC_FOR_AR9287_10_LATER)
1031 ath9k_olc_temp_compensation(ah);
1033 /* Get the value from the previous NF cal and update history buffer */
1034 ath9k_hw_getnf(ah, chan);
1037 * Load the NF from history buffer of the current channel.
1038 * NF is slow time-variant, so it is OK to use a historical value.
1040 ath9k_hw_loadnf(ah, ah->curchan);
1042 ath9k_hw_start_nfcal(ah);
1048 static bool ar9285_clc(struct ath_hw *ah, struct ath9k_channel *chan)
1050 struct ath_common *common = ath9k_hw_common(ah);
1052 REG_SET_BIT(ah, AR_PHY_CL_CAL_CTL, AR_PHY_CL_CAL_ENABLE);
1053 if (IS_CHAN_HT20(chan)) {
1054 REG_SET_BIT(ah, AR_PHY_CL_CAL_CTL, AR_PHY_PARALLEL_CAL_ENABLE);
1055 REG_SET_BIT(ah, AR_PHY_TURBO, AR_PHY_FC_DYN2040_EN);
1056 REG_CLR_BIT(ah, AR_PHY_AGC_CONTROL,
1057 AR_PHY_AGC_CONTROL_FLTR_CAL);
1058 REG_CLR_BIT(ah, AR_PHY_TPCRG1, AR_PHY_TPCRG1_PD_CAL_ENABLE);
1059 REG_SET_BIT(ah, AR_PHY_AGC_CONTROL, AR_PHY_AGC_CONTROL_CAL);
1060 if (!ath9k_hw_wait(ah, AR_PHY_AGC_CONTROL,
1061 AR_PHY_AGC_CONTROL_CAL, 0, AH_WAIT_TIMEOUT)) {
1062 ath_print(common, ATH_DBG_CALIBRATE, "offset "
1063 "calibration failed to complete in "
1067 REG_CLR_BIT(ah, AR_PHY_TURBO, AR_PHY_FC_DYN2040_EN);
1068 REG_CLR_BIT(ah, AR_PHY_CL_CAL_CTL, AR_PHY_PARALLEL_CAL_ENABLE);
1069 REG_CLR_BIT(ah, AR_PHY_CL_CAL_CTL, AR_PHY_CL_CAL_ENABLE);
1071 REG_CLR_BIT(ah, AR_PHY_ADC_CTL, AR_PHY_ADC_CTL_OFF_PWDADC);
1072 REG_SET_BIT(ah, AR_PHY_AGC_CONTROL, AR_PHY_AGC_CONTROL_FLTR_CAL);
1073 REG_SET_BIT(ah, AR_PHY_TPCRG1, AR_PHY_TPCRG1_PD_CAL_ENABLE);
1074 REG_SET_BIT(ah, AR_PHY_AGC_CONTROL, AR_PHY_AGC_CONTROL_CAL);
1075 if (!ath9k_hw_wait(ah, AR_PHY_AGC_CONTROL, AR_PHY_AGC_CONTROL_CAL,
1076 0, AH_WAIT_TIMEOUT)) {
1077 ath_print(common, ATH_DBG_CALIBRATE, "offset calibration "
1078 "failed to complete in 1ms; noisy ??\n");
1082 REG_SET_BIT(ah, AR_PHY_ADC_CTL, AR_PHY_ADC_CTL_OFF_PWDADC);
1083 REG_CLR_BIT(ah, AR_PHY_CL_CAL_CTL, AR_PHY_CL_CAL_ENABLE);
1084 REG_CLR_BIT(ah, AR_PHY_AGC_CONTROL, AR_PHY_AGC_CONTROL_FLTR_CAL);
1089 bool ath9k_hw_init_cal(struct ath_hw *ah, struct ath9k_channel *chan)
1091 struct ath_common *common = ath9k_hw_common(ah);
1093 if (AR_SREV_9285_12_OR_LATER(ah)) {
1094 if (!ar9285_clc(ah, chan))
1097 if (AR_SREV_9280_10_OR_LATER(ah)) {
1098 if (!AR_SREV_9287_10_OR_LATER(ah))
1099 REG_CLR_BIT(ah, AR_PHY_ADC_CTL,
1100 AR_PHY_ADC_CTL_OFF_PWDADC);
1101 REG_SET_BIT(ah, AR_PHY_AGC_CONTROL,
1102 AR_PHY_AGC_CONTROL_FLTR_CAL);
1105 /* Calibrate the AGC */
1106 REG_WRITE(ah, AR_PHY_AGC_CONTROL,
1107 REG_READ(ah, AR_PHY_AGC_CONTROL) |
1108 AR_PHY_AGC_CONTROL_CAL);
1110 /* Poll for offset calibration complete */
1111 if (!ath9k_hw_wait(ah, AR_PHY_AGC_CONTROL, AR_PHY_AGC_CONTROL_CAL,
1112 0, AH_WAIT_TIMEOUT)) {
1113 ath_print(common, ATH_DBG_CALIBRATE,
1114 "offset calibration failed to "
1115 "complete in 1ms; noisy environment?\n");
1119 if (AR_SREV_9280_10_OR_LATER(ah)) {
1120 if (!AR_SREV_9287_10_OR_LATER(ah))
1121 REG_SET_BIT(ah, AR_PHY_ADC_CTL,
1122 AR_PHY_ADC_CTL_OFF_PWDADC);
1123 REG_CLR_BIT(ah, AR_PHY_AGC_CONTROL,
1124 AR_PHY_AGC_CONTROL_FLTR_CAL);
1128 /* Do PA Calibration */
1129 if (AR_SREV_9285_11_OR_LATER(ah))
1130 ath9k_hw_9285_pa_cal(ah, true);
1132 /* Do NF Calibration after DC offset and other calibrations */
1133 REG_WRITE(ah, AR_PHY_AGC_CONTROL,
1134 REG_READ(ah, AR_PHY_AGC_CONTROL) | AR_PHY_AGC_CONTROL_NF);
1136 ah->cal_list = ah->cal_list_last = ah->cal_list_curr = NULL;
1138 /* Enable IQ, ADC Gain and ADC DC offset CALs */
1139 if (AR_SREV_9100(ah) || AR_SREV_9160_10_OR_LATER(ah)) {
1140 if (ath9k_hw_iscal_supported(ah, ADC_GAIN_CAL)) {
1141 INIT_CAL(&ah->adcgain_caldata);
1142 INSERT_CAL(ah, &ah->adcgain_caldata);
1143 ath_print(common, ATH_DBG_CALIBRATE,
1144 "enabling ADC Gain Calibration.\n");
1146 if (ath9k_hw_iscal_supported(ah, ADC_DC_CAL)) {
1147 INIT_CAL(&ah->adcdc_caldata);
1148 INSERT_CAL(ah, &ah->adcdc_caldata);
1149 ath_print(common, ATH_DBG_CALIBRATE,
1150 "enabling ADC DC Calibration.\n");
1152 if (ath9k_hw_iscal_supported(ah, IQ_MISMATCH_CAL)) {
1153 INIT_CAL(&ah->iq_caldata);
1154 INSERT_CAL(ah, &ah->iq_caldata);
1155 ath_print(common, ATH_DBG_CALIBRATE,
1156 "enabling IQ Calibration.\n");
1159 ah->cal_list_curr = ah->cal_list;
1161 if (ah->cal_list_curr)
1162 ath9k_hw_reset_calibration(ah, ah->cal_list_curr);
1170 const struct ath9k_percal_data iq_cal_multi_sample = {
1174 ath9k_hw_iqcal_collect,
1175 ath9k_hw_iqcalibrate
1177 const struct ath9k_percal_data iq_cal_single_sample = {
1181 ath9k_hw_iqcal_collect,
1182 ath9k_hw_iqcalibrate
1184 const struct ath9k_percal_data adc_gain_cal_multi_sample = {
1188 ath9k_hw_adc_gaincal_collect,
1189 ath9k_hw_adc_gaincal_calibrate
1191 const struct ath9k_percal_data adc_gain_cal_single_sample = {
1195 ath9k_hw_adc_gaincal_collect,
1196 ath9k_hw_adc_gaincal_calibrate
1198 const struct ath9k_percal_data adc_dc_cal_multi_sample = {
1202 ath9k_hw_adc_dccal_collect,
1203 ath9k_hw_adc_dccal_calibrate
1205 const struct ath9k_percal_data adc_dc_cal_single_sample = {
1209 ath9k_hw_adc_dccal_collect,
1210 ath9k_hw_adc_dccal_calibrate
1212 const struct ath9k_percal_data adc_init_dc_cal = {
1216 ath9k_hw_adc_dccal_collect,
1217 ath9k_hw_adc_dccal_calibrate