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:23 -0400
committerDavid S. Miller <davem@davemloft.net>2008-01-28 18:02:51 -0500
commitaddc81bd428f9eb29ed2ab64ad4039c6aed55aea (patch)
tree949871f2ba2d4f215df8bd323b1dec6d7906e104 /drivers/net/wireless/rt2x00/rt2x00config.c
parent362f3b6bfbb18b4b8bd8a8ef391fb95efb43c632 (diff)
[PATCH] rt2x00: Correctly translate mac80211 antenna setup to rt2x00
mac80211 has 3 values for the antenna setup: 0 - default 1 - use antenna 1 2 - use antenna 2 This means that rt2x00 should store the default value from the EEPROM somwhere and use that when mac80211 indicates that the antenna setup is 0. This also implies that rt2x00 should no longer write the hw->config.antenna_sel_* values based on the EEPROM input. This also adds the basis in rt2x00lib for correct software diversity handling. By default rt2x00lib will now configure antenna B instead of hardware diversity. 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.c51
1 files changed, 49 insertions, 2 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2x00config.c b/drivers/net/wireless/rt2x00/rt2x00config.c
index 12914cf7156c..04518b089bdb 100644
--- a/drivers/net/wireless/rt2x00/rt2x00config.c
+++ b/drivers/net/wireless/rt2x00/rt2x00config.c
@@ -100,6 +100,8 @@ void rt2x00lib_config(struct rt2x00_dev *rt2x00dev,
100 struct rt2x00lib_conf libconf; 100 struct rt2x00lib_conf libconf;
101 struct ieee80211_hw_mode *mode; 101 struct ieee80211_hw_mode *mode;
102 struct ieee80211_rate *rate; 102 struct ieee80211_rate *rate;
103 struct antenna_setup *default_ant = &rt2x00dev->default_ant;
104 struct antenna_setup *active_ant = &rt2x00dev->link.active_ant;
103 int flags = 0; 105 int flags = 0;
104 int short_slot_time; 106 int short_slot_time;
105 107
@@ -122,7 +124,35 @@ void rt2x00lib_config(struct rt2x00_dev *rt2x00dev,
122 flags |= CONFIG_UPDATE_CHANNEL; 124 flags |= CONFIG_UPDATE_CHANNEL;
123 if (rt2x00dev->tx_power != conf->power_level) 125 if (rt2x00dev->tx_power != conf->power_level)
124 flags |= CONFIG_UPDATE_TXPOWER; 126 flags |= CONFIG_UPDATE_TXPOWER;
125 if (rt2x00dev->rx_status.antenna == conf->antenna_sel_rx) 127
128 /*
129 * Determining changes in the antenna setups request several checks:
130 * antenna_sel_{r,t}x = 0
131 * -> Does active_{r,t}x match default_{r,t}x
132 * -> Is default_{r,t}x SW_DIVERSITY
133 * antenna_sel_{r,t}x = 1/2
134 * -> Does active_{r,t}x match antenna_sel_{r,t}x
135 * The reason for not updating the antenna while SW diversity
136 * should be used is simple: Software diversity means that
137 * we should switch between the antenna's based on the
138 * quality. This means that the current antenna is good enough
139 * to work with untill the link tuner decides that an antenna
140 * switch should be performed.
141 */
142 if (!conf->antenna_sel_rx &&
143 default_ant->rx != ANTENNA_SW_DIVERSITY &&
144 default_ant->rx != active_ant->rx)
145 flags |= CONFIG_UPDATE_ANTENNA;
146 else if (conf->antenna_sel_rx &&
147 conf->antenna_sel_rx != active_ant->rx)
148 flags |= CONFIG_UPDATE_ANTENNA;
149
150 if (!conf->antenna_sel_tx &&
151 default_ant->tx != ANTENNA_SW_DIVERSITY &&
152 default_ant->tx != active_ant->tx)
153 flags |= CONFIG_UPDATE_ANTENNA;
154 else if (conf->antenna_sel_tx &&
155 conf->antenna_sel_tx != active_ant->tx)
126 flags |= CONFIG_UPDATE_ANTENNA; 156 flags |= CONFIG_UPDATE_ANTENNA;
127 157
128 /* 158 /*
@@ -171,6 +201,22 @@ config:
171 sizeof(libconf.rf)); 201 sizeof(libconf.rf));
172 } 202 }
173 203
204 if (flags & CONFIG_UPDATE_ANTENNA) {
205 if (conf->antenna_sel_rx)
206 libconf.ant.rx = conf->antenna_sel_rx;
207 else if (default_ant->rx != ANTENNA_SW_DIVERSITY)
208 libconf.ant.rx = default_ant->rx;
209 else if (active_ant->rx == ANTENNA_SW_DIVERSITY)
210 libconf.ant.rx = ANTENNA_B;
211
212 if (conf->antenna_sel_tx)
213 libconf.ant.tx = conf->antenna_sel_tx;
214 else if (default_ant->tx != ANTENNA_SW_DIVERSITY)
215 libconf.ant.tx = default_ant->tx;
216 else if (active_ant->tx == ANTENNA_SW_DIVERSITY)
217 libconf.ant.tx = ANTENNA_B;
218 }
219
174 if (flags & CONFIG_UPDATE_SLOT_TIME) { 220 if (flags & CONFIG_UPDATE_SLOT_TIME) {
175 short_slot_time = conf->flags & IEEE80211_CONF_SHORT_SLOT_TIME; 221 short_slot_time = conf->flags & IEEE80211_CONF_SHORT_SLOT_TIME;
176 222
@@ -201,5 +247,6 @@ config:
201 rt2x00dev->rx_status.freq = conf->freq; 247 rt2x00dev->rx_status.freq = conf->freq;
202 rt2x00dev->rx_status.channel = conf->channel; 248 rt2x00dev->rx_status.channel = conf->channel;
203 rt2x00dev->tx_power = conf->power_level; 249 rt2x00dev->tx_power = conf->power_level;
204 rt2x00dev->rx_status.antenna = conf->antenna_sel_rx; 250 rt2x00dev->link.active_ant.rx = libconf.ant.rx;
251 rt2x00dev->link.active_ant.tx = libconf.ant.tx;
205} 252}