提交 4ff4ac1b 编写于 作者: B Barry Scott 提交者: Linus Torvalds

[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: NBarry Scott <barry.scott@onelan.co.uk>
Signed-off-by: NJohannes Stezenbach <js@linuxtv.org>
Signed-off-by: NAndrew Morton <akpm@osdl.org>
Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
上级 50b447d5
...@@ -462,9 +462,11 @@ static int mt352_read_signal_strength(struct dvb_frontend* fe, u16* strength) ...@@ -462,9 +462,11 @@ static int mt352_read_signal_strength(struct dvb_frontend* fe, u16* strength)
{ {
struct mt352_state* state = fe->demodulator_priv; struct mt352_state* state = fe->demodulator_priv;
u16 signal = ((mt352_read_register(state, AGC_GAIN_1) << 8) & 0x0f) | /* align the 12 bit AGC gain with the most significant bits */
(mt352_read_register(state, AGC_GAIN_0)); 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; *strength = ~signal;
return 0; return 0;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册