Skip to content

Commit

Permalink
carl9170: fix noise dBm conversion
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Christian Lamparter authored and John W. Linville committed Sep 21, 2010
1 parent 9dec6f9 commit e278c5a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/net/wireless/ath/carl9170/phy.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit e278c5a

Please sign in to comment.