V4L/DVB (5240): Qt1010: use i2c_gate_ctrl where appropriate
This patch adds calls to i2c_gate_ctrl in the qt1010 dvb tuner module,
while removing the temporary hack in au6610 and gl861.
Tested successfully against fi-Oulu frequencies with
MSI Megasky 580 GL861 and Sigmatek DVB-110 AU6610.
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Michael Krufky <mkrufky@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
diff --git a/drivers/media/dvb/frontends/qt1010.c b/drivers/media/dvb/frontends/qt1010.c
index d7360f4..c3408dc 100644
--- a/drivers/media/dvb/frontends/qt1010.c
+++ b/drivers/media/dvb/frontends/qt1010.c
@@ -149,6 +149,9 @@
priv->bandwidth = (fe->ops.info.type == FE_OFDM) ? params->u.ofdm.bandwidth : 0;
priv->frequency = freq;
+ if (fe->ops.i2c_gate_ctrl)
+ fe->ops.i2c_gate_ctrl(fe, 1); /* open i2c_gate */
+
/* reg 05 base value */
if (freq < 290000000) reg05 = 0x14; /* 290 MHz */
else if (freq < 610000000) reg05 = 0x34; /* 610 MHz */
@@ -242,6 +245,9 @@
if (debug)
qt1010_dump_regs(priv);
+ if (fe->ops.i2c_gate_ctrl)
+ fe->ops.i2c_gate_ctrl(fe, 0); /* close i2c_gate */
+
return 0;
}
@@ -277,7 +283,6 @@
return qt1010_writereg(priv, 0x1e, 0x00);
}
-
static u8 qt1010_init_meas2(struct qt1010_priv *priv, u8 reg_init_val, u8 *retval)
{
u8 i, val;
@@ -347,6 +352,9 @@
{ QT1010_WR, 0x08, 0x08 }
};
+ if (fe->ops.i2c_gate_ctrl)
+ fe->ops.i2c_gate_ctrl(fe, 1); /* open i2c_gate */
+
for (i = 0; i < sizeof(i2c_data) / sizeof(*i2c_data); i++) {
switch (i2c_data[i].oper) {
case QT1010_WR:
@@ -430,6 +438,9 @@
priv->cfg = cfg;
priv->i2c = i2c;
+ if (fe->ops.i2c_gate_ctrl)
+ fe->ops.i2c_gate_ctrl(fe, 1); /* open i2c_gate */
+
/* Try to detect tuner chip. Probably this is not correct register. */
if (qt1010_readreg(priv, 0x29, &id) != 0 || (id != 0x39)) {
@@ -437,6 +448,9 @@
return NULL;
}
+ if (fe->ops.i2c_gate_ctrl)
+ fe->ops.i2c_gate_ctrl(fe, 0); /* close i2c_gate */
+
printk(KERN_INFO "Quantek QT1010 successfully identified.\n");
memcpy(&fe->ops.tuner_ops, &qt1010_tuner_ops, sizeof(struct dvb_tuner_ops));