V4L/DVB (5237): Dvb: add new qt1010 tuner module
authorAntti Palosaari <crope@iki.fi>
Sun, 21 Jan 2007 18:56:10 +0000 (15:56 -0300)
committerMauro Carvalho Chehab <mchehab@infradead.org>
Wed, 21 Feb 2007 15:35:30 +0000 (13:35 -0200)
gl861: (MSI Megasky)
- hack for enable ZL10353 / QT1010 I2C gate
- use new QT1010 module instead of old code

au6610: (Sigmatek DVB-110)
- hack for enable ZL10353 / QT1010 I2C gate
- use new QT1010 module instead of old code

Tested successfully with au6610 and gl861 devices against fi-Yllas
frequencies. Now it locks perfectly with both devices.
There is a "hack" to enable probable i2c gate in zl10535
demodulator. QT1010 doesn't respond to any i2c messages before we
write 0x1a to demodulator register 0x62. In my understanding this
should be fixed to demodulator code.

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>
drivers/media/dvb/dvb-usb/au6610.c
drivers/media/dvb/dvb-usb/gl861.c

index 1796a7d63aa133f061e0d45d91aafd51ba6e9c26..1c0160dfc2af2d8a4c8caec2f5ad0aa6746cca95 100644 (file)
@@ -1,6 +1,6 @@
 /* DVB USB compliant linux driver for Sigmatek DVB-110 DVB-T USB2.0 receiver
  *
- * Copyright (C) 2006 Antti Palosaari (crope@iki.fi)
+ * Copyright (C) 2006 Antti Palosaari <crope@iki.fi>
  *
  *     This program is free software; you can redistribute it and/or modify it
  *     under the terms of the GNU General Public License as published by the Free
@@ -19,7 +19,6 @@ static int dvb_usb_au6610_debug;
 module_param_named(debug, dvb_usb_au6610_debug, int, 0644);
 MODULE_PARM_DESC(debug, "set debugging level (1=rc (or-able))." DVB_USB_DEBUG_STATUS);
 
-
 static int au6610_usb_msg(struct dvb_usb_device *d, u8 operation, u8 addr,
                          u8 *wbuf, u16 wlen, u8 *rbuf, u16 rlen)
 {
@@ -127,7 +126,6 @@ static struct zl10353_config au6610_zl10353_config = {
        .parallel_ts = 1,
 };
 
-
 static int au6610_zl10353_frontend_attach(struct dvb_usb_adapter *adap)
 {
        if ((adap->fe = dvb_attach(zl10353_attach, &au6610_zl10353_config,
@@ -138,6 +136,29 @@ static int au6610_zl10353_frontend_attach(struct dvb_usb_adapter *adap)
        return -EIO;
 }
 
+static struct qt1010_config au6610_qt1010_config = {
+       .i2c_address = 0xc4
+};
+
+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 demodulator
+       register 0x62. This ought to be done somewhere in demodulator 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;
+}
+
 /* DVB USB Driver stuff */
 static struct dvb_usb_device_properties au6610_properties;
 
@@ -180,7 +201,7 @@ static struct dvb_usb_device_properties au6610_properties = {
        .adapter = {
                {
                        .frontend_attach  = au6610_zl10353_frontend_attach,
-                       .tuner_attach     = qt1010_tuner_attach,
+                       .tuner_attach     = au6610_qt1010_tuner_attach,
 
                        .stream = {
                                .type = USB_ISOC,
index 7dbfc79278806d3df0b3bed9234f15ff954bf792..200ba13d1d19aabe6759961e3b43e459d5b69012 100644 (file)
@@ -116,6 +116,29 @@ static int gl861_frontend_attach(struct dvb_usb_adapter *adap)
        return -EIO;
 }
 
+static struct qt1010_config gl861_qt1010_config = {
+       .i2c_address = 0xc4
+};
+
+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 demodulator
+       register 0x62. This ought to be done somewhere in demodulator 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;
+}
+
 /* DVB USB Driver stuff */
 static struct dvb_usb_device_properties gl861_properties;
 
@@ -161,7 +184,7 @@ static struct dvb_usb_device_properties gl861_properties = {
        .adapter = {{
 
                .frontend_attach  = gl861_frontend_attach,
-               .tuner_attach     = qt1010_tuner_attach,
+               .tuner_attach     = gl861_tuner_attach,
 
                .stream = {
                        .type = USB_BULK,