aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@redhat.com>2013-04-11 09:59:12 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2013-04-16 20:33:36 -0400
commit52775fd5b599c79e9a4152f75a6426bf376198dc (patch)
treea168bfa7d06eba19fbc46a19b145a59176fe7c3d /drivers/media
parent6596e88043e2c55d934f43701c3ca9860f009b06 (diff)
[media] r820t: Allow disabling IMR callibration
The rtl-sdr library disabled IMR callibration. While I'm not sure yet why, it could be a good idea to add a modprobe parameter here, to allow to also disable it. There are two rationale behind it: - It helps to compare USB dumps between rtl-sdr and the Kernel module; - If rtl-sdr disabled it, perhaps there's a good reason (e. g. it might not be actually working, or it might be causing some trouble). For both cases, it seems useful to add a modprobe parameter to allow testing the device with both configurations. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com> Tested-by: Antti Palosaari <crope@iki.fi>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/tuners/r820t.c23
1 files changed, 19 insertions, 4 deletions
diff --git a/drivers/media/tuners/r820t.c b/drivers/media/tuners/r820t.c
index 0125de897c8d..2e6a690ffb1a 100644
--- a/drivers/media/tuners/r820t.c
+++ b/drivers/media/tuners/r820t.c
@@ -56,6 +56,11 @@ static int debug;
56module_param(debug, int, 0644); 56module_param(debug, int, 0644);
57MODULE_PARM_DESC(debug, "enable verbose debug messages"); 57MODULE_PARM_DESC(debug, "enable verbose debug messages");
58 58
59static int no_imr_cal;
60module_param(no_imr_cal, int, 0444);
61MODULE_PARM_DESC(no_imr_cal, "Disable IMR calibration at module init");
62
63
59/* 64/*
60 * enums and structures 65 * enums and structures
61 */ 66 */
@@ -87,7 +92,8 @@ struct r820t_priv {
87 u32 int_freq; 92 u32 int_freq;
88 u8 fil_cal_code; 93 u8 fil_cal_code;
89 bool imr_done; 94 bool imr_done;
90 95 bool has_lock;
96 bool init_done;
91 struct r820t_sect_type imr_data[NUM_IMR]; 97 struct r820t_sect_type imr_data[NUM_IMR];
92 98
93 /* Store current mode */ 99 /* Store current mode */
@@ -95,8 +101,6 @@ struct r820t_priv {
95 enum v4l2_tuner_type type; 101 enum v4l2_tuner_type type;
96 v4l2_std_id std; 102 v4l2_std_id std;
97 u32 bw; /* in MHz */ 103 u32 bw; /* in MHz */
98
99 bool has_lock;
100}; 104};
101 105
102struct r820t_freq_range { 106struct r820t_freq_range {
@@ -1999,7 +2003,7 @@ static int r820t_imr_callibrate(struct r820t_priv *priv)
1999 int rc, i; 2003 int rc, i;
2000 int xtal_cap = 0; 2004 int xtal_cap = 0;
2001 2005
2002 if (priv->imr_done) 2006 if (priv->init_done)
2003 return 0; 2007 return 0;
2004 2008
2005 /* Initialize registers */ 2009 /* Initialize registers */
@@ -2024,6 +2028,16 @@ static int r820t_imr_callibrate(struct r820t_priv *priv)
2024 priv->xtal_cap_sel = xtal_cap; 2028 priv->xtal_cap_sel = xtal_cap;
2025 } 2029 }
2026 2030
2031 /*
2032 * Disables IMR callibration. That emulates the same behaviour
2033 * as what is done by rtl-sdr userspace library. Useful for testing
2034 */
2035 if (no_imr_cal) {
2036 priv->init_done = true;
2037
2038 return 0;
2039 }
2040
2027 /* Initialize registers */ 2041 /* Initialize registers */
2028 rc = r820t_write(priv, 0x05, 2042 rc = r820t_write(priv, 0x05,
2029 r820t_init_array, sizeof(r820t_init_array)); 2043 r820t_init_array, sizeof(r820t_init_array));
@@ -2050,6 +2064,7 @@ static int r820t_imr_callibrate(struct r820t_priv *priv)
2050 if (rc < 0) 2064 if (rc < 0)
2051 return rc; 2065 return rc;
2052 2066
2067 priv->init_done = true;
2053 priv->imr_done = true; 2068 priv->imr_done = true;
2054 2069
2055 return 0; 2070 return 0;