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()
36 swap(sort[j], sort[j - 1]); in ath9k_hw_get_nf_hist_mid()
39 nfval = sort[(ATH9K_NF_CAL_HIST_MAX - 1) >> 1]; in ath9k_hw_get_nf_hist_mid()
50 limit = &ah->nf_2g; in ath9k_hw_get_nf_limits()
52 limit = &ah->nf_5g; in ath9k_hw_get_nf_limits()
61 s16 calib_nf = ath9k_hw_get_nf_limits(ah, chan)->cal[chain]; in ath9k_hw_get_default_nf()
66 return ath9k_hw_get_nf_limits(ah, chan)->nominal; in ath9k_hw_get_default_nf()
75 s8 delta = nf - ATH9K_NF_CAL_NOISE_THRESH - in ath9k_hw_getchan_noise()
85 struct ath9k_hw_cal_data *cal, in ath9k_hw_update_nfcal_hist_buffer() argument
92 u8 chainmask = (ah->rxchainmask << 3) | ah->rxchainmask; in ath9k_hw_update_nfcal_hist_buffer()
95 h = cal->nfCalHist; in ath9k_hw_update_nfcal_hist_buffer()
96 limit = ath9k_hw_get_nf_limits(ah, ah->curchan); in ath9k_hw_update_nfcal_hist_buffer()
100 ((i >= AR5416_MAX_CHAINS) && !IS_CHAN_HT40(ah->curchan))) in ath9k_hw_update_nfcal_hist_buffer()
109 h[i].invalidNFcount--; in ath9k_hw_update_nfcal_hist_buffer()
119 if (h[i].privNF > limit->max) { in ath9k_hw_update_nfcal_hist_buffer()
123 "NFmid[%d] (%d) > MAX (%d), %s\n", in ath9k_hw_update_nfcal_hist_buffer()
124 i, h[i].privNF, limit->max, in ath9k_hw_update_nfcal_hist_buffer()
125 (test_bit(NFCAL_INTF, &cal->cal_flags) ? in ath9k_hw_update_nfcal_hist_buffer()
136 if (!test_bit(NFCAL_INTF, &cal->cal_flags)) in ath9k_hw_update_nfcal_hist_buffer()
137 h[i].privNF = limit->max; in ath9k_hw_update_nfcal_hist_buffer()
144 * Re-enable the enforcement of the NF maximum again. in ath9k_hw_update_nfcal_hist_buffer()
147 clear_bit(NFCAL_INTF, &cal->cal_flags); in ath9k_hw_update_nfcal_hist_buffer()
156 *nft = (int8_t)ah->eep_ops->get_eeprom(ah, EEP_NFTHRESH_5); in ath9k_hw_get_nf_thresh()
159 *nft = (int8_t)ah->eep_ops->get_eeprom(ah, EEP_NFTHRESH_2); in ath9k_hw_get_nf_thresh()
176 ah->cal_start_time = jiffies; in ath9k_hw_reset_calibration()
177 currCal->calState = CAL_RUNNING; in ath9k_hw_reset_calibration()
180 ah->meas0.sign[i] = 0; in ath9k_hw_reset_calibration()
181 ah->meas1.sign[i] = 0; in ath9k_hw_reset_calibration()
182 ah->meas2.sign[i] = 0; in ath9k_hw_reset_calibration()
183 ah->meas3.sign[i] = 0; in ath9k_hw_reset_calibration()
186 ah->cal_samples = 0; in ath9k_hw_reset_calibration()
193 struct ath9k_cal_list *currCal = ah->cal_list_curr; in ath9k_hw_reset_calvalid()
195 if (!ah->caldata) in ath9k_hw_reset_calvalid()
204 if (currCal->calState != CAL_DONE) { in ath9k_hw_reset_calvalid()
205 ath_dbg(common, CALIBRATE, "Calibration state incorrect, %d\n", in ath9k_hw_reset_calvalid()
206 currCal->calState); in ath9k_hw_reset_calvalid()
210 currCal = ah->cal_list; in ath9k_hw_reset_calvalid()
212 ath_dbg(common, CALIBRATE, "Resetting Cal %d state for channel %u\n", in ath9k_hw_reset_calvalid()
213 currCal->calData->calType, in ath9k_hw_reset_calvalid()
214 ah->curchan->chan->center_freq); in ath9k_hw_reset_calvalid()
216 ah->caldata->CalValid &= ~currCal->calData->calType; in ath9k_hw_reset_calvalid()
217 currCal->calState = CAL_WAITING; in ath9k_hw_reset_calvalid()
219 currCal = currCal->calNext; in ath9k_hw_reset_calvalid()
220 } while (currCal != ah->cal_list); in ath9k_hw_reset_calvalid()
228 if (ah->caldata) in ath9k_hw_start_nfcal()
229 set_bit(NFCAL_PENDING, &ah->caldata->cal_flags); in ath9k_hw_start_nfcal()
248 u8 chainmask = (ah->rxchainmask << 3) | ah->rxchainmask; in ath9k_hw_loadnf()
250 s16 default_nf = ath9k_hw_get_nf_limits(ah, chan)->nominal; in ath9k_hw_loadnf()
253 if (ah->caldata) in ath9k_hw_loadnf()
254 h = ah->caldata->nfCalHist; in ath9k_hw_loadnf()
264 if (ah->nf_override) in ath9k_hw_loadnf()
265 nfval = ah->nf_override; in ath9k_hw_loadnf()
271 ath9k_hw_get_nf_limits(ah, chan)->cal[i]; in ath9k_hw_loadnf()
272 if (nfval > -60 || nfval < -127) in ath9k_hw_loadnf()
276 REG_RMW(ah, ah->nf_regs[i], in ath9k_hw_loadnf()
282 * stop NF cal if ongoing to ensure NF load completes immediately in ath9k_hw_loadnf()
283 * (or after end rx/tx frame if ongoing) in ath9k_hw_loadnf()
332 * in-progress rx. Simply return here and allow the load plenty of time in ath9k_hw_loadnf()
334 * trying to load -50 (which happens below) while the previous load is in ath9k_hw_loadnf()
336 * here, the baseband nf cal will just be capped by our present in ath9k_hw_loadnf()
343 return -ETIMEDOUT; in ath9k_hw_loadnf()
357 REG_RMW(ah, ah->nf_regs[i], in ath9k_hw_loadnf()
358 (((u32) (-50) << 1) & 0x1ff), 0x1ff); in ath9k_hw_loadnf()
374 if (IS_CHAN_2GHZ(ah->curchan)) in ath9k_hw_nf_sanitize()
375 limit = &ah->nf_2g; in ath9k_hw_nf_sanitize()
377 limit = &ah->nf_5g; in ath9k_hw_nf_sanitize()
384 "NF calibrated [%s] [chain %d] is %d\n", in ath9k_hw_nf_sanitize()
387 if (nf[i] > limit->max) { in ath9k_hw_nf_sanitize()
389 "NF[%d] (%d) > MAX (%d), correcting to MAX\n", in ath9k_hw_nf_sanitize()
390 i, nf[i], limit->max); in ath9k_hw_nf_sanitize()
391 nf[i] = limit->max; in ath9k_hw_nf_sanitize()
392 } else if (nf[i] < limit->min) { in ath9k_hw_nf_sanitize()
394 "NF[%d] (%d) < MIN (%d), correcting to NOM\n", in ath9k_hw_nf_sanitize()
395 i, nf[i], limit->min); in ath9k_hw_nf_sanitize()
396 nf[i] = limit->nominal; in ath9k_hw_nf_sanitize()
407 struct ieee80211_channel *c = chan->chan; in ath9k_hw_getnf()
408 struct ath9k_hw_cal_data *caldata = ah->caldata; in ath9k_hw_getnf()
419 if (ath9k_hw_get_nf_thresh(ah, c->band, &nfThresh) in ath9k_hw_getnf()
422 "noise floor failed detected; detected %d, threshold %d\n", in ath9k_hw_getnf()
427 chan->noisefloor = nf; in ath9k_hw_getnf()
431 h = caldata->nfCalHist; in ath9k_hw_getnf()
432 clear_bit(NFCAL_PENDING, &caldata->cal_flags); in ath9k_hw_getnf()
434 chan->noisefloor = h[0].privNF; in ath9k_hw_getnf()
435 ah->noise = ath9k_hw_getchan_noise(ah, chan, chan->noisefloor); in ath9k_hw_getnf()
446 ah->caldata->channel = chan->channel; in ath9k_init_nfcal_hist_buffer()
447 ah->caldata->channelFlags = chan->channelFlags; in ath9k_init_nfcal_hist_buffer()
448 h = ah->caldata->nfCalHist; in ath9k_init_nfcal_hist_buffer()
463 struct ath9k_hw_cal_data *caldata = ah->caldata; in ath9k_hw_bstuck_nfcal()
476 if (!test_bit(NFCAL_PENDING, &caldata->cal_flags)) in ath9k_hw_bstuck_nfcal()
479 ath9k_hw_getnf(ah, ah->curchan); in ath9k_hw_bstuck_nfcal()
481 set_bit(NFCAL_INTF, &caldata->cal_flags); in ath9k_hw_bstuck_nfcal()