aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless
diff options
context:
space:
mode:
authorLuis R. Rodriguez <lrodriguez@atheros.com>2008-12-23 18:58:41 -0500
committerJohn W. Linville <linville@tuxdriver.com>2009-01-29 15:59:30 -0500
commit76061abbbb39ba4bdf42fe28aa3157df8bb03d38 (patch)
tree3508e15a6a1950e274dacec8b83ec1d4de966d0e /drivers/net/wireless
parentae8d2858c54f52dc4df513a818cc4e1257fd9143 (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/net/wireless')
-rw-r--r--drivers/net/wireless/ath9k/ath9k.h1
-rw-r--r--drivers/net/wireless/ath9k/calib.c21
-rw-r--r--drivers/net/wireless/ath9k/main.c2
3 files changed, 10 insertions, 14 deletions
diff --git a/drivers/net/wireless/ath9k/ath9k.h b/drivers/net/wireless/ath9k/ath9k.h
index 0f6a99a3f21a..78fffdf9339f 100644
--- a/drivers/net/wireless/ath9k/ath9k.h
+++ b/drivers/net/wireless/ath9k/ath9k.h
@@ -453,6 +453,7 @@ struct ath9k_11n_rate_series {
453 CHANNEL_HT40MINUS) 453 CHANNEL_HT40MINUS)
454 454
455struct ath9k_channel { 455struct ath9k_channel {
456 struct ieee80211_channel *chan;
456 u16 channel; 457 u16 channel;
457 u32 channelFlags; 458 u32 channelFlags;
458 u8 privFlags; 459 u8 privFlags;
diff --git a/drivers/net/wireless/ath9k/calib.c b/drivers/net/wireless/ath9k/calib.c
index 3c7454fc51bd..2a6b8a4d6e9e 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,
168} 168}
169 169
170static bool getNoiseFloorThresh(struct ath_hal *ah, 170static bool getNoiseFloorThresh(struct ath_hal *ah,
171 const struct ath9k_channel *chan, 171 enum ieee80211_band band,
172 int16_t *nft) 172 int16_t *nft)
173{ 173{
174 switch (chan->chanmode) { 174 switch (band) {
175 case CHANNEL_A: 175 case IEEE80211_BAND_5GHZ:
176 case CHANNEL_A_HT20:
177 case CHANNEL_A_HT40PLUS:
178 case CHANNEL_A_HT40MINUS:
179 *nft = (int8_t)ath9k_hw_get_eeprom(ah, EEP_NFTHRESH_5); 176 *nft = (int8_t)ath9k_hw_get_eeprom(ah, EEP_NFTHRESH_5);
180 break; 177 break;
181 case CHANNEL_B: 178 case IEEE80211_BAND_2GHZ:
182 case CHANNEL_G:
183 case CHANNEL_G_HT20:
184 case CHANNEL_G_HT40PLUS:
185 case CHANNEL_G_HT40MINUS:
186 *nft = (int8_t)ath9k_hw_get_eeprom(ah, EEP_NFTHRESH_2); 179 *nft = (int8_t)ath9k_hw_get_eeprom(ah, EEP_NFTHRESH_2);
187 break; 180 break;
188 default: 181 default:
189 DPRINTF(ah->ah_sc, ATH_DBG_CHANNEL, 182 BUG_ON(1);
190 "invalid channel flags 0x%x\n", chan->channelFlags);
191 return false; 183 return false;
192 } 184 }
193 185
@@ -692,6 +684,7 @@ int16_t ath9k_hw_getnf(struct ath_hal *ah,
692 int16_t nf, nfThresh; 684 int16_t nf, nfThresh;
693 int16_t nfarray[NUM_NF_READINGS] = { 0 }; 685 int16_t nfarray[NUM_NF_READINGS] = { 0 };
694 struct ath9k_nfcal_hist *h; 686 struct ath9k_nfcal_hist *h;
687 struct ieee80211_channel *c = chan->chan;
695 u8 chainmask; 688 u8 chainmask;
696 689
697 if (AR_SREV_9280(ah)) 690 if (AR_SREV_9280(ah))
@@ -709,7 +702,7 @@ int16_t ath9k_hw_getnf(struct ath_hal *ah,
709 } else { 702 } else {
710 ath9k_hw_do_getnf(ah, nfarray); 703 ath9k_hw_do_getnf(ah, nfarray);
711 nf = nfarray[0]; 704 nf = nfarray[0];
712 if (getNoiseFloorThresh(ah, chan, &nfThresh) 705 if (getNoiseFloorThresh(ah, c->band, &nfThresh)
713 && nf > nfThresh) { 706 && nf > nfThresh) {
714 DPRINTF(ah->ah_sc, ATH_DBG_CALIBRATE, 707 DPRINTF(ah->ah_sc, ATH_DBG_CALIBRATE,
715 "noise floor failed detected; " 708 "noise floor failed detected; "
diff --git a/drivers/net/wireless/ath9k/main.c b/drivers/net/wireless/ath9k/main.c
index c65b27bd9f5f..12c5b9a44904 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)
218 chan_2ghz[a].band = IEEE80211_BAND_2GHZ; 218 chan_2ghz[a].band = IEEE80211_BAND_2GHZ;
219 chan_2ghz[a].center_freq = c->channel; 219 chan_2ghz[a].center_freq = c->channel;
220 chan_2ghz[a].max_power = c->maxTxPower; 220 chan_2ghz[a].max_power = c->maxTxPower;
221 c->chan = &chan_2ghz[a];
221 222
222 if (c->privFlags & CHANNEL_DISALLOW_ADHOC) 223 if (c->privFlags & CHANNEL_DISALLOW_ADHOC)
223 chan_2ghz[a].flags |= IEEE80211_CHAN_NO_IBSS; 224 chan_2ghz[a].flags |= IEEE80211_CHAN_NO_IBSS;
@@ -233,6 +234,7 @@ static int ath_setup_channels(struct ath_softc *sc)
233 chan_5ghz[b].band = IEEE80211_BAND_5GHZ; 234 chan_5ghz[b].band = IEEE80211_BAND_5GHZ;
234 chan_5ghz[b].center_freq = c->channel; 235 chan_5ghz[b].center_freq = c->channel;
235 chan_5ghz[b].max_power = c->maxTxPower; 236 chan_5ghz[b].max_power = c->maxTxPower;
237 c->chan = &chan_5ghz[a];
236 238
237 if (c->privFlags & CHANNEL_DISALLOW_ADHOC) 239 if (c->privFlags & CHANNEL_DISALLOW_ADHOC)
238 chan_5ghz[b].flags |= IEEE80211_CHAN_NO_IBSS; 240 chan_5ghz[b].flags |= IEEE80211_CHAN_NO_IBSS;