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.c39
1 files changed, 28 insertions, 11 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2x00config.c b/drivers/net/wireless/rt2x00/rt2x00config.c
index 3e4eee3ab7d2..7c62ce125b94 100644
--- a/drivers/net/wireless/rt2x00/rt2x00config.c
+++ b/drivers/net/wireless/rt2x00/rt2x00config.c
@@ -92,8 +92,8 @@ void rt2x00lib_config_erp(struct rt2x00_dev *rt2x00dev,
92 erp.difs = bss_conf->use_short_slot ? SHORT_DIFS : DIFS; 92 erp.difs = bss_conf->use_short_slot ? SHORT_DIFS : DIFS;
93 erp.eifs = bss_conf->use_short_slot ? SHORT_EIFS : EIFS; 93 erp.eifs = bss_conf->use_short_slot ? SHORT_EIFS : EIFS;
94 94
95 erp.ack_timeout = PLCP + erp.difs + get_duration(ACK_SIZE, 10); 95 erp.ack_timeout = PLCP + erp.difs + GET_DURATION(ACK_SIZE, 10);
96 erp.ack_consume_time = SIFS + PLCP + get_duration(ACK_SIZE, 10); 96 erp.ack_consume_time = SIFS + PLCP + GET_DURATION(ACK_SIZE, 10);
97 97
98 if (bss_conf->use_short_preamble) { 98 if (bss_conf->use_short_preamble) {
99 erp.ack_timeout += SHORT_PREAMBLE; 99 erp.ack_timeout += SHORT_PREAMBLE;
@@ -109,15 +109,32 @@ void rt2x00lib_config_erp(struct rt2x00_dev *rt2x00dev,
109} 109}
110 110
111void rt2x00lib_config_antenna(struct rt2x00_dev *rt2x00dev, 111void rt2x00lib_config_antenna(struct rt2x00_dev *rt2x00dev,
112 enum antenna rx, enum antenna tx) 112 struct antenna_setup *ant)
113{ 113{
114 struct antenna_setup ant; 114 /*
115 115 * Failsafe: Make sure we are not sending the
116 ant.rx = rx; 116 * ANTENNA_SW_DIVERSITY state to the driver.
117 ant.tx = tx; 117 * If that happes fallback to hardware default,
118 * or our own default.
119 */
120 if (ant->rx == ANTENNA_SW_DIVERSITY) {
121 if (rt2x00dev->default_ant.rx == ANTENNA_SW_DIVERSITY)
122 ant->rx = ANTENNA_B;
123 else
124 ant->rx = rt2x00dev->default_ant.rx;
125 }
126 if (ant->tx == ANTENNA_SW_DIVERSITY) {
127 if (rt2x00dev->default_ant.tx == ANTENNA_SW_DIVERSITY)
128 ant->tx = ANTENNA_B;
129 else
130 ant->tx = rt2x00dev->default_ant.tx;
131 }
118 132
119 if (rx == rt2x00dev->link.ant.active.rx && 133 /*
120 tx == rt2x00dev->link.ant.active.tx) 134 * Only reconfigure when something has changed.
135 */
136 if (ant->rx == rt2x00dev->link.ant.active.rx &&
137 ant->tx == rt2x00dev->link.ant.active.tx)
121 return; 138 return;
122 139
123 /* 140 /*
@@ -132,12 +149,12 @@ void rt2x00lib_config_antenna(struct rt2x00_dev *rt2x00dev,
132 * The latter is required since we need to recalibrate the 149 * The latter is required since we need to recalibrate the
133 * noise-sensitivity ratio for the new setup. 150 * noise-sensitivity ratio for the new setup.
134 */ 151 */
135 rt2x00dev->ops->lib->config_ant(rt2x00dev, &ant); 152 rt2x00dev->ops->lib->config_ant(rt2x00dev, ant);
136 153
137 rt2x00lib_reset_link_tuner(rt2x00dev); 154 rt2x00lib_reset_link_tuner(rt2x00dev);
138 rt2x00_reset_link_ant_rssi(&rt2x00dev->link); 155 rt2x00_reset_link_ant_rssi(&rt2x00dev->link);
139 156
140 memcpy(&rt2x00dev->link.ant.active, &ant, sizeof(ant)); 157 memcpy(&rt2x00dev->link.ant.active, ant, sizeof(*ant));
141 158
142 if (test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags)) 159 if (test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags))
143 rt2x00lib_toggle_rx(rt2x00dev, STATE_RADIO_RX_ON_LINK); 160 rt2x00lib_toggle_rx(rt2x00dev, STATE_RADIO_RX_ON_LINK);