aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/common
diff options
context:
space:
mode:
authorMichael Krufky <mkrufky@kernellabs.com>2009-10-23 02:20:45 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-12-05 15:40:55 -0500
commit42f9a03ed3ddcccc5372bf4774afc8c4273c6c3a (patch)
treebff1c5de6b7fd40c0a7bb099be07f53c8d1a99e9 /drivers/media/common
parent1724c8fa7eb33d68898e060a08a8e6a88348b62f (diff)
V4L/DVB (13215): tda18271: add support for the set_config method
Add the set_config method to allow drivers to configure the tda18271 driver options after attach. 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.c39
1 files changed, 26 insertions, 13 deletions
diff --git a/drivers/media/common/tuners/tda18271-fe.c b/drivers/media/common/tuners/tda18271-fe.c
index eb7724158861..ecb65802725f 100644
--- a/drivers/media/common/tuners/tda18271-fe.c
+++ b/drivers/media/common/tuners/tda18271-fe.c
@@ -1185,6 +1185,26 @@ 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)
1189{
1190 struct tda18271_priv *priv = fe->tuner_priv;
1191 struct tda18271_config *cfg = (struct tda18271_config *) priv_cfg;
1192
1193 priv->gate = (cfg) ? cfg->gate : TDA18271_GATE_AUTO;
1194 priv->role = (cfg) ? cfg->role : TDA18271_MASTER;
1195 priv->config = (cfg) ? cfg->config : 0;
1196 priv->small_i2c = (cfg) ?
1197 cfg->small_i2c : TDA18271_39_BYTE_CHUNK_INIT;
1198 priv->output_opt = (cfg) ?
1199 cfg->output_opt : TDA18271_OUTPUT_LT_XT_ON;
1200
1201 /* override default std map with values in config struct */
1202 if ((cfg) && (cfg->std_map))
1203 tda18271_update_std_map(fe, cfg->std_map);
1204
1205 return 0;
1206}
1207
1188static struct dvb_tuner_ops tda18271_tuner_ops = { 1208static struct dvb_tuner_ops tda18271_tuner_ops = {
1189 .info = { 1209 .info = {
1190 .name = "NXP TDA18271HD", 1210 .name = "NXP TDA18271HD",
@@ -1197,6 +1217,7 @@ static struct dvb_tuner_ops tda18271_tuner_ops = {
1197 .set_params = tda18271_set_params, 1217 .set_params = tda18271_set_params,
1198 .set_analog_params = tda18271_set_analog_params, 1218 .set_analog_params = tda18271_set_analog_params,
1199 .release = tda18271_release, 1219 .release = tda18271_release,
1220 .set_config = tda18271_set_config,
1200 .get_frequency = tda18271_get_frequency, 1221 .get_frequency = tda18271_get_frequency,
1201 .get_bandwidth = tda18271_get_bandwidth, 1222 .get_bandwidth = tda18271_get_bandwidth,
1202}; 1223};
@@ -1221,13 +1242,9 @@ struct dvb_frontend *tda18271_attach(struct dvb_frontend *fe, u8 addr,
1221 /* new tuner instance */ 1242 /* new tuner instance */
1222 int rf_cal_on_startup; 1243 int rf_cal_on_startup;
1223 1244
1224 priv->gate = (cfg) ? cfg->gate : TDA18271_GATE_AUTO; 1245 fe->tuner_priv = priv;
1225 priv->role = (cfg) ? cfg->role : TDA18271_MASTER; 1246
1226 priv->config = (cfg) ? cfg->config : 0; 1247 tda18271_set_config(fe, cfg);
1227 priv->small_i2c = (cfg) ?
1228 cfg->small_i2c : TDA18271_39_BYTE_CHUNK_INIT;
1229 priv->output_opt = (cfg) ?
1230 cfg->output_opt : TDA18271_OUTPUT_LT_XT_ON;
1231 1248
1232 /* tda18271_cal_on_startup == -1 when cal 1249 /* tda18271_cal_on_startup == -1 when cal
1233 * module option is unset */ 1250 * module option is unset */
@@ -1243,8 +1260,6 @@ struct dvb_frontend *tda18271_attach(struct dvb_frontend *fe, u8 addr,
1243 priv->cal_initialized = false; 1260 priv->cal_initialized = false;
1244 mutex_init(&priv->lock); 1261 mutex_init(&priv->lock);
1245 1262
1246 fe->tuner_priv = priv;
1247
1248 if (tda_fail(tda18271_get_id(fe))) 1263 if (tda_fail(tda18271_get_id(fe)))
1249 goto fail; 1264 goto fail;
1250 1265
@@ -1276,14 +1291,12 @@ struct dvb_frontend *tda18271_attach(struct dvb_frontend *fe, u8 addr,
1276 priv->small_i2c = cfg->small_i2c; 1291 priv->small_i2c = cfg->small_i2c;
1277 if (cfg->output_opt) 1292 if (cfg->output_opt)
1278 priv->output_opt = cfg->output_opt; 1293 priv->output_opt = cfg->output_opt;
1294 if (cfg->std_map)
1295 tda18271_update_std_map(fe, cfg->std_map);
1279 } 1296 }
1280 break; 1297 break;
1281 } 1298 }
1282 1299
1283 /* override default std map with values in config struct */
1284 if ((cfg) && (cfg->std_map))
1285 tda18271_update_std_map(fe, cfg->std_map);
1286
1287 mutex_unlock(&tda18271_list_mutex); 1300 mutex_unlock(&tda18271_list_mutex);
1288 1301
1289 memcpy(&fe->ops.tuner_ops, &tda18271_tuner_ops, 1302 memcpy(&fe->ops.tuner_ops, &tda18271_tuner_ops,