aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath/ath9k/ar9003_calib.c
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2010-10-03 13:07:16 -0400
committerJohn W. Linville <linville@tuxdriver.com>2010-10-06 16:26:01 -0400
commit6497827f53eb90dcf30c5d6414c83238f722e8ae (patch)
tree0d62c5406b55c30158daf0421f4e075f287e0ba9 /drivers/net/wireless/ath/ath9k/ar9003_calib.c
parent373426cac0cbb7f762018127803dcd70838e2cdf (diff)
ath9k_hw: clean up calibration flags
The calibration actual calibration flags are only used by the per chip family source files, so it makes more sense to define them in those files instead of globally. That way the code has to test for less flags. Also instead of using a separate callback for testing whether a particular calibration type is supported, simply adjust ah->supp_cals in the calibration init which is called right after the hardware reset, before any of the calibrations are run. Signed-off-by: Felix Fietkau <nbd@openwrt.org> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/ath/ath9k/ar9003_calib.c')
-rw-r--r--drivers/net/wireless/ath/ath9k/ar9003_calib.c36
1 files changed, 8 insertions, 28 deletions
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_calib.c b/drivers/net/wireless/ath/ath9k/ar9003_calib.c
index b41f5cda824b..9e6edffe0bd1 100644
--- a/drivers/net/wireless/ath/ath9k/ar9003_calib.c
+++ b/drivers/net/wireless/ath/ath9k/ar9003_calib.c
@@ -18,6 +18,11 @@
18#include "hw-ops.h" 18#include "hw-ops.h"
19#include "ar9003_phy.h" 19#include "ar9003_phy.h"
20 20
21enum ar9003_cal_types {
22 IQ_MISMATCH_CAL = BIT(0),
23 TEMP_COMP_CAL = BIT(1),
24};
25
21static void ar9003_hw_setup_calibration(struct ath_hw *ah, 26static void ar9003_hw_setup_calibration(struct ath_hw *ah,
22 struct ath9k_cal_list *currCal) 27 struct ath9k_cal_list *currCal)
23{ 28{
@@ -50,10 +55,6 @@ static void ar9003_hw_setup_calibration(struct ath_hw *ah,
50 ath_print(common, ATH_DBG_CALIBRATE, 55 ath_print(common, ATH_DBG_CALIBRATE,
51 "starting Temperature Compensation Calibration\n"); 56 "starting Temperature Compensation Calibration\n");
52 break; 57 break;
53 case ADC_GAIN_CAL:
54 case ADC_DC_CAL:
55 /* Not yet */
56 break;
57 } 58 }
58} 59}
59 60
@@ -313,27 +314,6 @@ static const struct ath9k_percal_data iq_cal_single_sample = {
313static void ar9003_hw_init_cal_settings(struct ath_hw *ah) 314static void ar9003_hw_init_cal_settings(struct ath_hw *ah)
314{ 315{
315 ah->iq_caldata.calData = &iq_cal_single_sample; 316 ah->iq_caldata.calData = &iq_cal_single_sample;
316 ah->supp_cals = IQ_MISMATCH_CAL;
317}
318
319static bool ar9003_hw_iscal_supported(struct ath_hw *ah,
320 enum ath9k_cal_types calType)
321{
322 switch (calType & ah->supp_cals) {
323 case IQ_MISMATCH_CAL:
324 /*
325 * XXX: Run IQ Mismatch for non-CCK only
326 * Note that CHANNEL_B is never set though.
327 */
328 return true;
329 case ADC_GAIN_CAL:
330 case ADC_DC_CAL:
331 return false;
332 case TEMP_COMP_CAL:
333 return true;
334 }
335
336 return false;
337} 317}
338 318
339/* 319/*
@@ -772,15 +752,16 @@ static bool ar9003_hw_init_cal(struct ath_hw *ah,
772 752
773 /* Initialize list pointers */ 753 /* Initialize list pointers */
774 ah->cal_list = ah->cal_list_last = ah->cal_list_curr = NULL; 754 ah->cal_list = ah->cal_list_last = ah->cal_list_curr = NULL;
755 ah->supp_cals = IQ_MISMATCH_CAL;
775 756
776 if (ar9003_hw_iscal_supported(ah, IQ_MISMATCH_CAL)) { 757 if (ah->supp_cals & IQ_MISMATCH_CAL) {
777 INIT_CAL(&ah->iq_caldata); 758 INIT_CAL(&ah->iq_caldata);
778 INSERT_CAL(ah, &ah->iq_caldata); 759 INSERT_CAL(ah, &ah->iq_caldata);
779 ath_print(common, ATH_DBG_CALIBRATE, 760 ath_print(common, ATH_DBG_CALIBRATE,
780 "enabling IQ Calibration.\n"); 761 "enabling IQ Calibration.\n");
781 } 762 }
782 763
783 if (ar9003_hw_iscal_supported(ah, TEMP_COMP_CAL)) { 764 if (ah->supp_cals & TEMP_COMP_CAL) {
784 INIT_CAL(&ah->tempCompCalData); 765 INIT_CAL(&ah->tempCompCalData);
785 INSERT_CAL(ah, &ah->tempCompCalData); 766 INSERT_CAL(ah, &ah->tempCompCalData);
786 ath_print(common, ATH_DBG_CALIBRATE, 767 ath_print(common, ATH_DBG_CALIBRATE,
@@ -807,7 +788,6 @@ void ar9003_hw_attach_calib_ops(struct ath_hw *ah)
807 priv_ops->init_cal_settings = ar9003_hw_init_cal_settings; 788 priv_ops->init_cal_settings = ar9003_hw_init_cal_settings;
808 priv_ops->init_cal = ar9003_hw_init_cal; 789 priv_ops->init_cal = ar9003_hw_init_cal;
809 priv_ops->setup_calibration = ar9003_hw_setup_calibration; 790 priv_ops->setup_calibration = ar9003_hw_setup_calibration;
810 priv_ops->iscal_supported = ar9003_hw_iscal_supported;
811 791
812 ops->calibrate = ar9003_hw_calibrate; 792 ops->calibrate = ar9003_hw_calibrate;
813} 793}