Skip to content

Commit

Permalink
V4L/DVB (5240): Qt1010: use i2c_gate_ctrl where appropriate
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Antti Palosaari authored and Mauro Carvalho Chehab committed Feb 21, 2007
1 parent 38d0629 commit 705d41e
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 27 deletions.
13 changes: 0 additions & 13 deletions drivers/media/dvb/dvb-usb/au6610.c
Original file line number Diff line number Diff line change
Expand Up @@ -145,19 +145,6 @@ static struct qt1010_config au6610_qt1010_config = {

static int au6610_qt1010_tuner_attach(struct dvb_usb_adapter *adap)
{
/* TODO FIXME; probably I2C gate.
QT1010 tuner does not respond before we write 0x1a to ZL10353 demod
register 0x62. This ought to be done somewhere in demod initialization.
This solution is temporary hack. */

u8 buf[2] = { 0x62, 0x1a };
struct i2c_msg msg = { .addr = au6610_zl10353_config.demod_address,
.flags = 0, .buf = buf, .len = 2 };

if (i2c_transfer(&adap->dev->i2c_adap, &msg, 1) != 1) {
printk(KERN_WARNING "au6610 tuner attach failed\n");
return -EREMOTEIO;
}
return dvb_attach(qt1010_attach,
adap->fe, &adap->dev->i2c_adap,
&au6610_qt1010_config) == NULL ? -ENODEV : 0;
Expand Down
13 changes: 0 additions & 13 deletions drivers/media/dvb/dvb-usb/gl861.c
Original file line number Diff line number Diff line change
Expand Up @@ -122,19 +122,6 @@ static struct qt1010_config gl861_qt1010_config = {

static int gl861_tuner_attach(struct dvb_usb_adapter *adap)
{
/* TODO FIXME; probably I2C gate.
QT1010 tuner does not respond before we write 0x1a to ZL10353 demod
register 0x62. This ought to be done somewhere in demod initialization.
This solution is temporary hack. */

u8 buf[2] = { 0x62, 0x1a };
struct i2c_msg msg = { .addr = gl861_zl10353_config.demod_address,
.flags = 0, .buf = buf, .len = 2 };

if (i2c_transfer(&adap->dev->i2c_adap, &msg, 1) != 1) {
printk(KERN_WARNING "gl861 tuner attach failed\n");
return -EREMOTEIO;
}
return dvb_attach(qt1010_attach,
adap->fe, &adap->dev->i2c_adap,
&gl861_qt1010_config) == NULL ? -ENODEV : 0;
Expand Down
16 changes: 15 additions & 1 deletion drivers/media/dvb/frontends/qt1010.c
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,9 @@ static int qt1010_set_params(struct dvb_frontend *fe, struct dvb_frontend_parame
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 */
Expand Down Expand Up @@ -242,6 +245,9 @@ static int qt1010_set_params(struct dvb_frontend *fe, struct dvb_frontend_parame
if (debug)
qt1010_dump_regs(priv);

if (fe->ops.i2c_gate_ctrl)
fe->ops.i2c_gate_ctrl(fe, 0); /* close i2c_gate */

return 0;
}

Expand Down Expand Up @@ -277,7 +283,6 @@ static int qt1010_init_meas1(struct qt1010_priv *priv, u8 oper, u8 reg, u8 reg_i
return qt1010_writereg(priv, 0x1e, 0x00);
}


static u8 qt1010_init_meas2(struct qt1010_priv *priv, u8 reg_init_val, u8 *retval)
{
u8 i, val;
Expand Down Expand Up @@ -347,6 +352,9 @@ static int qt1010_init(struct dvb_frontend *fe)
{ 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:
Expand Down Expand Up @@ -430,13 +438,19 @@ struct dvb_frontend * qt1010_attach(struct dvb_frontend *fe,
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)) {
kfree(priv);
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));

Expand Down

0 comments on commit 705d41e

Please sign in to comment.