p54: better rssi->dbm conversion for longbow phys
authorChristian Lamparter <chunkeey@googlemail.com>
Tue, 24 Aug 2010 21:29:05 +0000 (23:29 +0200)
committerJohn W. Linville <linville@tuxdriver.com>
Wed, 25 Aug 2010 18:34:56 +0000 (14:34 -0400)
This patch should fix the dodgy signal and noise value
reports for most longbow (p54spi) users:

e.g.: (an older tcpdump extract)
> 2.0 Mb/s 2437 MHz (0x00a0) -49dB signal -41dB noise
> 1.0 Mb/s 2437 MHz (0x00a0) 4dB signal -41dB noise

The formula is taken from stlc45xx:
http://gitorious.org/stlc45xx/mainline/blobs/master/stlc45xx.c#line1199

Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/p54/txrx.c

index 34447d1ad80debfdc5f44948ae56b440771b49f2..8f67db487f57cb2b50a822483a41abe35c652635 100644 (file)
@@ -275,15 +275,15 @@ static int p54_rssi_to_dbm(struct p54_common *priv, int rssi)
 {
        int band = priv->hw->conf.channel->band;
 
-       if (priv->rxhw != 5)
+       if (priv->rxhw != 5) {
                return ((rssi * priv->rssical_db[band].mul) / 64 +
                         priv->rssical_db[band].add) / 4;
-       else
+       } else {
                /*
                 * TODO: find the correct formula
                 */
-               return ((rssi * priv->rssical_db[band].mul) / 64 +
-                        priv->rssical_db[band].add) / 4;
+               return rssi / 2 - 110;
+       }
 }
 
 /*