au8522: set signal field to 100% when signal present

Message ID CAGoCfizrzVgDpA_wjk84yWQFrYcH+8F4bbQ5gQ=mja5mgGZkaA@mail.gmail.com (mailing list archive)
State Superseded, archived
Headers

Commit Message

Devin Heitmueller July 24, 2011, 8:23 p.m. UTC
  This patch makes the HVR-950q behave consistently with other drivers,
which is to show the signal level as 100% in cases where we have a
signal present but given we are unable to determine an actual signal
level.  The old code would set the value to "1", which divided by
65535 is rounded down to 0%.

Devin
  

Patch

au8522: set signal field to 100% when signal present

From: Devin Heitmueller <dheitmueller@kernellabs.com>

The signal state field in G_TUNER is typically scaled from 0-100%.  Since we
don't know the signal level, we really would prefer the field to contain 100%
than 1/256, which in many utilities (such as v4l2-ctl) rounds to 0% even when
a signal is actually present.

This patch makes the behavior consistent with other drivers.

Signed-off-by: Devin Heitmueller <dheitmueller@kernellabs.com>

diff --git a/drivers/media/dvb/frontends/au8522_decoder.c b/drivers/media/dvb/frontends/au8522_decoder.c
index b537891..2b248c1 100644
--- a/drivers/media/dvb/frontends/au8522_decoder.c
+++ b/drivers/media/dvb/frontends/au8522_decoder.c
@@ -692,7 +692,7 @@  static int au8522_g_tuner(struct v4l2_subdev *sd, struct v4l2_tuner *vt)
 	/* Interrogate the decoder to see if we are getting a real signal */
 	lock_status = au8522_readreg(state, 0x00);
 	if (lock_status == 0xa2)
-		vt->signal = 0x01;
+		vt->signal = 0xffff;
 	else
 		vt->signal = 0x00;