summaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@infradead.org>2008-04-24 11:19:55 -0300
committerMauro Carvalho Chehab <mchehab@infradead.org>2008-04-24 14:09:50 -0300
commitb0166ab3a6ae6d7af8d9a21a7836154963c69a11 (patch)
tree591f6089f36653b4e209be43615d94a69151fd0d /drivers/media
parentc21f1e2e39a1012f57c33d21af5c909cf2ae3b9a (diff)
downloadlinux-b0166ab3a6ae6d7af8d9a21a7836154963c69a11.tar.bz2
V4L/DVB (7731): tuner-xc2028: fix signal strength calculus
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/video/tuner-xc2028.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/drivers/media/video/tuner-xc2028.c b/drivers/media/video/tuner-xc2028.c
index a32094e545f7..cc3db7d79a0d 100644
--- a/drivers/media/video/tuner-xc2028.c
+++ b/drivers/media/video/tuner-xc2028.c
@@ -844,21 +844,28 @@ static int xc2028_signal(struct dvb_frontend *fe, u16 *strength)
/* Sync Lock Indicator */
rc = xc2028_get_reg(priv, 0x0002, &frq_lock);
- if (rc < 0 || frq_lock == 0)
+ if (rc < 0)
goto ret;
- /* Frequency is locked. Return signal quality */
+ /* Frequency is locked */
+ if (frq_lock == 1)
+ signal = 32768;
/* Get SNR of the video signal */
rc = xc2028_get_reg(priv, 0x0040, &signal);
if (rc < 0)
- signal = -frq_lock;
+ goto ret;
+
+ /* Use both frq_lock and signal to generate the result */
+ signal = signal || ((signal & 0x07) << 12);
ret:
mutex_unlock(&priv->lock);
*strength = signal;
+ tuner_dbg("signal strength is %d\n", signal);
+
return rc;
}