diff options
Diffstat (limited to 'linux/drivers/media/dvb/dibusb/dvb-dibusb-core.c')
-rw-r--r-- | linux/drivers/media/dvb/dibusb/dvb-dibusb-core.c | 422 |
1 files changed, 208 insertions, 214 deletions
diff --git a/linux/drivers/media/dvb/dibusb/dvb-dibusb-core.c b/linux/drivers/media/dvb/dibusb/dvb-dibusb-core.c index 776f725fb..1d5e3b166 100644 --- a/linux/drivers/media/dvb/dibusb/dvb-dibusb-core.c +++ b/linux/drivers/media/dvb/dibusb/dvb-dibusb-core.c @@ -41,86 +41,6 @@ int rc_query_interval; module_param(rc_query_interval, int, 0644); MODULE_PARM_DESC(rc_query_interval, "interval in msecs for remote control query (default: 100; min: 40)"); -/* Version information */ -#define DRIVER_VERSION "0.1" -#define DRIVER_DESC "Driver for DiBcom based USB Budget DVB-T device" -#define DRIVER_AUTHOR "Patrick Boettcher, patrick.boettcher@desy.de" - -static const char * dibusb_fw_filenames1_1[] = { - "dvb-dibusb-5.0.0.11.fw" -}; - -static const char * dibusb_fw_filenames1_1_an2235[] = { - "dvb-dibusb-an2235-1.fw" -}; - -static const char * dibusb_fw_filenames2_0[] = { - "dvb-dibusb-6.0.0.5.fw" -}; - -int panasonic_cofdm_env57h1xd5_pll_set(struct dvb_frontend *fe, struct - dvb_frontend_parameters *params); - -int thomson_cable_eu_pll_set(struct dvb_frontend* fe, struct - dvb_frontend_parameters* params); - -static struct dibusb_device_parameter dibusb_dev_parm[3] = { - { .type = DIBUSB1_1, - .fw_filenames = dibusb_fw_filenames1_1, - .usb_controller = "Cypress AN2135", - .usb_cpu_csreg = 0x7f92, - - .num_urbs = 3, - .urb_buf_size = 4096, - .default_size = 188*21, - .firmware_bug = 1, - - .cmd_pipe = 0x01, - .result_pipe = 0x01, - .data_pipe = 0x02, - - .pll_set = thomson_cable_eu_pll_set, - .pll_addr = 194, - .demod_i2c_addrs = { 0x10, 0, 0, 0 }, - }, - { .type = DIBUSB2_0, - .fw_filenames = dibusb_fw_filenames2_0, - .usb_controller = "Cypress FX2", - .usb_cpu_csreg = 0xe600, - - .num_urbs = 3, - .urb_buf_size = 188*210, - .default_size = 188*210, - .firmware_bug = 0, - - .cmd_pipe = 0x01, - .result_pipe = 0x01, - .data_pipe = 0x06, - - .pll_set = panasonic_cofdm_env57h1xd5_pll_set, - .pll_addr = 192, - .demod_i2c_addrs = { 0x12, 0x14, 0x16, 0x18 }, - }, - { .type = DIBUSB1_1_AN2235, - .fw_filenames = dibusb_fw_filenames1_1_an2235, - .usb_controller = "Cypress CY7C64613 (AN2235)", - .usb_cpu_csreg = 0x7f92, - - .num_urbs = 3, - .urb_buf_size = 4096, - .default_size = 188*21, - .firmware_bug = 1, - - .cmd_pipe = 0x01, - .result_pipe = 0x01, - .data_pipe = 0x02, - - .pll_set = thomson_cable_eu_pll_set, - .pll_addr = 194, - .demod_i2c_addrs = { 0x10, 0, 0, 0 }, - } -}; - /* Vendor IDs */ #define USB_VID_ANCHOR 0x0547 #define USB_VID_AVERMEDIA 0x14aa @@ -131,6 +51,7 @@ static struct dibusb_device_parameter dibusb_dev_parm[3] = { #define USB_VID_EMPIA 0xeb1a #define USB_VID_GRANDTEC 0x5032 #define USB_VID_HYPER_PALTEK 0x1025 +#define USB_VID_HANFTEK 0x15f4 #define USB_VID_IMC_NETWORKS 0x13d3 #define USB_VID_TWINHAN 0x1822 #define USB_VID_ULTIMA_ELECTRONIC 0x05d8 @@ -163,143 +84,203 @@ static struct dibusb_device_parameter dibusb_dev_parm[3] = { #define USB_PID_ULTIMA_TVBOX_USB2_FX_WARM 0x1002 #define USB_PID_UNK_HYPER_PALTEK_COLD 0x005e #define USB_PID_UNK_HYPER_PALTEK_WARM 0x005f +#define USB_PID_HANFTEK_UMT_010_COLD 0x0001 +#define USB_PID_HANFTEK_UMT_010_WARM 0x0025 #define USB_PID_YAKUMO_DTT200U_COLD 0x0201 #define USB_PID_YAKUMO_DTT200U_WARM 0x0301 -#define DIBUSB_SUPPORTED_DEVICES 16 +/* USB Driver stuff + * table of devices that this driver is working with + * + * ATTENTION: Never ever change the order of this table, the particular + * devices depend on this order + * + * Each entry is used as a reference in the device_struct. Currently this is + * the only non-redundant way of assigning USB ids to actual devices I'm aware + * of, because there is only one place in the code where the assignment of + * vendor and product id is done, here. + */ +static struct usb_device_id dib_table [] = { +/* 00 */ { USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_DVBT_USB_COLD)}, +/* 01 */ { USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_DVBT_USB_WARM)}, +/* 02 */ { USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_YAKUMO_DTT200U_COLD) }, +/* 03 */ { USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_YAKUMO_DTT200U_WARM) }, +/* 04 */ { USB_DEVICE(USB_VID_COMPRO, USB_PID_COMPRO_DVBU2000_COLD) }, +/* 05 */ { USB_DEVICE(USB_VID_COMPRO, USB_PID_COMPRO_DVBU2000_WARM) }, +/* 06 */ { USB_DEVICE(USB_VID_COMPRO_UNK, USB_PID_COMPRO_DVBU2000_UNK_COLD) }, +/* 07 */ { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_MOD3000_COLD) }, +/* 08 */ { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_MOD3000_WARM) }, +/* 09 */ { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_MOD3001_COLD) }, +/* 10 */ { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_MOD3001_WARM) }, +/* 11 */ { USB_DEVICE(USB_VID_EMPIA, USB_PID_KWORLD_VSTREAM_COLD) }, +/* 12 */ { USB_DEVICE(USB_VID_EMPIA, USB_PID_KWORLD_VSTREAM_WARM) }, +/* 13 */ { USB_DEVICE(USB_VID_GRANDTEC, USB_PID_GRANDTEC_DVBT_USB_COLD) }, +/* 14 */ { USB_DEVICE(USB_VID_GRANDTEC, USB_PID_GRANDTEC_DVBT_USB_WARM) }, +/* 15 */ { USB_DEVICE(USB_VID_GRANDTEC, USB_PID_DIBCOM_MOD3000_COLD) }, +/* 16 */ { USB_DEVICE(USB_VID_GRANDTEC, USB_PID_DIBCOM_MOD3000_WARM) }, +/* 17 */ { USB_DEVICE(USB_VID_HYPER_PALTEK, USB_PID_UNK_HYPER_PALTEK_COLD) }, +/* 18 */ { USB_DEVICE(USB_VID_HYPER_PALTEK, USB_PID_UNK_HYPER_PALTEK_WARM) }, +/* 19 */ { USB_DEVICE(USB_VID_IMC_NETWORKS, USB_PID_TWINHAN_VP7041_COLD) }, +/* 20 */ { USB_DEVICE(USB_VID_IMC_NETWORKS, USB_PID_TWINHAN_VP7041_WARM) }, +/* 21 */ { USB_DEVICE(USB_VID_TWINHAN, USB_PID_TWINHAN_VP7041_COLD) }, +/* 22 */ { USB_DEVICE(USB_VID_TWINHAN, USB_PID_TWINHAN_VP7041_WARM) }, +/* 23 */ { USB_DEVICE(USB_VID_ULTIMA_ELECTRONIC, USB_PID_ULTIMA_TVBOX_COLD) }, +/* 24 */ { USB_DEVICE(USB_VID_ULTIMA_ELECTRONIC, USB_PID_ULTIMA_TVBOX_WARM) }, +/* 25 */ { USB_DEVICE(USB_VID_ULTIMA_ELECTRONIC, USB_PID_ULTIMA_TVBOX_AN2235_COLD) }, +/* 26 */ { USB_DEVICE(USB_VID_ULTIMA_ELECTRONIC, USB_PID_ULTIMA_TVBOX_AN2235_WARM) }, +/* 27 */ { USB_DEVICE(USB_VID_ULTIMA_ELECTRONIC, USB_PID_ULTIMA_TVBOX_USB2_COLD) }, + +/* 28 */ { USB_DEVICE(USB_VID_HANFTEK, USB_PID_HANFTEK_UMT_010_COLD) }, +/* 29 */ { USB_DEVICE(USB_VID_HANFTEK, USB_PID_HANFTEK_UMT_010_WARM) }, + +/* + * activate the following define when you have one of the devices and want to + * build it from build-2.6 in dvb-kernel + */ +// #define CONFIG_DVB_DIBUSB_MISDESIGNED_DEVICES +#ifdef CONFIG_DVB_DIBUSB_MISDESIGNED_DEVICES +/* 30 */ { USB_DEVICE(USB_VID_ANCHOR, USB_PID_ULTIMA_TVBOX_ANCHOR_COLD) }, +/* 31 */ { USB_DEVICE(USB_VID_CYPRESS, USB_PID_ULTIMA_TVBOX_USB2_FX_COLD) }, +/* 32 */ { USB_DEVICE(USB_VID_ANCHOR, USB_PID_ULTIMA_TVBOX_USB2_FX_WARM) }, +/* 33 */ { USB_DEVICE(USB_VID_ANCHOR, USB_PID_DIBCOM_ANCHOR_2135_COLD) }, +#endif + + { } /* Terminating entry */ +}; + +MODULE_DEVICE_TABLE (usb, dib_table); + +static struct dibusb_usb_controller dibusb_usb_ctrl[] = { + { .name = "Cypress AN2135", .cpu_cs_register = 0x7f92 }, + { .name = "Cypress AN2235", .cpu_cs_register = 0x7f92 }, + { .name = "Cypress FX2", .cpu_cs_register = 0xe600 }, +}; + +int panasonic_cofdm_env57h1xd5_pll_set(struct dvb_frontend *fe, struct + dvb_frontend_parameters *fep); + +int thomson_cable_eu_pll_set(struct dvb_frontend *fe, struct + dvb_frontend_parameters *fep); + +int lg_tdtp_e102p_tua6034(struct dvb_frontend *fe, struct + dvb_frontend_parameters *fep, u8 *pllbuf); -/* USB Driver stuff */ -static struct dibusb_device dibusb_devices[DIBUSB_SUPPORTED_DEVICES] = { - { .name = "TwinhanDTV USB1.1 / Magic Box / HAMA USB1.1 DVB-T device", - .cold_product_id = USB_PID_TWINHAN_VP7041_COLD, - .warm_product_id = USB_PID_TWINHAN_VP7041_WARM, - .parm = &dibusb_dev_parm[0], +static struct dibusb_device_class dibusb_device_classes[] = { + { .id = DIBUSB1_1, .usb_ctrl = &dibusb_usb_ctrl[0], + .firmware = "dvb-dibusb-5.0.0.11.fw", + .pipe_cmd = 0x01, .pipe_data = 0x02, + .urb_count = 3, .urb_buffer_size = 4096, + .pll_set = thomson_cable_eu_pll_set, .pll_addr = 194, + .demod_i2c_addrs = { 0x10, 0 }, }, - { .name = "KWorld V-Stream XPERT DTV - DVB-T USB1.1", - .cold_product_id = USB_PID_KWORLD_VSTREAM_COLD, - .warm_product_id = USB_PID_KWORLD_VSTREAM_WARM, - .parm = &dibusb_dev_parm[0], + { DIBUSB1_1_AN2235, &dibusb_usb_ctrl[1], + "dvb-dibusb-an2235-1.fw", + 0x01, 0x02, + 3, 4096, + thomson_cable_eu_pll_set, 194, + { 0x10, 0 }, }, - { .name = "Grandtec USB1.1 DVB-T/DiBcom USB1.1 DVB-T reference design (MOD3000)", - .cold_product_id = USB_PID_DIBCOM_MOD3000_COLD, - .warm_product_id = USB_PID_DIBCOM_MOD3000_WARM, - .parm = &dibusb_dev_parm[0], + { DIBUSB2_0,&dibusb_usb_ctrl[2], + "dvb-dibusb-6.0.0.5.fw", + 0x01, 0x06, + 3, 188*210, + panasonic_cofdm_env57h1xd5_pll_set, 192, + { 0x12, 0x14, 0x16, 0x18 }, }, - { .name = "DiBcom USB1.1 DVB-T reference design (MOD3000) with AN2135 default IDs", - .cold_product_id = USB_PID_DIBCOM_ANCHOR_2135_COLD, - .warm_product_id = 0, /* undefined, let's see what comes out */ - .parm = &dibusb_dev_parm[0], + { UMT2_0, &dibusb_usb_ctrl[2], + "dvb-dibusb-umt-1.fw", + 0x01, 0x02, + 3, 200, // TODO + NULL, 192, + { 0x1e }, }, - { .name = "Artec T1 USB1.1 TVBOX with AN2135", - .cold_product_id = USB_PID_ULTIMA_TVBOX_COLD, - .warm_product_id = USB_PID_ULTIMA_TVBOX_WARM, - .parm = &dibusb_dev_parm[0], +}; + +static struct dibusb_usb_device dibusb_devices[] = { + { "TwinhanDTV USB1.1 / Magic Box / HAMA USB1.1 DVB-T device", + &dibusb_device_classes[DIBUSB1_1], + { &dib_table[19], &dib_table[21], NULL}, + { &dib_table[20], &dib_table[22], NULL}, }, - { .name = "Artec T1 USB1.1 TVBOX with AN2235", - .cold_product_id = USB_PID_ULTIMA_TVBOX_AN2235_COLD, - .warm_product_id = USB_PID_ULTIMA_TVBOX_AN2235_WARM, - .parm = &dibusb_dev_parm[2], + { "KWorld V-Stream XPERT DTV - DVB-T USB1.1", + &dibusb_device_classes[DIBUSB1_1], + { &dib_table[11], NULL }, + { &dib_table[12], NULL }, }, - { .name = "Artec T1 USB1.1 TVBOX with AN2235 (misdesigned)", - .cold_product_id = USB_PID_ULTIMA_TVBOX_ANCHOR_COLD, - .warm_product_id = 0, /* undefined, this design becomes USB_PID_DIBCOM_MOD3000_WARM in warm state */ - .parm = &dibusb_dev_parm[2], + { "Grandtec USB1.1 DVB-T", + &dibusb_device_classes[DIBUSB1_1], + { &dib_table[13], &dib_table[15], NULL }, + { &dib_table[14], &dib_table[16], NULL }, }, - { .name = "Artec T1 USB2.0 TVBOX (please report the warm ID)", - .cold_product_id = USB_PID_ULTIMA_TVBOX_USB2_COLD, - .warm_product_id = 0, /* don't know, it is most likely that the device will get another USB ID in warm state */ - .parm = &dibusb_dev_parm[1], + { "DiBcom USB1.1 DVB-T reference design (MOD3000)", + &dibusb_device_classes[DIBUSB1_1], + { &dib_table[7], NULL }, + { &dib_table[8], NULL }, }, - { .name = "Artec T1 USB2.0 TVBOX with FX2 IDs (misdesigned, please report the warm ID)", - .cold_product_id = USB_PID_ULTIMA_TVBOX_USB2_FX_COLD, - .warm_product_id = USB_PID_ULTIMA_TVBOX_USB2_FX_WARM, /* undefined, it could be that the device will get another USB ID in warm state */ - .parm = &dibusb_dev_parm[1], + { "Artec T1 USB1.1 TVBOX with AN2135", + &dibusb_device_classes[DIBUSB1_1], + { &dib_table[23], NULL }, + { &dib_table[24], NULL }, }, - { .name = "Compro Videomate DVB-U2000 - DVB-T USB1.1", - .cold_product_id = USB_PID_COMPRO_DVBU2000_COLD, - .warm_product_id = USB_PID_COMPRO_DVBU2000_WARM, - .parm = &dibusb_dev_parm[0], + { "Artec T1 USB1.1 TVBOX with AN2235", + &dibusb_device_classes[DIBUSB1_1_AN2235], + { &dib_table[25], NULL }, + { &dib_table[26], NULL }, }, - { .name = "Compro Videomate DVB-U2000 - DVB-T USB1.1 (really ?? please report the name!)", - .cold_product_id = USB_PID_COMPRO_DVBU2000_UNK_COLD, - .warm_product_id = USB_PID_COMPRO_DVBU2000_UNK_WARM, - .parm = &dibusb_dev_parm[0], + { "Avermedia AverTV DVBT USB1.1", + &dibusb_device_classes[DIBUSB1_1], + { &dib_table[0], NULL }, + { &dib_table[1], NULL }, }, - { .name = "Unkown USB1.1 DVB-T device ???? please report the name to the author", - .cold_product_id = USB_PID_UNK_HYPER_PALTEK_COLD, - .warm_product_id = USB_PID_UNK_HYPER_PALTEK_WARM, - .parm = &dibusb_dev_parm[0], + { "Compro Videomate DVB-U2000 - DVB-T USB1.1 (please confirm to linux-dvb)", + &dibusb_device_classes[DIBUSB1_1], + { &dib_table[4], &dib_table[6], NULL}, + { &dib_table[5], NULL }, }, - { .name = "DiBcom USB2.0 DVB-T reference design (MOD3000P)", - .cold_product_id = USB_PID_DIBCOM_MOD3001_COLD, - .warm_product_id = USB_PID_DIBCOM_MOD3001_WARM, - .parm = &dibusb_dev_parm[1], + { "Unkown USB1.1 DVB-T device ???? please report the name to the author", + &dibusb_device_classes[DIBUSB1_1], + { &dib_table[17], NULL }, + { &dib_table[18], NULL }, }, - { .name = "Grandtec DVB-T USB1.1", - .cold_product_id = USB_PID_GRANDTEC_DVBT_USB_COLD, - .warm_product_id = USB_PID_GRANDTEC_DVBT_USB_WARM, - .parm = &dibusb_dev_parm[0], + { "DiBcom USB2.0 DVB-T reference design (MOD3000P)", + &dibusb_device_classes[DIBUSB2_0], + { &dib_table[9], NULL }, + { &dib_table[10], NULL }, }, - { .name = "Avermedia AverTV DVBT USB1.1", - .cold_product_id = USB_PID_AVERMEDIA_DVBT_USB_COLD, - .warm_product_id = USB_PID_AVERMEDIA_DVBT_USB_WARM, - .parm = &dibusb_dev_parm[0], + { "Artec T1 USB2.0 TVBOX (please report the warm ID)", + &dibusb_device_classes[DIBUSB2_0], + { &dib_table[27], NULL }, + { NULL }, }, - { .name = "Yakumo/Typhoon DVB-T mobile USB2.0", - .cold_product_id = USB_PID_YAKUMO_DTT200U_COLD, - .warm_product_id = USB_PID_YAKUMO_DTT200U_WARM, - .parm = &dibusb_dev_parm[1], - } -}; - -/* USB Driver stuff */ -/* table of devices that this driver is working with */ -static struct usb_device_id dibusb_table [] = { - { USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_DVBT_USB_COLD)}, - { USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_DVBT_USB_WARM)}, - { USB_DEVICE(USB_VID_COMPRO, USB_PID_COMPRO_DVBU2000_COLD) }, - { USB_DEVICE(USB_VID_COMPRO, USB_PID_COMPRO_DVBU2000_WARM) }, - { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_MOD3000_COLD) }, - { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_MOD3000_WARM) }, - { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_MOD3001_COLD) }, - { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_MOD3001_WARM) }, - { USB_DEVICE(USB_VID_EMPIA, USB_PID_KWORLD_VSTREAM_COLD) }, - { USB_DEVICE(USB_VID_EMPIA, USB_PID_KWORLD_VSTREAM_WARM) }, - { USB_DEVICE(USB_VID_GRANDTEC, USB_PID_GRANDTEC_DVBT_USB_COLD) }, - { USB_DEVICE(USB_VID_GRANDTEC, USB_PID_GRANDTEC_DVBT_USB_WARM) }, - { USB_DEVICE(USB_VID_GRANDTEC, USB_PID_DIBCOM_MOD3000_COLD) }, - { USB_DEVICE(USB_VID_GRANDTEC, USB_PID_DIBCOM_MOD3000_WARM) }, - { USB_DEVICE(USB_VID_HYPER_PALTEK, USB_PID_UNK_HYPER_PALTEK_COLD) }, - { USB_DEVICE(USB_VID_HYPER_PALTEK, USB_PID_UNK_HYPER_PALTEK_WARM) }, - { USB_DEVICE(USB_VID_IMC_NETWORKS, USB_PID_TWINHAN_VP7041_COLD) }, - { USB_DEVICE(USB_VID_IMC_NETWORKS, USB_PID_TWINHAN_VP7041_WARM) }, - { USB_DEVICE(USB_VID_TWINHAN, USB_PID_TWINHAN_VP7041_COLD) }, - { USB_DEVICE(USB_VID_TWINHAN, USB_PID_TWINHAN_VP7041_WARM) }, - { USB_DEVICE(USB_VID_ULTIMA_ELECTRONIC, USB_PID_ULTIMA_TVBOX_COLD) }, - { USB_DEVICE(USB_VID_ULTIMA_ELECTRONIC, USB_PID_ULTIMA_TVBOX_WARM) }, - { USB_DEVICE(USB_VID_ULTIMA_ELECTRONIC, USB_PID_ULTIMA_TVBOX_AN2235_COLD) }, - { USB_DEVICE(USB_VID_ULTIMA_ELECTRONIC, USB_PID_ULTIMA_TVBOX_AN2235_WARM) }, - { USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_YAKUMO_DTT200U_COLD) }, - { USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_YAKUMO_DTT200U_WARM) }, - { USB_DEVICE(USB_PID_COMPRO_DVBU2000_UNK_COLD, USB_VID_COMPRO_UNK) }, - { USB_DEVICE(USB_VID_ULTIMA_ELECTRONIC, USB_PID_ULTIMA_TVBOX_USB2_COLD) }, - -/* - * activate the following define when you have one of the devices and want to - * build it from build-2.6 in dvb-kernel - */ -// #define CONFIG_DVB_DIBUSB_MISDESIGNED_DEVICES + { "Yakumo/Typhoon DVB-T mobile USB2.0", + &dibusb_device_classes[DIBUSB2_0], + { &dib_table[2], NULL }, + { &dib_table[3], NULL }, + }, + { "Hanftek UMT-010 DVB-T USB2.0", + &dibusb_device_classes[UMT2_0], + { &dib_table[28], NULL }, + { &dib_table[29], NULL }, + }, #ifdef CONFIG_DVB_DIBUSB_MISDESIGNED_DEVICES - { USB_DEVICE(USB_VID_ANCHOR, USB_PID_ULTIMA_TVBOX_ANCHOR_COLD) }, - { USB_DEVICE(USB_VID_CYPRESS, USB_PID_ULTIMA_TVBOX_USB2_FX_COLD) }, - { USB_DEVICE(USB_VID_ANCHOR, USB_PID_ULTIMA_TVBOX_USB2_FX_WARM) }, - { USB_DEVICE(USB_VID_ANCHOR, USB_PID_DIBCOM_ANCHOR_2135_COLD) }, + { "Artec T1 USB1.1 TVBOX with AN2235 (misdesigned)", + &dibusb_device_classes[DIBUSB1_1_AN2235], + { &dib_table[30], NULL }, + { NULL }, + }, + { "Artec T1 USB2.0 TVBOX with FX2 IDs (misdesigned, please report the warm ID)", + &dibusb_device_classes[DIBUSB2_0], + { &dib_table[31], NULL }, + { &dib_table[32], NULL }, /* undefined, it could be that the device will get another USB ID in warm state */ + }, + { "DiBcom USB1.1 DVB-T reference design (MOD3000) with AN2135 default IDs", + &dibusb_device_classes[DIBUSB1_1], + { &dib_table[33], NULL }, + { NULL }, + }, #endif - { } /* Terminating entry */ }; -MODULE_DEVICE_TABLE (usb, dibusb_table); - static int dibusb_exit(struct usb_dibusb *dib) { deb_info("init_state before exiting everything: %x\n",dib->init_state); @@ -342,6 +323,30 @@ static int dibusb_init(struct usb_dibusb *dib) return 0; } +static struct dibusb_usb_device * dibusb_find_device (struct usb_device *udev,int *cold) +{ + int i,j; + *cold = -1; + for (i = 0; i < sizeof(dibusb_devices)/sizeof(struct dibusb_usb_device); i++) { + for (j = 0; j < DIBUSB_ID_MAX_NUM && dibusb_devices[i].cold_ids[j] != NULL; j++) { + deb_info("check for %x %x\n",dibusb_devices[i].cold_ids[j]->idVendor, dibusb_devices[i].cold_ids[j]->idProduct); + if (dibusb_devices[i].cold_ids[j]->idVendor == udev->descriptor.idVendor && + dibusb_devices[i].cold_ids[j]->idProduct == udev->descriptor.idProduct) { + *cold = 1; + return &dibusb_devices[i]; + } + } + + for (j = 0; j < DIBUSB_ID_MAX_NUM && dibusb_devices[i].warm_ids[j] != NULL; j++) + if (dibusb_devices[i].warm_ids[j]->idVendor == udev->descriptor.idVendor && + dibusb_devices[i].warm_ids[j]->idProduct == udev->descriptor.idProduct) { + *cold = 0; + return &dibusb_devices[i]; + } + } + return NULL; +} + /* * USB */ @@ -350,32 +355,21 @@ static int dibusb_probe(struct usb_interface *intf, { struct usb_device *udev = interface_to_usbdev(intf); struct usb_dibusb *dib = NULL; - struct dibusb_device *dibdev = NULL; - - int ret = -ENOMEM,i,cold=0; - - for (i = 0; i < DIBUSB_SUPPORTED_DEVICES; i++) - if (dibusb_devices[i].cold_product_id == udev->descriptor.idProduct || - dibusb_devices[i].warm_product_id == udev->descriptor.idProduct) { - dibdev = &dibusb_devices[i]; - - cold = dibdev->cold_product_id == udev->descriptor.idProduct; - - if (cold) - info("found a '%s' in cold state, will try to load a firmware",dibdev->name); - else - info("found a '%s' in warm state.",dibdev->name); - } + struct dibusb_usb_device *dibdev = NULL; - if (dibdev == NULL) { + int ret = -ENOMEM,cold=0; + + if ((dibdev = dibusb_find_device(udev,&cold)) == NULL) { err("something went very wrong, " "unknown product ID: %.4x",udev->descriptor.idProduct); return -ENODEV; } - if (cold) + if (cold == 1) { + info("found a '%s' in cold state, will try to load a firmware",dibdev->name); ret = dibusb_loadfirmware(udev,dibdev); - else { + } else { + info("found a '%s' in warm state.",dibdev->name); dib = kmalloc(sizeof(struct usb_dibusb),GFP_KERNEL); if (dib == NULL) { err("no memory"); @@ -438,7 +432,7 @@ struct usb_driver dibusb_driver = { .name = "dvb_dibusb", .probe = dibusb_probe, .disconnect = dibusb_disconnect, - .id_table = dibusb_table, + .id_table = dib_table, }; /* module stuff */ |