aboutsummaryrefslogtreecommitdiff
path: root/drivers/media/common
diff options
context:
space:
mode:
authorMichael Krufky <mkrufky@kernellabs.com>2009-10-24 17:47:49 -0300
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-12-05 18:40:56 -0200
commitc54e1dde586ea0e930d6c443ca60a9b9d0310de3 (patch)
tree29aafafb9a7ebc0be14651909db5b42d657d2e56 /drivers/media/common
parent42f9a03ed3ddcccc5372bf4774afc8c4273c6c3a (diff)
V4L/DVB (13216): tda18271: initialize tuner during set_config if rf_cal_on_startup is set
If rf_cal_on_startup is enabled in the structure passed into tda18271_set_config, and the cal module option isn't disabled, then we should run the initialization and calibration procedures during the tda18271_set_config function call. Signed-off-by: Michael Krufky <mkrufky@kernellabs.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/common')
-rw-r--r--drivers/media/common/tuners/tda18271-fe.c28
1 files changed, 25 insertions, 3 deletions
diff --git a/drivers/media/common/tuners/tda18271-fe.c b/drivers/media/common/tuners/tda18271-fe.c
index ecb65802725..24f1d38081e 100644
--- a/drivers/media/common/tuners/tda18271-fe.c
+++ b/drivers/media/common/tuners/tda18271-fe.c
@@ -1185,10 +1185,10 @@ static int tda18271_get_id(struct dvb_frontend *fe)
return ret;
}
-static int tda18271_set_config(struct dvb_frontend *fe, void *priv_cfg)
+static int tda18271_setup_configuration(struct dvb_frontend *fe,
+ struct tda18271_config *cfg)
{
struct tda18271_priv *priv = fe->tuner_priv;
- struct tda18271_config *cfg = (struct tda18271_config *) priv_cfg;
priv->gate = (cfg) ? cfg->gate : TDA18271_GATE_AUTO;
priv->role = (cfg) ? cfg->role : TDA18271_MASTER;
@@ -1205,6 +1205,28 @@ static int tda18271_set_config(struct dvb_frontend *fe, void *priv_cfg)
return 0;
}
+static int tda18271_set_config(struct dvb_frontend *fe, void *priv_cfg)
+{
+ struct tda18271_config *cfg = (struct tda18271_config *) priv_cfg;
+ int rf_cal_on_startup;
+
+ tda18271_setup_configuration(fe, cfg);
+
+ /* tda18271_cal_on_startup == -1 when cal module option is unset */
+ if (tda18271_cal_on_startup == -1) {
+ /* honor configuration setting */
+ rf_cal_on_startup =
+ ((cfg) && (cfg->rf_cal_on_startup)) ? 1 : 0;
+ } else {
+ /* module option overrides configuration setting */
+ rf_cal_on_startup = tda18271_cal_on_startup;
+ }
+ if (rf_cal_on_startup)
+ tda18271_init(fe);
+
+ return 0;
+}
+
static struct dvb_tuner_ops tda18271_tuner_ops = {
.info = {
.name = "NXP TDA18271HD",
@@ -1244,7 +1266,7 @@ struct dvb_frontend *tda18271_attach(struct dvb_frontend *fe, u8 addr,
fe->tuner_priv = priv;
- tda18271_set_config(fe, cfg);
+ tda18271_setup_configuration(fe, cfg);
/* tda18271_cal_on_startup == -1 when cal
* module option is unset */