Commit ab84f182 authored by Antti Palosaari's avatar Antti Palosaari Committed by Mauro Carvalho Chehab

[media] ce6230: convert to new DVB USB

Signed-off-by: default avatarAntti Palosaari <crope@iki.fi>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 877e0aa7
...@@ -360,7 +360,7 @@ config DVB_USB_AF9015 ...@@ -360,7 +360,7 @@ config DVB_USB_AF9015
config DVB_USB_CE6230 config DVB_USB_CE6230
tristate "Intel CE6230 DVB-T USB2.0 support" tristate "Intel CE6230 DVB-T USB2.0 support"
depends on DVB_USB depends on DVB_USB_V2
select DVB_ZL10353 select DVB_ZL10353
select MEDIA_TUNER_MXL5005S if !MEDIA_TUNER_CUSTOMISE select MEDIA_TUNER_MXL5005S if !MEDIA_TUNER_CUSTOMISE
help help
......
...@@ -31,7 +31,7 @@ DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); ...@@ -31,7 +31,7 @@ DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
static struct zl10353_config ce6230_zl10353_config; 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; int ret;
unsigned int pipe; unsigned int pipe;
...@@ -71,15 +71,15 @@ static int ce6230_rw_udev(struct usb_device *udev, struct req_t *req) ...@@ -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)) { if (requesttype == (USB_TYPE_VENDOR | USB_DIR_OUT)) {
/* write */ /* write */
memcpy(buf, req->data, req->data_len); memcpy(buf, req->data, req->data_len);
pipe = usb_sndctrlpipe(udev, 0); pipe = usb_sndctrlpipe(d->udev, 0);
} else { } else {
/* read */ /* read */
pipe = usb_rcvctrlpipe(udev, 0); pipe = usb_rcvctrlpipe(d->udev, 0);
} }
msleep(1); /* avoid I2C errors */ 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); buf, req->data_len, CE6230_USB_TIMEOUT);
ce6230_debug_dump(request, requesttype, value, index, buf, ce6230_debug_dump(request, requesttype, value, index, buf,
...@@ -99,11 +99,6 @@ static int ce6230_rw_udev(struct usb_device *udev, struct req_t *req) ...@@ -99,11 +99,6 @@ static int ce6230_rw_udev(struct usb_device *udev, struct req_t *req)
return ret; return ret;
} }
static int ce6230_ctrl_msg(struct dvb_usb_device *d, struct req_t *req)
{
return ce6230_rw_udev(d->udev, req);
}
/* I2C */ /* I2C */
static int ce6230_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[], static int ce6230_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[],
int num) int num)
...@@ -186,9 +181,9 @@ static struct zl10353_config ce6230_zl10353_config = { ...@@ -186,9 +181,9 @@ static struct zl10353_config ce6230_zl10353_config = {
static int ce6230_zl10353_frontend_attach(struct dvb_usb_adapter *adap) static int ce6230_zl10353_frontend_attach(struct dvb_usb_adapter *adap)
{ {
deb_info("%s:\n", __func__); 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); &adap->dev->i2c_adap);
if (adap->fe_adap[0].fe == NULL) if (adap->fe[0] == NULL)
return -ENODEV; return -ENODEV;
return 0; return 0;
} }
...@@ -214,7 +209,7 @@ static int ce6230_mxl5003s_tuner_attach(struct dvb_usb_adapter *adap) ...@@ -214,7 +209,7 @@ static int ce6230_mxl5003s_tuner_attach(struct dvb_usb_adapter *adap)
{ {
int ret; int ret;
deb_info("%s:\n", __func__); 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; &ce6230_mxl5003s_config) == NULL ? -ENODEV : 0;
return ret; return ret;
} }
...@@ -234,49 +229,20 @@ static int ce6230_power_ctrl(struct dvb_usb_device *d, int onoff) ...@@ -234,49 +229,20 @@ static int ce6230_power_ctrl(struct dvb_usb_device *d, int onoff)
} }
/* DVB USB Driver stuff */ /* DVB USB Driver stuff */
static struct dvb_usb_device_properties ce6230_properties; static struct dvb_usb_device_properties ce6230_props = {
.driver_name = KBUILD_MODNAME,
static int ce6230_probe(struct usb_interface *intf, .owner = THIS_MODULE,
const struct usb_device_id *id) .adapter_nr = adapter_nr,
{ .bInterfaceNumber = 1,
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 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, .i2c_algo = &ce6230_i2c_algo,
.no_reconnect = 1, .power_ctrl = ce6230_power_ctrl,
.frontend_attach = ce6230_zl10353_frontend_attach,
.size_of_priv = 0, .tuner_attach = ce6230_mxl5003s_tuner_attach,
.num_adapters = 1, .num_adapters = 1,
.adapter = { .adapter = {
{ {
.num_frontends = 1,
.fe = {{
.frontend_attach = ce6230_zl10353_frontend_attach,
.tuner_attach = ce6230_mxl5003s_tuner_attach,
.stream = { .stream = {
.type = USB_BULK, .type = USB_BULK,
.count = 6, .count = 6,
...@@ -287,37 +253,31 @@ static struct dvb_usb_device_properties ce6230_properties = { ...@@ -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 = { static const struct usb_device_id ce6230_id_table[] = {
.name = "dvb_usb_ce6230", { DVB_USB_DEVICE(USB_VID_INTEL, USB_PID_INTEL_CE9500,
.probe = ce6230_probe, &ce6230_props, "Intel CE9500 reference design", NULL) },
.disconnect = dvb_usb_device_exit, { DVB_USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_A310,
.id_table = ce6230_table, &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_AUTHOR("Antti Palosaari <crope@iki.fi>");
MODULE_DESCRIPTION("Driver for Intel CE6230 DVB-T USB2.0"); MODULE_DESCRIPTION("Driver for Intel CE6230 DVB-T USB2.0");
......
...@@ -23,7 +23,23 @@ ...@@ -23,7 +23,23 @@
#define _DVB_USB_CE6230_H_ #define _DVB_USB_CE6230_H_
#define DVB_USB_LOG_PREFIX "ce6230" #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_info(args...) dprintk(dvb_usb_ce6230_debug, 0x01, args)
#define deb_rc(args...) dprintk(dvb_usb_ce6230_debug, 0x02, args) #define deb_rc(args...) dprintk(dvb_usb_ce6230_debug, 0x02, args)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment