diff options
author | Felix Fietkau <nbd@openwrt.org> | 2010-09-29 11:15:27 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2010-10-05 13:35:21 -0400 |
commit | d9891c7804f27c5b0ea9eb51f42bf473b24338a0 (patch) | |
tree | 02cf0c0ba96c1a9763d5720cc68c8e6a0926c54f /drivers/net/wireless/ath/ath9k | |
parent | 35ecfe03d96b7cdaf6e50aba13af37e2c99deb57 (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')
-rw-r--r-- | drivers/net/wireless/ath/ath9k/calib.c | 40 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath9k/hw.c | 2 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath9k/hw.h | 2 |
3 files changed, 22 insertions, 22 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 | ||
402 | s16 ath9k_hw_getchan_noise(struct ath_hw *ah, struct ath9k_channel *chan) | 402 | s16 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 | } |
409 | EXPORT_SYMBOL(ath9k_hw_getchan_noise); | 409 | EXPORT_SYMBOL(ath9k_hw_getchan_noise); |
410 | 410 | ||
diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c index 25ed65ac992c..1b066043d6cb 100644 --- a/drivers/net/wireless/ath/ath9k/hw.c +++ b/drivers/net/wireless/ath/ath9k/hw.c | |||
@@ -1239,7 +1239,7 @@ int ath9k_hw_reset(struct ath_hw *ah, struct ath9k_channel *chan, | |||
1239 | if (!ath9k_hw_setpower(ah, ATH9K_PM_AWAKE)) | 1239 | if (!ath9k_hw_setpower(ah, ATH9K_PM_AWAKE)) |
1240 | return -EIO; | 1240 | return -EIO; |
1241 | 1241 | ||
1242 | if (curchan && !ah->chip_fullsleep && ah->caldata) | 1242 | if (curchan && !ah->chip_fullsleep) |
1243 | ath9k_hw_getnf(ah, curchan); | 1243 | ath9k_hw_getnf(ah, curchan); |
1244 | 1244 | ||
1245 | ah->caldata = caldata; | 1245 | ah->caldata = caldata; |
diff --git a/drivers/net/wireless/ath/ath9k/hw.h b/drivers/net/wireless/ath/ath9k/hw.h index df47f792cf4e..1b6739bd93ff 100644 --- a/drivers/net/wireless/ath/ath9k/hw.h +++ b/drivers/net/wireless/ath/ath9k/hw.h | |||
@@ -342,7 +342,6 @@ struct ath9k_hw_cal_data { | |||
342 | int32_t CalValid; | 342 | int32_t CalValid; |
343 | int8_t iCoff; | 343 | int8_t iCoff; |
344 | int8_t qCoff; | 344 | int8_t qCoff; |
345 | int16_t rawNoiseFloor; | ||
346 | bool paprd_done; | 345 | bool paprd_done; |
347 | bool nfcal_pending; | 346 | bool nfcal_pending; |
348 | bool nfcal_interference; | 347 | bool nfcal_interference; |
@@ -356,6 +355,7 @@ struct ath9k_channel { | |||
356 | u16 channel; | 355 | u16 channel; |
357 | u32 channelFlags; | 356 | u32 channelFlags; |
358 | u32 chanmode; | 357 | u32 chanmode; |
358 | s16 noisefloor; | ||
359 | }; | 359 | }; |
360 | 360 | ||
361 | #define IS_CHAN_G(_c) ((((_c)->channelFlags & (CHANNEL_G)) == CHANNEL_G) || \ | 361 | #define IS_CHAN_G(_c) ((((_c)->channelFlags & (CHANNEL_G)) == CHANNEL_G) || \ |