1 /* DVB USB compliant linux driver for mobile DVB-T USB devices based on
2 * reference designs made by DiBcom (http://www.dibcom.fr/) (DiB3000M-B)
4 * Copyright (C) 2004-5 Patrick Boettcher (patrick.boettcher@desy.de)
6 * based on GPL code from DiBcom, which has
7 * Copyright (C) 2004 Amaury Demol for DiBcom (ademol@dibcom.fr)
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by the Free
11 * Software Foundation, version 2.
13 * see Documentation/dvb/README.dvb-usb for more information
17 static int dib3000mb_i2c_gate_ctrl(struct dvb_frontend* fe, int enable)
19 struct dvb_usb_adapter *adap = fe->dvb->priv;
20 struct dibusb_state *st = adap->priv;
22 return st->ops.tuner_pass_ctrl(fe, enable, st->tuner_addr);
25 static int dibusb_dib3000mb_frontend_attach(struct dvb_usb_adapter *adap)
27 struct dib3000_config demod_cfg;
28 struct dibusb_state *st = adap->priv;
30 demod_cfg.demod_address = 0x8;
32 if ((adap->fe = dvb_attach(dib3000mb_attach, &demod_cfg,
33 &adap->dev->i2c_adap, &st->ops)) == NULL)
36 adap->fe->ops.i2c_gate_ctrl = dib3000mb_i2c_gate_ctrl;
41 static int dibusb_thomson_tuner_attach(struct dvb_usb_adapter *adap)
43 struct dibusb_state *st = adap->priv;
45 st->tuner_addr = 0x61;
47 dvb_attach(dvb_pll_attach, adap->fe, 0x61, &adap->dev->i2c_adap,
52 static int dibusb_panasonic_tuner_attach(struct dvb_usb_adapter *adap)
54 struct dibusb_state *st = adap->priv;
56 st->tuner_addr = 0x60;
58 dvb_attach(dvb_pll_attach, adap->fe, 0x60, &adap->dev->i2c_adap,
63 /* Some of the Artec 1.1 device aren't equipped with the default tuner
64 * (Thomson Cable), but with a Panasonic ENV77H11D5. This function figures
66 static int dibusb_tuner_probe_and_attach(struct dvb_usb_adapter *adap)
68 u8 b[2] = { 0,0 }, b2[1];
70 struct i2c_msg msg[2] = {
71 { .flags = 0, .buf = b, .len = 2 },
72 { .flags = I2C_M_RD, .buf = b2, .len = 1 },
74 struct dibusb_state *st = adap->priv;
76 /* the Panasonic sits on I2C addrass 0x60, the Thomson on 0x61 */
77 msg[0].addr = msg[1].addr = st->tuner_addr = 0x60;
79 if (adap->fe->ops.i2c_gate_ctrl)
80 adap->fe->ops.i2c_gate_ctrl(adap->fe,1);
82 if (i2c_transfer(&adap->dev->i2c_adap, msg, 2) != 2) {
83 err("tuner i2c write failed.");
87 if (adap->fe->ops.i2c_gate_ctrl)
88 adap->fe->ops.i2c_gate_ctrl(adap->fe,0);
91 info("This device has the Thomson Cable onboard. Which is default.");
92 ret = dibusb_thomson_tuner_attach(adap);
94 info("This device has the Panasonic ENV77H11D5 onboard.");
95 ret = dibusb_panasonic_tuner_attach(adap);
101 /* USB Driver stuff */
102 static struct dvb_usb_device_properties dibusb1_1_properties;
103 static struct dvb_usb_device_properties dibusb1_1_an2235_properties;
104 static struct dvb_usb_device_properties dibusb2_0b_properties;
105 static struct dvb_usb_device_properties artec_t1_usb2_properties;
107 static int dibusb_probe(struct usb_interface *intf,
108 const struct usb_device_id *id)
110 if (dvb_usb_device_init(intf,&dibusb1_1_properties,THIS_MODULE,NULL) == 0 ||
111 dvb_usb_device_init(intf,&dibusb1_1_an2235_properties,THIS_MODULE,NULL) == 0 ||
112 dvb_usb_device_init(intf,&dibusb2_0b_properties,THIS_MODULE,NULL) == 0 ||
113 dvb_usb_device_init(intf,&artec_t1_usb2_properties,THIS_MODULE,NULL) == 0)
119 /* do not change the order of the ID table */
120 static struct usb_device_id dibusb_dib3000mb_table [] = {
121 /* 00 */ { USB_DEVICE(USB_VID_WIDEVIEW, USB_PID_AVERMEDIA_DVBT_USB_COLD) },
122 /* 01 */ { USB_DEVICE(USB_VID_WIDEVIEW, USB_PID_AVERMEDIA_DVBT_USB_WARM) },
123 /* 02 */ { USB_DEVICE(USB_VID_COMPRO, USB_PID_COMPRO_DVBU2000_COLD) },
124 /* 03 */ { USB_DEVICE(USB_VID_COMPRO, USB_PID_COMPRO_DVBU2000_WARM) },
125 /* 04 */ { USB_DEVICE(USB_VID_COMPRO_UNK, USB_PID_COMPRO_DVBU2000_UNK_COLD) },
126 /* 05 */ { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_MOD3000_COLD) },
127 /* 06 */ { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_MOD3000_WARM) },
128 /* 07 */ { USB_DEVICE(USB_VID_EMPIA, USB_PID_KWORLD_VSTREAM_COLD) },
129 /* 08 */ { USB_DEVICE(USB_VID_EMPIA, USB_PID_KWORLD_VSTREAM_WARM) },
130 /* 09 */ { USB_DEVICE(USB_VID_GRANDTEC, USB_PID_GRANDTEC_DVBT_USB_COLD) },
131 /* 10 */ { USB_DEVICE(USB_VID_GRANDTEC, USB_PID_GRANDTEC_DVBT_USB_WARM) },
132 /* 11 */ { USB_DEVICE(USB_VID_GRANDTEC, USB_PID_DIBCOM_MOD3000_COLD) },
133 /* 12 */ { USB_DEVICE(USB_VID_GRANDTEC, USB_PID_DIBCOM_MOD3000_WARM) },
134 /* 13 */ { USB_DEVICE(USB_VID_HYPER_PALTEK, USB_PID_UNK_HYPER_PALTEK_COLD) },
135 /* 14 */ { USB_DEVICE(USB_VID_HYPER_PALTEK, USB_PID_UNK_HYPER_PALTEK_WARM) },
136 /* 15 */ { USB_DEVICE(USB_VID_VISIONPLUS, USB_PID_TWINHAN_VP7041_COLD) },
137 /* 16 */ { USB_DEVICE(USB_VID_VISIONPLUS, USB_PID_TWINHAN_VP7041_WARM) },
138 /* 17 */ { USB_DEVICE(USB_VID_TWINHAN, USB_PID_TWINHAN_VP7041_COLD) },
139 /* 18 */ { USB_DEVICE(USB_VID_TWINHAN, USB_PID_TWINHAN_VP7041_WARM) },
140 /* 19 */ { USB_DEVICE(USB_VID_ULTIMA_ELECTRONIC, USB_PID_ULTIMA_TVBOX_COLD) },
141 /* 20 */ { USB_DEVICE(USB_VID_ULTIMA_ELECTRONIC, USB_PID_ULTIMA_TVBOX_WARM) },
142 /* 21 */ { USB_DEVICE(USB_VID_ULTIMA_ELECTRONIC, USB_PID_ULTIMA_TVBOX_AN2235_COLD) },
143 /* 22 */ { USB_DEVICE(USB_VID_ULTIMA_ELECTRONIC, USB_PID_ULTIMA_TVBOX_AN2235_WARM) },
144 /* 23 */ { USB_DEVICE(USB_VID_ADSTECH, USB_PID_ADSTECH_USB2_COLD) },
146 /* device ID with default DIBUSB2_0-firmware and with the hacked firmware */
147 /* 24 */ { USB_DEVICE(USB_VID_ADSTECH, USB_PID_ADSTECH_USB2_WARM) },
148 /* 25 */ { USB_DEVICE(USB_VID_KYE, USB_PID_KYE_DVB_T_COLD) },
149 /* 26 */ { USB_DEVICE(USB_VID_KYE, USB_PID_KYE_DVB_T_WARM) },
151 /* 27 */ { USB_DEVICE(USB_VID_KWORLD, USB_PID_KWORLD_VSTREAM_COLD) },
153 /* 28 */ { USB_DEVICE(USB_VID_ULTIMA_ELECTRONIC, USB_PID_ULTIMA_TVBOX_USB2_COLD) },
154 /* 29 */ { USB_DEVICE(USB_VID_ULTIMA_ELECTRONIC, USB_PID_ULTIMA_TVBOX_USB2_WARM) },
157 * XXX: As Artec just 'forgot' to program the EEPROM on some Artec T1 devices
158 * we don't catch these faulty IDs (namely 'Cypress FX1 USB controller') that
159 * have been left on the device. If you don't have such a device but an Artec
160 * device that's supposed to work with this driver but is not detected by it,
161 * free to enable CONFIG_DVB_USB_DIBUSB_MB_FAULTY via your kernel config.
164 #ifdef CONFIG_DVB_USB_DIBUSB_MB_FAULTY
165 /* 30 */ { USB_DEVICE(USB_VID_ANCHOR, USB_PID_ULTIMA_TVBOX_ANCHOR_COLD) },
168 { } /* Terminating entry */
170 MODULE_DEVICE_TABLE (usb, dibusb_dib3000mb_table);
172 static struct dvb_usb_device_properties dibusb1_1_properties = {
173 .caps = DVB_USB_IS_AN_I2C_ADAPTER,
175 .usb_ctrl = CYPRESS_AN2135,
177 .firmware = "dvb-usb-dibusb-5.0.0.11.fw",
182 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
183 .pid_filter_count = 16,
185 .streaming_ctrl = dibusb_streaming_ctrl,
186 .pid_filter = dibusb_pid_filter,
187 .pid_filter_ctrl = dibusb_pid_filter_ctrl,
188 .frontend_attach = dibusb_dib3000mb_frontend_attach,
189 .tuner_attach = dibusb_tuner_probe_and_attach,
191 /* parameter for the MPEG2-data transfer */
202 .size_of_priv = sizeof(struct dibusb_state),
206 .power_ctrl = dibusb_power_ctrl,
208 .rc_interval = DEFAULT_RC_INTERVAL,
209 .rc_key_map = dibusb_rc_keys,
210 .rc_key_map_size = 111, /* wow, that is ugly ... I want to load it to the driver dynamically */
211 .rc_query = dibusb_rc_query,
213 .i2c_algo = &dibusb_i2c_algo,
215 .generic_bulk_ctrl_endpoint = 0x01,
217 .num_device_descs = 9,
219 { "AVerMedia AverTV DVBT USB1.1",
220 { &dibusb_dib3000mb_table[0], NULL },
221 { &dibusb_dib3000mb_table[1], NULL },
223 { "Compro Videomate DVB-U2000 - DVB-T USB1.1 (please confirm to linux-dvb)",
224 { &dibusb_dib3000mb_table[2], &dibusb_dib3000mb_table[4], NULL},
225 { &dibusb_dib3000mb_table[3], NULL },
227 { "DiBcom USB1.1 DVB-T reference design (MOD3000)",
228 { &dibusb_dib3000mb_table[5], NULL },
229 { &dibusb_dib3000mb_table[6], NULL },
231 { "KWorld V-Stream XPERT DTV - DVB-T USB1.1",
232 { &dibusb_dib3000mb_table[7], NULL },
233 { &dibusb_dib3000mb_table[8], NULL },
235 { "Grandtec USB1.1 DVB-T",
236 { &dibusb_dib3000mb_table[9], &dibusb_dib3000mb_table[11], NULL },
237 { &dibusb_dib3000mb_table[10], &dibusb_dib3000mb_table[12], NULL },
239 { "Unkown USB1.1 DVB-T device ???? please report the name to the author",
240 { &dibusb_dib3000mb_table[13], NULL },
241 { &dibusb_dib3000mb_table[14], NULL },
243 { "TwinhanDTV USB-Ter USB1.1 / Magic Box I / HAMA USB1.1 DVB-T device",
244 { &dibusb_dib3000mb_table[15], &dibusb_dib3000mb_table[17], NULL},
245 { &dibusb_dib3000mb_table[16], &dibusb_dib3000mb_table[18], NULL},
247 { "Artec T1 USB1.1 TVBOX with AN2135",
248 { &dibusb_dib3000mb_table[19], NULL },
249 { &dibusb_dib3000mb_table[20], NULL },
251 { "VideoWalker DVB-T USB",
252 { &dibusb_dib3000mb_table[25], NULL },
253 { &dibusb_dib3000mb_table[26], NULL },
258 static struct dvb_usb_device_properties dibusb1_1_an2235_properties = {
259 .caps = DVB_USB_IS_AN_I2C_ADAPTER,
260 .usb_ctrl = CYPRESS_AN2235,
262 .firmware = "dvb-usb-dibusb-an2235-01.fw",
267 .caps = DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF | DVB_USB_ADAP_HAS_PID_FILTER,
268 .pid_filter_count = 16,
270 .streaming_ctrl = dibusb_streaming_ctrl,
271 .pid_filter = dibusb_pid_filter,
272 .pid_filter_ctrl = dibusb_pid_filter_ctrl,
273 .frontend_attach = dibusb_dib3000mb_frontend_attach,
274 .tuner_attach = dibusb_tuner_probe_and_attach,
276 /* parameter for the MPEG2-data transfer */
287 .size_of_priv = sizeof(struct dibusb_state),
290 .power_ctrl = dibusb_power_ctrl,
292 .rc_interval = DEFAULT_RC_INTERVAL,
293 .rc_key_map = dibusb_rc_keys,
294 .rc_key_map_size = 111, /* wow, that is ugly ... I want to load it to the driver dynamically */
295 .rc_query = dibusb_rc_query,
297 .i2c_algo = &dibusb_i2c_algo,
299 .generic_bulk_ctrl_endpoint = 0x01,
301 #ifdef CONFIG_DVB_USB_DIBUSB_MB_FAULTY
302 .num_device_descs = 2,
304 .num_device_descs = 1,
307 { "Artec T1 USB1.1 TVBOX with AN2235",
308 { &dibusb_dib3000mb_table[21], NULL },
309 { &dibusb_dib3000mb_table[22], NULL },
311 #ifdef CONFIG_DVB_USB_DIBUSB_MB_FAULTY
312 { "Artec T1 USB1.1 TVBOX with AN2235 (faulty USB IDs)",
313 { &dibusb_dib3000mb_table[30], NULL },
321 static struct dvb_usb_device_properties dibusb2_0b_properties = {
322 .caps = DVB_USB_IS_AN_I2C_ADAPTER,
324 .usb_ctrl = CYPRESS_FX2,
326 .firmware = "dvb-usb-adstech-usb2-02.fw",
331 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
332 .pid_filter_count = 16,
334 .streaming_ctrl = dibusb2_0_streaming_ctrl,
335 .pid_filter = dibusb_pid_filter,
336 .pid_filter_ctrl = dibusb_pid_filter_ctrl,
337 .frontend_attach = dibusb_dib3000mb_frontend_attach,
338 .tuner_attach = dibusb_thomson_tuner_attach,
340 /* parameter for the MPEG2-data transfer */
351 .size_of_priv = sizeof(struct dibusb_state),
354 .power_ctrl = dibusb2_0_power_ctrl,
356 .rc_interval = DEFAULT_RC_INTERVAL,
357 .rc_key_map = dibusb_rc_keys,
358 .rc_key_map_size = 111, /* wow, that is ugly ... I want to load it to the driver dynamically */
359 .rc_query = dibusb_rc_query,
361 .i2c_algo = &dibusb_i2c_algo,
363 .generic_bulk_ctrl_endpoint = 0x01,
365 .num_device_descs = 2,
367 { "KWorld/ADSTech Instant DVB-T USB2.0",
368 { &dibusb_dib3000mb_table[23], NULL },
369 { &dibusb_dib3000mb_table[24], NULL },
371 { "KWorld Xpert DVB-T USB2.0",
372 { &dibusb_dib3000mb_table[27], NULL },
379 static struct dvb_usb_device_properties artec_t1_usb2_properties = {
380 .caps = DVB_USB_IS_AN_I2C_ADAPTER,
382 .usb_ctrl = CYPRESS_FX2,
384 .firmware = "dvb-usb-dibusb-6.0.0.8.fw",
389 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
390 .pid_filter_count = 16,
392 .streaming_ctrl = dibusb2_0_streaming_ctrl,
393 .pid_filter = dibusb_pid_filter,
394 .pid_filter_ctrl = dibusb_pid_filter_ctrl,
395 .frontend_attach = dibusb_dib3000mb_frontend_attach,
396 .tuner_attach = dibusb_tuner_probe_and_attach,
397 /* parameter for the MPEG2-data transfer */
408 .size_of_priv = sizeof(struct dibusb_state),
411 .power_ctrl = dibusb2_0_power_ctrl,
413 .rc_interval = DEFAULT_RC_INTERVAL,
414 .rc_key_map = dibusb_rc_keys,
415 .rc_key_map_size = 111, /* wow, that is ugly ... I want to load it to the driver dynamically */
416 .rc_query = dibusb_rc_query,
418 .i2c_algo = &dibusb_i2c_algo,
420 .generic_bulk_ctrl_endpoint = 0x01,
422 .num_device_descs = 1,
425 { &dibusb_dib3000mb_table[28], NULL },
426 { &dibusb_dib3000mb_table[29], NULL },
432 static struct usb_driver dibusb_driver = {
433 .name = "dvb_usb_dibusb_mb",
434 .probe = dibusb_probe,
435 .disconnect = dvb_usb_device_exit,
436 .id_table = dibusb_dib3000mb_table,
440 static int __init dibusb_module_init(void)
443 if ((result = usb_register(&dibusb_driver))) {
444 err("usb_register failed. Error number %d",result);
451 static void __exit dibusb_module_exit(void)
453 /* deregister this driver from the USB subsystem */
454 usb_deregister(&dibusb_driver);
457 module_init (dibusb_module_init);
458 module_exit (dibusb_module_exit);
460 MODULE_AUTHOR("Patrick Boettcher <patrick.boettcher@desy.de>");
461 MODULE_DESCRIPTION("Driver for DiBcom USB DVB-T devices (DiB3000M-B based)");
462 MODULE_VERSION("1.0");
463 MODULE_LICENSE("GPL");