diff options
author | Anton Altaparmakov <aia21@cantab.net> | 2005-07-13 23:09:23 +0100 |
---|---|---|
committer | Anton Altaparmakov <aia21@cantab.net> | 2005-07-13 23:09:23 +0100 |
commit | c514720716c7b109ff980f8b3cb93f9af872c91c (patch) | |
tree | 490a9578995705de69712893a190b67651bddc56 /drivers/media/dvb/dvb-usb | |
parent | 07929dcb963786512c760dd3ecd148d89295e7e5 (diff) | |
parent | 1e279dd855d15b72364b4103f872d67d8592647e (diff) |
Automatic merge with /usr/src/ntfs-2.6.git.
Diffstat (limited to 'drivers/media/dvb/dvb-usb')
21 files changed, 808 insertions, 216 deletions
diff --git a/drivers/media/dvb/dvb-usb/Kconfig b/drivers/media/dvb/dvb-usb/Kconfig index 8aa32f6e447..612e5b087b1 100644 --- a/drivers/media/dvb/dvb-usb/Kconfig +++ b/drivers/media/dvb/dvb-usb/Kconfig @@ -3,30 +3,35 @@ config DVB_USB depends on DVB_CORE && USB select FW_LOADER help - By enabling this you will be able to choose the various USB 1.1 and - USB2.0 DVB devices. + By enabling this you will be able to choose the various supported + USB1.1 and USB2.0 DVB devices. Almost every USB device needs a firmware, please look into - <file:Documentation/dvb/README.dvb-usb> + <file:Documentation/dvb/README.dvb-usb>. - Say Y if you own an USB DVB device. + For a complete list of supported USB devices see the LinuxTV DVB Wiki: + <http://www.linuxtv.org/wiki/index.php/DVB_USB> + + Say Y if you own a USB DVB device. config DVB_USB_DEBUG bool "Enable extended debug support for all DVB-USB devices" depends on DVB_USB help - Say Y if you want to enable debuging. See modinfo dvb-usb (and the + Say Y if you want to enable debugging. See modinfo dvb-usb (and the appropriate drivers) for debug levels. config DVB_USB_A800 tristate "AVerMedia AverTV DVB-T USB 2.0 (A800)" depends on DVB_USB + select DVB_DIB3000MC help Say Y here to support the AVerMedia AverTV DVB-T USB 2.0 (A800) receiver. config DVB_USB_DIBUSB_MB tristate "DiBcom USB DVB-T devices (based on the DiB3000M-B) (see help for device list)" depends on DVB_USB + select DVB_DIB3000MB help Support for USB 1.1 and 2.0 DVB-T receivers based on reference designs made by DiBcom (<http://www.dibcom.fr>) equipped with a DiB3000M-B demodulator. @@ -52,6 +57,7 @@ config DVB_USB_DIBUSB_MB config DVB_USB_DIBUSB_MC tristate "DiBcom USB DVB-T devices (based on the DiB3000M-C/P) (see help for device list)" depends on DVB_USB + select DVB_DIB3000MC help Support for 2.0 DVB-T receivers based on reference designs made by DiBcom (<http://www.dibcom.fr>) equipped with a DiB3000M-C/P demodulator. @@ -66,12 +72,23 @@ config DVB_USB_DIBUSB_MC config DVB_USB_UMT_010 tristate "HanfTek UMT-010 DVB-T USB2.0 support" depends on DVB_USB + select DVB_DIB3000MC help Say Y here to support the HanfTek UMT-010 USB2.0 stick-sized DVB-T receiver. +config DVB_USB_CXUSB + tristate "Medion MD95700 hybrid USB2.0 (Conexant) support" + depends on DVB_USB + select DVB_CX22702 + help + Say Y here to support the Medion MD95700 hybrid USB2.0 device. Currently + only the DVB-T part is supported. + config DVB_USB_DIGITV tristate "Nebula Electronics uDigiTV DVB-T USB2.0 support" depends on DVB_USB + select DVB_NXT6000 + select DVB_MT352 help Say Y here to support the Nebula Electronics uDigitV USB2.0 DVB-T receiver. @@ -87,13 +104,16 @@ config DVB_USB_VP7045 config DVB_USB_NOVA_T_USB2 tristate "Hauppauge WinTV-NOVA-T usb2 DVB-T USB2.0 support" depends on DVB_USB + select DVB_DIB3000MC help Say Y here to support the Hauppauge WinTV-NOVA-T usb2 DVB-T USB2.0 receiver. config DVB_USB_DTT200U - tristate "Yakumo/Hama/Typhoon/Yuan DVB-T USB2.0 support" + tristate "WideView WT-200U and WT-220U (pen) DVB-T USB2.0 support (Yakumo/Hama/Typhoon/Yuan)" depends on DVB_USB help - Say Y here to support the Yakumo/Hama/Typhoon/Yuan DVB-T USB2.0 receiver. + Say Y here to support the WideView/Yakumo/Hama/Typhoon/Yuan DVB-T USB2.0 receiver. The receivers are also known as DTT200U (Yakumo) and UB300 (Yuan). + + The WT-220U and its clones are pen-sized. diff --git a/drivers/media/dvb/dvb-usb/Makefile b/drivers/media/dvb/dvb-usb/Makefile index d65b50f9abb..746d87ed6f3 100644 --- a/drivers/media/dvb/dvb-usb/Makefile +++ b/drivers/media/dvb/dvb-usb/Makefile @@ -27,4 +27,7 @@ obj-$(CONFIG_DVB_USB_UMT_010) += dvb-usb-dibusb-common.o dvb-usb-umt-010.o dvb-usb-digitv-objs = digitv.o obj-$(CONFIG_DVB_USB_DIGITV) += dvb-usb-digitv.o +dvb-usb-cxusb-objs = cxusb.o +obj-$(CONFIG_DVB_USB_CXUSB) += dvb-usb-cxusb.o + EXTRA_CFLAGS = -Idrivers/media/dvb/dvb-core/ -Idrivers/media/dvb/frontends/ diff --git a/drivers/media/dvb/dvb-usb/a800.c b/drivers/media/dvb/dvb-usb/a800.c index a3542935604..f2fcc2f1f84 100644 --- a/drivers/media/dvb/dvb-usb/a800.c +++ b/drivers/media/dvb/dvb-usb/a800.c @@ -61,6 +61,12 @@ static struct dvb_usb_rc_key a800_rc_keys[] = { { 0x02, 0x00, KEY_LAST }, /* >>| / BLUE */ { 0x02, 0x04, KEY_EPG }, /* EPG */ { 0x02, 0x15, KEY_MENU }, /* MENU */ + + { 0x03, 0x03, KEY_CHANNELUP }, /* CH UP */ + { 0x03, 0x02, KEY_CHANNELDOWN }, /* CH DOWN */ + { 0x03, 0x01, KEY_FIRST }, /* |<< / GREEN */ + { 0x03, 0x00, KEY_LAST }, /* >>| / BLUE */ + }; int a800_rc_query(struct dvb_usb_device *d, u32 *event, int *state) @@ -68,7 +74,7 @@ int a800_rc_query(struct dvb_usb_device *d, u32 *event, int *state) u8 key[5]; if (usb_control_msg(d->udev,usb_rcvctrlpipe(d->udev,0), 0x04, USB_TYPE_VENDOR | USB_DIR_IN, 0, 0, key, 5, - 2*HZ) != 5) + 2000) != 5) return -ENODEV; /* call the universal NEC remote processor, to find out the key's state and event */ @@ -143,7 +149,7 @@ static struct dvb_usb_properties a800_properties = { static struct usb_driver a800_driver = { .owner = THIS_MODULE, - .name = "AVerMedia AverTV DVB-T USB 2.0 (A800)", + .name = "dvb_usb_a800", .probe = a800_probe, .disconnect = dvb_usb_device_exit, .id_table = a800_table, diff --git a/drivers/media/dvb/dvb-usb/cxusb.c b/drivers/media/dvb/dvb-usb/cxusb.c new file mode 100644 index 00000000000..c3e1b661aae --- /dev/null +++ b/drivers/media/dvb/dvb-usb/cxusb.c @@ -0,0 +1,295 @@ +/* DVB USB compliant linux driver for Conexant USB reference design. + * + * The Conexant reference design I saw on their website was only for analogue + * capturing (using the cx25842). The box I took to write this driver (reverse + * engineered) is the one labeled Medion MD95700. In addition to the cx25842 + * for analogue capturing it also has a cx22702 DVB-T demodulator on the main + * board. Besides it has a atiremote (X10) and a USB2.0 hub onboard. + * + * Maybe it is a little bit premature to call this driver cxusb, but I assume + * the USB protocol is identical or at least inherited from the reference + * design, so it can be reused for the "analogue-only" device (if it will + * appear at all). + * + * TODO: check if the cx25840-driver (from ivtv) can be used for the analogue + * part + * + * Copyright (C) 2005 Patrick Boettcher (patrick.boettcher@desy.de) + * + * 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 "cxusb.h" + +#include "cx22702.h" + +/* debug */ +int dvb_usb_cxusb_debug; +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) +{ + int wo = (rbuf == NULL || rlen == 0); /* write-only */ + u8 sndbuf[1+wlen]; + memset(sndbuf,0,1+wlen); + + sndbuf[0] = cmd; + memcpy(&sndbuf[1],wbuf,wlen); + if (wo) + dvb_usb_generic_write(d,sndbuf,1+wlen); + else + dvb_usb_generic_rw(d,sndbuf,1+wlen,rbuf,rlen,0); + + return 0; +} + +/* I2C */ +static void cxusb_set_i2c_path(struct dvb_usb_device *d, enum cxusb_i2c_pathes path) +{ + struct cxusb_state *st = d->priv; + u8 o[2],i; + + if (path == st->cur_i2c_path) + return; + + o[0] = IOCTL_SET_I2C_PATH; + switch (path) { + case PATH_CX22702: + o[1] = 0; + break; + case PATH_TUNER_OTHER: + o[1] = 1; + break; + default: + err("unkown i2c path"); + return; + } + cxusb_ctrl_msg(d,CMD_IOCTL,o,2,&i,1); + + if (i != 0x01) + deb_info("i2c_path setting failed.\n"); + + st->cur_i2c_path = path; +} + +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) + return -EAGAIN; + + if (num > 2) + warn("more than 2 i2c messages at a time is not handled yet. TODO."); + + for (i = 0; i < num; i++) { + + switch (msg[i].addr) { + case 0x63: + cxusb_set_i2c_path(d,PATH_CX22702); + break; + default: + cxusb_set_i2c_path(d,PATH_TUNER_OTHER); + break; + } + + /* read request */ + if (i+1 < num && (msg[i+1].flags & I2C_M_RD)) { + u8 obuf[3+msg[i].len], ibuf[1+msg[i+1].len]; + 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); + + if (cxusb_ctrl_msg(d, CMD_I2C_READ, + 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"); + + 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); + + 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"); + } + } + + up(&d->i2c_sem); + return i; +} + +static u32 cxusb_i2c_func(struct i2c_adapter *adapter) +{ + return I2C_FUNC_I2C; +} + +static struct i2c_algorithm cxusb_i2c_algo = { + .name = "Conexant USB I2C algorithm", + .id = I2C_ALGO_BIT, + .master_xfer = cxusb_i2c_xfer, + .functionality = cxusb_i2c_func, +}; + +static int cxusb_power_ctrl(struct dvb_usb_device *d, int onoff) +{ + return 0; +} + +static int cxusb_streaming_ctrl(struct dvb_usb_device *d, int onoff) +{ + u8 buf[2] = { 0x03, 0x00 }; + if (onoff) + cxusb_ctrl_msg(d,0x36, buf, 2, NULL, 0); + else + cxusb_ctrl_msg(d,0x37, NULL, 0, NULL, 0); + + return 0; +} + +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, +}; + +/* Callbacks for DVB USB */ +static int cxusb_tuner_attach(struct dvb_usb_device *d) +{ + u8 bpll[4] = { 0x0b, 0xdc, 0x9c, 0xa0 }; + d->pll_addr = 0x61; + memcpy(d->pll_init,bpll,4); + d->pll_desc = &dvb_pll_fmd1216me; + return 0; +} + +static int cxusb_frontend_attach(struct dvb_usb_device *d) +{ + u8 buf[2] = { 0x03, 0x00 }; + u8 b = 0; + + if (usb_set_interface(d->udev,0,0) < 0) + err("set interface to alts=0 failed"); + + cxusb_ctrl_msg(d,0xde,&b,0,NULL,0); + cxusb_set_i2c_path(d,PATH_TUNER_OTHER); + cxusb_ctrl_msg(d,CMD_POWER_OFF, NULL, 0, &b, 1); + + if (usb_set_interface(d->udev,0,6) < 0) + err("set interface failed"); + + cxusb_ctrl_msg(d,0x36, buf, 2, NULL, 0); + cxusb_set_i2c_path(d,PATH_CX22702); + cxusb_ctrl_msg(d,CMD_POWER_ON, NULL, 0, &b, 1); + + if ((d->fe = cx22702_attach(&cxusb_cx22702_config, &d->i2c_adap)) != NULL) + return 0; + + return -EIO; +} + +/* DVB USB Driver stuff */ +static struct dvb_usb_properties cxusb_properties; + +static int cxusb_probe(struct usb_interface *intf, + const struct usb_device_id *id) +{ + return dvb_usb_device_init(intf,&cxusb_properties,THIS_MODULE); +} + +static struct usb_device_id cxusb_table [] = { + { USB_DEVICE(USB_VID_MEDION, USB_PID_MEDION_MD95700) }, + {} /* Terminating entry */ +}; +MODULE_DEVICE_TABLE (usb, cxusb_table); + +static struct dvb_usb_properties cxusb_properties = { + .caps = DVB_USB_IS_AN_I2C_ADAPTER, + + .usb_ctrl = CYPRESS_FX2, + + .size_of_priv = sizeof(struct cxusb_state), + + .streaming_ctrl = cxusb_streaming_ctrl, + .power_ctrl = cxusb_power_ctrl, + .frontend_attach = cxusb_frontend_attach, + .tuner_attach = cxusb_tuner_attach, + + .i2c_algo = &cxusb_i2c_algo, + + .generic_bulk_ctrl_endpoint = 0x01, + /* parameter for the MPEG2-data transfer */ + .urb = { + .type = DVB_USB_ISOC, + .count = 5, + .endpoint = 0x02, + .u = { + .isoc = { + .framesperurb = 32, + .framesize = 940, + .interval = 5, + } + } + }, + + .num_device_descs = 1, + .devices = { + { "Medion MD95700 (MDUSBTV-HYBRID)", + { NULL }, + { &cxusb_table[0], NULL }, + }, + } +}; + +static struct usb_driver cxusb_driver = { + .owner = THIS_MODULE, + .name = "dvb_usb_cxusb", + .probe = cxusb_probe, + .disconnect = dvb_usb_device_exit, + .id_table = cxusb_table, +}; + +/* module stuff */ +static int __init cxusb_module_init(void) +{ + int result; + if ((result = usb_register(&cxusb_driver))) { + err("usb_register failed. Error number %d",result); + return result; + } + + return 0; +} + +static void __exit cxusb_module_exit(void) +{ + /* deregister this driver from the USB subsystem */ + usb_deregister(&cxusb_driver); +} + +module_init (cxusb_module_init); +module_exit (cxusb_module_exit); + +MODULE_AUTHOR("Patrick Boettcher <patrick.boettcher@desy.de>"); +MODULE_DESCRIPTION("Driver for Conexant USB2.0 hybrid reference design"); +MODULE_VERSION("1.0-alpha"); +MODULE_LICENSE("GPL"); diff --git a/drivers/media/dvb/dvb-usb/cxusb.h b/drivers/media/dvb/dvb-usb/cxusb.h new file mode 100644 index 00000000000..1d79016e319 --- /dev/null +++ b/drivers/media/dvb/dvb-usb/cxusb.h @@ -0,0 +1,30 @@ +#ifndef _DVB_USB_CXUSB_H_ +#define _DVB_USB_CXUSB_H_ + +#define DVB_USB_LOG_PREFIX "digitv" +#include "dvb-usb.h" + +extern int dvb_usb_cxusb_debug; +#define deb_info(args...) dprintk(dvb_usb_cxusb_debug,0x01,args) + +/* usb commands - some of it are guesses, don't have a reference yet */ +#define CMD_I2C_WRITE 0x08 +#define CMD_I2C_READ 0x09 + +#define CMD_IOCTL 0x0e +#define IOCTL_SET_I2C_PATH 0x02 + +#define CMD_POWER_OFF 0x50 +#define CMD_POWER_ON 0x51 + +enum cxusb_i2c_pathes { + PATH_UNDEF = 0x00, + PATH_CX22702 = 0x01, + PATH_TUNER_OTHER = 0x02, +}; + +struct cxusb_state { + enum cxusb_i2c_pathes cur_i2c_path; +}; + +#endif diff --git a/drivers/media/dvb/dvb-usb/dibusb-mb.c b/drivers/media/dvb/dvb-usb/dibusb-mb.c index a0ffbb59fa1..828b5182e16 100644 --- a/drivers/media/dvb/dvb-usb/dibusb-mb.c +++ b/drivers/media/dvb/dvb-usb/dibusb-mb.c @@ -31,10 +31,17 @@ static int dibusb_dib3000mb_frontend_attach(struct dvb_usb_device *d) return 0; } -/* some of the dibusb 1.1 device aren't equipped with the default tuner +static int dibusb_thomson_tuner_attach(struct dvb_usb_device *d) +{ + d->pll_addr = 0x61; + d->pll_desc = &dvb_pll_tua6010xs; + return 0; +} + +/* Some of the Artec 1.1 device aren't equipped with the default tuner * (Thomson Cable), but with a Panasonic ENV77H11D5. This function figures * this out. */ -static int dibusb_dib3000mb_tuner_attach (struct dvb_usb_device *d) +static int dibusb_tuner_probe_and_attach(struct dvb_usb_device *d) { u8 b[2] = { 0,0 }, b2[1]; int ret = 0; @@ -59,8 +66,7 @@ static int dibusb_dib3000mb_tuner_attach (struct dvb_usb_device *d) if (b2[0] == 0xfe) { info("this device has the Thomson Cable onboard. Which is default."); - d->pll_addr = 0x61; - d->pll_desc = &dvb_pll_tua6010xs; + dibusb_thomson_tuner_attach(d); } else { u8 bpll[4] = { 0x0b, 0xf5, 0x85, 0xab }; info("this device has the Panasonic ENV77H11D5 onboard."); @@ -90,8 +96,8 @@ static int dibusb_probe(struct usb_interface *intf, /* do not change the order of the ID table */ static struct usb_device_id dibusb_dib3000mb_table [] = { -/* 00 */ { USB_DEVICE(USB_VID_AVERMEDIA_UNK, USB_PID_AVERMEDIA_DVBT_USB_COLD)}, -/* 01 */ { USB_DEVICE(USB_VID_AVERMEDIA_UNK, USB_PID_AVERMEDIA_DVBT_USB_WARM)}, +/* 00 */ { USB_DEVICE(USB_VID_WIDEVIEW, USB_PID_AVERMEDIA_DVBT_USB_COLD)}, +/* 01 */ { USB_DEVICE(USB_VID_WIDEVIEW, USB_PID_AVERMEDIA_DVBT_USB_WARM)}, /* 02 */ { USB_DEVICE(USB_VID_COMPRO, USB_PID_COMPRO_DVBU2000_COLD) }, /* 03 */ { USB_DEVICE(USB_VID_COMPRO, USB_PID_COMPRO_DVBU2000_WARM) }, /* 04 */ { USB_DEVICE(USB_VID_COMPRO_UNK, USB_PID_COMPRO_DVBU2000_UNK_COLD) }, @@ -114,7 +120,17 @@ static struct usb_device_id dibusb_dib3000mb_table [] = { /* 21 */ { USB_DEVICE(USB_VID_ULTIMA_ELECTRONIC, USB_PID_ULTIMA_TVBOX_AN2235_COLD) }, /* 22 */ { USB_DEVICE(USB_VID_ULTIMA_ELECTRONIC, USB_PID_ULTIMA_TVBOX_AN2235_WARM) }, /* 23 */ { USB_DEVICE(USB_VID_ADSTECH, USB_PID_ADSTECH_USB2_COLD) }, + +/* device ID with default DIBUSB2_0-firmware and with the hacked firmware */ /* 24 */ { USB_DEVICE(USB_VID_ADSTECH, USB_PID_ADSTECH_USB2_WARM) }, +/* 25 */ { USB_DEVICE(USB_VID_KYE, USB_PID_KYE_DVB_T_COLD) }, +/* 26 */ { USB_DEVICE(USB_VID_KYE, USB_PID_KYE_DVB_T_WARM) }, + +// #define DVB_USB_DIBUSB_MB_FAULTY_USB_IDs + +#ifdef DVB_USB_DIBUSB_MB_FAULTY_USB_IDs +/* 27 */ { USB_DEVICE(USB_VID_ANCHOR, USB_PID_ULTIMA_TVBOX_ANCHOR_COLD) }, +#endif { } /* Terminating entry */ }; MODULE_DEVICE_TABLE (usb, dibusb_dib3000mb_table); @@ -134,7 +150,7 @@ static struct dvb_usb_properties dibusb1_1_properties = { .pid_filter_ctrl = dibusb_pid_filter_ctrl, .power_ctrl = dibusb_power_ctrl, .frontend_attach = dibusb_dib3000mb_frontend_attach, - .tuner_attach = dibusb_dib3000mb_tuner_attach, + .tuner_attach = dibusb_tuner_probe_and_attach, .rc_interval = DEFAULT_RC_INTERVAL, .rc_key_map = dibusb_rc_keys, @@ -156,7 +172,7 @@ static struct dvb_usb_properties dibusb1_1_properties = { } }, - .num_device_descs = 8, + .num_device_descs = 9, .devices = { { "AVerMedia AverTV DVBT USB1.1", { &dibusb_dib3000mb_table[0], NULL }, @@ -190,11 +206,17 @@ static struct dvb_usb_properties dibusb1_1_properties = { { &dibusb_dib3000mb_table[19], NULL }, { &dibusb_dib3000mb_table[20], NULL }, }, + { "VideoWalker DVB-T USB", + { &dibusb_dib3000mb_table[25], NULL }, + { &dibusb_dib3000mb_table[26], NULL }, + }, } }; static struct dvb_usb_properties dibusb1_1_an2235_properties = { .caps = DVB_USB_HAS_PID_FILTER | DVB_USB_PID_FILTER_CAN_BE_TURNED_OFF | DVB_USB_IS_AN_I2C_ADAPTER, + .pid_filter_count = 16, + .usb_ctrl = CYPRESS_AN2235, .firmware = "dvb-usb-dibusb-an2235-01.fw", @@ -206,7 +228,7 @@ static struct dvb_usb_properties dibusb1_1_an2235_properties = { .pid_filter_ctrl = dibusb_pid_filter_ctrl, .power_ctrl = dibusb_power_ctrl, .frontend_attach = dibusb_dib3000mb_frontend_attach, - .tuner_attach = dibusb_dib3000mb_tuner_attach, + .tuner_attach = dibusb_tuner_probe_and_attach, .rc_interval = DEFAULT_RC_INTERVAL, .rc_key_map = dibusb_rc_keys, @@ -228,20 +250,32 @@ static struct dvb_usb_properties dibusb1_1_an2235_properties = { } }, +#ifdef DVB_USB_DIBUSB_MB_FAULTY_USB_IDs + .num_device_descs = 2, +#else .num_device_descs = 1, +#endif .devices = { { "Artec T1 USB1.1 TVBOX with AN2235", { &dibusb_dib3000mb_table[20], NULL }, { &dibusb_dib3000mb_table[21], NULL }, }, +#ifdef DVB_USB_DIBUSB_MB_FAULTY_USB_IDs + { "Artec T1 USB1.1 TVBOX with AN2235 (faulty USB IDs)", + { &dibusb_dib3000mb_table[27], NULL }, + { NULL }, + }, +#endif } }; static struct dvb_usb_properties dibusb2_0b_properties = { .caps = DVB_USB_HAS_PID_FILTER | DVB_USB_PID_FILTER_CAN_BE_TURNED_OFF | DVB_USB_IS_AN_I2C_ADAPTER, + .pid_filter_count = 32, + .usb_ctrl = CYPRESS_FX2, - .firmware = "dvb-usb-adstech-usb2-01.fw", + .firmware = "dvb-usb-adstech-usb2-02.fw", .size_of_priv = sizeof(struct dibusb_state), @@ -250,7 +284,7 @@ static struct dvb_usb_properties dibusb2_0b_properties = { .pid_filter_ctrl = dibusb_pid_filter_ctrl, .power_ctrl = dibusb2_0_power_ctrl, .frontend_attach = dibusb_dib3000mb_frontend_attach, - .tuner_attach = dibusb_dib3000mb_tuner_attach, + .tuner_attach = dibusb_thomson_tuner_attach, .rc_interval = DEFAULT_RC_INTERVAL, .rc_key_map = dibusb_rc_keys, @@ -272,18 +306,18 @@ static struct dvb_usb_properties dibusb2_0b_properties = { } }, - .num_device_descs = 2, + .num_device_descs = 1, .devices = { { "KWorld/ADSTech Instant DVB-T USB 2.0", { &dibusb_dib3000mb_table[23], NULL }, - { &dibusb_dib3000mb_table[24], NULL }, /* device ID with default DIBUSB2_0-firmware */ + { &dibusb_dib3000mb_table[24], NULL }, }, } }; static struct usb_driver dibusb_driver = { .owner = THIS_MODULE, - .name = "DiBcom based USB DVB-T devices (DiB3000M-B based)", + .name = "dvb_usb_dibusb_mb", .probe = dibusb_probe, .disconnect = dvb_usb_device_exit, .id_table = dibusb_dib3000mb_table, diff --git a/drivers/media/dvb/dvb-usb/dibusb-mc.c b/drivers/media/dvb/dvb-usb/dibusb-mc.c index aad8ed3fe00..e9dac430f37 100644 --- a/drivers/media/dvb/dvb-usb/dibusb-mc.c +++ b/drivers/media/dvb/dvb-usb/dibusb-mc.c @@ -83,7 +83,7 @@ static struct dvb_usb_properties dibusb_mc_properties = { static struct usb_driver dibusb_mc_driver = { .owner = THIS_MODULE, - .name = "DiBcom based USB2.0 DVB-T (DiB3000M-C/P based) devices", + .name = "dvb_usb_dibusb_mc", .probe = dibusb_mc_probe, .disconnect = dvb_usb_device_exit, .id_table = dibusb_dib3000mc_table, diff --git a/drivers/media/dvb/dvb-usb/digitv.c b/drivers/media/dvb/dvb-usb/digitv.c index 5acf3fde952..9a676afc1d6 100644 --- a/drivers/media/dvb/dvb-usb/digitv.c +++ b/drivers/media/dvb/dvb-usb/digitv.c @@ -1,10 +1,9 @@ /* DVB USB compliant linux driver for Nebula Electronics uDigiTV DVB-T USB2.0 * receiver * - * Copyright (C) 2005 Patrick Boettcher (patrick.boettcher@desy.de) and - * Allan Third (allan.third@cs.man.ac.uk) + * Copyright (C) 2005 Patrick Boettcher (patrick.boettcher@desy.de) * - * partly based on the SDK published by Nebula Electronics (TODO do we want this line ?) + * partly based on the SDK published by Nebula Electronics * * 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 @@ -38,7 +37,7 @@ static int digitv_ctrl_msg(struct dvb_usb_device *d, dvb_usb_generic_write(d,sndbuf,7); } else { dvb_usb_generic_rw(d,sndbuf,7,rcvbuf,7,10); - memcpy(&rbuf,&rcvbuf[3],rlen); + memcpy(rbuf,&rcvbuf[3],rlen); } return 0; } @@ -95,41 +94,20 @@ static int digitv_identify_state (struct usb_device *udev, struct static int digitv_mt352_demod_init(struct dvb_frontend *fe) { - static u8 mt352_clock_config[] = { 0x89, 0x38, 0x2d }; - static u8 mt352_reset[] = { 0x50, 0x80 }; - static u8 mt352_mclk_ratio[] = { 0x8b, 0x00 }; - - static u8 mt352_agc_cfg[] = { 0x68, 0xa0 }; - static u8 mt352_adc_ctl_1_cfg[] = { 0x8E, 0xa0 }; - static u8 mt352_acq_ctl[] = { 0x53, 0x50 }; - static u8 mt352_agc_target[] = { 0x67, 0x20 }; - - static u8 mt352_rs_err_per[] = { 0x7c, 0x00, 0x01 }; - static u8 mt352_snr_select[] = { 0x79, 0x00, 0x20 }; - - static u8 mt352_input_freq_1[] = { 0x56, 0x31, 0x05 }; + static u8 reset_buf[] = { 0x89, 0x38, 0x8a, 0x2d, 0x50, 0x80 }; + static u8 init_buf[] = { 0x68, 0xa0, 0x8e, 0x40, 0x53, 0x50, + 0x67, 0x20, 0x7d, 0x01, 0x7c, 0x00, 0x7a, 0x00, + 0x79, 0x20, 0x57, 0x05, 0x56, 0x31, 0x88, 0x0f, + 0x75, 0x32 }; + int i; - static u8 mt352_scan_ctl[] = { 0x88, 0x0f }; - static u8 mt352_capt_range[] = { 0x75, 0x32 }; + for (i = 0; i < ARRAY_SIZE(reset_buf); i += 2) + mt352_write(fe, &reset_buf[i], 2); - mt352_write(fe, mt352_clock_config, sizeof(mt352_clock_config)); - mt352_write(fe, mt352_reset, sizeof(mt352_reset)); msleep(1); - mt352_write(fe, mt352_mclk_ratio, sizeof(mt352_mclk_ratio)); - - mt352_write(fe, mt352_agc_cfg, sizeof(mt352_agc_cfg)); - mt352_write(fe, mt352_adc_ctl_1_cfg, sizeof(mt352_adc_ctl_1_cfg)); - mt352_write(fe, mt352_acq_ctl, sizeof(mt352_acq_ctl)); - mt352_write(fe, mt352_agc_target, sizeof(mt352_agc_target)); - - - mt352_write(fe, mt352_rs_err_per, sizeof(mt352_rs_err_per)); - mt352_write(fe, mt352_snr_select, sizeof(mt352_snr_select)); - mt352_write(fe, mt352_input_freq_1, sizeof(mt352_input_freq_1)); - - mt352_write(fe, mt352_scan_ctl, sizeof(mt352_scan_ctl)); - mt352_write(fe, mt352_capt_range, sizeof(mt352_capt_range)); + for (i = 0; i < ARRAY_SIZE(init_buf); i += 2) + mt352_write(fe, &init_buf[i], 2); return 0; } @@ -137,7 +115,7 @@ static int digitv_mt352_demod_init(struct dvb_frontend *fe) static struct mt352_config digitv_mt352_config = { .demod_address = 0x0, /* ignored by the digitv anyway */ .demod_init = digitv_mt352_demod_init, - .pll_set = NULL, /* TODO */ + .pll_set = dvb_usb_pll_set, }; static struct nxt6000_config digitv_nxt6000_config = { @@ -150,9 +128,9 @@ static struct nxt6000_config digitv_nxt6000_config = { static int digitv_frontend_attach(struct dvb_usb_device *d) { - if ((d->fe = mt352_attach(&digitv_mt352_config, &d->i2c_adap)) == NULL) + if ((d->fe = mt352_attach(&digitv_mt352_config, &d->i2c_adap)) != NULL) return 0; - if ((d->fe = nxt6000_attach(&digitv_nxt6000_config, &d->i2c_adap)) == NULL) { + if ((d->fe = nxt6000_attach(&digitv_nxt6000_config, &d->i2c_adap)) != NULL) { warn("nxt6000 support is not done yet, in fact you are one of the first " "person who wants to use this device in Linux. Please report to " @@ -163,6 +141,13 @@ static int digitv_frontend_attach(struct dvb_usb_device *d) return -EIO; } +static int digitv_tuner_attach(struct dvb_usb_device *d) +{ + d->pll_addr = 0x60; + d->pll_desc = &dvb_pll_tded4; + return 0; +} + static struct dvb_usb_rc_key digitv_rc_keys[] = { { 0x00, 0x16, KEY_POWER }, /* dummy key */ }; @@ -184,7 +169,6 @@ int digitv_rc_query(struct dvb_usb_device *d, u32 *event, int *state) return 0; } - /* DVB USB Driver stuff */ static struct dvb_usb_properties digitv_properties; @@ -208,13 +192,8 @@ static struct dvb_usb_properties digitv_properties = { .size_of_priv = 0, - .streaming_ctrl = NULL, - .pid_filter = NULL, - .pid_filter_ctrl = NULL, - .power_ctrl = NULL, .frontend_attach = digitv_frontend_attach, - .tuner_attach = NULL, // digitv_tuner_attach, - .read_mac_address = NULL, + .tuner_attach = digitv_tuner_attach, .rc_interval = 1000, .rc_key_map = digitv_rc_keys, @@ -238,7 +217,7 @@ static struct dvb_usb_properties digitv_properties = { } }, - .num_device_descs = 2, + .num_device_descs = 1, .devices = { { "Nebula Electronics uDigiTV DVB-T USB2.0)", { &digitv_table[0], NULL }, @@ -249,7 +228,7 @@ static struct dvb_usb_properties digitv_properties = { static struct usb_driver digitv_driver = { .owner = THIS_MODULE, - .name = "Nebula Electronics uDigiTV DVB-T USB2.0 device", + .name = "dvb_usb_digitv", .probe = digitv_probe, .disconnect = dvb_usb_device_exit, .id_table = digitv_table, diff --git a/drivers/media/dvb/dvb-usb/dtt200u-fe.c b/drivers/media/dvb/dvb-usb/dtt200u-fe.c index d17d768038c..b032523b07b 100644 --- a/drivers/media/dvb/dvb-usb/dtt200u-fe.c +++ b/drivers/media/dvb/dvb-usb/dtt200u-fe.c @@ -1,5 +1,5 @@ -/* Frontend part of the Linux driver for the Yakumo/Hama/Typhoon DVB-T - * USB2.0 receiver. +/* Frontend part of the Linux driver for the WideView/ Yakumo/ Hama/ + * Typhoon/ Yuan DVB-T USB2.0 receiver. * * Copyright (C) 2005 Patrick Boettcher <patrick.boettcher@desy.de> * @@ -14,61 +14,58 @@ struct dtt200u_fe_state { struct dvb_usb_device *d; + fe_status_t stat; + struct dvb_frontend_parameters fep; struct dvb_frontend frontend; }; -#define moan(which,what) info("unexpected value in '%s' for cmd '%02x' - please report to linux-dvb@linuxtv.org",which,what) - static int dtt200u_fe_read_status(struct dvb_frontend* fe, fe_status_t *stat) { struct dtt200u_fe_state *state = fe->demodulator_priv; - u8 bw = GET_TUNE_STAT; - u8 br[3] = { 0 }; -// u8 bdeb[5] = { 0 }; + u8 st = GET_TUNE_STATUS, b[3]; + + dvb_usb_generic_rw(state->d,&st,1,b,3,0); - dvb_usb_generic_rw(state->d,&bw,1,br,3,0); - switch (br[0]) { + switch (b[0]) { case 0x01: - *stat = FE_HAS_SIGNAL | FE_HAS_CARRIER | FE_HAS_VITERBI | FE_HAS_SYNC | FE_HAS_LOCK; + *stat = FE_HAS_SIGNAL | FE_HAS_CARRIER | + FE_HAS_VITERBI | FE_HAS_SYNC | FE_HAS_LOCK; break; - case 0x00: - *stat = 0; + case 0x00: /* pending */ + *stat = FE_TIMEDOUT; /* during set_frontend */ break; default: - moan("br[0]",GET_TUNE_STAT); + case 0x02: /* failed */ + *stat = 0; break; } - -// bw[0] = 0x88; -// dvb_usb_generic_rw(state->d,bw,1,bdeb,5,0); - -// deb_info("%02x: %02x %02x %02x %02x %02x\n",bw[0],bdeb[0],bdeb[1],bdeb[2],bdeb[3],bdeb[4]); - return 0; } + static int dtt200u_fe_read_ber(struct dvb_frontend* fe, u32 *ber) { struct dtt200u_fe_state *state = fe->demodulator_priv; - u8 bw = GET_BER; - *ber = 0; - dvb_usb_generic_rw(state->d,&bw,1,(u8*) ber,3,0); + u8 bw = GET_VIT_ERR_CNT,b[3]; + dvb_usb_generic_rw(state->d,&bw,1,b,3,0); + *ber = (b[0] << 16) | (b[1] << 8) | b[2]; return 0; } static int dtt200u_fe_read_unc_blocks(struct dvb_frontend* fe, u32 *unc) { struct dtt200u_fe_state *state = fe->demodulator_priv; - u8 bw = GET_UNK; - *unc = 0; - dvb_usb_generic_rw(state->d,&bw,1,(u8*) unc,3,0); + u8 bw = GET_RS_UNCOR_BLK_CNT,b[2]; + + dvb_usb_generic_rw(state->d,&bw,1,b,2,0); + *unc = (b[0] << 8) | b[1]; return 0; } static int dtt200u_fe_read_signal_strength(struct dvb_frontend* fe, u16 *strength) { struct dtt200u_fe_state *state = fe->demodulator_priv; - u8 bw = GET_SIG_STRENGTH, b; + u8 bw = GET_AGC, b; dvb_usb_generic_rw(state->d,&bw,1,&b,1,0); *strength = (b << 8) | b; return 0; @@ -86,7 +83,7 @@ static int dtt200u_fe_read_snr(struct dvb_frontend* fe, u16 *snr) static int dtt200u_fe_init(struct dvb_frontend* fe) { struct dtt200u_fe_state *state = fe->demodulator_priv; - u8 b = RESET_DEMOD; + u8 b = SET_INIT; return dvb_usb_generic_write(state->d,&b,1); } @@ -98,8 +95,8 @@ static int dtt200u_fe_sleep(struct dvb_frontend* fe) static int dtt200u_fe_get_tune_settings(struct dvb_frontend* fe, struct dvb_frontend_tune_settings *tune) { tune->min_delay_ms = 1500; - tune->step_size = 166667; - tune->max_drift = 166667 * 2; + tune->step_size = 0; + tune->max_drift = 0; return 0; } @@ -107,27 +104,32 @@ static int dtt200u_fe_set_frontend(struct dvb_frontend* fe, struct dvb_frontend_parameters *fep) { struct dtt200u_fe_state *state = fe->demodulator_priv; + int i; + fe_status_t st; u16 freq = fep->frequency / 250000; - u8 bw,bwbuf[2] = { SET_BANDWIDTH, 0 }, freqbuf[3] = { SET_FREQUENCY, 0, 0 }; + u8 bwbuf[2] = { SET_BANDWIDTH, 0 },freqbuf[3] = { SET_RF_FREQ, 0, 0 }; switch (fep->u.ofdm.bandwidth) { - case BANDWIDTH_8_MHZ: bw = 8; break; - case BANDWIDTH_7_MHZ: bw = 7; break; - case BANDWIDTH_6_MHZ: bw = 6; break; + case BANDWIDTH_8_MHZ: bwbuf[1] = 8; break; + case BANDWIDTH_7_MHZ: bwbuf[1] = 7; break; + case BANDWIDTH_6_MHZ: bwbuf[1] = 6; break; case BANDWIDTH_AUTO: return -EOPNOTSUPP; default: return -EINVAL; } - deb_info("set_frontend\n"); - bwbuf[1] = bw; dvb_usb_generic_write(state->d,bwbuf,2); freqbuf[1] = freq & 0xff; freqbuf[2] = (freq >> 8) & 0xff; dvb_usb_generic_write(state->d,freqbuf,3); - memcpy(&state->fep,fep,sizeof(struct dvb_frontend_parameters)); + for (i = 0; i < 30; i++) { + msleep(20); + dtt200u_fe_read_status(fe, &st); + if (st & FE_TIMEDOUT) + continue; + } return 0; } @@ -174,7 +176,7 @@ success: static struct dvb_frontend_ops dtt200u_fe_ops = { .info = { - .name = "DTT200U (Yakumo/Typhoon/Hama) DVB-T", + .name = "WideView USB DVB-T", .type = FE_OFDM, .frequency_min = 44250000, .frequency_max = 867250000, diff --git a/drivers/media/dvb/dvb-usb/dtt200u.c b/drivers/media/dvb/dvb-usb/dtt200u.c index fb2b5a2da13..47dba6e4596 100644 --- a/drivers/media/dvb/dvb-usb/dtt200u.c +++ b/drivers/media/dvb/dvb-usb/dtt200u.c @@ -1,8 +1,10 @@ -/* DVB USB library compliant Linux driver for the Yakumo/Hama/Typhoon DVB-T - * USB2.0 receiver. +/* DVB USB library compliant Linux driver for the WideView/ Yakumo/ Hama/ + * Typhoon/ Yuan DVB-T USB2.0 receiver. * * Copyright (C) 2004-5 Patrick Boettcher (patrick.boettcher@desy.de) * + * Thanks to Steve Chang from WideView for providing support for the WT-220U. + * * 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. @@ -16,14 +18,24 @@ int dvb_usb_dtt200u_debug; module_param_named(debug,dvb_usb_dtt200u_debug, int, 0644); MODULE_PARM_DESC(debug, "set debugging level (1=info,xfer=2 (or-able))." DVB_USB_DEBUG_STATUS); +static int dtt200u_power_ctrl(struct dvb_usb_device *d, int onoff) +{ + u8 b = SET_INIT; + + if (onoff) + dvb_usb_generic_write(d,&b,2); + + return 0; +} + static int dtt200u_streaming_ctrl(struct dvb_usb_device *d, int onoff) { - u8 b_streaming[2] = { SET_TS_CTRL, onoff }; + u8 b_streaming[2] = { SET_STREAMING, onoff }; u8 b_rst_pid = RESET_PID_FILTER; dvb_usb_generic_write(d,b_streaming,2); - if (!onoff) + if (onoff == 0) dvb_usb_generic_write(d,&b_rst_pid,1); return 0; } @@ -36,7 +48,7 @@ static int dtt200u_pid_filter(struct dvb_usb_device *d, int index, u16 pid, int b_pid[0] = SET_PID_FILTER; b_pid[1] = index; b_pid[2] = pid & 0xff; - b_pid[3] = (pid >> 8) & 0xff; + b_pid[3] = (pid >> 8) & 0x1f; return dvb_usb_generic_write(d,b_pid,4); } @@ -54,9 +66,9 @@ static struct dvb_usb_rc_key dtt200u_rc_keys[] = { { 0x80, 0x08, KEY_5 }, { 0x80, 0x09, KEY_6 }, { 0x80, 0x0a, KEY_7 }, - { 0x00, 0x0c, KEY_ZOOM }, + { 0x80, 0x0c, KEY_ZOOM }, { 0x80, 0x0d, KEY_0 }, - { 0x00, 0x0e, KEY_SELECT }, + { 0x80, 0x0e, KEY_SELECT }, { 0x80, 0x12, KEY_POWER }, { 0x80, 0x1a, KEY_CHANNELUP }, { 0x80, 0x1b, KEY_8 }, @@ -66,7 +78,7 @@ static struct dvb_usb_rc_key dtt200u_rc_keys[] = { static int dtt200u_rc_query(struct dvb_usb_device *d, u32 *event, int *state) { - u8 key[5],cmd = GET_RC_KEY; + u8 key[5],cmd = GET_RC_CODE; dvb_usb_generic_rw(d,&cmd,1,key,5,0); dvb_usb_nec_rc_key_to_event(d,key,event,state); if (key[0] != 0) @@ -81,32 +93,41 @@ static int dtt200u_frontend_attach(struct dvb_usb_device *d) } static struct dvb_usb_properties dtt200u_properties; +static struct dvb_usb_properties wt220u_properties; static int dtt200u_usb_probe(struct usb_interface *intf, const struct usb_device_id *id) { - return dvb_usb_device_init(intf,&dtt200u_properties,THIS_MODULE); + if (dvb_usb_device_init(intf,&dtt200u_properties,THIS_MODULE) == 0 || + dvb_usb_device_init(intf,&wt220u_properties,THIS_MODULE) == 0) + return 0; + + return -ENODEV; } static struct usb_device_id dtt200u_usb_table [] = { - { USB_DEVICE(USB_VID_AVERMEDIA_UNK, USB_PID_DTT200U_COLD) }, - { USB_DEVICE(USB_VID_AVERMEDIA_UNK, USB_PID_DTT200U_WARM) }, +// { USB_DEVICE(0x04b4,0x8613) }, + { USB_DEVICE(USB_VID_WIDEVIEW, USB_PID_DTT200U_COLD) }, + { USB_DEVICE(USB_VID_WIDEVIEW, USB_PID_DTT200U_WARM) }, + { USB_DEVICE(USB_VID_WIDEVIEW, USB_PID_WT220U_COLD) }, + { USB_DEVICE(USB_VID_WIDEVIEW, USB_PID_WT220U_WARM) }, { 0 }, }; MODULE_DEVICE_TABLE(usb, dtt200u_usb_table); static struct dvb_usb_properties dtt200u_properties = { .caps = DVB_USB_HAS_PID_FILTER | DVB_USB_NEED_PID_FILTERING, - .pid_filter_count = 255, /* It is a guess, but there are at least 10 */ + .pid_filter_count = 15, .usb_ctrl = CYPRESS_FX2, .firmware = "dvb-usb-dtt200u-01.fw", + .power_ctrl = dtt200u_power_ctrl, .streaming_ctrl = dtt200u_streaming_ctrl, .pid_filter = dtt200u_pid_filter, .frontend_attach = dtt200u_frontend_attach, - .rc_interval = 200, + .rc_interval = 300, .rc_key_map = dtt200u_rc_keys, .rc_key_map_size = ARRAY_SIZE(dtt200u_rc_keys), .rc_query = dtt200u_rc_query, @@ -127,18 +148,59 @@ static struct dvb_usb_properties dtt200u_properties = { .num_device_descs = 1, .devices = { - { .name = "Yakumo/Hama/Typhoon DVB-T USB2.0)", - .cold_ids = { &dtt200u_usb_table[0], &dtt200u_usb_table[2] }, + { .name = "WideView/Yuan/Yakumo/Hama/Typhoon DVB-T USB2.0 (WT-200U)", + .cold_ids = { &dtt200u_usb_table[0], NULL }, .warm_ids = { &dtt200u_usb_table[1], NULL }, }, { 0 }, } }; +static struct dvb_usb_properties wt220u_properties = { + .caps = DVB_USB_HAS_PID_FILTER | DVB_USB_NEED_PID_FILTERING, + .pid_filter_count = 15, + + .usb_ctrl = CYPRESS_FX2, + .firmware = "dvb-usb-wt220u-01.fw", + + .power_ctrl = dtt200u_power_ctrl, + .streaming_ctrl = dtt200u_streaming_ctrl, + .pid_filter = dtt200u_pid_filter, + .frontend_attach = dtt200u_frontend_attach, + + .rc_interval = 300, + .rc_key_map = dtt200u_rc_keys, + .rc_key_map_size = ARRAY_SIZE(dtt200u_rc_keys), + .rc_query = dtt200u_rc_query, + + .generic_bulk_ctrl_endpoint = 0x01, + + /* parameter for the MPEG2-data transfer */ + .urb = { + .type = DVB_USB_BULK, + .count = 7, + .endpoint = 0x02, + .u = { + .bulk = { + .buffersize = 4096, + } + } + }, + + .num_device_descs = 1, + .devices = { + { .name = "WideView WT-220U PenType Receiver (and clones)", + .cold_ids = { &dtt200u_usb_table[2], NULL }, + .warm_ids = { &dtt200u_usb_table[3], NULL }, + }, + { 0 }, + } +}; + /* usb specific object needed to register this driver with the usb subsystem */ static struct usb_driver dtt200u_usb_driver = { .owner = THIS_MODULE, - .name = "Yakumo/Hama/Typhoon DVB-T USB2.0", + .name = "dvb_usb_dtt200u", .probe = dtt200u_usb_probe, .disconnect = dvb_usb_device_exit, .id_table = dtt200u_usb_table, @@ -166,6 +228,6 @@ module_init(dtt200u_usb_module_init); module_exit(dtt200u_usb_module_exit); MODULE_AUTHOR("Patrick Boettcher <patrick.boettcher@desy.de>"); -MODULE_DESCRIPTION("Driver for the Yakumo/Hama/Typhoon DVB-T USB2.0 device"); +MODULE_DESCRIPTION("Driver for the WideView/Yakumo/Hama/Typhoon DVB-T USB2.0 devices"); MODULE_VERSION("1.0"); MODULE_LICENSE("GPL"); diff --git a/drivers/media/dvb/dvb-usb/dtt200u.h b/drivers/media/dvb/dvb-usb/dtt200u.h index ed414207151..6f1f3042e21 100644 --- a/drivers/media/dvb/dvb-usb/dtt200u.h +++ b/drivers/media/dvb/dvb-usb/dtt200u.h @@ -1,5 +1,5 @@ -/* Common header file of Linux driver for the Yakumo/Hama/Typhoon DVB-T - * USB2.0 receiver. +/* Common header file of Linux driver for the WideView/ Yakumo/ Hama/ + * Typhoon/ Yuan DVB-T USB2.0 receiver. * * Copyright (C) 2004-5 Patrick Boettcher (patrick.boettcher@desy.de) * @@ -22,44 +22,34 @@ extern int dvb_usb_dtt200u_debug; /* guessed protocol description (reverse engineered): * read * 00 - USB type 0x02 for usb2.0, 0x01 for usb1.1 - * 81 - <TS_LOCK> <current frequency divided by 250000> - * 82 - crash - do not touch - * 83 - crash - do not touch - * 84 - remote control - * 85 - crash - do not touch (OK, stop testing here) * 88 - locking 2 bytes (0x80 0x40 == no signal, 0x89 0x20 == nice signal) - * 89 - noise-to-signal - * 8a - unkown 1 byte - signal_strength - * 8c - ber ??? - * 8d - ber - * 8e - unc */ -#define GET_SPEED 0x00 -#define GET_TUNE_STAT 0x81 -#define GET_RC_KEY 0x84 -#define GET_STATUS 0x88 -#define GET_SNR 0x89 -#define GET_SIG_STRENGTH 0x8a -#define GET_UNK 0x8c -#define GET_BER 0x8d -#define GET_UNC 0x8e +#define GET_SPEED 0x00 +#define GET_TUNE_STATUS 0x81 +#define GET_RC_CODE 0x84 +#define GET_CONFIGURATION 0x88 +#define GET_AGC 0x89 +#define GET_SNR 0x8a +#define GET_VIT_ERR_CNT 0x8c +#define GET_RS_ERR_CNT 0x8d +#define GET_RS_UNCOR_BLK_CNT 0x8e /* write - * 01 - reset the demod + * 01 - init * 02 - frequency (divided by 250000) * 03 - bandwidth * 04 - pid table (index pid(7:0) pid(12:8)) * 05 - reset the pid table - * 08 - demod transfer enabled or not (FX2 transfer is enabled by default) + * 08 - transfer switch */ -#define RESET_DEMOD 0x01 -#define SET_FREQUENCY 0x02 +#define SET_INIT 0x01 +#define SET_RF_FREQ 0x02 #define SET_BANDWIDTH 0x03 #define SET_PID_FILTER 0x04 #define RESET_PID_FILTER 0x05 -#define SET_TS_CTRL 0x08 +#define SET_STREAMING 0x08 extern struct dvb_frontend * dtt200u_fe_attach(struct dvb_usb_device *d); diff --git a/drivers/media/dvb/dvb-usb/dvb-usb-common.h b/drivers/media/dvb/dvb-usb/dvb-usb-common.h index 67e0d73fbce..7300489d3e2 100644 --- a/drivers/media/dvb/dvb-usb/dvb-usb-common.h +++ b/drivers/media/dvb/dvb-usb/dvb-usb-common.h @@ -12,14 +12,16 @@ #include "dvb-usb.h" extern int dvb_usb_debug; +extern int dvb_usb_disable_rc_polling; #define deb_info(args...) dprintk(dvb_usb_debug,0x01,args) #define deb_xfer(args...) dprintk(dvb_usb_debug,0x02,args) -#define deb_pll(args...) dprintk(dvb_usb_debug,0x04,args) +#define deb_pll(args...) dprintk(dvb_usb_debug,0x04,args) #define deb_ts(args...) dprintk(dvb_usb_debug,0x08,args) #define deb_err(args...) dprintk(dvb_usb_debug,0x10,args) #define deb_rc(args...) dprintk(dvb_usb_debug,0x20,args) #define deb_fw(args...) dprintk(dvb_usb_debug,0x40,args) +#define deb_mem(args...) dprintk(dvb_usb_debug,0x80,args) /* commonly used methods */ extern int usb_cypress_load_firmware(struct usb_device *, const char *, int); diff --git a/drivers/media/dvb/dvb-usb/dvb-usb-dvb.c b/drivers/media/dvb/dvb-usb/dvb-usb-dvb.c index bdd72f77970..3491ff40885 100644 --- a/drivers/media/dvb/dvb-usb/dvb-usb-dvb.c +++ b/drivers/media/dvb/dvb-usb/dvb-usb-dvb.c @@ -175,7 +175,7 @@ static int dvb_usb_fe_sleep(struct dvb_frontend *fe) int dvb_usb_fe_init(struct dvb_usb_device* d) { if (d->props.frontend_attach == NULL) { - err("strange '%s' don't want to attach a frontend.",d->desc->name); + err("strange '%s' doesn't want to attach a frontend.",d->desc->name); return 0; } diff --git a/drivers/media/dvb/dvb-usb/dvb-usb-ids.h b/drivers/media/dvb/dvb-usb/dvb-usb-ids.h index bcb34191868..794d513a848 100644 --- a/drivers/media/dvb/dvb-usb/dvb-usb-ids.h +++ b/drivers/media/dvb/dvb-usb/dvb-usb-ids.h @@ -12,7 +12,7 @@ /* Vendor IDs */ #define USB_VID_ADSTECH 0x06e1 #define USB_VID_ANCHOR 0x0547 -#define USB_VID_AVERMEDIA_UNK 0x14aa +#define USB_VID_WIDEVIEW 0x14aa #define USB_VID_AVERMEDIA 0x07ca #define USB_VID_COMPRO 0x185b #define USB_VID_COMPRO_UNK 0x145f @@ -24,6 +24,8 @@ #define USB_VID_HANFTEK 0x15f4 #define USB_VID_HAUPPAUGE 0x2040 #define USB_VID_HYPER_PALTEK 0x1025 +#define USB_VID_KYE 0x0458 +#define USB_VID_MEDION 0x1660 #define USB_VID_VISIONPLUS 0x13d3 #define USB_VID_TWINHAN 0x1822 #define USB_VID_ULTIMA_ELECTRONIC 0x05d8 @@ -70,6 +72,8 @@ #define USB_PID_HANFTEK_UMT_010_WARM 0x0015 #define USB_PID_DTT200U_COLD 0x0201 #define USB_PID_DTT200U_WARM 0x0301 +#define USB_PID_WT220U_COLD 0x0222 +#define USB_PID_WT220U_WARM 0x0221 #define USB_PID_WINTV_NOVA_T_USB2_COLD 0x9300 #define USB_PID_WINTV_NOVA_T_USB2_WARM 0x9301 #define USB_PID_NEBULA_DIGITV 0x0201 @@ -78,6 +82,8 @@ #define USB_PID_DVICO_BLUEBIRD_LGDT 0xd820 #define USB_PID_DVICO_BLUEBIRD_LGZ201_1 0xdb01 #define USB_PID_DVICO_BLUEBIRD_TH7579_2 0xdb11 - +#define USB_PID_MEDION_MD95700 0x0932 +#define USB_PID_KYE_DVB_T_COLD 0x701e +#define USB_PID_KYE_DVB_T_WARM 0x701f #endif diff --git a/drivers/media/dvb/dvb-usb/dvb-usb-init.c b/drivers/media/dvb/dvb-usb/dvb-usb-init.c index 3aadec974cf..65f0c095abc 100644 --- a/drivers/media/dvb/dvb-usb/dvb-usb-init.c +++ b/drivers/media/dvb/dvb-usb/dvb-usb-init.c @@ -18,6 +18,10 @@ int dvb_usb_debug; module_param_named(debug,dvb_usb_debug, int, 0644); MODULE_PARM_DESC(debug, "set debugging level (1=info,xfer=2,pll=4,ts=8,err=16,rc=32,fw=64 (or-able))." DVB_USB_DEBUG_STATUS); +int dvb_usb_disable_rc_polling; +module_param_named(disable_rc_polling, dvb_usb_disable_rc_polling, int, 0644); +MODULE_PARM_DESC(disable_rc_polling, "disable remote control polling (default: 0)."); + /* general initialization functions */ int dvb_usb_exit(struct dvb_usb_device *d) { @@ -47,17 +51,17 @@ static int dvb_usb_init(struct dvb_usb_device *d) /* speed - when running at FULL speed we need a HW PID filter */ if (d->udev->speed == USB_SPEED_FULL && !(d->props.caps & DVB_USB_HAS_PID_FILTER)) { - err("This USB2.0 device cannot be run on a USB1.1 port. (it lacks a HW PID filter)"); + err("This USB2.0 device cannot be run on a USB1.1 port. (it lacks a hardware PID filter)"); return -ENODEV; } if ((d->udev->speed == USB_SPEED_FULL && d->props.caps & DVB_USB_HAS_PID_FILTER) || (d->props.caps & DVB_USB_NEED_PID_FILTERING)) { - info("will use the device's hw PID filter."); + info("will use the device's hardware PID filter (table count: %d).",d->props.pid_filter_count); d->pid_filtering = 1; d->max_feed_count = d->props.pid_filter_count; } else { - info("will pass the complete MPEG2 transport stream to the demuxer."); + info("will pass the complete MPEG2 transport stream to the software demuxer."); d->pid_filtering = 0; d->max_feed_count = 255; } diff --git a/drivers/media/dvb/dvb-usb/dvb-usb-remote.c b/drivers/media/dvb/dvb-usb/dvb-usb-remote.c index 9f1e23f82ba..fc7800f1743 100644 --- a/drivers/media/dvb/dvb-usb/dvb-usb-remote.c +++ b/drivers/media/dvb/dvb-usb/dvb-usb-remote.c @@ -21,6 +21,10 @@ static void dvb_usb_read_remote_control(void *data) /* TODO: need a lock here. We can simply skip checking for the remote control if we're busy. */ + /* when the parameter has been set to 1 via sysfs while the driver was running */ + if (dvb_usb_disable_rc_polling) + return; + if (d->props.rc_query(d,&event,&state)) { err("error while querying for an remote control event."); goto schedule; @@ -35,7 +39,7 @@ static void dvb_usb_read_remote_control(void *data) d->last_event = event; case REMOTE_KEY_REPEAT: deb_rc("key repeated\n"); - input_event(&d->rc_input_dev, EV_KEY, event, 1); + input_event(&d->rc_input_dev, EV_KEY, d->last_event, 1); input_event(&d->rc_input_dev, EV_KEY, d->last_event, 0); input_sync(&d->rc_input_dev); break; @@ -85,7 +89,9 @@ schedule: int dvb_usb_remote_init(struct dvb_usb_device *d) { int i; - if (d->props.rc_key_map == NULL) + if (d->props.rc_key_map == NULL || + d->props.rc_query == NULL || + dvb_usb_disable_rc_polling) return 0; /* Initialise the remote-control structures.*/ @@ -154,12 +160,12 @@ int dvb_usb_nec_rc_key_to_event(struct dvb_usb_device *d, break; } /* See if we can match the raw key code. */ - for (i = 0; i < sizeof(keymap)/sizeof(struct dvb_usb_rc_key); i++) + for (i = 0; i < d->props.rc_key_map_size; i++) if (keymap[i].custom == keybuf[1] && keymap[i].data == keybuf[3]) { *event = keymap[i].event; *state = REMOTE_KEY_PRESSED; - break; + return 0; } deb_err("key mapping failed - no appropriate key found in keymapping\n"); break; diff --git a/drivers/media/dvb/dvb-usb/dvb-usb-urb.c b/drivers/media/dvb/dvb-usb/dvb-usb-urb.c index 83d476fb410..f5799a4c228 100644 --- a/drivers/media/dvb/dvb-usb/dvb-usb-urb.c +++ b/drivers/media/dvb/dvb-usb/dvb-usb-urb.c @@ -24,11 +24,12 @@ int dvb_usb_generic_rw(struct dvb_usb_device *d, u8 *wbuf, u16 wlen, u8 *rbuf, if ((ret = down_interruptible(&d->usb_sem))) return ret; + deb_xfer(">>> "); debug_dump(wbuf,wlen,deb_xfer); ret = usb_bulk_msg(d->udev,usb_sndbulkpipe(d->udev, d->props.generic_bulk_ctrl_endpoint), wbuf,wlen,&actlen, - 2*HZ); + 2000); if (ret) err("bulk message failed: %d (%d/%d)",ret,wlen,actlen); @@ -42,12 +43,14 @@ int dvb_usb_generic_rw(struct dvb_usb_device *d, u8 *wbuf, u16 wlen, u8 *rbuf, ret = usb_bulk_msg(d->udev,usb_rcvbulkpipe(d->udev, d->props.generic_bulk_ctrl_endpoint),rbuf,rlen,&actlen, - 2*HZ); + 2000); if (ret) err("recv bulk message failed: %d",ret); - else + else { + deb_xfer("<<< "); debug_dump(rbuf,actlen,deb_xfer); + } } up(&d->usb_sem); @@ -61,12 +64,19 @@ int dvb_usb_generic_write(struct dvb_usb_device *d, u8 *buf, u16 len) } EXPORT_SYMBOL(dvb_usb_generic_write); -static void dvb_usb_bulk_urb_complete(struct urb *urb, struct pt_regs *ptregs) + +/* URB stuff for streaming */ +static void dvb_usb_urb_complete(struct urb *urb, struct pt_regs *ptregs) { struct dvb_usb_device *d = urb->context; + int ptype = usb_pipetype(urb->pipe); + int i; + u8 *b; - deb_ts("bulk urb completed. feedcount: %d, status: %d, length: %d\n",d->feedcount,urb->status, - urb->actual_length); + deb_ts("'%s' urb completed. feedcount: %d, status: %d, length: %d/%d, pack_num: %d, errors: %d\n", + ptype == PIPE_ISOCHRONOUS ? "isoc" : "bulk", d->feedcount, + urb->status,urb->actual_length,urb->transfer_buffer_length, + urb->number_of_packets,urb->error_count); switch (urb->status) { case 0: /* success */ @@ -81,11 +91,33 @@ static void dvb_usb_bulk_urb_complete(struct urb *urb, struct pt_regs *ptregs) break; } - if (d->feedcount > 0 && urb->actual_length > 0) { - if (d->state & DVB_USB_STATE_DVB) - dvb_dmx_swfilter(&d->demux, (u8*) urb->transfer_buffer,urb->actual_length); - } else - deb_ts("URB dropped because of feedcount.\n"); + if (d->feedcount > 0) { + if (d->state & DVB_USB_STATE_DVB) { + switch (ptype) { + case PIPE_ISOCHRONOUS: + b = (u8 *) urb->transfer_buffer; + for (i = 0; i < urb->number_of_packets; i++) { + if (urb->iso_frame_desc[i].status != 0) + deb_ts("iso frame descriptor has an error: %d\n",urb->iso_frame_desc[i].status); + else if (urb->iso_frame_desc[i].actual_length > 0) { + dvb_dmx_swfilter(&d->demux,b + urb->iso_frame_desc[i].offset, + urb->iso_frame_desc[i].actual_length); + } + urb->iso_frame_desc[i].status = 0; + urb->iso_frame_desc[i].actual_length = 0; + } + debug_dump(b,20,deb_ts); + break; + case PIPE_BULK: + if (urb->actual_length > 0) + dvb_dmx_swfilter(&d->demux, (u8 *) urb->transfer_buffer,urb->actual_length); + break; + default: + err("unkown endpoint type in completition handler."); + return; + } + } + } usb_submit_urb(urb,GFP_ATOMIC); } @@ -94,7 +126,7 @@ int dvb_usb_urb_kill(struct dvb_usb_device *d) { int i; for (i = 0; i < d->urbs_submitted; i++) { - deb_info("killing URB no. %d.\n",i); + deb_ts("killing URB no. %d.\n",i); /* stop the URB */ usb_kill_urb(d->urb_list[i]); @@ -107,9 +139,9 @@ int dvb_usb_urb_submit(struct dvb_usb_device *d) { int i,ret; for (i = 0; i < d->urbs_initialized; i++) { - deb_info("submitting URB no. %d\n",i); + deb_ts("submitting URB no. %d\n",i); if ((ret = usb_submit_urb(d->urb_list[i],GFP_ATOMIC))) { - err("could not submit URB no. %d - get them all back\n",i); + err("could not submit URB no. %d - get them all back",i); dvb_usb_urb_kill(d); return ret; } @@ -118,32 +150,78 @@ int dvb_usb_urb_submit(struct dvb_usb_device *d) return 0; } -static int dvb_usb_bulk_urb_init(struct dvb_usb_device *d) +static int dvb_usb_free_stream_buffers(struct dvb_usb_device *d) { - int i,bufsize = d->props.urb.count * d->props.urb.u.bulk.buffersize; + if (d->state & DVB_USB_STATE_URB_BUF) { + while (d->buf_num) { + d->buf_num--; + deb_mem("freeing buffer %d\n",d->buf_num); + usb_buffer_free(d->udev, d->buf_size, + d->buf_list[d->buf_num], d->dma_addr[d->buf_num]); + } + kfree(d->buf_list); + kfree(d->dma_addr); + } + + d->state &= ~DVB_USB_STATE_URB_BUF; - deb_info("allocate %d bytes as buffersize for all URBs\n",bufsize); - /* allocate the actual buffer for the URBs */ - if ((d->buffer = usb_buffer_alloc(d->udev, bufsize, SLAB_ATOMIC, &d->dma_handle)) == NULL) { - deb_info("not enough memory for urb-buffer allocation.\n"); + return 0; +} + +static int dvb_usb_allocate_stream_buffers(struct dvb_usb_device *d, int num, unsigned long size) +{ + d->buf_num = 0; + d->buf_size = size; + + deb_mem("all in all I will use %lu bytes for streaming\n",num*size); + + if ((d->buf_list = kmalloc(num*sizeof(u8 *), GFP_ATOMIC)) == NULL) + return -ENOMEM; + + if ((d->dma_addr = kmalloc(num*sizeof(dma_addr_t), GFP_ATOMIC)) == NULL) { + kfree(d->buf_list); return -ENOMEM; } - deb_info("allocation successful\n"); - memset(d->buffer,0,bufsize); + memset(d->buf_list,0,num*sizeof(u8 *)); + memset(d->dma_addr,0,num*sizeof(dma_addr_t)); d->state |= DVB_USB_STATE_URB_BUF; + for (d->buf_num = 0; d->buf_num < num; d->buf_num++) { + deb_mem("allocating buffer %d\n",d->buf_num); + if (( d->buf_list[d->buf_num] = + usb_buffer_alloc(d->udev, size, SLAB_ATOMIC, + &d->dma_addr[d->buf_num]) ) == NULL) { + deb_mem("not enough memory for urb-buffer allocation.\n"); + dvb_usb_free_stream_buffers(d); + return -ENOMEM; + } + deb_mem("buffer %d: %p (dma: %d)\n",d->buf_num,d->buf_list[d->buf_num],d->dma_addr[d->buf_num]); + memset(d->buf_list[d->buf_num],0,size); + } + deb_mem("allocation successful\n"); + + return 0; +} + +static int dvb_usb_bulk_urb_init(struct dvb_usb_device *d) +{ + int i; + + if ((i = dvb_usb_allocate_stream_buffers(d,d->props.urb.count, + d->props.urb.u.bulk.buffersize)) < 0) + return i; + /* allocate the URBs */ for (i = 0; i < d->props.urb.count; i++) { - if (!(d->urb_list[i] = usb_alloc_urb(0,GFP_ATOMIC))) { + if ((d->urb_list[i] = usb_alloc_urb(0,GFP_ATOMIC)) == NULL) return -ENOMEM; - } usb_fill_bulk_urb( d->urb_list[i], d->udev, usb_rcvbulkpipe(d->udev,d->props.urb.endpoint), - &d->buffer[i*d->props.urb.u.bulk.buffersize], + d->buf_list[i], d->props.urb.u.bulk.buffersize, - dvb_usb_bulk_urb_complete, d); + dvb_usb_urb_complete, d); d->urb_list[i]->transfer_flags = 0; d->urbs_initialized++; @@ -151,6 +229,47 @@ static int dvb_usb_bulk_urb_init(struct dvb_usb_device *d) return 0; } +static int dvb_usb_isoc_urb_init(struct dvb_usb_device *d) +{ + int i,j; + + if ((i = dvb_usb_allocate_stream_buffers(d,d->props.urb.count, + d->props.urb.u.isoc.framesize*d->props.urb.u.isoc.framesperurb)) < 0) + return i; + + /* allocate the URBs */ + for (i = 0; i < d->props.urb.count; i++) { + struct urb *urb; + int frame_offset = 0; + if ((d->urb_list[i] = + usb_alloc_urb(d->props.urb.u.isoc.framesperurb,GFP_ATOMIC)) == NULL) + return -ENOMEM; + + urb = d->urb_list[i]; + + urb->dev = d->udev; + urb->context = d; + urb->complete = dvb_usb_urb_complete; + urb->pipe = usb_rcvisocpipe(d->udev,d->props.urb.endpoint); + urb->transfer_flags = URB_ISO_ASAP | URB_NO_TRANSFER_DMA_MAP; + urb->interval = d->props.urb.u.isoc.interval; + urb->number_of_packets = d->props.urb.u.isoc.framesperurb; + urb->transfer_buffer_length = d->buf_size; + urb->transfer_buffer = d->buf_list[i]; + urb->transfer_dma = d->dma_addr[i]; + + for (j = 0; j < d->props.urb.u.isoc.framesperurb; j++) { + urb->iso_frame_desc[j].offset = frame_offset; + urb->iso_frame_desc[j].length = d->props.urb.u.isoc.framesize; + frame_offset += d->props.urb.u.isoc.framesize; + } + + d->urbs_initialized++; + } + return 0; + +} + int dvb_usb_urb_init(struct dvb_usb_device *d) { /* @@ -174,8 +293,7 @@ int dvb_usb_urb_init(struct dvb_usb_device *d) case DVB_USB_BULK: return dvb_usb_bulk_urb_init(d); case DVB_USB_ISOC: - err("isochronous transfer not yet implemented in dvb-usb."); - return -EINVAL; + return dvb_usb_isoc_urb_init(d); default: err("unkown URB-type for data transfer."); return -EINVAL; @@ -191,7 +309,7 @@ int dvb_usb_urb_exit(struct dvb_usb_device *d) if (d->state & DVB_USB_STATE_URB_LIST) { for (i = 0; i < d->urbs_initialized; i++) { if (d->urb_list[i] != NULL) { - deb_info("freeing URB no. %d.\n",i); + deb_mem("freeing URB no. %d.\n",i); /* free the URBs */ usb_free_urb(d->urb_list[i]); } @@ -202,10 +320,6 @@ int dvb_usb_urb_exit(struct dvb_usb_device *d) d->state &= ~DVB_USB_STATE_URB_LIST; } - if (d->state & DVB_USB_STATE_URB_BUF) - usb_buffer_free(d->udev, d->props.urb.u.bulk.buffersize * d->props.urb.count, - d->buffer, d->dma_handle); - - d->state &= ~DVB_USB_STATE_URB_BUF; + dvb_usb_free_stream_buffers(d); return 0; } diff --git a/drivers/media/dvb/dvb-usb/dvb-usb.h b/drivers/media/dvb/dvb-usb/dvb-usb.h index abcee1943f6..a80567caf50 100644 --- a/drivers/media/dvb/dvb-usb/dvb-usb.h +++ b/drivers/media/dvb/dvb-usb/dvb-usb.h @@ -189,12 +189,13 @@ struct dvb_usb_properties { struct { int framesperurb; int framesize; + int interval; } isoc; } u; } urb; int num_device_descs; - struct dvb_usb_device_description devices[8]; + struct dvb_usb_device_description devices[9]; }; @@ -207,19 +208,28 @@ struct dvb_usb_properties { * @udev: pointer to the device's struct usb_device. * @urb_list: array of dynamically allocated struct urb for the MPEG2-TS- * streaming. - * @buffer: buffer used to streaming. - * @dma_handle: dma_addr_t for buffer. + * + * @buf_num: number of buffer allocated. + * @buf_size: size of each buffer in buf_list. + * @buf_list: array containing all allocate buffers for streaming. + * @dma_addr: list of dma_addr_t for each buffer in buf_list. + * * @urbs_initialized: number of URBs initialized. * @urbs_submitted: number of URBs submitted. + * * @feedcount: number of reqested feeds (used for streaming-activation) * @pid_filtering: is hardware pid_filtering used or not. + * * @usb_sem: semaphore of USB control messages (reading needs two messages) * @i2c_sem: semaphore for i2c-transfers + * * @i2c_adap: device's i2c_adapter if it uses I2CoverUSB * @pll_addr: I2C address of the tuner for programming * @pll_init: array containing the initialization buffer * @pll_desc: pointer to the appropriate struct dvb_pll_desc - * @tuner_pass_ctrl: called to (de)activate tuner passthru of the demod + * + * @tuner_pass_ctrl: called to (de)activate tuner passthru of the demod or the board + * * @dvb_adap: device's dvb_adapter. * @dmxdev: device's dmxdev. * @demux: device's software demuxer. @@ -253,8 +263,12 @@ struct dvb_usb_device { /* usb */ struct usb_device *udev; struct urb **urb_list; - u8 *buffer; - dma_addr_t dma_handle; + + int buf_num; + unsigned long buf_size; + u8 **buf_list; + dma_addr_t *dma_addr; + int urbs_initialized; int urbs_submitted; diff --git a/drivers/media/dvb/dvb-usb/nova-t-usb2.c b/drivers/media/dvb/dvb-usb/nova-t-usb2.c index 9d83781aef9..258a92bfbcc 100644 --- a/drivers/media/dvb/dvb-usb/nova-t-usb2.c +++ b/drivers/media/dvb/dvb-usb/nova-t-usb2.c @@ -203,7 +203,7 @@ static struct dvb_usb_properties nova_t_properties = { static struct usb_driver nova_t_driver = { .owner = THIS_MODULE, - .name = "Hauppauge WinTV-NOVA-T usb2", + .name = "dvb_usb_nova_t_usb2", .probe = nova_t_probe, .disconnect = dvb_usb_device_exit, .id_table = nova_t_table, diff --git a/drivers/media/dvb/dvb-usb/umt-010.c b/drivers/media/dvb/dvb-usb/umt-010.c index aa560422ce7..2112ac3cf5e 100644 --- a/drivers/media/dvb/dvb-usb/umt-010.c +++ b/drivers/media/dvb/dvb-usb/umt-010.c @@ -129,7 +129,7 @@ static struct dvb_usb_properties umt_properties = { static struct usb_driver umt_driver = { .owner = THIS_MODULE, - .name = "HanfTek UMT-010 USB2.0 DVB-T devices", + .name = "dvb_usb_umt_010", .probe = umt_probe, .disconnect = dvb_usb_device_exit, .id_table = umt_table, diff --git a/drivers/media/dvb/dvb-usb/vp7045.c b/drivers/media/dvb/dvb-usb/vp7045.c index 02ecc9a8e3b..9ac95f54f9f 100644 --- a/drivers/media/dvb/dvb-usb/vp7045.c +++ b/drivers/media/dvb/dvb-usb/vp7045.c @@ -44,7 +44,7 @@ int vp7045_usb_op(struct dvb_usb_device *d, u8 cmd, u8 *out, int outlen, u8 *in, if (usb_control_msg(d->udev, usb_sndctrlpipe(d->udev,0), TH_COMMAND_OUT, USB_TYPE_VENDOR | USB_DIR_OUT, 0, 0, - outbuf, 20, 2*HZ) != 20) { + outbuf, 20, 2000) != 20) { err("USB control message 'out' went wrong."); ret = -EIO; goto unlock; @@ -55,7 +55,7 @@ int vp7045_usb_op(struct dvb_usb_device *d, u8 cmd, u8 *out, int outlen, u8 *in, if (usb_control_msg(d->udev, usb_rcvctrlpipe(d->udev,0), TH_COMMAND_IN, USB_TYPE_VENDOR | USB_DIR_IN, 0, 0, - inbuf, 12, 2*HZ) != 12) { + inbuf, 12, 2000) != 12) { err("USB control message 'in' went wrong."); ret = -EIO; goto unlock; @@ -94,16 +94,41 @@ static int vp7045_power_ctrl(struct dvb_usb_device *d, int onoff) /* The keymapping struct. Somehow this should be loaded to the driver, but * currently it is hardcoded. */ static struct dvb_usb_rc_key vp7045_rc_keys[] = { - /* insert the keys like this. to make the raw keys visible, enable - * debug=0x04 when loading dvb-usb-vp7045. */ - - /* these keys are probably wrong. I don't have a working IR-receiver on my - * vp7045, so I can't test it. Patches are welcome. */ - { 0x00, 0x01, KEY_1 }, - { 0x00, 0x02, KEY_2 }, + { 0x00, 0x16, KEY_POWER }, + { 0x00, 0x10, KEY_MUTE }, + { 0x00, 0x03, KEY_1 }, + { 0x00, 0x01, KEY_2 }, + { 0x00, 0x06, KEY_3 }, + { 0x00, 0x09, KEY_4 }, + { 0x00, 0x1d, KEY_5 }, + { 0x00, 0x1f, KEY_6 }, + { 0x00, 0x0d, KEY_7 }, + { 0x00, 0x19, KEY_8 }, + { 0x00, 0x1b, KEY_9 }, + { 0x00, 0x15, KEY_0 }, + { 0x00, 0x05, KEY_CHANNELUP }, + { 0x00, 0x02, KEY_CHANNELDOWN }, + { 0x00, 0x1e, KEY_VOLUMEUP }, + { 0x00, 0x0a, KEY_VOLUMEDOWN }, + { 0x00, 0x11, KEY_RECORD }, + { 0x00, 0x17, KEY_FAVORITES }, /* Heart symbol - Channel list. */ + { 0x00, 0x14, KEY_PLAY }, + { 0x00, 0x1a, KEY_STOP }, + { 0x00, 0x40, KEY_REWIND }, + { 0x00, 0x12, KEY_FASTFORWARD }, + { 0x00, 0x0e, KEY_PREVIOUS }, /* Recall - Previous channel. */ + { 0x00, 0x4c, KEY_PAUSE }, + { 0x00, 0x4d, KEY_SCREEN }, /* Full screen mode. */ + { 0x00, 0x54, KEY_AUDIO }, /* MTS - Switch to secondary audio. */ + { 0x00, 0x0c, KEY_CANCEL }, /* Cancel */ + { 0x00, 0x1c, KEY_EPG }, /* EPG */ + { 0x00, 0x00, KEY_TAB }, /* Tab */ + { 0x00, 0x48, KEY_INFO }, /* Preview */ + { 0x00, 0x04, KEY_LIST }, /* RecordList */ + { 0x00, 0x0f, KEY_TEXT } /* Teletext */ }; -static int vp7045_rc_query(struct dvb_usb_device *d, u32 *key_buf, int *state) +static int vp7045_rc_query(struct dvb_usb_device *d, u32 *event, int *state) { u8 key; int i; @@ -119,7 +144,7 @@ static int vp7045_rc_query(struct dvb_usb_device *d, u32 *key_buf, int *state) for (i = 0; i < sizeof(vp7045_rc_keys)/sizeof(struct dvb_usb_rc_key); i++) if (vp7045_rc_keys[i].data == key) { *state = REMOTE_KEY_PRESSED; - *key_buf = vp7045_rc_keys[i].event; + *event = vp7045_rc_keys[i].event; break; } return 0; @@ -230,7 +255,7 @@ static struct dvb_usb_properties vp7045_properties = { /* usb specific object needed to register this driver with the usb subsystem */ static struct usb_driver vp7045_usb_driver = { .owner = THIS_MODULE, - .name = "dvb-usb-vp7045", + .name = "dvb_usb_vp7045", .probe = vp7045_usb_probe, .disconnect = dvb_usb_device_exit, .id_table = vp7045_usb_table, |