[Patch] stv0297: The value of the signal strength depends on the configuration of the agc polarity.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

the attached patch fixes the increasing of the signal strength value (higher value = higher signal
strength) and scales the value to the range of 0..ffff. The charcteristic 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.

- Hartmut




signed-off-by: Hartmut Birr <e9hack@xxxxxxxxxxxxxx>
- The value of the signal strength depends on the configuration of the agc polarity.
diff -r 603862cf6d21 linux/drivers/media/dvb/frontends/stv0297.c
--- a/linux/drivers/media/dvb/frontends/stv0297.c	Tue Oct 02 13:37:21 2007 -0700
+++ b/linux/drivers/media/dvb/frontends/stv0297.c	Wed Oct 03 14:28:53 2007 +0200
@@ -358,11 +358,23 @@ static int stv0297_read_signal_strength(
 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;
 }
 
_______________________________________________
linux-dvb mailing list
linux-dvb@xxxxxxxxxxx
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb

[Index of Archives]     [Linux Media]     [Video 4 Linux]     [Asterisk]     [Samba]     [Xorg]     [Xfree86]     [Linux USB]

  Powered by Linux