diff options
Diffstat (limited to 'drivers/net/wireless/ath9k/hw.c')
-rw-r--r-- | drivers/net/wireless/ath9k/hw.c | 35 |
1 files changed, 30 insertions, 5 deletions
diff --git a/drivers/net/wireless/ath9k/hw.c b/drivers/net/wireless/ath9k/hw.c index 272c7581660..62e44a0ef99 100644 --- a/drivers/net/wireless/ath9k/hw.c +++ b/drivers/net/wireless/ath9k/hw.c | |||
@@ -329,7 +329,7 @@ static void ath9k_hw_set_defaults(struct ath_hal *ah) | |||
329 | ah->ah_config.ofdm_trig_high = 500; | 329 | ah->ah_config.ofdm_trig_high = 500; |
330 | ah->ah_config.cck_trig_high = 200; | 330 | ah->ah_config.cck_trig_high = 200; |
331 | ah->ah_config.cck_trig_low = 100; | 331 | ah->ah_config.cck_trig_low = 100; |
332 | ah->ah_config.enable_ani = 0; | 332 | ah->ah_config.enable_ani = 1; |
333 | ah->ah_config.noise_immunity_level = 4; | 333 | ah->ah_config.noise_immunity_level = 4; |
334 | ah->ah_config.ofdm_weaksignal_det = 1; | 334 | ah->ah_config.ofdm_weaksignal_det = 1; |
335 | ah->ah_config.cck_weaksignal_thr = 0; | 335 | ah->ah_config.cck_weaksignal_thr = 0; |
@@ -8405,23 +8405,48 @@ u32 ath9k_hw_mhz2ieee(struct ath_hal *ah, u32 freq, u32 flags) | |||
8405 | } | 8405 | } |
8406 | } | 8406 | } |
8407 | 8407 | ||
8408 | int16_t | 8408 | /* We can tune this as we go by monitoring really low values */ |
8409 | #define ATH9K_NF_TOO_LOW -60 | ||
8410 | |||
8411 | /* AR5416 may return very high value (like -31 dBm), in those cases the nf | ||
8412 | * is incorrect and we should use the static NF value. Later we can try to | ||
8413 | * find out why they are reporting these values */ | ||
8414 | static bool ath9k_hw_nf_in_range(struct ath_hal *ah, s16 nf) | ||
8415 | { | ||
8416 | if (nf > ATH9K_NF_TOO_LOW) { | ||
8417 | DPRINTF(ah->ah_sc, ATH_DBG_NF_CAL, | ||
8418 | "%s: noise floor value detected (%d) is " | ||
8419 | "lower than what we think is a " | ||
8420 | "reasonable value (%d)\n", | ||
8421 | __func__, nf, ATH9K_NF_TOO_LOW); | ||
8422 | return false; | ||
8423 | } | ||
8424 | return true; | ||
8425 | } | ||
8426 | |||
8427 | s16 | ||
8409 | ath9k_hw_getchan_noise(struct ath_hal *ah, struct ath9k_channel *chan) | 8428 | ath9k_hw_getchan_noise(struct ath_hal *ah, struct ath9k_channel *chan) |
8410 | { | 8429 | { |
8411 | struct ath9k_channel *ichan; | 8430 | struct ath9k_channel *ichan; |
8431 | s16 nf; | ||
8412 | 8432 | ||
8413 | ichan = ath9k_regd_check_channel(ah, chan); | 8433 | ichan = ath9k_regd_check_channel(ah, chan); |
8414 | if (ichan == NULL) { | 8434 | if (ichan == NULL) { |
8415 | DPRINTF(ah->ah_sc, ATH_DBG_NF_CAL, | 8435 | DPRINTF(ah->ah_sc, ATH_DBG_NF_CAL, |
8416 | "%s: invalid channel %u/0x%x; no mapping\n", | 8436 | "%s: invalid channel %u/0x%x; no mapping\n", |
8417 | __func__, chan->channel, chan->channelFlags); | 8437 | __func__, chan->channel, chan->channelFlags); |
8418 | return 0; | 8438 | return ATH_DEFAULT_NOISE_FLOOR; |
8419 | } | 8439 | } |
8420 | if (ichan->rawNoiseFloor == 0) { | 8440 | if (ichan->rawNoiseFloor == 0) { |
8421 | enum wireless_mode mode = ath9k_hw_chan2wmode(ah, chan); | 8441 | enum wireless_mode mode = ath9k_hw_chan2wmode(ah, chan); |
8422 | return NOISE_FLOOR[mode]; | 8442 | nf = NOISE_FLOOR[mode]; |
8423 | } else | 8443 | } else |
8424 | return ichan->rawNoiseFloor; | 8444 | nf = ichan->rawNoiseFloor; |
8445 | |||
8446 | if (!ath9k_hw_nf_in_range(ah, nf)) | ||
8447 | nf = ATH_DEFAULT_NOISE_FLOOR; | ||
8448 | |||
8449 | return nf; | ||
8425 | } | 8450 | } |
8426 | 8451 | ||
8427 | bool ath9k_hw_set_tsfadjust(struct ath_hal *ah, u32 setting) | 8452 | bool ath9k_hw_set_tsfadjust(struct ath_hal *ah, u32 setting) |