27 #define ATH9K_NF_TOO_HIGH -60 36 sort[i] = nfCalBuffer[i];
40 if (sort[j] > sort[j - 1]) {
42 sort[j] = sort[j - 1];
79 u8 chainmask = (
ah->rxchainmask << 3) |
ah->rxchainmask;
86 if (!(chainmask & (1 << i)) ||
90 h[i].nfCalBuffer[
h[i].currIndex] = nfarray[i];
96 h[i].invalidNFcount--;
97 h[i].privNF = nfarray[i];
110 "NFmid[%d] (%d) > MAX (%d), %s\n",
113 "not corrected (due to interference)" :
114 "correcting to MAX"));
165 ah->meas0.sign[i] = 0;
166 ah->meas1.sign[i] = 0;
167 ah->meas2.sign[i] = 0;
168 ah->meas3.sign[i] = 0;
190 "Calibration state incorrect, %d\n",
199 "Resetting Cal %d state for channel %d\n",
211 ah->caldata->nfcal_pending = 1;
231 u8 chainmask = (
ah->rxchainmask << 3) |
ah->rxchainmask;
235 h =
ah->caldata->nfCalHist;
238 if (chainmask & (1 << i)) {
251 val |= (((
u32) nfval << 1) & 0x1ff);
272 for (j = 0; j < 10000; j++) {
290 "Timeout while waiting for nf to load: AR_PHY_AGC_CONTROL=0x%x\n",
302 if (chainmask & (1 << i)) {
308 val |= (((
u32) (-50) << 1) & 0x1ff);
331 "NF calibrated [%s] [chain %d] is %d\n",
332 (i >= 3 ?
"ext" :
"ctl"), i % 3, nf[i]);
336 "NF[%d] (%d) > MAX (%d), correcting to MAX\n",
339 }
else if (nf[i] <
limit->min) {
341 "NF[%d] (%d) < MIN (%d), correcting to NOM\n",
342 i, nf[i],
limit->min);
343 nf[i] =
limit->nominal;
359 "NF did not complete in calibration window\n");
369 "noise floor failed detected; detected %d, threshold %d\n",
395 h =
ah->caldata->nfCalHist;
399 h[i].privNF = default_nf;
402 h[i].nfCalBuffer[j] = default_nf;
#define ATH9K_NF_TOO_HIGH
static void ath9k_hw_nf_sanitize(struct ath_hw *ah, s16 *nf)
void ath9k_hw_start_nfcal(struct ath_hw *ah, int update)
#define REG_CLR_BIT(_a, _r, _f)
#define AR_PHY_AGC_CONTROL_NO_UPDATE_NF
#define REGWRITE_BUFFER_FLUSH(_ah)
#define AR_PHY_CCA_FILTERWINDOW_LENGTH
static void ath9k_hw_update_nfcal_hist_buffer(struct ath_hw *ah, struct ath9k_hw_cal_data *cal, int16_t *nfarray)
static int ath9k_hw_get_nf_thresh(struct ath_hw *ah, int band, int16_t *nft)
struct net80211_channel * chan
#define NET80211_BAND_2GHZ
The 2.4 GHz ISM band, unlicensed in most countries.
int ath9k_hw_reset_calvalid(struct ath_hw *ah)
static void ath9k_hw_setup_calibration(struct ath_hw *ah, struct ath9k_cal_list *currCal)
void udelay(unsigned long usecs)
Delay for a fixed number of microseconds.
void ath9k_hw_loadnf(struct ath_hw *ah, struct ath9k_channel *chan)
#define AR_PHY_AGC_CONTROL
int16_t nfCalBuffer[ATH9K_NF_CAL_HIST_MAX]
#define NET80211_BAND_5GHZ
The band from 4.9 GHz to 5.7 GHz, which tends to be more restricted.
u8 band
The band with which this channel is associated.
const struct ath9k_percal_data * calData
#define AR_PHY_AGC_CONTROL_NF
static struct ath_nf_limits * ath9k_hw_get_nf_limits(struct ath_hw *ah, struct ath9k_channel *chan)
#define AR_PHY_AGC_CONTROL_ENABLE_NF
#define REG_READ(_ah, _reg)
#define AR5416_MAX_CHAINS
#define REG_SET_BIT(_a, _r, _f)
#define REG_WRITE(_ah, _reg, _val)
static int16_t ath9k_hw_get_nf_hist_mid(int16_t *nfCalBuffer)
int ath9k_hw_getnf(struct ath_hw *ah, struct ath9k_channel *chan)
#define AR_SREV_9160_10_OR_LATER(_ah)
static void ath9k_hw_do_getnf(struct ath_hw *ah, int16_t nfarray[NUM_NF_READINGS])
#define DBG(...)
Print a debugging message.
static s16 ath9k_hw_get_default_nf(struct ath_hw *ah, struct ath9k_channel *chan)
void ath9k_hw_reset_calibration(struct ath_hw *ah, struct ath9k_cal_list *currCal)
#define NULL
NULL pointer (VOID *)
enum ath9k_cal_state calState
#define ENABLE_REGWRITE_BUFFER(_ah)
#define ATH9K_NF_CAL_HIST_MAX
struct ath9k_nfcal_hist nfCalHist[NUM_NF_READINGS]
void ath9k_init_nfcal_hist_buffer(struct ath_hw *ah, struct ath9k_channel *chan)