Lines Matching +full:tx +full:- +full:d +full:- +full:cal

2  * Copyright (c) 2008-2011 Atheros Communications Inc.
18 #include "hw-ops.h"
33 for (i = 0; i < ATH9K_NF_CAL_HIST_MAX - 1; i++) { in ath9k_hw_get_nf_hist_mid()
34 for (j = 1; j < ATH9K_NF_CAL_HIST_MAX - i; j++) { in ath9k_hw_get_nf_hist_mid()
35 if (sort[j] > sort[j - 1]) { in ath9k_hw_get_nf_hist_mid()
37 sort[j] = sort[j - 1]; in ath9k_hw_get_nf_hist_mid()
38 sort[j - 1] = nfval; in ath9k_hw_get_nf_hist_mid()
42 nfval = sort[(ATH9K_NF_CAL_HIST_MAX - 1) >> 1]; in ath9k_hw_get_nf_hist_mid()
53 limit = &ah->nf_2g; in ath9k_hw_get_nf_limits()
55 limit = &ah->nf_5g; in ath9k_hw_get_nf_limits()
64 s16 calib_nf = ath9k_hw_get_nf_limits(ah, chan)->cal[chain]; in ath9k_hw_get_default_nf()
69 return ath9k_hw_get_nf_limits(ah, chan)->nominal; in ath9k_hw_get_default_nf()
78 s8 delta = nf - ATH9K_NF_CAL_NOISE_THRESH - in ath9k_hw_getchan_noise()
88 struct ath9k_hw_cal_data *cal, in ath9k_hw_update_nfcal_hist_buffer() argument
95 u8 chainmask = (ah->rxchainmask << 3) | ah->rxchainmask; in ath9k_hw_update_nfcal_hist_buffer()
98 h = cal->nfCalHist; in ath9k_hw_update_nfcal_hist_buffer()
99 limit = ath9k_hw_get_nf_limits(ah, ah->curchan); in ath9k_hw_update_nfcal_hist_buffer()
103 ((i >= AR5416_MAX_CHAINS) && !IS_CHAN_HT40(ah->curchan))) in ath9k_hw_update_nfcal_hist_buffer()
112 h[i].invalidNFcount--; in ath9k_hw_update_nfcal_hist_buffer()
122 if (h[i].privNF > limit->max) { in ath9k_hw_update_nfcal_hist_buffer()
126 "NFmid[%d] (%d) > MAX (%d), %s\n", in ath9k_hw_update_nfcal_hist_buffer()
127 i, h[i].privNF, limit->max, in ath9k_hw_update_nfcal_hist_buffer()
128 (test_bit(NFCAL_INTF, &cal->cal_flags) ? in ath9k_hw_update_nfcal_hist_buffer()
139 if (!test_bit(NFCAL_INTF, &cal->cal_flags)) in ath9k_hw_update_nfcal_hist_buffer()
140 h[i].privNF = limit->max; in ath9k_hw_update_nfcal_hist_buffer()
147 * Re-enable the enforcement of the NF maximum again. in ath9k_hw_update_nfcal_hist_buffer()
150 clear_bit(NFCAL_INTF, &cal->cal_flags); in ath9k_hw_update_nfcal_hist_buffer()
159 *nft = (int8_t)ah->eep_ops->get_eeprom(ah, EEP_NFTHRESH_5); in ath9k_hw_get_nf_thresh()
162 *nft = (int8_t)ah->eep_ops->get_eeprom(ah, EEP_NFTHRESH_2); in ath9k_hw_get_nf_thresh()
179 ah->cal_start_time = jiffies; in ath9k_hw_reset_calibration()
180 currCal->calState = CAL_RUNNING; in ath9k_hw_reset_calibration()
183 ah->meas0.sign[i] = 0; in ath9k_hw_reset_calibration()
184 ah->meas1.sign[i] = 0; in ath9k_hw_reset_calibration()
185 ah->meas2.sign[i] = 0; in ath9k_hw_reset_calibration()
186 ah->meas3.sign[i] = 0; in ath9k_hw_reset_calibration()
189 ah->cal_samples = 0; in ath9k_hw_reset_calibration()
196 struct ath9k_cal_list *currCal = ah->cal_list_curr; in ath9k_hw_reset_calvalid()
198 if (!ah->caldata) in ath9k_hw_reset_calvalid()
207 if (currCal->calState != CAL_DONE) { in ath9k_hw_reset_calvalid()
208 ath_dbg(common, CALIBRATE, "Calibration state incorrect, %d\n", in ath9k_hw_reset_calvalid()
209 currCal->calState); in ath9k_hw_reset_calvalid()
213 currCal = ah->cal_list; in ath9k_hw_reset_calvalid()
215 ath_dbg(common, CALIBRATE, "Resetting Cal %d state for channel %u\n", in ath9k_hw_reset_calvalid()
216 currCal->calData->calType, in ath9k_hw_reset_calvalid()
217 ah->curchan->chan->center_freq); in ath9k_hw_reset_calvalid()
219 ah->caldata->CalValid &= ~currCal->calData->calType; in ath9k_hw_reset_calvalid()
220 currCal->calState = CAL_WAITING; in ath9k_hw_reset_calvalid()
222 currCal = currCal->calNext; in ath9k_hw_reset_calvalid()
223 } while (currCal != ah->cal_list); in ath9k_hw_reset_calvalid()
231 if (ah->caldata) in ath9k_hw_start_nfcal()
232 set_bit(NFCAL_PENDING, &ah->caldata->cal_flags); in ath9k_hw_start_nfcal()
251 u8 chainmask = (ah->rxchainmask << 3) | ah->rxchainmask; in ath9k_hw_loadnf()
253 s16 default_nf = ath9k_hw_get_nf_limits(ah, chan)->nominal; in ath9k_hw_loadnf()
256 if (ah->caldata) in ath9k_hw_loadnf()
257 h = ah->caldata->nfCalHist; in ath9k_hw_loadnf()
267 if (ah->nf_override) in ath9k_hw_loadnf()
268 nfval = ah->nf_override; in ath9k_hw_loadnf()
274 ath9k_hw_get_nf_limits(ah, chan)->cal[i]; in ath9k_hw_loadnf()
275 if (nfval > -60 || nfval < -127) in ath9k_hw_loadnf()
279 REG_RMW(ah, ah->nf_regs[i], in ath9k_hw_loadnf()
285 * stop NF cal if ongoing to ensure NF load completes immediately in ath9k_hw_loadnf()
286 * (or after end rx/tx frame if ongoing) in ath9k_hw_loadnf()
335 * in-progress rx. Simply return here and allow the load plenty of time in ath9k_hw_loadnf()
337 * trying to load -50 (which happens below) while the previous load is in ath9k_hw_loadnf()
339 * here, the baseband nf cal will just be capped by our present in ath9k_hw_loadnf()
346 return -ETIMEDOUT; in ath9k_hw_loadnf()
360 REG_RMW(ah, ah->nf_regs[i], in ath9k_hw_loadnf()
361 (((u32) (-50) << 1) & 0x1ff), 0x1ff); in ath9k_hw_loadnf()
377 if (IS_CHAN_2GHZ(ah->curchan)) in ath9k_hw_nf_sanitize()
378 limit = &ah->nf_2g; in ath9k_hw_nf_sanitize()
380 limit = &ah->nf_5g; in ath9k_hw_nf_sanitize()
387 "NF calibrated [%s] [chain %d] is %d\n", in ath9k_hw_nf_sanitize()
390 if (nf[i] > limit->max) { in ath9k_hw_nf_sanitize()
392 "NF[%d] (%d) > MAX (%d), correcting to MAX\n", in ath9k_hw_nf_sanitize()
393 i, nf[i], limit->max); in ath9k_hw_nf_sanitize()
394 nf[i] = limit->max; in ath9k_hw_nf_sanitize()
395 } else if (nf[i] < limit->min) { in ath9k_hw_nf_sanitize()
397 "NF[%d] (%d) < MIN (%d), correcting to NOM\n", in ath9k_hw_nf_sanitize()
398 i, nf[i], limit->min); in ath9k_hw_nf_sanitize()
399 nf[i] = limit->nominal; in ath9k_hw_nf_sanitize()
410 struct ieee80211_channel *c = chan->chan; in ath9k_hw_getnf()
411 struct ath9k_hw_cal_data *caldata = ah->caldata; in ath9k_hw_getnf()
422 if (ath9k_hw_get_nf_thresh(ah, c->band, &nfThresh) in ath9k_hw_getnf()
425 "noise floor failed detected; detected %d, threshold %d\n", in ath9k_hw_getnf()
430 chan->noisefloor = nf; in ath9k_hw_getnf()
434 h = caldata->nfCalHist; in ath9k_hw_getnf()
435 clear_bit(NFCAL_PENDING, &caldata->cal_flags); in ath9k_hw_getnf()
437 chan->noisefloor = h[0].privNF; in ath9k_hw_getnf()
438 ah->noise = ath9k_hw_getchan_noise(ah, chan, chan->noisefloor); in ath9k_hw_getnf()
449 ah->caldata->channel = chan->channel; in ath9k_init_nfcal_hist_buffer()
450 ah->caldata->channelFlags = chan->channelFlags; in ath9k_init_nfcal_hist_buffer()
451 h = ah->caldata->nfCalHist; in ath9k_init_nfcal_hist_buffer()
466 struct ath9k_hw_cal_data *caldata = ah->caldata; in ath9k_hw_bstuck_nfcal()
479 if (!test_bit(NFCAL_PENDING, &caldata->cal_flags)) in ath9k_hw_bstuck_nfcal()
482 ath9k_hw_getnf(ah, ah->curchan); in ath9k_hw_bstuck_nfcal()
484 set_bit(NFCAL_INTF, &caldata->cal_flags); in ath9k_hw_bstuck_nfcal()