aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAntti Palosaari <crope@iki.fi>2007-01-27 14:41:35 -0500
committerMauro Carvalho Chehab <mchehab@infradead.org>2007-02-21 10:35:31 -0500
commit705d41e5da674b449f900df97ad13ebe53e82b82 (patch)
tree058036817b0d597f778dc9e48f78ebb3c7df2efe
parent38d0629fd80464247290450d8641890d6f94b6fa (diff)
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>
-rw-r--r--drivers/media/dvb/dvb-usb/au6610.c13
-rw-r--r--drivers/media/dvb/dvb-usb/gl861.c13
-rw-r--r--drivers/media/dvb/frontends/qt1010.c16
3 files changed, 15 insertions, 27 deletions
diff --git a/drivers/media/dvb/dvb-usb/au6610.c b/drivers/media/dvb/dvb-usb/au6610.c
index 456b89f4f761..0dc66a8d2baf 100644
--- a/drivers/media/dvb/dvb-usb/au6610.c
+++ b/drivers/media/dvb/dvb-usb/au6610.c
@@ -145,19 +145,6 @@ static struct qt1010_config au6610_qt1010_config = {
145 145
146static int au6610_qt1010_tuner_attach(struct dvb_usb_adapter *adap) 146static int au6610_qt1010_tuner_attach(struct dvb_usb_adapter *adap)
147{ 147{
148 /* TODO FIXME; probably I2C gate.
149 QT1010 tuner does not respond before we write 0x1a to ZL10353 demod
150 register 0x62. This ought to be done somewhere in demod initialization.
151 This solution is temporary hack. */
152
153 u8 buf[2] = { 0x62, 0x1a };
154 struct i2c_msg msg = { .addr = au6610_zl10353_config.demod_address,
155 .flags = 0, .buf = buf, .len = 2 };
156
157 if (i2c_transfer(&adap->dev->i2c_adap, &msg, 1) != 1) {
158 printk(KERN_WARNING "au6610 tuner attach failed\n");
159 return -EREMOTEIO;
160 }
161 return dvb_attach(qt1010_attach, 148 return dvb_attach(qt1010_attach,
162 adap->fe, &adap->dev->i2c_adap, 149 adap->fe, &adap->dev->i2c_adap,
163 &au6610_qt1010_config) == NULL ? -ENODEV : 0; 150 &au6610_qt1010_config) == NULL ? -ENODEV : 0;
diff --git a/drivers/media/dvb/dvb-usb/gl861.c b/drivers/media/dvb/dvb-usb/gl861.c
index d62edb533d00..c9f38a5e70d3 100644
--- a/drivers/media/dvb/dvb-usb/gl861.c
+++ b/drivers/media/dvb/dvb-usb/gl861.c
@@ -122,19 +122,6 @@ static struct qt1010_config gl861_qt1010_config = {
122 122
123static int gl861_tuner_attach(struct dvb_usb_adapter *adap) 123static int gl861_tuner_attach(struct dvb_usb_adapter *adap)
124{ 124{
125 /* TODO FIXME; probably I2C gate.
126 QT1010 tuner does not respond before we write 0x1a to ZL10353 demod
127 register 0x62. This ought to be done somewhere in demod initialization.
128 This solution is temporary hack. */
129
130 u8 buf[2] = { 0x62, 0x1a };
131 struct i2c_msg msg = { .addr = gl861_zl10353_config.demod_address,
132 .flags = 0, .buf = buf, .len = 2 };
133
134 if (i2c_transfer(&adap->dev->i2c_adap, &msg, 1) != 1) {
135 printk(KERN_WARNING "gl861 tuner attach failed\n");
136 return -EREMOTEIO;
137 }
138 return dvb_attach(qt1010_attach, 125 return dvb_attach(qt1010_attach,
139 adap->fe, &adap->dev->i2c_adap, 126 adap->fe, &adap->dev->i2c_adap,
140 &gl861_qt1010_config) == NULL ? -ENODEV : 0; 127 &gl861_qt1010_config) == NULL ? -ENODEV : 0;
diff --git a/drivers/media/dvb/frontends/qt1010.c b/drivers/media/dvb/frontends/qt1010.c
index d7360f45355a..c3408dcabe87 100644
--- a/drivers/media/dvb/frontends/qt1010.c
+++ b/drivers/media/dvb/frontends/qt1010.c
@@ -149,6 +149,9 @@ static int qt1010_set_params(struct dvb_frontend *fe, struct dvb_frontend_parame
149 priv->bandwidth = (fe->ops.info.type == FE_OFDM) ? params->u.ofdm.bandwidth : 0; 149 priv->bandwidth = (fe->ops.info.type == FE_OFDM) ? params->u.ofdm.bandwidth : 0;
150 priv->frequency = freq; 150 priv->frequency = freq;
151 151
152 if (fe->ops.i2c_gate_ctrl)
153 fe->ops.i2c_gate_ctrl(fe, 1); /* open i2c_gate */
154
152 /* reg 05 base value */ 155 /* reg 05 base value */
153 if (freq < 290000000) reg05 = 0x14; /* 290 MHz */ 156 if (freq < 290000000) reg05 = 0x14; /* 290 MHz */
154 else if (freq < 610000000) reg05 = 0x34; /* 610 MHz */ 157 else if (freq < 610000000) reg05 = 0x34; /* 610 MHz */
@@ -242,6 +245,9 @@ static int qt1010_set_params(struct dvb_frontend *fe, struct dvb_frontend_parame
242 if (debug) 245 if (debug)
243 qt1010_dump_regs(priv); 246 qt1010_dump_regs(priv);
244 247
248 if (fe->ops.i2c_gate_ctrl)
249 fe->ops.i2c_gate_ctrl(fe, 0); /* close i2c_gate */
250
245 return 0; 251 return 0;
246} 252}
247 253
@@ -277,7 +283,6 @@ static int qt1010_init_meas1(struct qt1010_priv *priv, u8 oper, u8 reg, u8 reg_i
277 return qt1010_writereg(priv, 0x1e, 0x00); 283 return qt1010_writereg(priv, 0x1e, 0x00);
278} 284}
279 285
280
281static u8 qt1010_init_meas2(struct qt1010_priv *priv, u8 reg_init_val, u8 *retval) 286static u8 qt1010_init_meas2(struct qt1010_priv *priv, u8 reg_init_val, u8 *retval)
282{ 287{
283 u8 i, val; 288 u8 i, val;
@@ -347,6 +352,9 @@ static int qt1010_init(struct dvb_frontend *fe)
347 { QT1010_WR, 0x08, 0x08 } 352 { QT1010_WR, 0x08, 0x08 }
348 }; 353 };
349 354
355 if (fe->ops.i2c_gate_ctrl)
356 fe->ops.i2c_gate_ctrl(fe, 1); /* open i2c_gate */
357
350 for (i = 0; i < sizeof(i2c_data) / sizeof(*i2c_data); i++) { 358 for (i = 0; i < sizeof(i2c_data) / sizeof(*i2c_data); i++) {
351 switch (i2c_data[i].oper) { 359 switch (i2c_data[i].oper) {
352 case QT1010_WR: 360 case QT1010_WR:
@@ -430,6 +438,9 @@ struct dvb_frontend * qt1010_attach(struct dvb_frontend *fe,
430 priv->cfg = cfg; 438 priv->cfg = cfg;
431 priv->i2c = i2c; 439 priv->i2c = i2c;
432 440
441 if (fe->ops.i2c_gate_ctrl)
442 fe->ops.i2c_gate_ctrl(fe, 1); /* open i2c_gate */
443
433 444
434 /* Try to detect tuner chip. Probably this is not correct register. */ 445 /* Try to detect tuner chip. Probably this is not correct register. */
435 if (qt1010_readreg(priv, 0x29, &id) != 0 || (id != 0x39)) { 446 if (qt1010_readreg(priv, 0x29, &id) != 0 || (id != 0x39)) {
@@ -437,6 +448,9 @@ struct dvb_frontend * qt1010_attach(struct dvb_frontend *fe,
437 return NULL; 448 return NULL;
438 } 449 }
439 450
451 if (fe->ops.i2c_gate_ctrl)
452 fe->ops.i2c_gate_ctrl(fe, 0); /* close i2c_gate */
453
440 printk(KERN_INFO "Quantek QT1010 successfully identified.\n"); 454 printk(KERN_INFO "Quantek QT1010 successfully identified.\n");
441 memcpy(&fe->ops.tuner_ops, &qt1010_tuner_ops, sizeof(struct dvb_tuner_ops)); 455 memcpy(&fe->ops.tuner_ops, &qt1010_tuner_ops, sizeof(struct dvb_tuner_ops));
442 456