aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/rt2x00/rt2x00config.c
diff options
context:
space:
mode:
authorIvo van Doorn <ivdoorn@gmail.com>2007-10-13 10:26:36 -0400
committerDavid S. Miller <davem@davemloft.net>2008-01-28 18:02:53 -0500
commit69f81a2cac860cf183eb9ef7787525c3552d4612 (patch)
treeb149e55f1e21df8edf33046e662ce8f00834f1ac /drivers/net/wireless/rt2x00/rt2x00config.c
parent8de8c5162b157884aa4855564cbfd9ec9119c819 (diff)
[PATCH] rt2x00: Implement SW diversity
When mac80211 indicates that the default antenna setup should be used _and_ that this default setup is SW_DIVERSITY. This requires sampling and storing the RSSI per antenna and check once every 2 seconds to determine if the RSSI has changed significantly. Once this is the case we should sample the other antenna for a short period and evaluate if we need to swap antenna or not. Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/wireless/rt2x00/rt2x00config.c')
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00config.c26
1 files changed, 23 insertions, 3 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2x00config.c b/drivers/net/wireless/rt2x00/rt2x00config.c
index 04518b089bdb..2b0edd20eea5 100644
--- a/drivers/net/wireless/rt2x00/rt2x00config.c
+++ b/drivers/net/wireless/rt2x00/rt2x00config.c
@@ -94,6 +94,26 @@ void rt2x00lib_config_type(struct rt2x00_dev *rt2x00dev, const int type)
94 rt2x00dev->ops->lib->config_type(rt2x00dev, type, tsf_sync); 94 rt2x00dev->ops->lib->config_type(rt2x00dev, type, tsf_sync);
95} 95}
96 96
97void rt2x00lib_config_antenna(struct rt2x00_dev *rt2x00dev,
98 enum antenna rx, enum antenna tx)
99{
100 struct rt2x00lib_conf libconf;
101
102 libconf.ant.rx = rx;
103 libconf.ant.tx = tx;
104
105 /*
106 * Write new antenna setup to device and reset the link tuner.
107 * The latter is required since we need to recalibrate the
108 * noise-sensitivity ratio for the new setup.
109 */
110 rt2x00dev->ops->lib->config(rt2x00dev, CONFIG_UPDATE_ANTENNA, &libconf);
111 rt2x00lib_reset_link_tuner(rt2x00dev);
112
113 rt2x00dev->link.ant.active.rx = libconf.ant.rx;
114 rt2x00dev->link.ant.active.tx = libconf.ant.tx;
115}
116
97void rt2x00lib_config(struct rt2x00_dev *rt2x00dev, 117void rt2x00lib_config(struct rt2x00_dev *rt2x00dev,
98 struct ieee80211_conf *conf, const int force_config) 118 struct ieee80211_conf *conf, const int force_config)
99{ 119{
@@ -101,7 +121,7 @@ void rt2x00lib_config(struct rt2x00_dev *rt2x00dev,
101 struct ieee80211_hw_mode *mode; 121 struct ieee80211_hw_mode *mode;
102 struct ieee80211_rate *rate; 122 struct ieee80211_rate *rate;
103 struct antenna_setup *default_ant = &rt2x00dev->default_ant; 123 struct antenna_setup *default_ant = &rt2x00dev->default_ant;
104 struct antenna_setup *active_ant = &rt2x00dev->link.active_ant; 124 struct antenna_setup *active_ant = &rt2x00dev->link.ant.active;
105 int flags = 0; 125 int flags = 0;
106 int short_slot_time; 126 int short_slot_time;
107 127
@@ -247,6 +267,6 @@ config:
247 rt2x00dev->rx_status.freq = conf->freq; 267 rt2x00dev->rx_status.freq = conf->freq;
248 rt2x00dev->rx_status.channel = conf->channel; 268 rt2x00dev->rx_status.channel = conf->channel;
249 rt2x00dev->tx_power = conf->power_level; 269 rt2x00dev->tx_power = conf->power_level;
250 rt2x00dev->link.active_ant.rx = libconf.ant.rx; 270 rt2x00dev->link.ant.active.rx = libconf.ant.rx;
251 rt2x00dev->link.active_ant.tx = libconf.ant.tx; 271 rt2x00dev->link.ant.active.tx = libconf.ant.tx;
252} 272}