summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Lamparter <chunkeey@googlemail.com>2010-09-17 22:22:50 +0200
committerJohn W. Linville <linville@tuxdriver.com>2010-09-21 11:05:20 -0400
commite278c5a90368408bd191743e7c6f978f068f4b8d (patch)
tree6900ca09d6309e2e0621e1ab7ff405f5ab959763
parent9dec6f9c48242eec742c9475f32eeef29448701c (diff)
carl9170: fix noise dBm conversion
Ever since carl9170 gained support to read the noisefloor, the reported noisefloor level was pretty poor. Initially I assumed that something was wrong in the PHY setup and it would be impossible to fix without any guidances. But this was not the case. In fact the nf readings were correct and the thing that was broken was the "simple" sign extension code! Signed-off-by: Christian Lamparter <chunkeey@googlemail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r--drivers/net/wireless/ath/carl9170/phy.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/net/wireless/ath/carl9170/phy.c b/drivers/net/wireless/ath/carl9170/phy.c
index fe265e3e6ac4..7df8f711f5d8 100644
--- a/drivers/net/wireless/ath/carl9170/phy.c
+++ b/drivers/net/wireless/ath/carl9170/phy.c
@@ -1558,9 +1558,9 @@ static int carl9170_set_power_cal(struct ar9170 *ar, u32 freq,
static int carl9170_calc_noise_dbm(u32 raw_noise)
{
if (raw_noise & 0x100)
- return ~((raw_noise & 0x0ff) >> 1);
+ return ~0x1ff | raw_noise;
else
- return (raw_noise & 0xff) >> 1;
+ return raw_noise;
}
int carl9170_get_noisefloor(struct ar9170 *ar)