aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb
diff options
context:
space:
mode:
authorBarry Scott <barry.scott@onelan.co.uk>2005-09-09 16:02:29 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2005-09-09 16:57:37 -0400
commit4ff4ac1beae58a2fea7ec2ad43d6c3b60d90ec61 (patch)
tree88f7f1956d0f0514d04ea78cbb2352c4f583c2d1 /drivers/media/dvb
parent50b447d5b70dc4021ae3b4eaf8ce98932f61a413 (diff)
[PATCH] dvb: frontend: mt352: fix signal strength reading
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> Signed-off-by: Johannes Stezenbach <js@linuxtv.org> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/media/dvb')
-rw-r--r--drivers/media/dvb/frontends/mt352.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/media/dvb/frontends/mt352.c b/drivers/media/dvb/frontends/mt352.c
index d32dc4de9e7f..cc1bc0edd65e 100644
--- a/drivers/media/dvb/frontends/mt352.c
+++ b/drivers/media/dvb/frontends/mt352.c
@@ -462,9 +462,11 @@ static int mt352_read_signal_strength(struct dvb_frontend* fe, u16* strength)
462{ 462{
463 struct mt352_state* state = fe->demodulator_priv; 463 struct mt352_state* state = fe->demodulator_priv;
464 464
465 u16 signal = ((mt352_read_register(state, AGC_GAIN_1) << 8) & 0x0f) | 465 /* align the 12 bit AGC gain with the most significant bits */
466 (mt352_read_register(state, AGC_GAIN_0)); 466 u16 signal = ((mt352_read_register(state, AGC_GAIN_1) & 0x0f) << 12) |
467 (mt352_read_register(state, AGC_GAIN_0) << 4);
467 468
469 /* inverse of gain is signal strength */
468 *strength = ~signal; 470 *strength = ~signal;
469 return 0; 471 return 0;
470} 472}