aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Krufky <mkrufky@kernellabs.com>2009-10-24 16:47:49 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-12-05 15:40:56 -0500
commitc54e1dde586ea0e930d6c443ca60a9b9d0310de3 (patch)
tree29aafafb9a7ebc0be14651909db5b42d657d2e56
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>
-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 ecb65802725f..24f1d38081e6 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)
1185 return ret; 1185 return ret;
1186} 1186}
1187 1187
1188static int tda18271_set_config(struct dvb_frontend *fe, void *priv_cfg) 1188static int tda18271_setup_configuration(struct dvb_frontend *fe,
1189 struct tda18271_config *cfg)
1189{ 1190{
1190 struct tda18271_priv *priv = fe->tuner_priv; 1191 struct tda18271_priv *priv = fe->tuner_priv;
1191 struct tda18271_config *cfg = (struct tda18271_config *) priv_cfg;
1192 1192
1193 priv->gate = (cfg) ? cfg->gate : TDA18271_GATE_AUTO; 1193 priv->gate = (cfg) ? cfg->gate : TDA18271_GATE_AUTO;
1194 priv->role = (cfg) ? cfg->role : TDA18271_MASTER; 1194 priv->role = (cfg) ? cfg->role : TDA18271_MASTER;
@@ -1205,6 +1205,28 @@ static int tda18271_set_config(struct dvb_frontend *fe, void *priv_cfg)
1205 return 0; 1205 return 0;
1206} 1206}
1207 1207
1208static int tda18271_set_config(struct dvb_frontend *fe, void *priv_cfg)
1209{
1210 struct tda18271_config *cfg = (struct tda18271_config *) priv_cfg;
1211 int rf_cal_on_startup;
1212
1213 tda18271_setup_configuration(fe, cfg);
1214
1215 /* tda18271_cal_on_startup == -1 when cal module option is unset */
1216 if (tda18271_cal_on_startup == -1) {
1217 /* honor configuration setting */
1218 rf_cal_on_startup =
1219 ((cfg) && (cfg->rf_cal_on_startup)) ? 1 : 0;
1220 } else {
1221 /* module option overrides configuration setting */
1222 rf_cal_on_startup = tda18271_cal_on_startup;
1223 }
1224 if (rf_cal_on_startup)
1225 tda18271_init(fe);
1226
1227 return 0;
1228}
1229
1208static struct dvb_tuner_ops tda18271_tuner_ops = { 1230static struct dvb_tuner_ops tda18271_tuner_ops = {
1209 .info = { 1231 .info = {
1210 .name = "NXP TDA18271HD", 1232 .name = "NXP TDA18271HD",
@@ -1244,7 +1266,7 @@ struct dvb_frontend *tda18271_attach(struct dvb_frontend *fe, u8 addr,
1244 1266
1245 fe->tuner_priv = priv; 1267 fe->tuner_priv = priv;
1246 1268
1247 tda18271_set_config(fe, cfg); 1269 tda18271_setup_configuration(fe, cfg);
1248 1270
1249 /* tda18271_cal_on_startup == -1 when cal 1271 /* tda18271_cal_on_startup == -1 when cal
1250 * module option is unset */ 1272 * module option is unset */