Commit 05253c93 authored by Ivo van Doorn's avatar Ivo van Doorn Committed by John W. Linville

rt2x00: Don't switch to antenna with low rssi

When rssi_a > rssi_b is true and the current antenna
was already antenna A, then rt2x00 incorrectly jumped
to antenna B.

Also don't configure the antenna when there has been
no change in the antenna setup.
Signed-off-by: default avatarIvo van Doorn <IvDoorn@gmail.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 61667d8d
...@@ -97,6 +97,10 @@ void rt2x00lib_config_antenna(struct rt2x00_dev *rt2x00dev, ...@@ -97,6 +97,10 @@ void rt2x00lib_config_antenna(struct rt2x00_dev *rt2x00dev,
libconf.ant.rx = rx; libconf.ant.rx = rx;
libconf.ant.tx = tx; libconf.ant.tx = tx;
if (rx == rt2x00dev->link.ant.active.rx &&
tx == rt2x00dev->link.ant.active.tx)
return;
/* /*
* Antenna setup changes require the RX to be disabled, * Antenna setup changes require the RX to be disabled,
* else the changes will be ignored by the device. * else the changes will be ignored by the device.
......
...@@ -260,19 +260,11 @@ static void rt2x00lib_evaluate_antenna_sample(struct rt2x00_dev *rt2x00dev) ...@@ -260,19 +260,11 @@ static void rt2x00lib_evaluate_antenna_sample(struct rt2x00_dev *rt2x00dev)
if (sample_a == sample_b) if (sample_a == sample_b)
return; return;
if (rt2x00dev->link.ant.flags & ANTENNA_RX_DIVERSITY) { if (rt2x00dev->link.ant.flags & ANTENNA_RX_DIVERSITY)
if (sample_a > sample_b && rx == ANTENNA_B) rx = (sample_a > sample_b) ? ANTENNA_A : ANTENNA_B;
rx = ANTENNA_A;
else if (rx == ANTENNA_A)
rx = ANTENNA_B;
}
if (rt2x00dev->link.ant.flags & ANTENNA_TX_DIVERSITY) { if (rt2x00dev->link.ant.flags & ANTENNA_TX_DIVERSITY)
if (sample_a > sample_b && tx == ANTENNA_B) tx = (sample_a > sample_b) ? ANTENNA_A : ANTENNA_B;
tx = ANTENNA_A;
else if (tx == ANTENNA_A)
tx = ANTENNA_B;
}
rt2x00lib_config_antenna(rt2x00dev, rx, tx); rt2x00lib_config_antenna(rt2x00dev, rx, tx);
} }
...@@ -327,7 +319,7 @@ static void rt2x00lib_evaluate_antenna(struct rt2x00_dev *rt2x00dev) ...@@ -327,7 +319,7 @@ static void rt2x00lib_evaluate_antenna(struct rt2x00_dev *rt2x00dev)
if (!(rt2x00dev->link.ant.flags & ANTENNA_RX_DIVERSITY) && if (!(rt2x00dev->link.ant.flags & ANTENNA_RX_DIVERSITY) &&
!(rt2x00dev->link.ant.flags & ANTENNA_TX_DIVERSITY)) { !(rt2x00dev->link.ant.flags & ANTENNA_TX_DIVERSITY)) {
rt2x00dev->link.ant.flags &= ~ANTENNA_MODE_SAMPLE; rt2x00dev->link.ant.flags = 0;
return; return;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment