summaryrefslogtreecommitdiff
path: root/drivers/net/wireless/rtl818x/rtl8180_dev.c
diff options
context:
space:
mode:
authorJohn W. Linville <linville@tuxdriver.com>2010-07-22 00:26:40 +0400
committerJohn W. Linville <linville@tuxdriver.com>2010-07-26 23:09:03 +0400
commit8b73fb8e29e9ae0458d36cc0dc25e2717587dfd4 (patch)
treea711485ca5e49078386f624ecbf4942288b77d89 /drivers/net/wireless/rtl818x/rtl8180_dev.c
parent1ab36d68e37faa431d99a07cbfb477a48879934e (diff)
downloadlinux-8b73fb8e29e9ae0458d36cc0dc25e2717587dfd4.tar.xz
rtl8180: improve signal reporting for actual rtl8180 hardware
Adapted from Realtek-provided driver... Signed-off-by: John W. Linville <linville@tuxdriver.com> Tested-by: Pauli Nieminen <suokkos@gmail.com>
Diffstat (limited to 'drivers/net/wireless/rtl818x/rtl8180_dev.c')
-rw-r--r--drivers/net/wireless/rtl818x/rtl8180_dev.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/drivers/net/wireless/rtl818x/rtl8180_dev.c b/drivers/net/wireless/rtl818x/rtl8180_dev.c
index 31808f96a3d6..d8b186a260ed 100644
--- a/drivers/net/wireless/rtl818x/rtl8180_dev.c
+++ b/drivers/net/wireless/rtl818x/rtl8180_dev.c
@@ -103,7 +103,7 @@ static void rtl8180_handle_rx(struct ieee80211_hw *dev)
{
struct rtl8180_priv *priv = dev->priv;
unsigned int count = 32;
- u8 signal;
+ u8 signal, agc, sq;
while (count--) {
struct rtl8180_rx_desc *entry = &priv->rx_ring[priv->rx_idx];
@@ -132,12 +132,16 @@ static void rtl8180_handle_rx(struct ieee80211_hw *dev)
rx_status.antenna = (flags2 >> 15) & 1;
rx_status.rate_idx = (flags >> 20) & 0xF;
- /* TODO: improve signal/rssi reporting for !rtl8185 */
- signal = (flags2 >> 17) & 0x7F;
- if (rx_status.rate_idx > 3)
- signal = 90 - clamp_t(u8, signal, 25, 90);
- else
- signal = 95 - clamp_t(u8, signal, 30, 95);
+ agc = (flags2 >> 17) & 0x7F;
+ if (priv->r8185) {
+ if (rx_status.rate_idx > 3)
+ signal = 90 - clamp_t(u8, agc, 25, 90);
+ else
+ signal = 95 - clamp_t(u8, agc, 30, 95);
+ } else {
+ sq = flags2 & 0xff;
+ signal = priv->rf->calc_rssi(agc, sq);
+ }
rx_status.signal = signal;
rx_status.freq = dev->conf.channel->center_freq;
rx_status.band = dev->conf.channel->band;