aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorDevin Heitmueller <dheitmueller@kernellabs.com>2012-08-06 21:46:56 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2012-08-09 19:32:47 -0400
commit7c287f1849cd904c210608a6a7bcec055bcb1152 (patch)
treebcb7ab49879ca91b286f11db336903b79ec6933b /drivers/media
parent1aa9c487ffb3b3190a51ad447c33628488c7774f (diff)
[media] xc5000: add support for showing the SNR and gain in the debug output
When debugging is enabled, also show the analog SNR and the total gain status values. Signed-off-by: Devin Heitmueller <dheitmueller@kernellabs.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/common/tuners/xc5000.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/drivers/media/common/tuners/xc5000.c b/drivers/media/common/tuners/xc5000.c
index a8f108652f55..a3f775a2ccd7 100644
--- a/drivers/media/common/tuners/xc5000.c
+++ b/drivers/media/common/tuners/xc5000.c
@@ -111,6 +111,7 @@ struct xc5000_priv {
111#define XREG_PRODUCT_ID 0x08 111#define XREG_PRODUCT_ID 0x08
112#define XREG_BUSY 0x09 112#define XREG_BUSY 0x09
113#define XREG_BUILD 0x0D 113#define XREG_BUILD 0x0D
114#define XREG_TOTALGAIN 0x0F
114 115
115/* 116/*
116 Basic firmware description. This will remain with 117 Basic firmware description. This will remain with
@@ -541,6 +542,16 @@ static int xc_get_quality(struct xc5000_priv *priv, u16 *quality)
541 return xc5000_readreg(priv, XREG_QUALITY, quality); 542 return xc5000_readreg(priv, XREG_QUALITY, quality);
542} 543}
543 544
545static int xc_get_analogsnr(struct xc5000_priv *priv, u16 *snr)
546{
547 return xc5000_readreg(priv, XREG_SNR, snr);
548}
549
550static int xc_get_totalgain(struct xc5000_priv *priv, u16 *totalgain)
551{
552 return xc5000_readreg(priv, XREG_TOTALGAIN, totalgain);
553}
554
544static u16 WaitForLock(struct xc5000_priv *priv) 555static u16 WaitForLock(struct xc5000_priv *priv)
545{ 556{
546 u16 lockState = 0; 557 u16 lockState = 0;
@@ -652,6 +663,8 @@ static void xc_debug_dump(struct xc5000_priv *priv)
652 u32 hsync_freq_hz = 0; 663 u32 hsync_freq_hz = 0;
653 u16 frame_lines; 664 u16 frame_lines;
654 u16 quality; 665 u16 quality;
666 u16 snr;
667 u16 totalgain;
655 u8 hw_majorversion = 0, hw_minorversion = 0; 668 u8 hw_majorversion = 0, hw_minorversion = 0;
656 u8 fw_majorversion = 0, fw_minorversion = 0; 669 u8 fw_majorversion = 0, fw_minorversion = 0;
657 u16 fw_buildversion = 0; 670 u16 fw_buildversion = 0;
@@ -687,6 +700,13 @@ static void xc_debug_dump(struct xc5000_priv *priv)
687 700
688 xc_get_quality(priv, &quality); 701 xc_get_quality(priv, &quality);
689 dprintk(1, "*** Quality (0:<8dB, 7:>56dB) = %d\n", quality & 0x07); 702 dprintk(1, "*** Quality (0:<8dB, 7:>56dB) = %d\n", quality & 0x07);
703
704 xc_get_analogsnr(priv, &snr);
705 dprintk(1, "*** Unweighted analog SNR = %d dB\n", snr & 0x3f);
706
707 xc_get_totalgain(priv, &totalgain);
708 dprintk(1, "*** Total gain = %d.%d dB\n", totalgain / 256,
709 (totalgain % 256) * 100 / 256);
690} 710}
691 711
692static int xc5000_set_params(struct dvb_frontend *fe) 712static int xc5000_set_params(struct dvb_frontend *fe)