fedora core 6 1.2949 + vserver 2.2.0
[linux-2.6.git] / drivers / media / dvb / dvb-usb / cxusb.c
index 356a09a..127a94b 100644 (file)
  * TODO: Use the cx25840-driver for the analogue part
  *
  * Copyright (C) 2005 Patrick Boettcher (patrick.boettcher@desy.de)
- * Copyright (C) 2005 Michael Krufky (mkrufky@m1k.net)
+ * Copyright (C) 2006 Michael Krufky (mkrufky@linuxtv.org)
  * Copyright (C) 2006 Chris Pascoe (c.pascoe@itee.uq.edu.au)
  *
- *     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
- *     Software Foundation, version 2.
+ *   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
+ *   Software Foundation, version 2.
  *
  * see Documentation/dvb/README.dvb-usb for more information
  */
 
 #include "cx22702.h"
 #include "lgdt330x.h"
+#include "lgh06xf.h"
 #include "mt352.h"
 #include "mt352_priv.h"
+#include "zl10353.h"
 
 /* debug */
 int dvb_usb_cxusb_debug;
-module_param_named(debug,dvb_usb_cxusb_debug, int, 0644);
+module_param_named(debug, dvb_usb_cxusb_debug, int, 0644);
 MODULE_PARM_DESC(debug, "set debugging level (1=rc (or-able))." DVB_USB_DEBUG_STATUS);
 
 static int cxusb_ctrl_msg(struct dvb_usb_device *d,
-               u8 cmd, u8 *wbuf, int wlen, u8 *rbuf, int rlen)
+                         u8 cmd, u8 *wbuf, int wlen, u8 *rbuf, int rlen)
 {
        int wo = (rbuf == NULL || rlen == 0); /* write-only */
        u8 sndbuf[1+wlen];
-       memset(sndbuf,0,1+wlen);
+       memset(sndbuf, 0, 1+wlen);
 
        sndbuf[0] = cmd;
-       memcpy(&sndbuf[1],wbuf,wlen);
+       memcpy(&sndbuf[1], wbuf, wlen);
        if (wo)
-               dvb_usb_generic_write(d,sndbuf,1+wlen);
+               dvb_usb_generic_write(d, sndbuf, 1+wlen);
        else
-               dvb_usb_generic_rw(d,sndbuf,1+wlen,rbuf,rlen,0);
+               dvb_usb_generic_rw(d, sndbuf, 1+wlen, rbuf, rlen, 0);
 
        return 0;
 }
@@ -56,14 +58,14 @@ static int cxusb_ctrl_msg(struct dvb_usb_device *d,
 static void cxusb_gpio_tuner(struct dvb_usb_device *d, int onoff)
 {
        struct cxusb_state *st = d->priv;
-       u8 o[2],i;
+       u8 o[2], i;
 
        if (st->gpio_write_state[GPIO_TUNER] == onoff)
                return;
 
        o[0] = GPIO_TUNER;
        o[1] = onoff;
-       cxusb_ctrl_msg(d,CMD_GPIO_WRITE,o,2,&i,1);
+       cxusb_ctrl_msg(d, CMD_GPIO_WRITE, o, 2, &i, 1);
 
        if (i != 0x01)
                deb_info("gpio_write failed.\n");
@@ -72,27 +74,29 @@ static void cxusb_gpio_tuner(struct dvb_usb_device *d, int onoff)
 }
 
 /* I2C */
-static int cxusb_i2c_xfer(struct i2c_adapter *adap,struct i2c_msg msg[],int num)
+static int cxusb_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[],
+                         int num)
 {
        struct dvb_usb_device *d = i2c_get_adapdata(adap);
        int i;
 
-       if (down_interruptible(&d->i2c_sem) < 0)
+       if (mutex_lock_interruptible(&d->i2c_mutex) < 0)
                return -EAGAIN;
 
        if (num > 2)
-               warn("more than 2 i2c messages at a time is not handled yet. TODO.");
+               warn("more than two i2c messages at a time is not handled yet. TODO.");
 
        for (i = 0; i < num; i++) {
 
-               switch (msg[i].addr) {
+               if (d->udev->descriptor.idVendor == USB_VID_MEDION)
+                       switch (msg[i].addr) {
                        case 0x63:
-                               cxusb_gpio_tuner(d,0);
+                               cxusb_gpio_tuner(d, 0);
                                break;
                        default:
-                               cxusb_gpio_tuner(d,1);
+                               cxusb_gpio_tuner(d, 1);
                                break;
-               }
+                       }
 
                /* read request */
                if (i+1 < num && (msg[i+1].flags & I2C_M_RD)) {
@@ -100,33 +104,34 @@ static int cxusb_i2c_xfer(struct i2c_adapter *adap,struct i2c_msg msg[],int num)
                        obuf[0] = msg[i].len;
                        obuf[1] = msg[i+1].len;
                        obuf[2] = msg[i].addr;
-                       memcpy(&obuf[3],msg[i].buf,msg[i].len);
+                       memcpy(&obuf[3], msg[i].buf, msg[i].len);
 
                        if (cxusb_ctrl_msg(d, CMD_I2C_READ,
-                                               obuf, 3+msg[i].len,
-                                               ibuf, 1+msg[i+1].len) < 0)
+                                          obuf, 3+msg[i].len,
+                                          ibuf, 1+msg[i+1].len) < 0)
                                break;
 
                        if (ibuf[0] != 0x08)
-                               deb_info("i2c read could have been failed\n");
+                               deb_i2c("i2c read may have failed\n");
 
-                       memcpy(msg[i+1].buf,&ibuf[1],msg[i+1].len);
+                       memcpy(msg[i+1].buf, &ibuf[1], msg[i+1].len);
 
                        i++;
                } else { /* write */
                        u8 obuf[2+msg[i].len], ibuf;
                        obuf[0] = msg[i].addr;
                        obuf[1] = msg[i].len;
-                       memcpy(&obuf[2],msg[i].buf,msg[i].len);
+                       memcpy(&obuf[2], msg[i].buf, msg[i].len);
 
-                       if (cxusb_ctrl_msg(d,CMD_I2C_WRITE, obuf, 2+msg[i].len, &ibuf,1) < 0)
+                       if (cxusb_ctrl_msg(d, CMD_I2C_WRITE, obuf,
+                                          2+msg[i].len, &ibuf,1) < 0)
                                break;
                        if (ibuf != 0x08)
-                               deb_info("i2c write could have been failed\n");
+                               deb_i2c("i2c write may have failed\n");
                }
        }
 
-       up(&d->i2c_sem);
+       mutex_unlock(&d->i2c_mutex);
        return i;
 }
 
@@ -158,13 +163,13 @@ static int cxusb_bluebird_power_ctrl(struct dvb_usb_device *d, int onoff)
                return 0;
 }
 
-static int cxusb_streaming_ctrl(struct dvb_usb_device *d, int onoff)
+static int cxusb_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff)
 {
        u8 buf[2] = { 0x03, 0x00 };
        if (onoff)
-               cxusb_ctrl_msg(d,CMD_STREAMING_ON, buf, 2, NULL, 0);
+               cxusb_ctrl_msg(adap->dev, CMD_STREAMING_ON, buf, 2, NULL, 0);
        else
-               cxusb_ctrl_msg(d,CMD_STREAMING_OFF, NULL, 0, NULL, 0);
+               cxusb_ctrl_msg(adap->dev, CMD_STREAMING_OFF, NULL, 0, NULL, 0);
 
        return 0;
 }
@@ -241,6 +246,45 @@ static struct dvb_usb_rc_key dvico_mce_rc_keys[] = {
        { 0xfe, 0x4e, KEY_POWER },
 };
 
+static struct dvb_usb_rc_key dvico_portable_rc_keys[] = {
+       { 0xfc, 0x02, KEY_SETUP },       /* Profile */
+       { 0xfc, 0x43, KEY_POWER2 },
+       { 0xfc, 0x06, KEY_EPG },
+       { 0xfc, 0x5a, KEY_BACK },
+       { 0xfc, 0x05, KEY_MENU },
+       { 0xfc, 0x47, KEY_INFO },
+       { 0xfc, 0x01, KEY_TAB },
+       { 0xfc, 0x42, KEY_PREVIOUSSONG },/* Replay */
+       { 0xfc, 0x49, KEY_VOLUMEUP },
+       { 0xfc, 0x09, KEY_VOLUMEDOWN },
+       { 0xfc, 0x54, KEY_CHANNELUP },
+       { 0xfc, 0x0b, KEY_CHANNELDOWN },
+       { 0xfc, 0x16, KEY_CAMERA },
+       { 0xfc, 0x40, KEY_TUNER },      /* ATV/DTV */
+       { 0xfc, 0x45, KEY_OPEN },
+       { 0xfc, 0x19, KEY_1 },
+       { 0xfc, 0x18, KEY_2 },
+       { 0xfc, 0x1b, KEY_3 },
+       { 0xfc, 0x1a, KEY_4 },
+       { 0xfc, 0x58, KEY_5 },
+       { 0xfc, 0x59, KEY_6 },
+       { 0xfc, 0x15, KEY_7 },
+       { 0xfc, 0x14, KEY_8 },
+       { 0xfc, 0x17, KEY_9 },
+       { 0xfc, 0x44, KEY_ANGLE },      /* Aspect */
+       { 0xfc, 0x55, KEY_0 },
+       { 0xfc, 0x07, KEY_ZOOM },
+       { 0xfc, 0x0a, KEY_REWIND },
+       { 0xfc, 0x08, KEY_PLAYPAUSE },
+       { 0xfc, 0x4b, KEY_FASTFORWARD },
+       { 0xfc, 0x5b, KEY_MUTE },
+       { 0xfc, 0x04, KEY_STOP },
+       { 0xfc, 0x56, KEY_RECORD },
+       { 0xfc, 0x57, KEY_POWER },
+       { 0xfc, 0x41, KEY_UNKNOWN },    /* INPUT */
+       { 0xfc, 0x00, KEY_UNKNOWN },    /* HD */
+};
+
 static int cxusb_dee1601_demod_init(struct dvb_frontend* fe)
 {
        static u8 clock_config []  = { CLOCK_CTL,  0x38, 0x28 };
@@ -284,122 +328,126 @@ static int cxusb_mt352_demod_init(struct dvb_frontend* fe)
 
 static struct cx22702_config cxusb_cx22702_config = {
        .demod_address = 0x63,
-
        .output_mode = CX22702_PARALLEL_OUTPUT,
-
-       .pll_init = dvb_usb_pll_init_i2c,
-       .pll_set  = dvb_usb_pll_set_i2c,
 };
 
 static struct lgdt330x_config cxusb_lgdt3303_config = {
        .demod_address = 0x0e,
        .demod_chip    = LGDT3303,
-       .pll_set       = dvb_usb_pll_set_i2c,
 };
 
 static struct mt352_config cxusb_dee1601_config = {
        .demod_address = 0x0f,
        .demod_init    = cxusb_dee1601_demod_init,
-       .pll_set       = dvb_usb_pll_set,
 };
 
-struct mt352_config cxusb_mt352_config = {
+static struct zl10353_config cxusb_zl10353_dee1601_config = {
+       .demod_address = 0x0f,
+       .parallel_ts = 1,
+};
+
+static struct mt352_config cxusb_mt352_config = {
        /* used in both lgz201 and th7579 */
        .demod_address = 0x0f,
        .demod_init    = cxusb_mt352_demod_init,
-       .pll_set       = dvb_usb_pll_set,
 };
 
 /* Callbacks for DVB USB */
-static int cxusb_fmd1216me_tuner_attach(struct dvb_usb_device *d)
+static int cxusb_fmd1216me_tuner_attach(struct dvb_usb_adapter *adap)
 {
        u8 bpll[4] = { 0x0b, 0xdc, 0x9c, 0xa0 };
-       d->pll_addr = 0x61;
-       memcpy(d->pll_init, bpll, 4);
-       d->pll_desc = &dvb_pll_fmd1216me;
+       adap->pll_addr = 0x61;
+       memcpy(adap->pll_init, bpll, 4);
+       adap->pll_desc = &dvb_pll_fmd1216me;
+
+       adap->fe->ops.tuner_ops.init = dvb_usb_tuner_init_i2c;
+       adap->fe->ops.tuner_ops.set_params = dvb_usb_tuner_set_params_i2c;
+
        return 0;
 }
 
-static int cxusb_lgh064f_tuner_attach(struct dvb_usb_device *d)
+static int cxusb_dee1601_tuner_attach(struct dvb_usb_adapter *adap)
 {
-       u8 bpll[4] = { 0x00, 0x00, 0x18, 0x50 };
-       /* bpll[2] : unset bit 3, set bits 4&5
-          bpll[3] : 0x50 - digital, 0x20 - analog */
-       d->pll_addr = 0x61;
-       memcpy(d->pll_init, bpll, 4);
-       d->pll_desc = &dvb_pll_tdvs_tua6034;
+       dvb_attach(dvb_pll_attach, adap->fe, 0x61,
+                  NULL, &dvb_pll_thomson_dtt7579);
        return 0;
 }
 
-static int cxusb_dee1601_tuner_attach(struct dvb_usb_device *d)
+static int cxusb_lgz201_tuner_attach(struct dvb_usb_adapter *adap)
 {
-       d->pll_addr = 0x61;
-       d->pll_desc = &dvb_pll_thomson_dtt7579;
+       dvb_attach(dvb_pll_attach, adap->fe, 0x61, NULL, &dvb_pll_lg_z201);
        return 0;
 }
 
-static int cxusb_lgz201_tuner_attach(struct dvb_usb_device *d)
+static int cxusb_dtt7579_tuner_attach(struct dvb_usb_adapter *adap)
 {
-       d->pll_addr = 0x61;
-       d->pll_desc = &dvb_pll_lg_z201;
+       dvb_attach(dvb_pll_attach, adap->fe, 0x60,
+                  NULL, &dvb_pll_thomson_dtt7579);
        return 0;
 }
 
-static int cxusb_dtt7579_tuner_attach(struct dvb_usb_device *d)
+static int cxusb_lgh064f_tuner_attach(struct dvb_usb_adapter *adap)
 {
-       d->pll_addr = 0x60;
-       d->pll_desc = &dvb_pll_thomson_dtt7579;
+       dvb_attach(lgh06xf_attach, adap->fe, &adap->dev->i2c_adap);
        return 0;
 }
 
-static int cxusb_cx22702_frontend_attach(struct dvb_usb_device *d)
+static int cxusb_cx22702_frontend_attach(struct dvb_usb_adapter *adap)
 {
        u8 b;
-       if (usb_set_interface(d->udev,0,6) < 0)
+       if (usb_set_interface(adap->dev->udev, 0, 6) < 0)
                err("set interface failed");
 
-       cxusb_ctrl_msg(d,CMD_DIGITAL, NULL, 0, &b, 1);
+       cxusb_ctrl_msg(adap->dev, CMD_DIGITAL, NULL, 0, &b, 1);
 
-       if ((d->fe = cx22702_attach(&cxusb_cx22702_config, &d->i2c_adap)) != NULL)
+       if ((adap->fe = dvb_attach(cx22702_attach, &cxusb_cx22702_config,
+                                  &adap->dev->i2c_adap)) != NULL)
                return 0;
 
        return -EIO;
 }
 
-static int cxusb_lgdt3303_frontend_attach(struct dvb_usb_device *d)
+static int cxusb_lgdt3303_frontend_attach(struct dvb_usb_adapter *adap)
 {
-       if (usb_set_interface(d->udev,0,7) < 0)
+       if (usb_set_interface(adap->dev->udev, 0, 7) < 0)
                err("set interface failed");
 
-       cxusb_ctrl_msg(d,CMD_DIGITAL, NULL, 0, NULL, 0);
+       cxusb_ctrl_msg(adap->dev, CMD_DIGITAL, NULL, 0, NULL, 0);
 
-       if ((d->fe = lgdt330x_attach(&cxusb_lgdt3303_config, &d->i2c_adap)) != NULL)
+       if ((adap->fe = dvb_attach(lgdt330x_attach, &cxusb_lgdt3303_config,
+                                  &adap->dev->i2c_adap)) != NULL)
                return 0;
 
        return -EIO;
 }
 
-static int cxusb_mt352_frontend_attach(struct dvb_usb_device *d)
-{      /* used in both lgz201 and th7579 */
-       if (usb_set_interface(d->udev,0,0) < 0)
+static int cxusb_mt352_frontend_attach(struct dvb_usb_adapter *adap)
+{
+       /* used in both lgz201 and th7579 */
+       if (usb_set_interface(adap->dev->udev, 0, 0) < 0)
                err("set interface failed");
 
-       cxusb_ctrl_msg(d,CMD_DIGITAL, NULL, 0, NULL, 0);
+       cxusb_ctrl_msg(adap->dev, CMD_DIGITAL, NULL, 0, NULL, 0);
 
-       if ((d->fe = mt352_attach(&cxusb_mt352_config, &d->i2c_adap)) != NULL)
+       if ((adap->fe = dvb_attach(mt352_attach, &cxusb_mt352_config,
+                                  &adap->dev->i2c_adap)) != NULL)
                return 0;
 
        return -EIO;
 }
 
-static int cxusb_dee1601_frontend_attach(struct dvb_usb_device *d)
+static int cxusb_dee1601_frontend_attach(struct dvb_usb_adapter *adap)
 {
-       if (usb_set_interface(d->udev,0,0) < 0)
+       if (usb_set_interface(adap->dev->udev, 0, 0) < 0)
                err("set interface failed");
 
-       cxusb_ctrl_msg(d,CMD_DIGITAL, NULL, 0, NULL, 0);
+       cxusb_ctrl_msg(adap->dev, CMD_DIGITAL, NULL, 0, NULL, 0);
 
-       if ((d->fe = mt352_attach(&cxusb_dee1601_config, &d->i2c_adap)) != NULL)
+       if (((adap->fe = dvb_attach(mt352_attach, &cxusb_dee1601_config,
+                                   &adap->dev->i2c_adap)) != NULL) ||
+               ((adap->fe = dvb_attach(zl10353_attach,
+                                       &cxusb_zl10353_dee1601_config,
+                                       &adap->dev->i2c_adap)) != NULL))
                return 0;
 
        return -EIO;
@@ -411,7 +459,8 @@ static int cxusb_dee1601_frontend_attach(struct dvb_usb_device *d)
  */
 
 #define BLUEBIRD_01_ID_OFFSET 6638
-static int bluebird_patch_dvico_firmware_download(struct usb_device *udev, const struct firmware *fw)
+static int bluebird_patch_dvico_firmware_download(struct usb_device *udev,
+                                                 const struct firmware *fw)
 {
        if (fw->size < BLUEBIRD_01_ID_OFFSET + 4)
                return -EINVAL;
@@ -419,25 +468,26 @@ static int bluebird_patch_dvico_firmware_download(struct usb_device *udev, const
        if (fw->data[BLUEBIRD_01_ID_OFFSET] == (USB_VID_DVICO & 0xff) &&
            fw->data[BLUEBIRD_01_ID_OFFSET + 1] == USB_VID_DVICO >> 8) {
 
-               /* FIXME: are we allowed to change the fw-data ? */
-               fw->data[BLUEBIRD_01_ID_OFFSET + 2] = udev->descriptor.idProduct + 1;
-               fw->data[BLUEBIRD_01_ID_OFFSET + 3] = udev->descriptor.idProduct >> 8;
+               fw->data[BLUEBIRD_01_ID_OFFSET + 2] =
+                       le16_to_cpu(udev->descriptor.idProduct) + 1;
+               fw->data[BLUEBIRD_01_ID_OFFSET + 3] =
+                       le16_to_cpu(udev->descriptor.idProduct) >> 8;
 
-               return usb_cypress_load_firmware(udev,fw,CYPRESS_FX2);
+               return usb_cypress_load_firmware(udev, fw, CYPRESS_FX2);
        }
 
        return -EINVAL;
 }
 
 /* DVB USB Driver stuff */
-static struct dvb_usb_properties cxusb_medion_properties;
-static struct dvb_usb_properties cxusb_bluebird_lgh064f_properties;
-static struct dvb_usb_properties cxusb_bluebird_dee1601_properties;
-static struct dvb_usb_properties cxusb_bluebird_lgz201_properties;
-static struct dvb_usb_properties cxusb_bluebird_dtt7579_properties;
+static struct dvb_usb_device_properties cxusb_medion_properties;
+static struct dvb_usb_device_properties cxusb_bluebird_lgh064f_properties;
+static struct dvb_usb_device_properties cxusb_bluebird_dee1601_properties;
+static struct dvb_usb_device_properties cxusb_bluebird_lgz201_properties;
+static struct dvb_usb_device_properties cxusb_bluebird_dtt7579_properties;
 
 static int cxusb_probe(struct usb_interface *intf,
-               const struct usb_device_id *id)
+                      const struct usb_device_id *id)
 {
        if (dvb_usb_device_init(intf,&cxusb_medion_properties,THIS_MODULE,NULL) == 0 ||
                dvb_usb_device_init(intf,&cxusb_bluebird_lgh064f_properties,THIS_MODULE,NULL) == 0 ||
@@ -451,47 +501,55 @@ static int cxusb_probe(struct usb_interface *intf,
 }
 
 static struct usb_device_id cxusb_table [] = {
-               { USB_DEVICE(USB_VID_MEDION, USB_PID_MEDION_MD95700) },
-               { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_LG064F_COLD) },
-               { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_LG064F_WARM) },
-               { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DEE1601_COLD) },
-               { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DEE1601_WARM) },
-               { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_LGZ201_COLD) },
-               { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_LGZ201_WARM) },
-               { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_TH7579_COLD) },
-               { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_TH7579_WARM) },
-               { USB_DEVICE(USB_VID_DVICO, USB_PID_DIGITALNOW_BLUEBIRD_DEE1601_COLD) },
-               { USB_DEVICE(USB_VID_DVICO, USB_PID_DIGITALNOW_BLUEBIRD_DEE1601_WARM) },
-               {}              /* Terminating entry */
+       { USB_DEVICE(USB_VID_MEDION, USB_PID_MEDION_MD95700) },
+       { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_LG064F_COLD) },
+       { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_LG064F_WARM) },
+       { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DUAL_1_COLD) },
+       { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DUAL_1_WARM) },
+       { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_LGZ201_COLD) },
+       { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_LGZ201_WARM) },
+       { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_TH7579_COLD) },
+       { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_TH7579_WARM) },
+       { USB_DEVICE(USB_VID_DVICO, USB_PID_DIGITALNOW_BLUEBIRD_DUAL_1_COLD) },
+       { USB_DEVICE(USB_VID_DVICO, USB_PID_DIGITALNOW_BLUEBIRD_DUAL_1_WARM) },
+       { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DUAL_2_COLD) },
+       { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DUAL_2_WARM) },
+       {}              /* Terminating entry */
 };
 MODULE_DEVICE_TABLE (usb, cxusb_table);
 
-static struct dvb_usb_properties cxusb_medion_properties = {
+static struct dvb_usb_device_properties cxusb_medion_properties = {
        .caps = DVB_USB_IS_AN_I2C_ADAPTER,
 
        .usb_ctrl = CYPRESS_FX2,
 
        .size_of_priv     = sizeof(struct cxusb_state),
 
-       .streaming_ctrl   = cxusb_streaming_ctrl,
+       .num_adapters = 1,
+       .adapter = {
+               {
+                       .streaming_ctrl   = cxusb_streaming_ctrl,
+                       .frontend_attach  = cxusb_cx22702_frontend_attach,
+                       .tuner_attach     = cxusb_fmd1216me_tuner_attach,
+                       /* parameter for the MPEG2-data transfer */
+                                       .stream = {
+                                               .type = USB_BULK,
+                               .count = 5,
+                               .endpoint = 0x02,
+                               .u = {
+                                       .bulk = {
+                                               .buffersize = 8192,
+                                       }
+                               }
+                       },
+
+               },
+       },
        .power_ctrl       = cxusb_power_ctrl,
-       .frontend_attach  = cxusb_cx22702_frontend_attach,
-       .tuner_attach     = cxusb_fmd1216me_tuner_attach,
 
        .i2c_algo         = &cxusb_i2c_algo,
 
        .generic_bulk_ctrl_endpoint = 0x01,
-       /* parameter for the MPEG2-data transfer */
-       .urb = {
-               .type = DVB_USB_BULK,
-               .count = 5,
-               .endpoint = 0x02,
-               .u = {
-                       .bulk = {
-                               .buffersize = 8192,
-                       }
-               }
-       },
 
        .num_device_descs = 1,
        .devices = {
@@ -502,7 +560,7 @@ static struct dvb_usb_properties cxusb_medion_properties = {
        }
 };
 
-static struct dvb_usb_properties cxusb_bluebird_lgh064f_properties = {
+static struct dvb_usb_device_properties cxusb_bluebird_lgh064f_properties = {
        .caps = DVB_USB_IS_AN_I2C_ADAPTER,
 
        .usb_ctrl          = DEVICE_SPECIFIC,
@@ -513,25 +571,37 @@ static struct dvb_usb_properties cxusb_bluebird_lgh064f_properties = {
 
        .size_of_priv     = sizeof(struct cxusb_state),
 
-       .streaming_ctrl   = cxusb_streaming_ctrl,
+       .num_adapters = 1,
+       .adapter = {
+               {
+                       .streaming_ctrl   = cxusb_streaming_ctrl,
+                       .frontend_attach  = cxusb_lgdt3303_frontend_attach,
+                       .tuner_attach     = cxusb_lgh064f_tuner_attach,
+
+                       /* parameter for the MPEG2-data transfer */
+                                       .stream = {
+                                               .type = USB_BULK,
+                               .count = 5,
+                               .endpoint = 0x02,
+                               .u = {
+                                       .bulk = {
+                                               .buffersize = 8192,
+                                       }
+                               }
+                       },
+               },
+       },
+
        .power_ctrl       = cxusb_bluebird_power_ctrl,
-       .frontend_attach  = cxusb_lgdt3303_frontend_attach,
-       .tuner_attach     = cxusb_lgh064f_tuner_attach,
 
        .i2c_algo         = &cxusb_i2c_algo,
 
+       .rc_interval      = 100,
+       .rc_key_map       = dvico_portable_rc_keys,
+       .rc_key_map_size  = ARRAY_SIZE(dvico_portable_rc_keys),
+       .rc_query         = cxusb_rc_query,
+
        .generic_bulk_ctrl_endpoint = 0x01,
-       /* parameter for the MPEG2-data transfer */
-       .urb = {
-               .type = DVB_USB_BULK,
-               .count = 5,
-               .endpoint = 0x02,
-               .u = {
-                       .bulk = {
-                               .buffersize = 8192,
-                       }
-               }
-       },
 
        .num_device_descs = 1,
        .devices = {
@@ -542,7 +612,7 @@ static struct dvb_usb_properties cxusb_bluebird_lgh064f_properties = {
        }
 };
 
-static struct dvb_usb_properties cxusb_bluebird_dee1601_properties = {
+static struct dvb_usb_device_properties cxusb_bluebird_dee1601_properties = {
        .caps = DVB_USB_IS_AN_I2C_ADAPTER,
 
        .usb_ctrl          = DEVICE_SPECIFIC,
@@ -553,10 +623,27 @@ static struct dvb_usb_properties cxusb_bluebird_dee1601_properties = {
 
        .size_of_priv     = sizeof(struct cxusb_state),
 
-       .streaming_ctrl   = cxusb_streaming_ctrl,
+       .num_adapters = 1,
+       .adapter = {
+               {
+                       .streaming_ctrl   = cxusb_streaming_ctrl,
+                       .frontend_attach  = cxusb_dee1601_frontend_attach,
+                       .tuner_attach     = cxusb_dee1601_tuner_attach,
+                       /* parameter for the MPEG2-data transfer */
+                       .stream = {
+                               .type = USB_BULK,
+                               .count = 5,
+                               .endpoint = 0x04,
+                               .u = {
+                                       .bulk = {
+                                               .buffersize = 8192,
+                                       }
+                               }
+                       },
+               },
+       },
+
        .power_ctrl       = cxusb_bluebird_power_ctrl,
-       .frontend_attach  = cxusb_dee1601_frontend_attach,
-       .tuner_attach     = cxusb_dee1601_tuner_attach,
 
        .i2c_algo         = &cxusb_i2c_algo,
 
@@ -566,19 +653,8 @@ static struct dvb_usb_properties cxusb_bluebird_dee1601_properties = {
        .rc_query         = cxusb_rc_query,
 
        .generic_bulk_ctrl_endpoint = 0x01,
-       /* parameter for the MPEG2-data transfer */
-       .urb = {
-               .type = DVB_USB_BULK,
-               .count = 5,
-               .endpoint = 0x04,
-               .u = {
-                       .bulk = {
-                               .buffersize = 8192,
-                       }
-               }
-       },
 
-       .num_device_descs = 2,
+       .num_device_descs = 3,
        .devices = {
                {   "DViCO FusionHDTV DVB-T Dual USB",
                        { &cxusb_table[3], NULL },
@@ -588,10 +664,14 @@ static struct dvb_usb_properties cxusb_bluebird_dee1601_properties = {
                        { &cxusb_table[9],  NULL },
                        { &cxusb_table[10], NULL },
                },
+               {   "DViCO FusionHDTV DVB-T Dual Digital 2",
+                       { &cxusb_table[11], NULL },
+                       { &cxusb_table[12], NULL },
+               },
        }
 };
 
-static struct dvb_usb_properties cxusb_bluebird_lgz201_properties = {
+static struct dvb_usb_device_properties cxusb_bluebird_lgz201_properties = {
        .caps = DVB_USB_IS_AN_I2C_ADAPTER,
 
        .usb_ctrl          = DEVICE_SPECIFIC,
@@ -602,26 +682,36 @@ static struct dvb_usb_properties cxusb_bluebird_lgz201_properties = {
 
        .size_of_priv     = sizeof(struct cxusb_state),
 
-       .streaming_ctrl   = cxusb_streaming_ctrl,
+       .num_adapters = 2,
+       .adapter = {
+               {
+                       .streaming_ctrl   = cxusb_streaming_ctrl,
+                       .frontend_attach  = cxusb_mt352_frontend_attach,
+                       .tuner_attach     = cxusb_lgz201_tuner_attach,
+
+                       /* parameter for the MPEG2-data transfer */
+                       .stream = {
+                               .type = USB_BULK,
+                               .count = 5,
+                               .endpoint = 0x04,
+                               .u = {
+                                       .bulk = {
+                                               .buffersize = 8192,
+                                       }
+                               }
+                       },
+               },
+       },
        .power_ctrl       = cxusb_bluebird_power_ctrl,
-       .frontend_attach  = cxusb_mt352_frontend_attach,
-       .tuner_attach     = cxusb_lgz201_tuner_attach,
 
        .i2c_algo         = &cxusb_i2c_algo,
 
-       .generic_bulk_ctrl_endpoint = 0x01,
-       /* parameter for the MPEG2-data transfer */
-       .urb = {
-               .type = DVB_USB_BULK,
-               .count = 5,
-               .endpoint = 0x04,
-               .u = {
-                       .bulk = {
-                               .buffersize = 8192,
-                       }
-               }
-       },
+       .rc_interval      = 100,
+       .rc_key_map       = dvico_portable_rc_keys,
+       .rc_key_map_size  = ARRAY_SIZE(dvico_portable_rc_keys),
+       .rc_query         = cxusb_rc_query,
 
+       .generic_bulk_ctrl_endpoint = 0x01,
        .num_device_descs = 1,
        .devices = {
                {   "DViCO FusionHDTV DVB-T USB (LGZ201)",
@@ -631,7 +721,7 @@ static struct dvb_usb_properties cxusb_bluebird_lgz201_properties = {
        }
 };
 
-static struct dvb_usb_properties cxusb_bluebird_dtt7579_properties = {
+static struct dvb_usb_device_properties cxusb_bluebird_dtt7579_properties = {
        .caps = DVB_USB_IS_AN_I2C_ADAPTER,
 
        .usb_ctrl          = DEVICE_SPECIFIC,
@@ -642,25 +732,36 @@ static struct dvb_usb_properties cxusb_bluebird_dtt7579_properties = {
 
        .size_of_priv     = sizeof(struct cxusb_state),
 
-       .streaming_ctrl   = cxusb_streaming_ctrl,
+       .num_adapters = 1,
+       .adapter = {
+               {
+                       .streaming_ctrl   = cxusb_streaming_ctrl,
+                       .frontend_attach  = cxusb_mt352_frontend_attach,
+                       .tuner_attach     = cxusb_dtt7579_tuner_attach,
+
+                       /* parameter for the MPEG2-data transfer */
+                       .stream = {
+                               .type = USB_BULK,
+                               .count = 5,
+                               .endpoint = 0x04,
+                               .u = {
+                                       .bulk = {
+                                               .buffersize = 8192,
+                                       }
+                               }
+                       },
+               },
+       },
        .power_ctrl       = cxusb_bluebird_power_ctrl,
-       .frontend_attach  = cxusb_mt352_frontend_attach,
-       .tuner_attach     = cxusb_dtt7579_tuner_attach,
 
        .i2c_algo         = &cxusb_i2c_algo,
 
+       .rc_interval      = 100,
+       .rc_key_map       = dvico_portable_rc_keys,
+       .rc_key_map_size  = ARRAY_SIZE(dvico_portable_rc_keys),
+       .rc_query         = cxusb_rc_query,
+
        .generic_bulk_ctrl_endpoint = 0x01,
-       /* parameter for the MPEG2-data transfer */
-       .urb = {
-               .type = DVB_USB_BULK,
-               .count = 5,
-               .endpoint = 0x04,
-               .u = {
-                       .bulk = {
-                               .buffersize = 8192,
-                       }
-               }
-       },
 
        .num_device_descs = 1,
        .devices = {
@@ -674,7 +775,7 @@ static struct dvb_usb_properties cxusb_bluebird_dtt7579_properties = {
 static struct usb_driver cxusb_driver = {
        .name           = "dvb_usb_cxusb",
        .probe          = cxusb_probe,
-       .disconnect = dvb_usb_device_exit,
+       .disconnect     = dvb_usb_device_exit,
        .id_table       = cxusb_table,
 };
 
@@ -700,7 +801,7 @@ module_init (cxusb_module_init);
 module_exit (cxusb_module_exit);
 
 MODULE_AUTHOR("Patrick Boettcher <patrick.boettcher@desy.de>");
-MODULE_AUTHOR("Michael Krufky <mkrufky@m1k.net>");
+MODULE_AUTHOR("Michael Krufky <mkrufky@linuxtv.org>");
 MODULE_AUTHOR("Chris Pascoe <c.pascoe@itee.uq.edu.au>");
 MODULE_DESCRIPTION("Driver for Conexant USB2.0 hybrid reference design");
 MODULE_VERSION("1.0-alpha");