Commit 188ea058 authored by Michael Krufky's avatar Michael Krufky Committed by Mauro Carvalho Chehab

V4L/DVB (13217): tda18271: handle rf_cal_on_startup properly during attach

If rf_cal_on_startup is enabled in the structure passed into
tda18271_attach, and the cal module option isn't disabled, then we
should run the initialization and calibration procedures during the
tda18271_attach function call, regardless of how many instances of the
driver have been attached.  If the device is already calibrated, the
driver will detect that and will only calibrate again if necessary.
Signed-off-by: default avatarMichael Krufky <mkrufky@kernellabs.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent c54e1dde
...@@ -1249,7 +1249,7 @@ struct dvb_frontend *tda18271_attach(struct dvb_frontend *fe, u8 addr, ...@@ -1249,7 +1249,7 @@ struct dvb_frontend *tda18271_attach(struct dvb_frontend *fe, u8 addr,
struct tda18271_config *cfg) struct tda18271_config *cfg)
{ {
struct tda18271_priv *priv = NULL; struct tda18271_priv *priv = NULL;
int instance; int instance, rf_cal_on_startup = 0;
mutex_lock(&tda18271_list_mutex); mutex_lock(&tda18271_list_mutex);
...@@ -1262,8 +1262,6 @@ struct dvb_frontend *tda18271_attach(struct dvb_frontend *fe, u8 addr, ...@@ -1262,8 +1262,6 @@ struct dvb_frontend *tda18271_attach(struct dvb_frontend *fe, u8 addr,
case 1: case 1:
{ {
/* new tuner instance */ /* new tuner instance */
int rf_cal_on_startup;
fe->tuner_priv = priv; fe->tuner_priv = priv;
tda18271_setup_configuration(fe, cfg); tda18271_setup_configuration(fe, cfg);
...@@ -1315,7 +1313,20 @@ struct dvb_frontend *tda18271_attach(struct dvb_frontend *fe, u8 addr, ...@@ -1315,7 +1313,20 @@ struct dvb_frontend *tda18271_attach(struct dvb_frontend *fe, u8 addr,
priv->output_opt = cfg->output_opt; priv->output_opt = cfg->output_opt;
if (cfg->std_map) if (cfg->std_map)
tda18271_update_std_map(fe, cfg->std_map); tda18271_update_std_map(fe, cfg->std_map);
/* tda18271_cal_on_startup == -1 when cal
* module option is unset */
if (tda18271_cal_on_startup == -1) {
/* honor attach-time configuration */
rf_cal_on_startup =
(cfg->rf_cal_on_startup) ? 1 : 0;
} else {
/* module option overrides attach config */
rf_cal_on_startup = tda18271_cal_on_startup;
}
} }
if (rf_cal_on_startup)
tda18271_init(fe);
break; break;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment