diff options
author | Mauro Carvalho Chehab <mchehab@infradead.org> | 2008-04-24 10:19:55 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2008-04-24 13:09:50 -0400 |
commit | b0166ab3a6ae6d7af8d9a21a7836154963c69a11 (patch) | |
tree | 591f6089f36653b4e209be43615d94a69151fd0d /drivers/media/video/tuner-xc2028.c | |
parent | c21f1e2e39a1012f57c33d21af5c909cf2ae3b9a (diff) |
V4L/DVB (7731): tuner-xc2028: fix signal strength calculus
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/video/tuner-xc2028.c')
-rw-r--r-- | drivers/media/video/tuner-xc2028.c | 13 |
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) | |||
844 | 844 | ||
845 | /* Sync Lock Indicator */ | 845 | /* Sync Lock Indicator */ |
846 | rc = xc2028_get_reg(priv, 0x0002, &frq_lock); | 846 | rc = xc2028_get_reg(priv, 0x0002, &frq_lock); |
847 | if (rc < 0 || frq_lock == 0) | 847 | if (rc < 0) |
848 | goto ret; | 848 | goto ret; |
849 | 849 | ||
850 | /* Frequency is locked. Return signal quality */ | 850 | /* Frequency is locked */ |
851 | if (frq_lock == 1) | ||
852 | signal = 32768; | ||
851 | 853 | ||
852 | /* Get SNR of the video signal */ | 854 | /* Get SNR of the video signal */ |
853 | rc = xc2028_get_reg(priv, 0x0040, &signal); | 855 | rc = xc2028_get_reg(priv, 0x0040, &signal); |
854 | if (rc < 0) | 856 | if (rc < 0) |
855 | signal = -frq_lock; | 857 | goto ret; |
858 | |||
859 | /* Use both frq_lock and signal to generate the result */ | ||
860 | signal = signal || ((signal & 0x07) << 12); | ||
856 | 861 | ||
857 | ret: | 862 | ret: |
858 | mutex_unlock(&priv->lock); | 863 | mutex_unlock(&priv->lock); |
859 | 864 | ||
860 | *strength = signal; | 865 | *strength = signal; |
861 | 866 | ||
867 | tuner_dbg("signal strength is %d\n", signal); | ||
868 | |||
862 | return rc; | 869 | return rc; |
863 | } | 870 | } |
864 | 871 | ||