Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=85085ad7b2cc281a94bb406172ba938870863639
Commit:     85085ad7b2cc281a94bb406172ba938870863639
Parent:     7cccccc33aa9ab7171ca05c0b59c62912509b23e
Author:     Hartmut Birr <[EMAIL PROTECTED]>
AuthorDate: Wed Oct 31 02:04:16 2007 -0300
Committer:  Mauro Carvalho Chehab <[EMAIL PROTECTED]>
CommitDate: Sun Nov 4 21:41:25 2007 -0200

    V4L/DVB (6501): stv0297: Signal strength fixes
    
    Fixes the signal strength value (higher value = higher signal strength)
    and scales the value to the range of 0..ffff. The characteristic itself
    is wrong. To get proper values on a TT-C2300 in the range of 40..60%
    real signal strength, the values from the patch should be divide by two.
    The attached patch doesn't fix the characteristic.
    
    Signed-off-by: Hartmut Birr <[EMAIL PROTECTED]>
    Signed-off-by: Oliver Endriss <[EMAIL PROTECTED]>
    Signed-off-by: Mauro Carvalho Chehab <[EMAIL PROTECTED]>
---
 drivers/media/dvb/frontends/stv0297.c |   22 +++++++++++++++++-----
 1 files changed, 17 insertions(+), 5 deletions(-)

diff --git a/drivers/media/dvb/frontends/stv0297.c 
b/drivers/media/dvb/frontends/stv0297.c
index 17e5cb5..7c23775 100644
--- a/drivers/media/dvb/frontends/stv0297.c
+++ b/drivers/media/dvb/frontends/stv0297.c
@@ -358,11 +358,23 @@ static int stv0297_read_ber(struct dvb_frontend *fe, u32 
* ber)
 static int stv0297_read_signal_strength(struct dvb_frontend *fe, u16 * 
strength)
 {
        struct stv0297_state *state = fe->demodulator_priv;
-       u8 STRENGTH[2];
-
-       stv0297_readregs(state, 0x41, STRENGTH, 2);
-       *strength = (STRENGTH[1] & 0x03) << 8 | STRENGTH[0];
-
+       u8 STRENGTH[3];
+       u16 tmp;
+
+       stv0297_readregs(state, 0x41, STRENGTH, 3);
+       tmp = (STRENGTH[1] & 0x03) << 8 | STRENGTH[0];
+       if (STRENGTH[2] & 0x20) {
+               if (tmp < 0x200)
+                       tmp = 0;
+               else
+                       tmp = tmp - 0x200;
+       } else {
+               if (tmp > 0x1ff)
+                       tmp = 0;
+               else
+                       tmp = 0x1ff - tmp;
+       }
+       *strength = (tmp << 7) | (tmp >> 2);
        return 0;
 }
 
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to