V4L/DVB (6500): tda10021: Fix reported signal strength
authorHartmut Birr <e9hack@googlemail.com>
Wed, 31 Oct 2007 04:57:58 +0000 (01:57 -0300)
committerMauro Carvalho Chehab <mchehab@infradead.org>
Sun, 4 Nov 2007 23:41:25 +0000 (21:41 -0200)
Fix reported signal strength value (higher value = higher signal strength).

Signed-off-by: Hartmut Birr <e9hack@googlemail.com>
Signed-off-by: Oliver Endriss <o.endriss@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
drivers/media/dvb/frontends/tda10021.c

index 5ee7298..45137d2 100644 (file)
@@ -312,7 +312,11 @@ static int tda10021_read_signal_strength(struct dvb_frontend* fe, u16* strength)
 {
        struct tda10021_state* state = fe->demodulator_priv;
 
+       u8 config = tda10021_readreg(state, 0x02);
        u8 gain = tda10021_readreg(state, 0x17);
+       if (config & 0x02)
+               /* the agc value is inverted */
+               gain = ~gain;
        *strength = (gain << 8) | gain;
 
        return 0;