]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
[media] ce6230: convert to new DVB USB
authorAntti Palosaari <crope@iki.fi>
Thu, 14 Jun 2012 02:03:08 +0000 (23:03 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Sat, 4 Aug 2012 10:56:32 +0000 (07:56 -0300)
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/dvb/dvb-usb/Kconfig
drivers/media/dvb/dvb-usb/ce6230.c
drivers/media/dvb/dvb-usb/ce6230.h

index fbca7a07623601d66648221b17a464323563a05a..52b3108601a61eccdfc61e376c94e4a20e07ba2c 100644 (file)
@@ -360,7 +360,7 @@ config DVB_USB_AF9015
 
 config DVB_USB_CE6230
        tristate "Intel CE6230 DVB-T USB2.0 support"
-       depends on DVB_USB
+       depends on DVB_USB_V2
        select DVB_ZL10353
        select MEDIA_TUNER_MXL5005S if !MEDIA_TUNER_CUSTOMISE
        help
index fa637255729c50a7026565d0bdc5eba2cc3ba903..ee6a4019dd8e5f104133e3371c47ff709d4356fa 100644 (file)
@@ -31,7 +31,7 @@ DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
 
 static struct zl10353_config ce6230_zl10353_config;
 
-static int ce6230_rw_udev(struct usb_device *udev, struct req_t *req)
+static int ce6230_ctrl_msg(struct dvb_usb_device *d, struct req_t *req)
 {
        int ret;
        unsigned int pipe;
@@ -71,15 +71,15 @@ static int ce6230_rw_udev(struct usb_device *udev, struct req_t *req)
        if (requesttype == (USB_TYPE_VENDOR | USB_DIR_OUT)) {
                /* write */
                memcpy(buf, req->data, req->data_len);
-               pipe = usb_sndctrlpipe(udev, 0);
+               pipe = usb_sndctrlpipe(d->udev, 0);
        } else {
                /* read */
-               pipe = usb_rcvctrlpipe(udev, 0);
+               pipe = usb_rcvctrlpipe(d->udev, 0);
        }
 
        msleep(1); /* avoid I2C errors */
 
-       ret = usb_control_msg(udev, pipe, request, requesttype, value, index,
+       ret = usb_control_msg(d->udev, pipe, request, requesttype, value, index,
                                buf, req->data_len, CE6230_USB_TIMEOUT);
 
        ce6230_debug_dump(request, requesttype, value, index, buf,
@@ -99,11 +99,6 @@ error:
        return ret;
 }
 
-static int ce6230_ctrl_msg(struct dvb_usb_device *d, struct req_t *req)
-{
-       return ce6230_rw_udev(d->udev, req);
-}
-
 /* I2C */
 static int ce6230_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[],
                           int num)
@@ -186,9 +181,9 @@ static struct zl10353_config ce6230_zl10353_config = {
 static int ce6230_zl10353_frontend_attach(struct dvb_usb_adapter *adap)
 {
        deb_info("%s:\n", __func__);
-       adap->fe_adap[0].fe = dvb_attach(zl10353_attach, &ce6230_zl10353_config,
+       adap->fe[0] = dvb_attach(zl10353_attach, &ce6230_zl10353_config,
                &adap->dev->i2c_adap);
-       if (adap->fe_adap[0].fe == NULL)
+       if (adap->fe[0] == NULL)
                return -ENODEV;
        return 0;
 }
@@ -214,7 +209,7 @@ static int ce6230_mxl5003s_tuner_attach(struct dvb_usb_adapter *adap)
 {
        int ret;
        deb_info("%s:\n", __func__);
-       ret = dvb_attach(mxl5005s_attach, adap->fe_adap[0].fe, &adap->dev->i2c_adap,
+       ret = dvb_attach(mxl5005s_attach, adap->fe[0], &adap->dev->i2c_adap,
                        &ce6230_mxl5003s_config) == NULL ? -ENODEV : 0;
        return ret;
 }
@@ -234,49 +229,20 @@ static int ce6230_power_ctrl(struct dvb_usb_device *d, int onoff)
 }
 
 /* DVB USB Driver stuff */
-static struct dvb_usb_device_properties ce6230_properties;
-
-static int ce6230_probe(struct usb_interface *intf,
-                       const struct usb_device_id *id)
-{
-       int ret = 0;
-       struct dvb_usb_device *d = NULL;
-
-       deb_info("%s: interface:%d\n", __func__,
-               intf->cur_altsetting->desc.bInterfaceNumber);
-
-       if (intf->cur_altsetting->desc.bInterfaceNumber == 1) {
-               ret = dvb_usb_device_init(intf, &ce6230_properties, THIS_MODULE,
-                       &d, adapter_nr);
-               if (ret)
-                       err("init failed with error:%d\n", ret);
-       }
-
-       return ret;
-}
+static struct dvb_usb_device_properties ce6230_props = {
+       .driver_name = KBUILD_MODNAME,
+       .owner = THIS_MODULE,
+       .adapter_nr = adapter_nr,
+       .bInterfaceNumber = 1,
 
-static struct usb_device_id ce6230_table[] = {
-       { USB_DEVICE(USB_VID_INTEL, USB_PID_INTEL_CE9500) },
-       { USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_A310) },
-       { } /* Terminating entry */
-};
-MODULE_DEVICE_TABLE(usb, ce6230_table);
-
-static struct dvb_usb_device_properties ce6230_properties = {
-       .caps = DVB_USB_IS_AN_I2C_ADAPTER,
-
-       .usb_ctrl = DEVICE_SPECIFIC,
-       .no_reconnect = 1,
-
-       .size_of_priv = 0,
+       .i2c_algo = &ce6230_i2c_algo,
+       .power_ctrl = ce6230_power_ctrl,
+       .frontend_attach = ce6230_zl10353_frontend_attach,
+       .tuner_attach = ce6230_mxl5003s_tuner_attach,
 
        .num_adapters = 1,
        .adapter = {
                {
-               .num_frontends = 1,
-               .fe = {{
-                       .frontend_attach  = ce6230_zl10353_frontend_attach,
-                       .tuner_attach     = ce6230_mxl5003s_tuner_attach,
                        .stream = {
                                .type = USB_BULK,
                                .count = 6,
@@ -287,37 +253,31 @@ static struct dvb_usb_device_properties ce6230_properties = {
                                        }
                                }
                        },
-               }},
                }
        },
-
-       .power_ctrl = ce6230_power_ctrl,
-
-       .i2c_algo = &ce6230_i2c_algo,
-
-       .num_device_descs = 2,
-       .devices = {
-               {
-                       .name = "Intel CE9500 reference design",
-                       .cold_ids = {NULL},
-                       .warm_ids = {&ce6230_table[0], NULL},
-               },
-               {
-                       .name = "AVerMedia A310 USB 2.0 DVB-T tuner",
-                       .cold_ids = {NULL},
-                       .warm_ids = {&ce6230_table[1], NULL},
-               },
-       }
 };
 
-static struct usb_driver ce6230_driver = {
-       .name       = "dvb_usb_ce6230",
-       .probe      = ce6230_probe,
-       .disconnect = dvb_usb_device_exit,
-       .id_table   = ce6230_table,
+static const struct usb_device_id ce6230_id_table[] = {
+       { DVB_USB_DEVICE(USB_VID_INTEL, USB_PID_INTEL_CE9500,
+               &ce6230_props, "Intel CE9500 reference design", NULL) },
+       { DVB_USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_A310,
+               &ce6230_props, "AVerMedia A310 USB 2.0 DVB-T tuner", NULL) },
+       { }
+};
+MODULE_DEVICE_TABLE(usb, ce6230_id_table);
+
+static struct usb_driver ce6230_usb_driver = {
+       .name = KBUILD_MODNAME,
+       .id_table = ce6230_id_table,
+       .probe = dvb_usbv2_probe,
+       .disconnect = dvb_usbv2_disconnect,
+       .suspend = dvb_usbv2_suspend,
+       .resume = dvb_usbv2_resume,
+       .no_dynamic_id = 1,
+       .soft_unbind = 1,
 };
 
-module_usb_driver(ce6230_driver);
+module_usb_driver(ce6230_usb_driver);
 
 MODULE_AUTHOR("Antti Palosaari <crope@iki.fi>");
 MODULE_DESCRIPTION("Driver for Intel CE6230 DVB-T USB2.0");
index 97c42482ccb3de40e9f11e19289111227e501581..7c219539fbd8e0752e7172d31d5d0f02788566da 100644 (file)
 #define _DVB_USB_CE6230_H_
 
 #define DVB_USB_LOG_PREFIX "ce6230"
-#include "dvb-usb.h"
+#include "dvb_usb.h"
+
+#ifdef CONFIG_DVB_USB_DEBUG
+#define dprintk(var, level, args...) \
+       do { if ((var & level)) printk(args); } while (0)
+#define DVB_USB_DEBUG_STATUS
+#else
+#define dprintk(args...)
+#define DVB_USB_DEBUG_STATUS " (debugging is not enabled)"
+#endif
+
+#undef err
+#define err(format, arg...)  printk(KERN_ERR     DVB_USB_LOG_PREFIX ": " format "\n" , ## arg)
+#undef info
+#define info(format, arg...) printk(KERN_INFO    DVB_USB_LOG_PREFIX ": " format "\n" , ## arg)
+#undef warn
+#define warn(format, arg...) printk(KERN_WARNING DVB_USB_LOG_PREFIX ": " format "\n" , ## arg)
 
 #define deb_info(args...) dprintk(dvb_usb_ce6230_debug, 0x01, args)
 #define deb_rc(args...)   dprintk(dvb_usb_ce6230_debug, 0x02, args)