diff options
Diffstat (limited to 'drivers/net/wireless/ath/ath9k/ar9003_calib.c')
-rw-r--r-- | drivers/net/wireless/ath/ath9k/ar9003_calib.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_calib.c b/drivers/net/wireless/ath/ath9k/ar9003_calib.c index 5a065039913..4674ea8c9c9 100644 --- a/drivers/net/wireless/ath/ath9k/ar9003_calib.c +++ b/drivers/net/wireless/ath/ath9k/ar9003_calib.c | |||
@@ -68,6 +68,7 @@ static bool ar9003_hw_per_calibration(struct ath_hw *ah, | |||
68 | u8 rxchainmask, | 68 | u8 rxchainmask, |
69 | struct ath9k_cal_list *currCal) | 69 | struct ath9k_cal_list *currCal) |
70 | { | 70 | { |
71 | struct ath9k_hw_cal_data *caldata = ah->caldata; | ||
71 | /* Cal is assumed not done until explicitly set below */ | 72 | /* Cal is assumed not done until explicitly set below */ |
72 | bool iscaldone = false; | 73 | bool iscaldone = false; |
73 | 74 | ||
@@ -95,7 +96,7 @@ static bool ar9003_hw_per_calibration(struct ath_hw *ah, | |||
95 | currCal->calData->calPostProc(ah, numChains); | 96 | currCal->calData->calPostProc(ah, numChains); |
96 | 97 | ||
97 | /* Calibration has finished. */ | 98 | /* Calibration has finished. */ |
98 | ichan->CalValid |= currCal->calData->calType; | 99 | caldata->CalValid |= currCal->calData->calType; |
99 | currCal->calState = CAL_DONE; | 100 | currCal->calState = CAL_DONE; |
100 | iscaldone = true; | 101 | iscaldone = true; |
101 | } else { | 102 | } else { |
@@ -106,7 +107,7 @@ static bool ar9003_hw_per_calibration(struct ath_hw *ah, | |||
106 | ar9003_hw_setup_calibration(ah, currCal); | 107 | ar9003_hw_setup_calibration(ah, currCal); |
107 | } | 108 | } |
108 | } | 109 | } |
109 | } else if (!(ichan->CalValid & currCal->calData->calType)) { | 110 | } else if (!(caldata->CalValid & currCal->calData->calType)) { |
110 | /* If current cal is marked invalid in channel, kick it off */ | 111 | /* If current cal is marked invalid in channel, kick it off */ |
111 | ath9k_hw_reset_calibration(ah, currCal); | 112 | ath9k_hw_reset_calibration(ah, currCal); |
112 | } | 113 | } |
@@ -149,6 +150,12 @@ static bool ar9003_hw_calibrate(struct ath_hw *ah, | |||
149 | /* Do NF cal only at longer intervals */ | 150 | /* Do NF cal only at longer intervals */ |
150 | if (longcal) { | 151 | if (longcal) { |
151 | /* | 152 | /* |
153 | * Get the value from the previous NF cal and update | ||
154 | * history buffer. | ||
155 | */ | ||
156 | ath9k_hw_getnf(ah, chan); | ||
157 | |||
158 | /* | ||
152 | * Load the NF from history buffer of the current channel. | 159 | * Load the NF from history buffer of the current channel. |
153 | * NF is slow time-variant, so it is OK to use a historical | 160 | * NF is slow time-variant, so it is OK to use a historical |
154 | * value. | 161 | * value. |
@@ -156,7 +163,7 @@ static bool ar9003_hw_calibrate(struct ath_hw *ah, | |||
156 | ath9k_hw_loadnf(ah, ah->curchan); | 163 | ath9k_hw_loadnf(ah, ah->curchan); |
157 | 164 | ||
158 | /* start NF calibration, without updating BB NF register */ | 165 | /* start NF calibration, without updating BB NF register */ |
159 | ath9k_hw_start_nfcal(ah); | 166 | ath9k_hw_start_nfcal(ah, false); |
160 | } | 167 | } |
161 | 168 | ||
162 | return iscaldone; | 169 | return iscaldone; |
@@ -762,6 +769,8 @@ static bool ar9003_hw_init_cal(struct ath_hw *ah, | |||
762 | /* Revert chainmasks to their original values before NF cal */ | 769 | /* Revert chainmasks to their original values before NF cal */ |
763 | ar9003_hw_set_chain_masks(ah, ah->rxchainmask, ah->txchainmask); | 770 | ar9003_hw_set_chain_masks(ah, ah->rxchainmask, ah->txchainmask); |
764 | 771 | ||
772 | ath9k_hw_start_nfcal(ah, true); | ||
773 | |||
765 | /* Initialize list pointers */ | 774 | /* Initialize list pointers */ |
766 | ah->cal_list = ah->cal_list_last = ah->cal_list_curr = NULL; | 775 | ah->cal_list = ah->cal_list_last = ah->cal_list_curr = NULL; |
767 | 776 | ||
@@ -785,7 +794,8 @@ static bool ar9003_hw_init_cal(struct ath_hw *ah, | |||
785 | if (ah->cal_list_curr) | 794 | if (ah->cal_list_curr) |
786 | ath9k_hw_reset_calibration(ah, ah->cal_list_curr); | 795 | ath9k_hw_reset_calibration(ah, ah->cal_list_curr); |
787 | 796 | ||
788 | chan->CalValid = 0; | 797 | if (ah->caldata) |
798 | ah->caldata->CalValid = 0; | ||
789 | 799 | ||
790 | return true; | 800 | return true; |
791 | } | 801 | } |