aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/rt2x00/rt2x00config.c
diff options
context:
space:
mode:
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}