diff options
author | Luis R. Rodriguez <lrodriguez@atheros.com> | 2008-12-23 15:58:41 -0800 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-01-29 15:59:30 -0500 |
commit | 76061abbbb39ba4bdf42fe28aa3157df8bb03d38 (patch) | |
tree | 3508e15a6a1950e274dacec8b83ec1d4de966d0e /drivers | |
parent | ae8d2858c54f52dc4df513a818cc4e1257fd9143 (diff) |
ath9k: make request to get the noisefloor threshold band specific
Lets make the request to get the current noise floor threshold
from the EEPROM band specific as it is band specific, not mode
specific.
This also adds a backpointer on the private channel structure
back to the ieee80211_channel structure as this is now needed during
ath9k_hw_getnf().
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/wireless/ath9k/ath9k.h | 1 | ||||
-rw-r--r-- | drivers/net/wireless/ath9k/calib.c | 21 | ||||
-rw-r--r-- | drivers/net/wireless/ath9k/main.c | 2 |
3 files changed, 10 insertions, 14 deletions
diff --git a/drivers/net/wireless/ath9k/ath9k.h b/drivers/net/wireless/ath9k/ath9k.h index 0f6a99a3f21..78fffdf9339 100644 --- a/drivers/net/wireless/ath9k/ath9k.h +++ b/drivers/net/wireless/ath9k/ath9k.h @@ -453,6 +453,7 @@ struct ath9k_11n_rate_series { CHANNEL_HT40MINUS) struct ath9k_channel { + struct ieee80211_channel *chan; u16 channel; u32 channelFlags; u8 privFlags; diff --git a/drivers/net/wireless/ath9k/calib.c b/drivers/net/wireless/ath9k/calib.c index 3c7454fc51b..2a6b8a4d6e9 100644 --- a/drivers/net/wireless/ath9k/calib.c +++ b/drivers/net/wireless/ath9k/calib.c @@ -168,26 +168,18 @@ static void ath9k_hw_do_getnf(struct ath_hal *ah, } static bool getNoiseFloorThresh(struct ath_hal *ah, - const struct ath9k_channel *chan, + enum ieee80211_band band, int16_t *nft) { - switch (chan->chanmode) { - case CHANNEL_A: - case CHANNEL_A_HT20: - case CHANNEL_A_HT40PLUS: - case CHANNEL_A_HT40MINUS: + switch (band) { + case IEEE80211_BAND_5GHZ: *nft = (int8_t)ath9k_hw_get_eeprom(ah, EEP_NFTHRESH_5); break; - case CHANNEL_B: - case CHANNEL_G: - case CHANNEL_G_HT20: - case CHANNEL_G_HT40PLUS: - case CHANNEL_G_HT40MINUS: + case IEEE80211_BAND_2GHZ: *nft = (int8_t)ath9k_hw_get_eeprom(ah, EEP_NFTHRESH_2); break; default: - DPRINTF(ah->ah_sc, ATH_DBG_CHANNEL, - "invalid channel flags 0x%x\n", chan->channelFlags); + BUG_ON(1); return false; } @@ -692,6 +684,7 @@ int16_t ath9k_hw_getnf(struct ath_hal *ah, int16_t nf, nfThresh; int16_t nfarray[NUM_NF_READINGS] = { 0 }; struct ath9k_nfcal_hist *h; + struct ieee80211_channel *c = chan->chan; u8 chainmask; if (AR_SREV_9280(ah)) @@ -709,7 +702,7 @@ int16_t ath9k_hw_getnf(struct ath_hal *ah, } else { ath9k_hw_do_getnf(ah, nfarray); nf = nfarray[0]; - if (getNoiseFloorThresh(ah, chan, &nfThresh) + if (getNoiseFloorThresh(ah, c->band, &nfThresh) && nf > nfThresh) { DPRINTF(ah->ah_sc, ATH_DBG_CALIBRATE, "noise floor failed detected; " diff --git a/drivers/net/wireless/ath9k/main.c b/drivers/net/wireless/ath9k/main.c index c65b27bd9f5..12c5b9a4490 100644 --- a/drivers/net/wireless/ath9k/main.c +++ b/drivers/net/wireless/ath9k/main.c @@ -218,6 +218,7 @@ static int ath_setup_channels(struct ath_softc *sc) chan_2ghz[a].band = IEEE80211_BAND_2GHZ; chan_2ghz[a].center_freq = c->channel; chan_2ghz[a].max_power = c->maxTxPower; + c->chan = &chan_2ghz[a]; if (c->privFlags & CHANNEL_DISALLOW_ADHOC) chan_2ghz[a].flags |= IEEE80211_CHAN_NO_IBSS; @@ -233,6 +234,7 @@ static int ath_setup_channels(struct ath_softc *sc) chan_5ghz[b].band = IEEE80211_BAND_5GHZ; chan_5ghz[b].center_freq = c->channel; chan_5ghz[b].max_power = c->maxTxPower; + c->chan = &chan_5ghz[a]; if (c->privFlags & CHANNEL_DISALLOW_ADHOC) chan_5ghz[b].flags |= IEEE80211_CHAN_NO_IBSS; |