[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>
This commit is contained in:
parent
6596e88043
commit
52775fd5b5
@ -56,6 +56,11 @@ static int debug;
|
|||||||
module_param(debug, int, 0644);
|
module_param(debug, int, 0644);
|
||||||
MODULE_PARM_DESC(debug, "enable verbose debug messages");
|
MODULE_PARM_DESC(debug, "enable verbose debug messages");
|
||||||
|
|
||||||
|
static int no_imr_cal;
|
||||||
|
module_param(no_imr_cal, int, 0444);
|
||||||
|
MODULE_PARM_DESC(no_imr_cal, "Disable IMR calibration at module init");
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* enums and structures
|
* enums and structures
|
||||||
*/
|
*/
|
||||||
@ -87,7 +92,8 @@ struct r820t_priv {
|
|||||||
u32 int_freq;
|
u32 int_freq;
|
||||||
u8 fil_cal_code;
|
u8 fil_cal_code;
|
||||||
bool imr_done;
|
bool imr_done;
|
||||||
|
bool has_lock;
|
||||||
|
bool init_done;
|
||||||
struct r820t_sect_type imr_data[NUM_IMR];
|
struct r820t_sect_type imr_data[NUM_IMR];
|
||||||
|
|
||||||
/* Store current mode */
|
/* Store current mode */
|
||||||
@ -95,8 +101,6 @@ struct r820t_priv {
|
|||||||
enum v4l2_tuner_type type;
|
enum v4l2_tuner_type type;
|
||||||
v4l2_std_id std;
|
v4l2_std_id std;
|
||||||
u32 bw; /* in MHz */
|
u32 bw; /* in MHz */
|
||||||
|
|
||||||
bool has_lock;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct r820t_freq_range {
|
struct r820t_freq_range {
|
||||||
@ -1999,7 +2003,7 @@ static int r820t_imr_callibrate(struct r820t_priv *priv)
|
|||||||
int rc, i;
|
int rc, i;
|
||||||
int xtal_cap = 0;
|
int xtal_cap = 0;
|
||||||
|
|
||||||
if (priv->imr_done)
|
if (priv->init_done)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
/* Initialize registers */
|
/* Initialize registers */
|
||||||
@ -2024,6 +2028,16 @@ static int r820t_imr_callibrate(struct r820t_priv *priv)
|
|||||||
priv->xtal_cap_sel = xtal_cap;
|
priv->xtal_cap_sel = xtal_cap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Disables IMR callibration. That emulates the same behaviour
|
||||||
|
* as what is done by rtl-sdr userspace library. Useful for testing
|
||||||
|
*/
|
||||||
|
if (no_imr_cal) {
|
||||||
|
priv->init_done = true;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/* Initialize registers */
|
/* Initialize registers */
|
||||||
rc = r820t_write(priv, 0x05,
|
rc = r820t_write(priv, 0x05,
|
||||||
r820t_init_array, sizeof(r820t_init_array));
|
r820t_init_array, sizeof(r820t_init_array));
|
||||||
@ -2050,6 +2064,7 @@ static int r820t_imr_callibrate(struct r820t_priv *priv)
|
|||||||
if (rc < 0)
|
if (rc < 0)
|
||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
|
priv->init_done = true;
|
||||||
priv->imr_done = true;
|
priv->imr_done = true;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user