aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless
diff options
context:
space:
mode:
authorJohn W. Linville <linville@tuxdriver.com>2010-07-28 15:23:30 -0400
committerJohn W. Linville <linville@tuxdriver.com>2010-07-29 12:46:47 -0400
commit19434148d16dc231026f37af7c40e81ad9342e75 (patch)
treeee649a89a690db417e2f3d19980a4a6ec4b9e6fb /drivers/net/wireless
parenta55427e8284541d43630f10a6c637b28802c21b0 (diff)
wl1251: add get_survey callback in order to get channel noise
Signed-off-by: John W. Linville <linville@tuxdriver.com> Acked-by: Kalle Valo <kvalo@adurom.com>
Diffstat (limited to 'drivers/net/wireless')
-rw-r--r--drivers/net/wireless/wl12xx/wl1251.h3
-rw-r--r--drivers/net/wireless/wl12xx/wl1251_main.c17
-rw-r--r--drivers/net/wireless/wl12xx/wl1251_rx.c6
3 files changed, 26 insertions, 0 deletions
diff --git a/drivers/net/wireless/wl12xx/wl1251.h b/drivers/net/wireless/wl12xx/wl1251.h
index 4f5f02a26e62..6b942a28e6a5 100644
--- a/drivers/net/wireless/wl12xx/wl1251.h
+++ b/drivers/net/wireless/wl12xx/wl1251.h
@@ -381,6 +381,9 @@ struct wl1251 {
381 381
382 u32 chip_id; 382 u32 chip_id;
383 char fw_ver[21]; 383 char fw_ver[21];
384
385 /* Most recently reported noise in dBm */
386 s8 noise;
384}; 387};
385 388
386int wl1251_plt_start(struct wl1251 *wl); 389int wl1251_plt_start(struct wl1251 *wl);
diff --git a/drivers/net/wireless/wl12xx/wl1251_main.c b/drivers/net/wireless/wl12xx/wl1251_main.c
index 38f72f417183..a6d8d1ad5dc0 100644
--- a/drivers/net/wireless/wl12xx/wl1251_main.c
+++ b/drivers/net/wireless/wl12xx/wl1251_main.c
@@ -1172,6 +1172,22 @@ out:
1172 return ret; 1172 return ret;
1173} 1173}
1174 1174
1175static int wl1251_op_get_survey(struct ieee80211_hw *hw, int idx,
1176 struct survey_info *survey)
1177{
1178 struct wl1251 *wl = hw->priv;
1179 struct ieee80211_conf *conf = &hw->conf;
1180
1181 if (idx != 0)
1182 return -ENOENT;
1183
1184 survey->channel = conf->channel;
1185 survey->filled = SURVEY_INFO_NOISE_DBM;
1186 survey->noise = wl->noise;
1187
1188 return 0;
1189}
1190
1175/* can't be const, mac80211 writes to this */ 1191/* can't be const, mac80211 writes to this */
1176static struct ieee80211_supported_band wl1251_band_2ghz = { 1192static struct ieee80211_supported_band wl1251_band_2ghz = {
1177 .channels = wl1251_channels, 1193 .channels = wl1251_channels,
@@ -1193,6 +1209,7 @@ static const struct ieee80211_ops wl1251_ops = {
1193 .bss_info_changed = wl1251_op_bss_info_changed, 1209 .bss_info_changed = wl1251_op_bss_info_changed,
1194 .set_rts_threshold = wl1251_op_set_rts_threshold, 1210 .set_rts_threshold = wl1251_op_set_rts_threshold,
1195 .conf_tx = wl1251_op_conf_tx, 1211 .conf_tx = wl1251_op_conf_tx,
1212 .get_survey = wl1251_op_get_survey,
1196}; 1213};
1197 1214
1198static int wl1251_read_eeprom_byte(struct wl1251 *wl, off_t offset, u8 *data) 1215static int wl1251_read_eeprom_byte(struct wl1251 *wl, off_t offset, u8 *data)
diff --git a/drivers/net/wireless/wl12xx/wl1251_rx.c b/drivers/net/wireless/wl12xx/wl1251_rx.c
index 851515836a7f..1b6294b3b996 100644
--- a/drivers/net/wireless/wl12xx/wl1251_rx.c
+++ b/drivers/net/wireless/wl12xx/wl1251_rx.c
@@ -74,6 +74,12 @@ static void wl1251_rx_status(struct wl1251 *wl,
74 74
75 status->signal = desc->rssi; 75 status->signal = desc->rssi;
76 76
77 /*
78 * FIXME: guessing that snr needs to be divided by two, otherwise
79 * the values don't make any sense
80 */
81 wl->noise = desc->rssi - desc->snr / 2;
82
77 status->freq = ieee80211_channel_to_frequency(desc->channel); 83 status->freq = ieee80211_channel_to_frequency(desc->channel);
78 84
79 status->flag |= RX_FLAG_TSFT; 85 status->flag |= RX_FLAG_TSFT;