aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/common
diff options
context:
space:
mode:
authorMichael Krufky <mkrufky@kernellabs.com>2009-08-27 15:58:06 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-09-12 11:19:37 -0400
commit81016b496ee75cfb13d346ee58176d36a5f9c191 (patch)
treeac58c8e2ac88299819c4d5b48629ab32d481db8c /drivers/media/common
parentee8145d5634da4e062f8693f59695b0b2ed6e60d (diff)
V4L/DVB (12578): tda18271: allow drivers to request RF tracking filter calibration during attach
On certain master / slave dual tuner configurations, tuning performance improves when the RF tracking filter calibration is performed sequentially. This patch allows for the bridge driver to specify this behavior in the configuration structure at attach-time. The "cal" module option will continue to override this attach-time configuration: set cal=0 to prevent RF tracking filter calibration on startup, and set cal=1 to force it. Signed-off-by: Michael Krufky <mkrufky@kernellabs.com> Reviewed-by: Steven Toth <stoth@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.c20
-rw-r--r--drivers/media/common/tuners/tda18271.h3
2 files changed, 21 insertions, 2 deletions
diff --git a/drivers/media/common/tuners/tda18271-fe.c b/drivers/media/common/tuners/tda18271-fe.c
index b10935630154..bc4b004ba7db 100644
--- a/drivers/media/common/tuners/tda18271-fe.c
+++ b/drivers/media/common/tuners/tda18271-fe.c
@@ -27,7 +27,7 @@ module_param_named(debug, tda18271_debug, int, 0644);
27MODULE_PARM_DESC(debug, "set debug level " 27MODULE_PARM_DESC(debug, "set debug level "
28 "(info=1, map=2, reg=4, adv=8, cal=16 (or-able))"); 28 "(info=1, map=2, reg=4, adv=8, cal=16 (or-able))");
29 29
30static int tda18271_cal_on_startup; 30static int tda18271_cal_on_startup = -1;
31module_param_named(cal, tda18271_cal_on_startup, int, 0644); 31module_param_named(cal, tda18271_cal_on_startup, int, 0644);
32MODULE_PARM_DESC(cal, "perform RF tracking filter calibration on startup"); 32MODULE_PARM_DESC(cal, "perform RF tracking filter calibration on startup");
33 33
@@ -1192,10 +1192,25 @@ struct dvb_frontend *tda18271_attach(struct dvb_frontend *fe, u8 addr,
1192 case 0: 1192 case 0:
1193 goto fail; 1193 goto fail;
1194 case 1: 1194 case 1:
1195 {
1195 /* new tuner instance */ 1196 /* new tuner instance */
1197 int rf_cal_on_startup;
1198
1196 priv->gate = (cfg) ? cfg->gate : TDA18271_GATE_AUTO; 1199 priv->gate = (cfg) ? cfg->gate : TDA18271_GATE_AUTO;
1197 priv->role = (cfg) ? cfg->role : TDA18271_MASTER; 1200 priv->role = (cfg) ? cfg->role : TDA18271_MASTER;
1198 priv->config = (cfg) ? cfg->config : 0; 1201 priv->config = (cfg) ? cfg->config : 0;
1202
1203 /* tda18271_cal_on_startup == -1 when cal
1204 * module option is unset */
1205 if (tda18271_cal_on_startup == -1) {
1206 /* honor attach-time configuration */
1207 rf_cal_on_startup =
1208 ((cfg) && (cfg->rf_cal_on_startup)) ? 1 : 0;
1209 } else {
1210 /* module option overrides attach configuration */
1211 rf_cal_on_startup = tda18271_cal_on_startup;
1212 }
1213
1199 priv->cal_initialized = false; 1214 priv->cal_initialized = false;
1200 mutex_init(&priv->lock); 1215 mutex_init(&priv->lock);
1201 1216
@@ -1213,11 +1228,12 @@ struct dvb_frontend *tda18271_attach(struct dvb_frontend *fe, u8 addr,
1213 mutex_lock(&priv->lock); 1228 mutex_lock(&priv->lock);
1214 tda18271_init_regs(fe); 1229 tda18271_init_regs(fe);
1215 1230
1216 if ((tda18271_cal_on_startup) && (priv->id == TDA18271HDC2)) 1231 if ((rf_cal_on_startup) && (priv->id == TDA18271HDC2))
1217 tda18271c2_rf_cal_init(fe); 1232 tda18271c2_rf_cal_init(fe);
1218 1233
1219 mutex_unlock(&priv->lock); 1234 mutex_unlock(&priv->lock);
1220 break; 1235 break;
1236 }
1221 default: 1237 default:
1222 /* existing tuner instance */ 1238 /* existing tuner instance */
1223 fe->tuner_priv = priv; 1239 fe->tuner_priv = priv;
diff --git a/drivers/media/common/tuners/tda18271.h b/drivers/media/common/tuners/tda18271.h
index 53a9892a18d0..71bac9593f1e 100644
--- a/drivers/media/common/tuners/tda18271.h
+++ b/drivers/media/common/tuners/tda18271.h
@@ -77,6 +77,9 @@ struct tda18271_config {
77 /* use i2c gate provided by analog or digital demod */ 77 /* use i2c gate provided by analog or digital demod */
78 enum tda18271_i2c_gate gate; 78 enum tda18271_i2c_gate gate;
79 79
80 /* force rf tracking filter calibration on startup */
81 unsigned int rf_cal_on_startup:1;
82
80 /* some i2c providers cant write all 39 registers at once */ 83 /* some i2c providers cant write all 39 registers at once */
81 unsigned int small_i2c:1; 84 unsigned int small_i2c:1;
82 85