diff options
author | Patrick Boettcher <devnull@localhost> | 2005-07-12 17:19:28 +0000 |
---|---|---|
committer | Patrick Boettcher <devnull@localhost> | 2005-07-12 17:19:28 +0000 |
commit | 9fb3f7d1f2b5c5a6967dad1cd95e3e0f215ef0ec (patch) | |
tree | 76c38da392727ab951d482019f8b5f2288da5870 /linux/drivers/media/dvb/frontends | |
parent | 239d8040e1c607aa08a2588b5f2f2d785ddb56d9 (diff) | |
download | mediapointer-dvb-s2-9fb3f7d1f2b5c5a6967dad1cd95e3e0f215ef0ec.tar.gz mediapointer-dvb-s2-9fb3f7d1f2b5c5a6967dad1cd95e3e0f215ef0ec.tar.bz2 |
Here is a patch to fix two problems with the signal strength value in the mt352.c frontend:
1. the 4 most significant bits are zeroed - shift and mask wrong way round
2. Need to align the 12 bits from the registers at the top of the 16 bit
returned value - otherwise the range is not 0 to 0xffff its 0xf000 to 0xffff
Signed-off-by: Barry Scott <barry.scott@onelan.co.uk>
Diffstat (limited to 'linux/drivers/media/dvb/frontends')
-rw-r--r-- | linux/drivers/media/dvb/frontends/mt352.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/linux/drivers/media/dvb/frontends/mt352.c b/linux/drivers/media/dvb/frontends/mt352.c index d32dc4de9..cc1bc0edd 100644 --- a/linux/drivers/media/dvb/frontends/mt352.c +++ b/linux/drivers/media/dvb/frontends/mt352.c @@ -462,9 +462,11 @@ static int mt352_read_signal_strength(struct dvb_frontend* fe, u16* strength) { struct mt352_state* state = fe->demodulator_priv; - u16 signal = ((mt352_read_register(state, AGC_GAIN_1) << 8) & 0x0f) | - (mt352_read_register(state, AGC_GAIN_0)); + /* align the 12 bit AGC gain with the most significant bits */ + u16 signal = ((mt352_read_register(state, AGC_GAIN_1) & 0x0f) << 12) | + (mt352_read_register(state, AGC_GAIN_0) << 4); + /* inverse of gain is signal strength */ *strength = ~signal; return 0; } |