25 #define ATH9K_NF_TOO_HIGH -60 34 sort[i] = nfCalBuffer[i];
38 if (sort[j] > sort[j - 1]) {
40 sort[j] = sort[j - 1];
77 u8 chainmask = (
ah->rxchainmask << 3) |
ah->rxchainmask;
84 if (!(chainmask & (1 << i)) ||
88 h[i].nfCalBuffer[
h[i].currIndex] = nfarray[i];
94 h[i].invalidNFcount--;
95 h[i].privNF = nfarray[i];
108 "NFmid[%d] (%d) > MAX (%d), %s\n",
111 "not corrected (due to interference)" :
112 "correcting to MAX"));
163 ah->meas0.sign[i] = 0;
164 ah->meas1.sign[i] = 0;
165 ah->meas2.sign[i] = 0;
166 ah->meas3.sign[i] = 0;
188 "Calibration state incorrect, %d\n",
197 "Resetting Cal %d state for channel %d\n",
209 ah->caldata->nfcal_pending = 1;
229 u8 chainmask = (
ah->rxchainmask << 3) |
ah->rxchainmask;
233 h =
ah->caldata->nfCalHist;
236 if (chainmask & (1 << i)) {
249 val |= (((
u32) nfval << 1) & 0x1ff);
270 for (j = 0; j < 10000; j++) {
288 "Timeout while waiting for nf to load: AR_PHY_AGC_CONTROL=0x%x\n",
300 if (chainmask & (1 << i)) {
306 val |= (((
u32) (-50) << 1) & 0x1ff);
329 "NF calibrated [%s] [chain %d] is %d\n",
330 (i >= 3 ?
"ext" :
"ctl"), i % 3, nf[i]);
334 "NF[%d] (%d) > MAX (%d), correcting to MAX\n",
337 }
else if (nf[i] <
limit->min) {
339 "NF[%d] (%d) < MIN (%d), correcting to NOM\n",
340 i, nf[i],
limit->min);
341 nf[i] =
limit->nominal;
357 "NF did not complete in calibration window\n");
367 "noise floor failed detected; detected %d, threshold %d\n",
393 h =
ah->caldata->nfCalHist;
397 h[i].privNF = default_nf;
400 h[i].nfCalBuffer[j] = default_nf;
#define ATH9K_NF_TOO_HIGH
static __always_inline void off_t int c
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.
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)