aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath/ath9k/calib.c
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2010-09-29 11:15:27 -0400
committerJohn W. Linville <linville@tuxdriver.com>2010-10-05 13:35:21 -0400
commitd9891c7804f27c5b0ea9eb51f42bf473b24338a0 (patch)
tree02cf0c0ba96c1a9763d5720cc68c8e6a0926c54f /drivers/net/wireless/ath/ath9k/calib.c
parent35ecfe03d96b7cdaf6e50aba13af37e2c99deb57 (diff)
ath9k_hw: keep calibrated noise floor values per channel
Signed-off-by: Felix Fietkau <nbd@openwrt.org> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/ath/ath9k/calib.c')
-rw-r--r--drivers/net/wireless/ath/ath9k/calib.c40
1 files changed, 20 insertions, 20 deletions
diff --git a/drivers/net/wireless/ath/ath9k/calib.c b/drivers/net/wireless/ath/ath9k/calib.c
index 67ee5d735cc1..6351e76792a6 100644
--- a/drivers/net/wireless/ath/ath9k/calib.c
+++ b/drivers/net/wireless/ath/ath9k/calib.c
@@ -346,34 +346,34 @@ bool ath9k_hw_getnf(struct ath_hw *ah, struct ath9k_channel *chan)
346 struct ieee80211_channel *c = chan->chan; 346 struct ieee80211_channel *c = chan->chan;
347 struct ath9k_hw_cal_data *caldata = ah->caldata; 347 struct ath9k_hw_cal_data *caldata = ah->caldata;
348 348
349 if (!caldata)
350 return false;
351
352 chan->channelFlags &= (~CHANNEL_CW_INT); 349 chan->channelFlags &= (~CHANNEL_CW_INT);
353 if (REG_READ(ah, AR_PHY_AGC_CONTROL) & AR_PHY_AGC_CONTROL_NF) { 350 if (REG_READ(ah, AR_PHY_AGC_CONTROL) & AR_PHY_AGC_CONTROL_NF) {
354 ath_print(common, ATH_DBG_CALIBRATE, 351 ath_print(common, ATH_DBG_CALIBRATE,
355 "NF did not complete in calibration window\n"); 352 "NF did not complete in calibration window\n");
356 nf = 0;
357 caldata->rawNoiseFloor = nf;
358 return false; 353 return false;
359 } else { 354 }
360 ath9k_hw_do_getnf(ah, nfarray); 355
361 ath9k_hw_nf_sanitize(ah, nfarray); 356 ath9k_hw_do_getnf(ah, nfarray);
362 nf = nfarray[0]; 357 ath9k_hw_nf_sanitize(ah, nfarray);
363 if (ath9k_hw_get_nf_thresh(ah, c->band, &nfThresh) 358 nf = nfarray[0];
364 && nf > nfThresh) { 359 if (ath9k_hw_get_nf_thresh(ah, c->band, &nfThresh)
365 ath_print(common, ATH_DBG_CALIBRATE, 360 && nf > nfThresh) {
366 "noise floor failed detected; " 361 ath_print(common, ATH_DBG_CALIBRATE,
367 "detected %d, threshold %d\n", 362 "noise floor failed detected; "
368 nf, nfThresh); 363 "detected %d, threshold %d\n",
369 chan->channelFlags |= CHANNEL_CW_INT; 364 nf, nfThresh);
370 } 365 chan->channelFlags |= CHANNEL_CW_INT;
366 }
367
368 if (!caldata) {
369 chan->noisefloor = nf;
370 return false;
371 } 371 }
372 372
373 h = caldata->nfCalHist; 373 h = caldata->nfCalHist;
374 caldata->nfcal_pending = false; 374 caldata->nfcal_pending = false;
375 ath9k_hw_update_nfcal_hist_buffer(ah, caldata, nfarray); 375 ath9k_hw_update_nfcal_hist_buffer(ah, caldata, nfarray);
376 caldata->rawNoiseFloor = h[0].privNF; 376 chan->noisefloor = h[0].privNF;
377 return true; 377 return true;
378} 378}
379 379
@@ -401,10 +401,10 @@ void ath9k_init_nfcal_hist_buffer(struct ath_hw *ah,
401 401
402s16 ath9k_hw_getchan_noise(struct ath_hw *ah, struct ath9k_channel *chan) 402s16 ath9k_hw_getchan_noise(struct ath_hw *ah, struct ath9k_channel *chan)
403{ 403{
404 if (!ah->caldata || !ah->caldata->rawNoiseFloor) 404 if (!ah->curchan || !ah->curchan->noisefloor)
405 return ath9k_hw_get_default_nf(ah, chan); 405 return ath9k_hw_get_default_nf(ah, chan);
406 406
407 return ah->caldata->rawNoiseFloor; 407 return ah->curchan->noisefloor;
408} 408}
409EXPORT_SYMBOL(ath9k_hw_getchan_noise); 409EXPORT_SYMBOL(ath9k_hw_getchan_noise);
410 410