aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/wl12xx
diff options
context:
space:
mode:
authorJohn W. Linville <linville@tuxdriver.com>2010-07-28 16:41:06 -0400
committerJohn W. Linville <linville@tuxdriver.com>2010-07-29 12:46:49 -0400
commitece550d0e416b4146e1ec3d934f9773dbf8c7242 (patch)
treecfdce97332f066556a0c80746c4ef2f4a0f80a67 /drivers/net/wireless/wl12xx
parentbef9cb589d37c5eb2e3fb9e529fa3933db4dda19 (diff)
wl1271: add get_survey callback in order to get channel noise
Signed-off-by: John W. Linville <linville@tuxdriver.com> Acked-by: Juuso Oikarinen <juuso.oikarinen@nokia.com>
Diffstat (limited to 'drivers/net/wireless/wl12xx')
-rw-r--r--drivers/net/wireless/wl12xx/wl1271.h3
-rw-r--r--drivers/net/wireless/wl12xx/wl1271_main.c17
-rw-r--r--drivers/net/wireless/wl12xx/wl1271_rx.c7
3 files changed, 27 insertions, 0 deletions
diff --git a/drivers/net/wireless/wl12xx/wl1271.h b/drivers/net/wireless/wl12xx/wl1271.h
index 53d47d7a2a1d..dd3cee6ea5bb 100644
--- a/drivers/net/wireless/wl12xx/wl1271.h
+++ b/drivers/net/wireless/wl12xx/wl1271.h
@@ -475,6 +475,9 @@ struct wl1271 {
475 bool sg_enabled; 475 bool sg_enabled;
476 476
477 struct list_head list; 477 struct list_head list;
478
479 /* Most recently reported noise in dBm */
480 s8 noise;
478}; 481};
479 482
480int wl1271_plt_start(struct wl1271 *wl); 483int wl1271_plt_start(struct wl1271 *wl);
diff --git a/drivers/net/wireless/wl12xx/wl1271_main.c b/drivers/net/wireless/wl12xx/wl1271_main.c
index 864318f096ea..374abf0f5cc7 100644
--- a/drivers/net/wireless/wl12xx/wl1271_main.c
+++ b/drivers/net/wireless/wl12xx/wl1271_main.c
@@ -1927,6 +1927,22 @@ out:
1927 return mactime; 1927 return mactime;
1928} 1928}
1929 1929
1930static int wl1271_op_get_survey(struct ieee80211_hw *hw, int idx,
1931 struct survey_info *survey)
1932{
1933 struct wl1271 *wl = hw->priv;
1934 struct ieee80211_conf *conf = &hw->conf;
1935
1936 if (idx != 0)
1937 return -ENOENT;
1938
1939 survey->channel = conf->channel;
1940 survey->filled = SURVEY_INFO_NOISE_DBM;
1941 survey->noise = wl->noise;
1942
1943 return 0;
1944}
1945
1930/* can't be const, mac80211 writes to this */ 1946/* can't be const, mac80211 writes to this */
1931static struct ieee80211_rate wl1271_rates[] = { 1947static struct ieee80211_rate wl1271_rates[] = {
1932 { .bitrate = 10, 1948 { .bitrate = 10,
@@ -2156,6 +2172,7 @@ static const struct ieee80211_ops wl1271_ops = {
2156 .set_rts_threshold = wl1271_op_set_rts_threshold, 2172 .set_rts_threshold = wl1271_op_set_rts_threshold,
2157 .conf_tx = wl1271_op_conf_tx, 2173 .conf_tx = wl1271_op_conf_tx,
2158 .get_tsf = wl1271_op_get_tsf, 2174 .get_tsf = wl1271_op_get_tsf,
2175 .get_survey = wl1271_op_get_survey,
2159 CFG80211_TESTMODE_CMD(wl1271_tm_cmd) 2176 CFG80211_TESTMODE_CMD(wl1271_tm_cmd)
2160}; 2177};
2161 2178
diff --git a/drivers/net/wireless/wl12xx/wl1271_rx.c b/drivers/net/wireless/wl12xx/wl1271_rx.c
index e98f22b3c3ba..019aa79cd9df 100644
--- a/drivers/net/wireless/wl12xx/wl1271_rx.c
+++ b/drivers/net/wireless/wl12xx/wl1271_rx.c
@@ -55,6 +55,13 @@ static void wl1271_rx_status(struct wl1271 *wl,
55 55
56 status->signal = desc->rssi; 56 status->signal = desc->rssi;
57 57
58 /*
59 * FIXME: In wl1251, the SNR should be divided by two. In wl1271 we
60 * need to divide by two for now, but TI has been discussing about
61 * changing it. This needs to be rechecked.
62 */
63 wl->noise = desc->rssi - (desc->snr >> 1);
64
58 status->freq = ieee80211_channel_to_frequency(desc->channel); 65 status->freq = ieee80211_channel_to_frequency(desc->channel);
59 66
60 if (desc->flags & WL1271_RX_DESC_ENCRYPT_MASK) { 67 if (desc->flags & WL1271_RX_DESC_ENCRYPT_MASK) {