moikka!
Take 2. Same patch generated against different tree, this one is for
http://linuxtv.org/hg/~mkrufky/megasky.new . All other information from
previous mail applies to this patch also.
Signed-off-by: Antti Palosaari <crope@xxxxxx>
Regards Antti
Antti Palosaari wrote:
moro!
This patch adds i2c_gate_ctrl to QT1010-tuner and ZL10353-demodulator.
Tested successfully against fi-Oulu frequencies with following hw: MSI
Megasky 580 GL861 and Sigmatek DVB-110 AU6610.
changes:
QT1010:
- use i2c_gate_ctrl when accessing to tuner
ZL10353:
- implement i2c_gate_ctrl
- change one reset_attach register to same as main v4l-dvb tree
- leave registers 0x65 and 0x66 to chipset default one... This change
could *break* some other devices using ZL10353 module! Testing needed!
This change is needed to get Megasky GL861 and Sigmatek AU6610 working.
AU6610:
- remove unneeded code due to proper i2c_gate_ctrl
GL861:
- remove unneeded code due to proper i2c_gate_ctrl
Regards Antti Palosaari
diff -r 3d509470d279 linux/drivers/media/dvb/dvb-usb/au6610.c
--- a/linux/drivers/media/dvb/dvb-usb/au6610.c Sun Jan 21 13:57:48 2007 -0500
+++ b/linux/drivers/media/dvb/dvb-usb/au6610.c Wed Jan 24 01:06:11 2007 +0200
@@ -145,19 +145,6 @@ static struct qt1010_config au6610_qt101
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;
diff -r 3d509470d279 linux/drivers/media/dvb/dvb-usb/gl861.c
--- a/linux/drivers/media/dvb/dvb-usb/gl861.c Sun Jan 21 13:57:48 2007 -0500
+++ b/linux/drivers/media/dvb/dvb-usb/gl861.c Wed Jan 24 02:40:36 2007 +0200
@@ -122,19 +122,6 @@ static struct qt1010_config gl861_qt1010
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;
diff -r 3d509470d279 linux/drivers/media/dvb/frontends/qt1010.c
--- a/linux/drivers/media/dvb/frontends/qt1010.c Sun Jan 21 13:57:48 2007 -0500
+++ b/linux/drivers/media/dvb/frontends/qt1010.c Wed Jan 24 02:39:24 2007 +0200
@@ -149,6 +149,9 @@ static int qt1010_set_params(struct dvb_
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 @@ static int qt1010_set_params(struct dvb_
if (debug)
qt1010_dump_regs(priv);
+ if (fe->ops.i2c_gate_ctrl)
+ fe->ops.i2c_gate_ctrl(fe, 0); /* close i2c_gate */
+
return 0;
}
@@ -276,7 +282,6 @@ static int qt1010_init_meas1(struct qt10
return qt1010_writereg(priv, 0x1e, 0x00);
}
-
static u8 qt1010_init_meas2(struct qt1010_priv *priv, u8 reg_init_val, u8 *retval)
{
@@ -347,6 +352,9 @@ static int qt1010_init(struct dvb_fronte
{ 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 @@ struct dvb_frontend * qt1010_attach(stru
priv->cfg = cfg;
priv->i2c = i2c;
+ if (fe->ops.i2c_gate_ctrl)
+ fe->ops.i2c_gate_ctrl(fe, 1); /* open i2c_gate */
+
#if 0
qt1010_dump_regs(priv);
#endif
@@ -439,6 +450,9 @@ struct dvb_frontend * qt1010_attach(stru
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));
diff -r 3d509470d279 linux/drivers/media/dvb/frontends/zl10353.c
--- a/linux/drivers/media/dvb/frontends/zl10353.c Sun Jan 21 13:57:48 2007 -0500
+++ b/linux/drivers/media/dvb/frontends/zl10353.c Wed Jan 24 02:36:41 2007 +0200
@@ -142,11 +142,9 @@ static int zl10353_set_parameters(struct
zl10353_single_write(fe, 0x56, 0x28);
zl10353_single_write(fe, 0x89, 0x20);
zl10353_single_write(fe, 0x5E, 0x00);
- zl10353_single_write(fe, 0x65, 0x5A);
- zl10353_single_write(fe, 0x66, 0xE9);
zl10353_single_write(fe, 0x6C, 0xCD);
zl10353_single_write(fe, 0x6D, 0x7E);
- zl10353_single_write(fe, 0x62, 0x0A);
+ fe->ops.i2c_gate_ctrl(fe, 0); /* close i2c_gate */
// if there is no attached secondary tuner, we call set_params to program
// a potential tuner attached somewhere else
@@ -269,6 +267,13 @@ static int zl10353_init(struct dvb_front
}
return 0;
+}
+
+static int zl10353_i2c_gate_ctrl(struct dvb_frontend* fe, int enable)
+{
+ u8 val = 0x0a;
+ if (enable) val |= 0x10;
+ return zl10353_single_write(fe, 0x62, val);
}
static void zl10353_release(struct dvb_frontend *fe)
@@ -329,6 +334,7 @@ static struct dvb_frontend_ops zl10353_o
.init = zl10353_init,
.sleep = zl10353_sleep,
+ .i2c_gate_ctrl = zl10353_i2c_gate_ctrl,
.write = zl10353_write,
.set_frontend = zl10353_set_parameters,
_______________________________________________
linux-dvb mailing list
linux-dvb@xxxxxxxxxxx
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb