include: replace linux/module.h with "struct module" wherever possible
[linux-2.6/next.git] / drivers / media / video / em28xx / em28xx-cards.c
blob3e3959fee4195cad5bfc6070d42250f57e2c96a2
1 /*
2 em28xx-cards.c - driver for Empia EM2800/EM2820/2840 USB
3 video capture devices
5 Copyright (C) 2005 Ludovico Cavedon <cavedon@sssup.it>
6 Markus Rechberger <mrechberger@gmail.com>
7 Mauro Carvalho Chehab <mchehab@infradead.org>
8 Sascha Sommer <saschasommer@freenet.de>
10 This program is free software; you can redistribute it and/or modify
11 it under the terms of the GNU General Public License as published by
12 the Free Software Foundation; either version 2 of the License, or
13 (at your option) any later version.
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details.
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25 #include <linux/init.h>
26 #include <linux/module.h>
27 #include <linux/slab.h>
28 #include <linux/delay.h>
29 #include <linux/i2c.h>
30 #include <linux/usb.h>
31 #include <media/tuner.h>
32 #include <media/msp3400.h>
33 #include <media/saa7115.h>
34 #include <media/tvp5150.h>
35 #include <media/tvaudio.h>
36 #include <media/mt9v011.h>
37 #include <media/i2c-addr.h>
38 #include <media/tveeprom.h>
39 #include <media/v4l2-common.h>
40 #include <media/v4l2-chip-ident.h>
42 #include "em28xx.h"
44 #define DRIVER_NAME "em28xx"
46 static int tuner = -1;
47 module_param(tuner, int, 0444);
48 MODULE_PARM_DESC(tuner, "tuner type");
50 static unsigned int disable_ir;
51 module_param(disable_ir, int, 0444);
52 MODULE_PARM_DESC(disable_ir, "disable infrared remote support");
54 static unsigned int disable_usb_speed_check;
55 module_param(disable_usb_speed_check, int, 0444);
56 MODULE_PARM_DESC(disable_usb_speed_check,
57 "override min bandwidth requirement of 480M bps");
59 static unsigned int card[] = {[0 ... (EM28XX_MAXBOARDS - 1)] = UNSET };
60 module_param_array(card, int, NULL, 0444);
61 MODULE_PARM_DESC(card, "card type");
63 /* Bitmask marking allocated devices from 0 to EM28XX_MAXBOARDS */
64 static unsigned long em28xx_devused;
66 struct em28xx_hash_table {
67 unsigned long hash;
68 unsigned int model;
69 unsigned int tuner;
73 * Reset sequences for analog/digital modes
76 /* Reset for the most [analog] boards */
77 static struct em28xx_reg_seq default_analog[] = {
78 {EM28XX_R08_GPIO, 0x6d, ~EM_GPIO_4, 10},
79 { -1, -1, -1, -1},
82 /* Reset for the most [digital] boards */
83 static struct em28xx_reg_seq default_digital[] = {
84 {EM28XX_R08_GPIO, 0x6e, ~EM_GPIO_4, 10},
85 { -1, -1, -1, -1},
88 /* Board Hauppauge WinTV HVR 900 analog */
89 static struct em28xx_reg_seq hauppauge_wintv_hvr_900_analog[] = {
90 {EM28XX_R08_GPIO, 0x2d, ~EM_GPIO_4, 10},
91 {0x05, 0xff, 0x10, 10},
92 { -1, -1, -1, -1},
95 /* Board Hauppauge WinTV HVR 900 digital */
96 static struct em28xx_reg_seq hauppauge_wintv_hvr_900_digital[] = {
97 {EM28XX_R08_GPIO, 0x2e, ~EM_GPIO_4, 10},
98 {EM2880_R04_GPO, 0x04, 0x0f, 10},
99 {EM2880_R04_GPO, 0x0c, 0x0f, 10},
100 { -1, -1, -1, -1},
103 /* Board Hauppauge WinTV HVR 900 (R2) digital */
104 static struct em28xx_reg_seq hauppauge_wintv_hvr_900R2_digital[] = {
105 {EM28XX_R08_GPIO, 0x2e, ~EM_GPIO_4, 10},
106 {EM2880_R04_GPO, 0x0c, 0x0f, 10},
107 { -1, -1, -1, -1},
110 /* Boards - EM2880 MSI DIGIVOX AD and EM2880_BOARD_MSI_DIGIVOX_AD_II */
111 static struct em28xx_reg_seq em2880_msi_digivox_ad_analog[] = {
112 {EM28XX_R08_GPIO, 0x69, ~EM_GPIO_4, 10},
113 { -1, -1, -1, -1},
116 /* Boards - EM2880 MSI DIGIVOX AD and EM2880_BOARD_MSI_DIGIVOX_AD_II */
118 /* Board - EM2870 Kworld 355u
119 Analog - No input analog */
121 /* Board - EM2882 Kworld 315U digital */
122 static struct em28xx_reg_seq em2882_kworld_315u_digital[] = {
123 {EM28XX_R08_GPIO, 0xff, 0xff, 10},
124 {EM28XX_R08_GPIO, 0xfe, 0xff, 10},
125 {EM2880_R04_GPO, 0x04, 0xff, 10},
126 {EM2880_R04_GPO, 0x0c, 0xff, 10},
127 {EM28XX_R08_GPIO, 0x7e, 0xff, 10},
128 { -1, -1, -1, -1},
131 static struct em28xx_reg_seq em2882_kworld_315u_tuner_gpio[] = {
132 {EM2880_R04_GPO, 0x08, 0xff, 10},
133 {EM2880_R04_GPO, 0x0c, 0xff, 10},
134 {EM2880_R04_GPO, 0x08, 0xff, 10},
135 {EM2880_R04_GPO, 0x0c, 0xff, 10},
136 { -1, -1, -1, -1},
139 static struct em28xx_reg_seq kworld_330u_analog[] = {
140 {EM28XX_R08_GPIO, 0x6d, ~EM_GPIO_4, 10},
141 {EM2880_R04_GPO, 0x00, 0xff, 10},
142 { -1, -1, -1, -1},
145 static struct em28xx_reg_seq kworld_330u_digital[] = {
146 {EM28XX_R08_GPIO, 0x6e, ~EM_GPIO_4, 10},
147 {EM2880_R04_GPO, 0x08, 0xff, 10},
148 { -1, -1, -1, -1},
151 /* Evga inDtube
152 GPIO0 - Enable digital power (s5h1409) - low to enable
153 GPIO1 - Enable analog power (tvp5150/emp202) - low to enable
154 GPIO4 - xc3028 reset
155 GOP3 - s5h1409 reset
157 static struct em28xx_reg_seq evga_indtube_analog[] = {
158 {EM28XX_R08_GPIO, 0x79, 0xff, 60},
159 { -1, -1, -1, -1},
162 static struct em28xx_reg_seq evga_indtube_digital[] = {
163 {EM28XX_R08_GPIO, 0x7a, 0xff, 1},
164 {EM2880_R04_GPO, 0x04, 0xff, 10},
165 {EM2880_R04_GPO, 0x0c, 0xff, 1},
166 { -1, -1, -1, -1},
170 * KWorld PlusTV 340U and UB435-Q (ATSC) GPIOs map:
171 * EM_GPIO_0 - currently unknown
172 * EM_GPIO_1 - LED disable/enable (1 = off, 0 = on)
173 * EM_GPIO_2 - currently unknown
174 * EM_GPIO_3 - currently unknown
175 * EM_GPIO_4 - TDA18271HD/C1 tuner (1 = active, 0 = in reset)
176 * EM_GPIO_5 - LGDT3304 ATSC/QAM demod (1 = active, 0 = in reset)
177 * EM_GPIO_6 - currently unknown
178 * EM_GPIO_7 - currently unknown
180 static struct em28xx_reg_seq kworld_a340_digital[] = {
181 {EM28XX_R08_GPIO, 0x6d, ~EM_GPIO_4, 10},
182 { -1, -1, -1, -1},
185 /* Pinnacle Hybrid Pro eb1a:2881 */
186 static struct em28xx_reg_seq pinnacle_hybrid_pro_analog[] = {
187 {EM28XX_R08_GPIO, 0xfd, ~EM_GPIO_4, 10},
188 { -1, -1, -1, -1},
191 static struct em28xx_reg_seq pinnacle_hybrid_pro_digital[] = {
192 {EM28XX_R08_GPIO, 0x6e, ~EM_GPIO_4, 10},
193 {EM2880_R04_GPO, 0x04, 0xff, 100},/* zl10353 reset */
194 {EM2880_R04_GPO, 0x0c, 0xff, 1},
195 { -1, -1, -1, -1},
198 static struct em28xx_reg_seq terratec_cinergy_USB_XS_FR_analog[] = {
199 {EM28XX_R08_GPIO, 0x6d, ~EM_GPIO_4, 10},
200 {EM2880_R04_GPO, 0x00, 0xff, 10},
201 { -1, -1, -1, -1},
204 static struct em28xx_reg_seq terratec_cinergy_USB_XS_FR_digital[] = {
205 {EM28XX_R08_GPIO, 0x6e, ~EM_GPIO_4, 10},
206 {EM2880_R04_GPO, 0x08, 0xff, 10},
207 { -1, -1, -1, -1},
210 /* eb1a:2868 Reddo DVB-C USB TV Box
211 GPIO4 - CU1216L NIM
212 Other GPIOs seems to be don't care. */
213 static struct em28xx_reg_seq reddo_dvb_c_usb_box[] = {
214 {EM28XX_R08_GPIO, 0xfe, 0xff, 10},
215 {EM28XX_R08_GPIO, 0xde, 0xff, 10},
216 {EM28XX_R08_GPIO, 0xfe, 0xff, 10},
217 {EM28XX_R08_GPIO, 0xff, 0xff, 10},
218 {EM28XX_R08_GPIO, 0x7f, 0xff, 10},
219 {EM28XX_R08_GPIO, 0x6f, 0xff, 10},
220 {EM28XX_R08_GPIO, 0xff, 0xff, 10},
221 {-1, -1, -1, -1},
224 /* Callback for the most boards */
225 static struct em28xx_reg_seq default_tuner_gpio[] = {
226 {EM28XX_R08_GPIO, EM_GPIO_4, EM_GPIO_4, 10},
227 {EM28XX_R08_GPIO, 0, EM_GPIO_4, 10},
228 {EM28XX_R08_GPIO, EM_GPIO_4, EM_GPIO_4, 10},
229 { -1, -1, -1, -1},
232 /* Mute/unmute */
233 static struct em28xx_reg_seq compro_unmute_tv_gpio[] = {
234 {EM28XX_R08_GPIO, 5, 7, 10},
235 { -1, -1, -1, -1},
238 static struct em28xx_reg_seq compro_unmute_svid_gpio[] = {
239 {EM28XX_R08_GPIO, 4, 7, 10},
240 { -1, -1, -1, -1},
243 static struct em28xx_reg_seq compro_mute_gpio[] = {
244 {EM28XX_R08_GPIO, 6, 7, 10},
245 { -1, -1, -1, -1},
248 /* Terratec AV350 */
249 static struct em28xx_reg_seq terratec_av350_mute_gpio[] = {
250 {EM28XX_R08_GPIO, 0xff, 0x7f, 10},
251 { -1, -1, -1, -1},
254 static struct em28xx_reg_seq terratec_av350_unmute_gpio[] = {
255 {EM28XX_R08_GPIO, 0xff, 0xff, 10},
256 { -1, -1, -1, -1},
259 static struct em28xx_reg_seq silvercrest_reg_seq[] = {
260 {EM28XX_R08_GPIO, 0xff, 0xff, 10},
261 {EM28XX_R08_GPIO, 0x01, 0xf7, 10},
262 { -1, -1, -1, -1},
265 static struct em28xx_reg_seq vc211a_enable[] = {
266 {EM28XX_R08_GPIO, 0xff, 0x07, 10},
267 {EM28XX_R08_GPIO, 0xff, 0x0f, 10},
268 {EM28XX_R08_GPIO, 0xff, 0x0b, 10},
269 { -1, -1, -1, -1},
272 static struct em28xx_reg_seq dikom_dk300_digital[] = {
273 {EM28XX_R08_GPIO, 0x6e, ~EM_GPIO_4, 10},
274 {EM2880_R04_GPO, 0x08, 0xff, 10},
275 { -1, -1, -1, -1},
279 /* Reset for the most [digital] boards */
280 static struct em28xx_reg_seq leadership_digital[] = {
281 {EM2874_R80_GPIO, 0x70, 0xff, 10},
282 { -1, -1, -1, -1},
285 static struct em28xx_reg_seq leadership_reset[] = {
286 {EM2874_R80_GPIO, 0xf0, 0xff, 10},
287 {EM2874_R80_GPIO, 0xb0, 0xff, 10},
288 {EM2874_R80_GPIO, 0xf0, 0xff, 10},
289 { -1, -1, -1, -1},
292 /* 2013:024f PCTV nanoStick T2 290e
293 * GPIO_6 - demod reset
294 * GPIO_7 - LED
296 static struct em28xx_reg_seq pctv_290e[] = {
297 {EM2874_R80_GPIO, 0x00, 0xff, 80},
298 {EM2874_R80_GPIO, 0x40, 0xff, 80}, /* GPIO_6 = 1 */
299 {EM2874_R80_GPIO, 0xc0, 0xff, 80}, /* GPIO_7 = 1 */
300 {-1, -1, -1, -1},
303 #if 0
304 static struct em28xx_reg_seq terratec_h5_gpio[] = {
305 {EM28XX_R08_GPIO, 0xff, 0xff, 10},
306 {EM2874_R80_GPIO, 0xf6, 0xff, 100},
307 {EM2874_R80_GPIO, 0xf2, 0xff, 50},
308 {EM2874_R80_GPIO, 0xf6, 0xff, 50},
309 { -1, -1, -1, -1},
312 static struct em28xx_reg_seq terratec_h5_digital[] = {
313 {EM2874_R80_GPIO, 0xf6, 0xff, 10},
314 {EM2874_R80_GPIO, 0xe6, 0xff, 100},
315 {EM2874_R80_GPIO, 0xa6, 0xff, 10},
316 { -1, -1, -1, -1},
318 #endif
321 * Board definitions
323 struct em28xx_board em28xx_boards[] = {
324 [EM2750_BOARD_UNKNOWN] = {
325 .name = "EM2710/EM2750/EM2751 webcam grabber",
326 .xclk = EM28XX_XCLK_FREQUENCY_20MHZ,
327 .tuner_type = TUNER_ABSENT,
328 .is_webcam = 1,
329 .input = { {
330 .type = EM28XX_VMUX_COMPOSITE1,
331 .vmux = 0,
332 .amux = EM28XX_AMUX_VIDEO,
333 .gpio = silvercrest_reg_seq,
334 } },
336 [EM2800_BOARD_UNKNOWN] = {
337 .name = "Unknown EM2800 video grabber",
338 .is_em2800 = 1,
339 .tda9887_conf = TDA9887_PRESENT,
340 .decoder = EM28XX_SAA711X,
341 .tuner_type = TUNER_ABSENT,
342 .input = { {
343 .type = EM28XX_VMUX_COMPOSITE1,
344 .vmux = SAA7115_COMPOSITE0,
345 .amux = EM28XX_AMUX_LINE_IN,
346 }, {
347 .type = EM28XX_VMUX_SVIDEO,
348 .vmux = SAA7115_SVIDEO3,
349 .amux = EM28XX_AMUX_LINE_IN,
350 } },
352 [EM2820_BOARD_UNKNOWN] = {
353 .name = "Unknown EM2750/28xx video grabber",
354 .tuner_type = TUNER_ABSENT,
355 .is_webcam = 1, /* To enable sensor probe */
357 [EM2750_BOARD_DLCW_130] = {
358 /* Beijing Huaqi Information Digital Technology Co., Ltd */
359 .name = "Huaqi DLCW-130",
360 .valid = EM28XX_BOARD_NOT_VALIDATED,
361 .xclk = EM28XX_XCLK_FREQUENCY_48MHZ,
362 .tuner_type = TUNER_ABSENT,
363 .is_webcam = 1,
364 .input = { {
365 .type = EM28XX_VMUX_COMPOSITE1,
366 .vmux = 0,
367 .amux = EM28XX_AMUX_VIDEO,
368 } },
370 [EM2820_BOARD_KWORLD_PVRTV2800RF] = {
371 .name = "Kworld PVR TV 2800 RF",
372 .tuner_type = TUNER_TEMIC_PAL,
373 .tda9887_conf = TDA9887_PRESENT,
374 .decoder = EM28XX_SAA711X,
375 .input = { {
376 .type = EM28XX_VMUX_COMPOSITE1,
377 .vmux = SAA7115_COMPOSITE0,
378 .amux = EM28XX_AMUX_LINE_IN,
379 }, {
380 .type = EM28XX_VMUX_SVIDEO,
381 .vmux = SAA7115_SVIDEO3,
382 .amux = EM28XX_AMUX_LINE_IN,
383 } },
385 [EM2820_BOARD_GADMEI_TVR200] = {
386 .name = "Gadmei TVR200",
387 .tuner_type = TUNER_LG_PAL_NEW_TAPC,
388 .tda9887_conf = TDA9887_PRESENT,
389 .decoder = EM28XX_SAA711X,
390 .input = { {
391 .type = EM28XX_VMUX_TELEVISION,
392 .vmux = SAA7115_COMPOSITE2,
393 .amux = EM28XX_AMUX_LINE_IN,
394 }, {
395 .type = EM28XX_VMUX_COMPOSITE1,
396 .vmux = SAA7115_COMPOSITE0,
397 .amux = EM28XX_AMUX_LINE_IN,
398 }, {
399 .type = EM28XX_VMUX_SVIDEO,
400 .vmux = SAA7115_SVIDEO3,
401 .amux = EM28XX_AMUX_LINE_IN,
402 } },
404 [EM2820_BOARD_TERRATEC_CINERGY_250] = {
405 .name = "Terratec Cinergy 250 USB",
406 .tuner_type = TUNER_LG_PAL_NEW_TAPC,
407 .has_ir_i2c = 1,
408 .tda9887_conf = TDA9887_PRESENT,
409 .decoder = EM28XX_SAA711X,
410 .input = { {
411 .type = EM28XX_VMUX_TELEVISION,
412 .vmux = SAA7115_COMPOSITE2,
413 .amux = EM28XX_AMUX_LINE_IN,
414 }, {
415 .type = EM28XX_VMUX_COMPOSITE1,
416 .vmux = SAA7115_COMPOSITE0,
417 .amux = EM28XX_AMUX_LINE_IN,
418 }, {
419 .type = EM28XX_VMUX_SVIDEO,
420 .vmux = SAA7115_SVIDEO3,
421 .amux = EM28XX_AMUX_LINE_IN,
422 } },
424 [EM2820_BOARD_PINNACLE_USB_2] = {
425 .name = "Pinnacle PCTV USB 2",
426 .tuner_type = TUNER_LG_PAL_NEW_TAPC,
427 .has_ir_i2c = 1,
428 .tda9887_conf = TDA9887_PRESENT,
429 .decoder = EM28XX_SAA711X,
430 .input = { {
431 .type = EM28XX_VMUX_TELEVISION,
432 .vmux = SAA7115_COMPOSITE2,
433 .amux = EM28XX_AMUX_VIDEO,
434 }, {
435 .type = EM28XX_VMUX_COMPOSITE1,
436 .vmux = SAA7115_COMPOSITE0,
437 .amux = EM28XX_AMUX_LINE_IN,
438 }, {
439 .type = EM28XX_VMUX_SVIDEO,
440 .vmux = SAA7115_SVIDEO3,
441 .amux = EM28XX_AMUX_LINE_IN,
442 } },
444 [EM2820_BOARD_HAUPPAUGE_WINTV_USB_2] = {
445 .name = "Hauppauge WinTV USB 2",
446 .tuner_type = TUNER_PHILIPS_FM1236_MK3,
447 .tda9887_conf = TDA9887_PRESENT |
448 TDA9887_PORT1_ACTIVE |
449 TDA9887_PORT2_ACTIVE,
450 .decoder = EM28XX_TVP5150,
451 .has_msp34xx = 1,
452 .has_ir_i2c = 1,
453 .input = { {
454 .type = EM28XX_VMUX_TELEVISION,
455 .vmux = TVP5150_COMPOSITE0,
456 .amux = MSP_INPUT_DEFAULT,
457 }, {
458 .type = EM28XX_VMUX_SVIDEO,
459 .vmux = TVP5150_SVIDEO,
460 .amux = MSP_INPUT(MSP_IN_SCART1, MSP_IN_TUNER1,
461 MSP_DSP_IN_SCART, MSP_DSP_IN_SCART),
462 } },
464 [EM2820_BOARD_DLINK_USB_TV] = {
465 .name = "D-Link DUB-T210 TV Tuner",
466 .valid = EM28XX_BOARD_NOT_VALIDATED,
467 .tuner_type = TUNER_LG_PAL_NEW_TAPC,
468 .tda9887_conf = TDA9887_PRESENT,
469 .decoder = EM28XX_SAA711X,
470 .input = { {
471 .type = EM28XX_VMUX_TELEVISION,
472 .vmux = SAA7115_COMPOSITE2,
473 .amux = EM28XX_AMUX_LINE_IN,
474 }, {
475 .type = EM28XX_VMUX_COMPOSITE1,
476 .vmux = SAA7115_COMPOSITE0,
477 .amux = EM28XX_AMUX_LINE_IN,
478 }, {
479 .type = EM28XX_VMUX_SVIDEO,
480 .vmux = SAA7115_SVIDEO3,
481 .amux = EM28XX_AMUX_LINE_IN,
482 } },
484 [EM2820_BOARD_HERCULES_SMART_TV_USB2] = {
485 .name = "Hercules Smart TV USB 2.0",
486 .valid = EM28XX_BOARD_NOT_VALIDATED,
487 .tuner_type = TUNER_LG_PAL_NEW_TAPC,
488 .tda9887_conf = TDA9887_PRESENT,
489 .decoder = EM28XX_SAA711X,
490 .input = { {
491 .type = EM28XX_VMUX_TELEVISION,
492 .vmux = SAA7115_COMPOSITE2,
493 .amux = EM28XX_AMUX_LINE_IN,
494 }, {
495 .type = EM28XX_VMUX_COMPOSITE1,
496 .vmux = SAA7115_COMPOSITE0,
497 .amux = EM28XX_AMUX_LINE_IN,
498 }, {
499 .type = EM28XX_VMUX_SVIDEO,
500 .vmux = SAA7115_SVIDEO3,
501 .amux = EM28XX_AMUX_LINE_IN,
502 } },
504 [EM2820_BOARD_PINNACLE_USB_2_FM1216ME] = {
505 .name = "Pinnacle PCTV USB 2 (Philips FM1216ME)",
506 .valid = EM28XX_BOARD_NOT_VALIDATED,
507 .tuner_type = TUNER_PHILIPS_FM1216ME_MK3,
508 .tda9887_conf = TDA9887_PRESENT,
509 .decoder = EM28XX_SAA711X,
510 .input = { {
511 .type = EM28XX_VMUX_TELEVISION,
512 .vmux = SAA7115_COMPOSITE2,
513 .amux = EM28XX_AMUX_VIDEO,
514 }, {
515 .type = EM28XX_VMUX_COMPOSITE1,
516 .vmux = SAA7115_COMPOSITE0,
517 .amux = EM28XX_AMUX_LINE_IN,
518 }, {
519 .type = EM28XX_VMUX_SVIDEO,
520 .vmux = SAA7115_SVIDEO3,
521 .amux = EM28XX_AMUX_LINE_IN,
522 } },
524 [EM2820_BOARD_GADMEI_UTV310] = {
525 .name = "Gadmei UTV310",
526 .valid = EM28XX_BOARD_NOT_VALIDATED,
527 .tuner_type = TUNER_TNF_5335MF,
528 .tda9887_conf = TDA9887_PRESENT,
529 .decoder = EM28XX_SAA711X,
530 .input = { {
531 .type = EM28XX_VMUX_TELEVISION,
532 .vmux = SAA7115_COMPOSITE1,
533 .amux = EM28XX_AMUX_LINE_IN,
534 }, {
535 .type = EM28XX_VMUX_COMPOSITE1,
536 .vmux = SAA7115_COMPOSITE0,
537 .amux = EM28XX_AMUX_LINE_IN,
538 }, {
539 .type = EM28XX_VMUX_SVIDEO,
540 .vmux = SAA7115_SVIDEO3,
541 .amux = EM28XX_AMUX_LINE_IN,
542 } },
544 [EM2820_BOARD_LEADTEK_WINFAST_USBII_DELUXE] = {
545 .name = "Leadtek Winfast USB II Deluxe",
546 .valid = EM28XX_BOARD_NOT_VALIDATED,
547 .tuner_type = TUNER_PHILIPS_FM1216ME_MK3,
548 .has_ir_i2c = 1,
549 .tvaudio_addr = 0x58,
550 .tda9887_conf = TDA9887_PRESENT |
551 TDA9887_PORT2_ACTIVE |
552 TDA9887_QSS,
553 .decoder = EM28XX_SAA711X,
554 .adecoder = EM28XX_TVAUDIO,
555 .input = { {
556 .type = EM28XX_VMUX_TELEVISION,
557 .vmux = SAA7115_COMPOSITE4,
558 .amux = EM28XX_AMUX_AUX,
559 }, {
560 .type = EM28XX_VMUX_COMPOSITE1,
561 .vmux = SAA7115_COMPOSITE5,
562 .amux = EM28XX_AMUX_LINE_IN,
563 }, {
564 .type = EM28XX_VMUX_SVIDEO,
565 .vmux = SAA7115_SVIDEO3,
566 .amux = EM28XX_AMUX_LINE_IN,
567 } },
568 .radio = {
569 .type = EM28XX_RADIO,
570 .amux = EM28XX_AMUX_AUX,
573 [EM2820_BOARD_VIDEOLOGY_20K14XUSB] = {
574 .name = "Videology 20K14XUSB USB2.0",
575 .valid = EM28XX_BOARD_NOT_VALIDATED,
576 .tuner_type = TUNER_ABSENT,
577 .is_webcam = 1,
578 .input = { {
579 .type = EM28XX_VMUX_COMPOSITE1,
580 .vmux = 0,
581 .amux = EM28XX_AMUX_VIDEO,
582 } },
584 [EM2820_BOARD_SILVERCREST_WEBCAM] = {
585 .name = "Silvercrest Webcam 1.3mpix",
586 .tuner_type = TUNER_ABSENT,
587 .is_webcam = 1,
588 .input = { {
589 .type = EM28XX_VMUX_COMPOSITE1,
590 .vmux = 0,
591 .amux = EM28XX_AMUX_VIDEO,
592 .gpio = silvercrest_reg_seq,
593 } },
595 [EM2821_BOARD_SUPERCOMP_USB_2] = {
596 .name = "Supercomp USB 2.0 TV",
597 .valid = EM28XX_BOARD_NOT_VALIDATED,
598 .tuner_type = TUNER_PHILIPS_FM1236_MK3,
599 .tda9887_conf = TDA9887_PRESENT |
600 TDA9887_PORT1_ACTIVE |
601 TDA9887_PORT2_ACTIVE,
602 .decoder = EM28XX_SAA711X,
603 .input = { {
604 .type = EM28XX_VMUX_TELEVISION,
605 .vmux = SAA7115_COMPOSITE2,
606 .amux = EM28XX_AMUX_LINE_IN,
607 }, {
608 .type = EM28XX_VMUX_COMPOSITE1,
609 .vmux = SAA7115_COMPOSITE0,
610 .amux = EM28XX_AMUX_VIDEO,
611 }, {
612 .type = EM28XX_VMUX_SVIDEO,
613 .vmux = SAA7115_SVIDEO3,
614 .amux = EM28XX_AMUX_LINE_IN,
615 } },
617 [EM2821_BOARD_USBGEAR_VD204] = {
618 .name = "Usbgear VD204v9",
619 .valid = EM28XX_BOARD_NOT_VALIDATED,
620 .tuner_type = TUNER_ABSENT, /* Capture only device */
621 .decoder = EM28XX_SAA711X,
622 .input = { {
623 .type = EM28XX_VMUX_COMPOSITE1,
624 .vmux = SAA7115_COMPOSITE0,
625 .amux = EM28XX_AMUX_LINE_IN,
626 }, {
627 .type = EM28XX_VMUX_SVIDEO,
628 .vmux = SAA7115_SVIDEO3,
629 .amux = EM28XX_AMUX_LINE_IN,
630 } },
632 [EM2860_BOARD_NETGMBH_CAM] = {
633 /* Beijing Huaqi Information Digital Technology Co., Ltd */
634 .name = "NetGMBH Cam",
635 .valid = EM28XX_BOARD_NOT_VALIDATED,
636 .tuner_type = TUNER_ABSENT,
637 .is_webcam = 1,
638 .input = { {
639 .type = EM28XX_VMUX_COMPOSITE1,
640 .vmux = 0,
641 .amux = EM28XX_AMUX_VIDEO,
642 } },
644 [EM2860_BOARD_TYPHOON_DVD_MAKER] = {
645 .name = "Typhoon DVD Maker",
646 .decoder = EM28XX_SAA711X,
647 .tuner_type = TUNER_ABSENT, /* Capture only device */
648 .input = { {
649 .type = EM28XX_VMUX_COMPOSITE1,
650 .vmux = SAA7115_COMPOSITE0,
651 .amux = EM28XX_AMUX_LINE_IN,
652 }, {
653 .type = EM28XX_VMUX_SVIDEO,
654 .vmux = SAA7115_SVIDEO3,
655 .amux = EM28XX_AMUX_LINE_IN,
656 } },
658 [EM2860_BOARD_GADMEI_UTV330] = {
659 .name = "Gadmei UTV330",
660 .valid = EM28XX_BOARD_NOT_VALIDATED,
661 .tuner_type = TUNER_TNF_5335MF,
662 .tda9887_conf = TDA9887_PRESENT,
663 .decoder = EM28XX_SAA711X,
664 .input = { {
665 .type = EM28XX_VMUX_TELEVISION,
666 .vmux = SAA7115_COMPOSITE2,
667 .amux = EM28XX_AMUX_VIDEO,
668 }, {
669 .type = EM28XX_VMUX_COMPOSITE1,
670 .vmux = SAA7115_COMPOSITE0,
671 .amux = EM28XX_AMUX_LINE_IN,
672 }, {
673 .type = EM28XX_VMUX_SVIDEO,
674 .vmux = SAA7115_SVIDEO3,
675 .amux = EM28XX_AMUX_LINE_IN,
676 } },
678 [EM2861_BOARD_GADMEI_UTV330PLUS] = {
679 .name = "Gadmei UTV330+",
680 .tuner_type = TUNER_TNF_5335MF,
681 .tda9887_conf = TDA9887_PRESENT,
682 .ir_codes = RC_MAP_GADMEI_RM008Z,
683 .decoder = EM28XX_SAA711X,
684 .xclk = EM28XX_XCLK_FREQUENCY_12MHZ,
685 .input = { {
686 .type = EM28XX_VMUX_TELEVISION,
687 .vmux = SAA7115_COMPOSITE2,
688 .amux = EM28XX_AMUX_VIDEO,
689 }, {
690 .type = EM28XX_VMUX_COMPOSITE1,
691 .vmux = SAA7115_COMPOSITE0,
692 .amux = EM28XX_AMUX_LINE_IN,
693 }, {
694 .type = EM28XX_VMUX_SVIDEO,
695 .vmux = SAA7115_SVIDEO3,
696 .amux = EM28XX_AMUX_LINE_IN,
697 } },
699 [EM2860_BOARD_TERRATEC_HYBRID_XS] = {
700 .name = "Terratec Cinergy A Hybrid XS",
701 .valid = EM28XX_BOARD_NOT_VALIDATED,
702 .tuner_type = TUNER_XC2028,
703 .tuner_gpio = default_tuner_gpio,
704 .decoder = EM28XX_TVP5150,
706 .input = { {
707 .type = EM28XX_VMUX_TELEVISION,
708 .vmux = TVP5150_COMPOSITE0,
709 .amux = EM28XX_AMUX_VIDEO,
710 .gpio = hauppauge_wintv_hvr_900_analog,
711 }, {
712 .type = EM28XX_VMUX_COMPOSITE1,
713 .vmux = TVP5150_COMPOSITE1,
714 .amux = EM28XX_AMUX_LINE_IN,
715 .gpio = hauppauge_wintv_hvr_900_analog,
716 }, {
717 .type = EM28XX_VMUX_SVIDEO,
718 .vmux = TVP5150_SVIDEO,
719 .amux = EM28XX_AMUX_LINE_IN,
720 .gpio = hauppauge_wintv_hvr_900_analog,
721 } },
723 [EM2861_BOARD_KWORLD_PVRTV_300U] = {
724 .name = "KWorld PVRTV 300U",
725 .valid = EM28XX_BOARD_NOT_VALIDATED,
726 .tuner_type = TUNER_XC2028,
727 .tuner_gpio = default_tuner_gpio,
728 .decoder = EM28XX_TVP5150,
729 .input = { {
730 .type = EM28XX_VMUX_TELEVISION,
731 .vmux = TVP5150_COMPOSITE0,
732 .amux = EM28XX_AMUX_VIDEO,
733 }, {
734 .type = EM28XX_VMUX_COMPOSITE1,
735 .vmux = TVP5150_COMPOSITE1,
736 .amux = EM28XX_AMUX_LINE_IN,
737 }, {
738 .type = EM28XX_VMUX_SVIDEO,
739 .vmux = TVP5150_SVIDEO,
740 .amux = EM28XX_AMUX_LINE_IN,
741 } },
743 [EM2861_BOARD_YAKUMO_MOVIE_MIXER] = {
744 .name = "Yakumo MovieMixer",
745 .tuner_type = TUNER_ABSENT, /* Capture only device */
746 .decoder = EM28XX_TVP5150,
747 .input = { {
748 .type = EM28XX_VMUX_TELEVISION,
749 .vmux = TVP5150_COMPOSITE0,
750 .amux = EM28XX_AMUX_VIDEO,
751 }, {
752 .type = EM28XX_VMUX_COMPOSITE1,
753 .vmux = TVP5150_COMPOSITE1,
754 .amux = EM28XX_AMUX_LINE_IN,
755 }, {
756 .type = EM28XX_VMUX_SVIDEO,
757 .vmux = TVP5150_SVIDEO,
758 .amux = EM28XX_AMUX_LINE_IN,
759 } },
761 [EM2860_BOARD_TVP5150_REFERENCE_DESIGN] = {
762 .name = "EM2860/TVP5150 Reference Design",
763 .tuner_type = TUNER_ABSENT, /* Capture only device */
764 .decoder = EM28XX_TVP5150,
765 .input = { {
766 .type = EM28XX_VMUX_COMPOSITE1,
767 .vmux = TVP5150_COMPOSITE1,
768 .amux = EM28XX_AMUX_LINE_IN,
769 }, {
770 .type = EM28XX_VMUX_SVIDEO,
771 .vmux = TVP5150_SVIDEO,
772 .amux = EM28XX_AMUX_LINE_IN,
773 } },
775 [EM2861_BOARD_PLEXTOR_PX_TV100U] = {
776 .name = "Plextor ConvertX PX-TV100U",
777 .tuner_type = TUNER_TNF_5335MF,
778 .xclk = EM28XX_XCLK_I2S_MSB_TIMING |
779 EM28XX_XCLK_FREQUENCY_12MHZ,
780 .tda9887_conf = TDA9887_PRESENT,
781 .decoder = EM28XX_TVP5150,
782 .has_msp34xx = 1,
783 .input = { {
784 .type = EM28XX_VMUX_TELEVISION,
785 .vmux = TVP5150_COMPOSITE0,
786 .amux = EM28XX_AMUX_LINE_IN,
787 .gpio = pinnacle_hybrid_pro_analog,
788 }, {
789 .type = EM28XX_VMUX_COMPOSITE1,
790 .vmux = TVP5150_COMPOSITE1,
791 .amux = EM28XX_AMUX_LINE_IN,
792 .gpio = pinnacle_hybrid_pro_analog,
793 }, {
794 .type = EM28XX_VMUX_SVIDEO,
795 .vmux = TVP5150_SVIDEO,
796 .amux = EM28XX_AMUX_LINE_IN,
797 .gpio = pinnacle_hybrid_pro_analog,
798 } },
801 /* Those boards with em2870 are DVB Only*/
803 [EM2870_BOARD_TERRATEC_XS] = {
804 .name = "Terratec Cinergy T XS",
805 .valid = EM28XX_BOARD_NOT_VALIDATED,
806 .tuner_type = TUNER_XC2028,
807 .tuner_gpio = default_tuner_gpio,
809 [EM2870_BOARD_TERRATEC_XS_MT2060] = {
810 .name = "Terratec Cinergy T XS (MT2060)",
811 .valid = EM28XX_BOARD_NOT_VALIDATED,
812 .tuner_type = TUNER_ABSENT, /* MT2060 */
814 [EM2870_BOARD_KWORLD_350U] = {
815 .name = "Kworld 350 U DVB-T",
816 .valid = EM28XX_BOARD_NOT_VALIDATED,
817 .tuner_type = TUNER_XC2028,
818 .tuner_gpio = default_tuner_gpio,
820 [EM2870_BOARD_KWORLD_355U] = {
821 .name = "Kworld 355 U DVB-T",
822 .valid = EM28XX_BOARD_NOT_VALIDATED,
824 [EM2870_BOARD_PINNACLE_PCTV_DVB] = {
825 .name = "Pinnacle PCTV DVB-T",
826 .valid = EM28XX_BOARD_NOT_VALIDATED,
827 .tuner_type = TUNER_ABSENT, /* MT2060 */
828 /* djh - I have serious doubts this is right... */
829 .xclk = EM28XX_XCLK_IR_RC5_MODE |
830 EM28XX_XCLK_FREQUENCY_10MHZ,
832 [EM2870_BOARD_COMPRO_VIDEOMATE] = {
833 .name = "Compro, VideoMate U3",
834 .valid = EM28XX_BOARD_NOT_VALIDATED,
835 .tuner_type = TUNER_ABSENT, /* MT2060 */
838 [EM2880_BOARD_TERRATEC_HYBRID_XS_FR] = {
839 .name = "Terratec Hybrid XS Secam",
840 .has_msp34xx = 1,
841 .tuner_type = TUNER_XC2028,
842 .tuner_gpio = default_tuner_gpio,
843 .decoder = EM28XX_TVP5150,
844 .has_dvb = 1,
845 .dvb_gpio = terratec_cinergy_USB_XS_FR_digital,
846 .input = { {
847 .type = EM28XX_VMUX_TELEVISION,
848 .vmux = TVP5150_COMPOSITE0,
849 .amux = EM28XX_AMUX_VIDEO,
850 .gpio = terratec_cinergy_USB_XS_FR_analog,
851 }, {
852 .type = EM28XX_VMUX_COMPOSITE1,
853 .vmux = TVP5150_COMPOSITE1,
854 .amux = EM28XX_AMUX_LINE_IN,
855 .gpio = terratec_cinergy_USB_XS_FR_analog,
856 }, {
857 .type = EM28XX_VMUX_SVIDEO,
858 .vmux = TVP5150_SVIDEO,
859 .amux = EM28XX_AMUX_LINE_IN,
860 .gpio = terratec_cinergy_USB_XS_FR_analog,
861 } },
863 [EM2884_BOARD_TERRATEC_H5] = {
864 .name = "Terratec Cinergy H5",
865 .has_dvb = 1,
866 #if 0
867 .tuner_type = TUNER_PHILIPS_TDA8290,
868 .tuner_addr = 0x41,
869 .dvb_gpio = terratec_h5_digital, /* FIXME: probably wrong */
870 .tuner_gpio = terratec_h5_gpio,
871 #endif
872 .i2c_speed = EM2874_I2C_SECONDARY_BUS_SELECT |
873 EM28XX_I2C_CLK_WAIT_ENABLE |
874 EM28XX_I2C_FREQ_400_KHZ,
876 [EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900] = {
877 .name = "Hauppauge WinTV HVR 900",
878 .tda9887_conf = TDA9887_PRESENT,
879 .tuner_type = TUNER_XC2028,
880 .tuner_gpio = default_tuner_gpio,
881 .mts_firmware = 1,
882 .has_dvb = 1,
883 .dvb_gpio = hauppauge_wintv_hvr_900_digital,
884 .ir_codes = RC_MAP_HAUPPAUGE,
885 .decoder = EM28XX_TVP5150,
886 .input = { {
887 .type = EM28XX_VMUX_TELEVISION,
888 .vmux = TVP5150_COMPOSITE0,
889 .amux = EM28XX_AMUX_VIDEO,
890 .gpio = hauppauge_wintv_hvr_900_analog,
891 }, {
892 .type = EM28XX_VMUX_COMPOSITE1,
893 .vmux = TVP5150_COMPOSITE1,
894 .amux = EM28XX_AMUX_LINE_IN,
895 .gpio = hauppauge_wintv_hvr_900_analog,
896 }, {
897 .type = EM28XX_VMUX_SVIDEO,
898 .vmux = TVP5150_SVIDEO,
899 .amux = EM28XX_AMUX_LINE_IN,
900 .gpio = hauppauge_wintv_hvr_900_analog,
901 } },
903 [EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900_R2] = {
904 .name = "Hauppauge WinTV HVR 900 (R2)",
905 .tda9887_conf = TDA9887_PRESENT,
906 .tuner_type = TUNER_XC2028,
907 .tuner_gpio = default_tuner_gpio,
908 .mts_firmware = 1,
909 .has_dvb = 1,
910 .dvb_gpio = hauppauge_wintv_hvr_900R2_digital,
911 .ir_codes = RC_MAP_HAUPPAUGE,
912 .decoder = EM28XX_TVP5150,
913 .input = { {
914 .type = EM28XX_VMUX_TELEVISION,
915 .vmux = TVP5150_COMPOSITE0,
916 .amux = EM28XX_AMUX_VIDEO,
917 .gpio = hauppauge_wintv_hvr_900_analog,
918 }, {
919 .type = EM28XX_VMUX_COMPOSITE1,
920 .vmux = TVP5150_COMPOSITE1,
921 .amux = EM28XX_AMUX_LINE_IN,
922 .gpio = hauppauge_wintv_hvr_900_analog,
923 }, {
924 .type = EM28XX_VMUX_SVIDEO,
925 .vmux = TVP5150_SVIDEO,
926 .amux = EM28XX_AMUX_LINE_IN,
927 .gpio = hauppauge_wintv_hvr_900_analog,
928 } },
930 [EM2883_BOARD_HAUPPAUGE_WINTV_HVR_850] = {
931 .name = "Hauppauge WinTV HVR 850",
932 .tuner_type = TUNER_XC2028,
933 .tuner_gpio = default_tuner_gpio,
934 .mts_firmware = 1,
935 .has_dvb = 1,
936 .dvb_gpio = hauppauge_wintv_hvr_900_digital,
937 .ir_codes = RC_MAP_HAUPPAUGE,
938 .decoder = EM28XX_TVP5150,
939 .input = { {
940 .type = EM28XX_VMUX_TELEVISION,
941 .vmux = TVP5150_COMPOSITE0,
942 .amux = EM28XX_AMUX_VIDEO,
943 .gpio = hauppauge_wintv_hvr_900_analog,
944 }, {
945 .type = EM28XX_VMUX_COMPOSITE1,
946 .vmux = TVP5150_COMPOSITE1,
947 .amux = EM28XX_AMUX_LINE_IN,
948 .gpio = hauppauge_wintv_hvr_900_analog,
949 }, {
950 .type = EM28XX_VMUX_SVIDEO,
951 .vmux = TVP5150_SVIDEO,
952 .amux = EM28XX_AMUX_LINE_IN,
953 .gpio = hauppauge_wintv_hvr_900_analog,
954 } },
956 [EM2883_BOARD_HAUPPAUGE_WINTV_HVR_950] = {
957 .name = "Hauppauge WinTV HVR 950",
958 .tuner_type = TUNER_XC2028,
959 .tuner_gpio = default_tuner_gpio,
960 .mts_firmware = 1,
961 .has_dvb = 1,
962 .dvb_gpio = hauppauge_wintv_hvr_900_digital,
963 .ir_codes = RC_MAP_HAUPPAUGE,
964 .decoder = EM28XX_TVP5150,
965 .input = { {
966 .type = EM28XX_VMUX_TELEVISION,
967 .vmux = TVP5150_COMPOSITE0,
968 .amux = EM28XX_AMUX_VIDEO,
969 .gpio = hauppauge_wintv_hvr_900_analog,
970 }, {
971 .type = EM28XX_VMUX_COMPOSITE1,
972 .vmux = TVP5150_COMPOSITE1,
973 .amux = EM28XX_AMUX_LINE_IN,
974 .gpio = hauppauge_wintv_hvr_900_analog,
975 }, {
976 .type = EM28XX_VMUX_SVIDEO,
977 .vmux = TVP5150_SVIDEO,
978 .amux = EM28XX_AMUX_LINE_IN,
979 .gpio = hauppauge_wintv_hvr_900_analog,
980 } },
982 [EM2880_BOARD_PINNACLE_PCTV_HD_PRO] = {
983 .name = "Pinnacle PCTV HD Pro Stick",
984 .tuner_type = TUNER_XC2028,
985 .tuner_gpio = default_tuner_gpio,
986 .mts_firmware = 1,
987 .has_dvb = 1,
988 .dvb_gpio = hauppauge_wintv_hvr_900_digital,
989 .ir_codes = RC_MAP_PINNACLE_PCTV_HD,
990 .decoder = EM28XX_TVP5150,
991 .input = { {
992 .type = EM28XX_VMUX_TELEVISION,
993 .vmux = TVP5150_COMPOSITE0,
994 .amux = EM28XX_AMUX_VIDEO,
995 .gpio = hauppauge_wintv_hvr_900_analog,
996 }, {
997 .type = EM28XX_VMUX_COMPOSITE1,
998 .vmux = TVP5150_COMPOSITE1,
999 .amux = EM28XX_AMUX_LINE_IN,
1000 .gpio = hauppauge_wintv_hvr_900_analog,
1001 }, {
1002 .type = EM28XX_VMUX_SVIDEO,
1003 .vmux = TVP5150_SVIDEO,
1004 .amux = EM28XX_AMUX_LINE_IN,
1005 .gpio = hauppauge_wintv_hvr_900_analog,
1006 } },
1008 [EM2880_BOARD_AMD_ATI_TV_WONDER_HD_600] = {
1009 .name = "AMD ATI TV Wonder HD 600",
1010 .tuner_type = TUNER_XC2028,
1011 .tuner_gpio = default_tuner_gpio,
1012 .mts_firmware = 1,
1013 .has_dvb = 1,
1014 .dvb_gpio = hauppauge_wintv_hvr_900_digital,
1015 .ir_codes = RC_MAP_ATI_TV_WONDER_HD_600,
1016 .decoder = EM28XX_TVP5150,
1017 .input = { {
1018 .type = EM28XX_VMUX_TELEVISION,
1019 .vmux = TVP5150_COMPOSITE0,
1020 .amux = EM28XX_AMUX_VIDEO,
1021 .gpio = hauppauge_wintv_hvr_900_analog,
1022 }, {
1023 .type = EM28XX_VMUX_COMPOSITE1,
1024 .vmux = TVP5150_COMPOSITE1,
1025 .amux = EM28XX_AMUX_LINE_IN,
1026 .gpio = hauppauge_wintv_hvr_900_analog,
1027 }, {
1028 .type = EM28XX_VMUX_SVIDEO,
1029 .vmux = TVP5150_SVIDEO,
1030 .amux = EM28XX_AMUX_LINE_IN,
1031 .gpio = hauppauge_wintv_hvr_900_analog,
1032 } },
1034 [EM2880_BOARD_TERRATEC_HYBRID_XS] = {
1035 .name = "Terratec Hybrid XS",
1036 .tuner_type = TUNER_XC2028,
1037 .tuner_gpio = default_tuner_gpio,
1038 .decoder = EM28XX_TVP5150,
1039 .has_dvb = 1,
1040 .dvb_gpio = default_digital,
1041 .ir_codes = RC_MAP_TERRATEC_CINERGY_XS,
1042 .xclk = EM28XX_XCLK_FREQUENCY_12MHZ, /* NEC IR */
1043 .input = { {
1044 .type = EM28XX_VMUX_TELEVISION,
1045 .vmux = TVP5150_COMPOSITE0,
1046 .amux = EM28XX_AMUX_VIDEO,
1047 .gpio = default_analog,
1048 }, {
1049 .type = EM28XX_VMUX_COMPOSITE1,
1050 .vmux = TVP5150_COMPOSITE1,
1051 .amux = EM28XX_AMUX_LINE_IN,
1052 .gpio = default_analog,
1053 }, {
1054 .type = EM28XX_VMUX_SVIDEO,
1055 .vmux = TVP5150_SVIDEO,
1056 .amux = EM28XX_AMUX_LINE_IN,
1057 .gpio = default_analog,
1058 } },
1060 /* maybe there's a reason behind it why Terratec sells the Hybrid XS
1061 as Prodigy XS with a different PID, let's keep it separated for now
1062 maybe we'll need it lateron */
1063 [EM2880_BOARD_TERRATEC_PRODIGY_XS] = {
1064 .name = "Terratec Prodigy XS",
1065 .tuner_type = TUNER_XC2028,
1066 .tuner_gpio = default_tuner_gpio,
1067 .decoder = EM28XX_TVP5150,
1068 .input = { {
1069 .type = EM28XX_VMUX_TELEVISION,
1070 .vmux = TVP5150_COMPOSITE0,
1071 .amux = EM28XX_AMUX_VIDEO,
1072 .gpio = hauppauge_wintv_hvr_900_analog,
1073 }, {
1074 .type = EM28XX_VMUX_COMPOSITE1,
1075 .vmux = TVP5150_COMPOSITE1,
1076 .amux = EM28XX_AMUX_LINE_IN,
1077 .gpio = hauppauge_wintv_hvr_900_analog,
1078 }, {
1079 .type = EM28XX_VMUX_SVIDEO,
1080 .vmux = TVP5150_SVIDEO,
1081 .amux = EM28XX_AMUX_LINE_IN,
1082 .gpio = hauppauge_wintv_hvr_900_analog,
1083 } },
1085 [EM2820_BOARD_MSI_VOX_USB_2] = {
1086 .name = "MSI VOX USB 2.0",
1087 .tuner_type = TUNER_LG_PAL_NEW_TAPC,
1088 .tda9887_conf = TDA9887_PRESENT |
1089 TDA9887_PORT1_ACTIVE |
1090 TDA9887_PORT2_ACTIVE,
1091 .max_range_640_480 = 1,
1092 .decoder = EM28XX_SAA711X,
1093 .input = { {
1094 .type = EM28XX_VMUX_TELEVISION,
1095 .vmux = SAA7115_COMPOSITE4,
1096 .amux = EM28XX_AMUX_VIDEO,
1097 }, {
1098 .type = EM28XX_VMUX_COMPOSITE1,
1099 .vmux = SAA7115_COMPOSITE0,
1100 .amux = EM28XX_AMUX_LINE_IN,
1101 }, {
1102 .type = EM28XX_VMUX_SVIDEO,
1103 .vmux = SAA7115_SVIDEO3,
1104 .amux = EM28XX_AMUX_LINE_IN,
1105 } },
1107 [EM2800_BOARD_TERRATEC_CINERGY_200] = {
1108 .name = "Terratec Cinergy 200 USB",
1109 .is_em2800 = 1,
1110 .has_ir_i2c = 1,
1111 .tuner_type = TUNER_LG_PAL_NEW_TAPC,
1112 .tda9887_conf = TDA9887_PRESENT,
1113 .decoder = EM28XX_SAA711X,
1114 .input = { {
1115 .type = EM28XX_VMUX_TELEVISION,
1116 .vmux = SAA7115_COMPOSITE2,
1117 .amux = EM28XX_AMUX_VIDEO,
1118 }, {
1119 .type = EM28XX_VMUX_COMPOSITE1,
1120 .vmux = SAA7115_COMPOSITE0,
1121 .amux = EM28XX_AMUX_LINE_IN,
1122 }, {
1123 .type = EM28XX_VMUX_SVIDEO,
1124 .vmux = SAA7115_SVIDEO3,
1125 .amux = EM28XX_AMUX_LINE_IN,
1126 } },
1128 [EM2800_BOARD_GRABBEEX_USB2800] = {
1129 .name = "eMPIA Technology, Inc. GrabBeeX+ Video Encoder",
1130 .is_em2800 = 1,
1131 .decoder = EM28XX_SAA711X,
1132 .tuner_type = TUNER_ABSENT, /* capture only board */
1133 .input = { {
1134 .type = EM28XX_VMUX_COMPOSITE1,
1135 .vmux = SAA7115_COMPOSITE0,
1136 .amux = EM28XX_AMUX_LINE_IN,
1137 }, {
1138 .type = EM28XX_VMUX_SVIDEO,
1139 .vmux = SAA7115_SVIDEO3,
1140 .amux = EM28XX_AMUX_LINE_IN,
1141 } },
1143 [EM2800_BOARD_VC211A] = {
1144 .name = "Actionmaster/LinXcel/Digitus VC211A",
1145 .is_em2800 = 1,
1146 .tuner_type = TUNER_ABSENT, /* Capture-only board */
1147 .decoder = EM28XX_SAA711X,
1148 .input = { {
1149 .type = EM28XX_VMUX_COMPOSITE1,
1150 .vmux = SAA7115_COMPOSITE0,
1151 .amux = EM28XX_AMUX_LINE_IN,
1152 .gpio = vc211a_enable,
1153 }, {
1154 .type = EM28XX_VMUX_SVIDEO,
1155 .vmux = SAA7115_SVIDEO3,
1156 .amux = EM28XX_AMUX_LINE_IN,
1157 .gpio = vc211a_enable,
1158 } },
1160 [EM2800_BOARD_LEADTEK_WINFAST_USBII] = {
1161 .name = "Leadtek Winfast USB II",
1162 .is_em2800 = 1,
1163 .tuner_type = TUNER_LG_PAL_NEW_TAPC,
1164 .tda9887_conf = TDA9887_PRESENT,
1165 .decoder = EM28XX_SAA711X,
1166 .input = { {
1167 .type = EM28XX_VMUX_TELEVISION,
1168 .vmux = SAA7115_COMPOSITE2,
1169 .amux = EM28XX_AMUX_VIDEO,
1170 }, {
1171 .type = EM28XX_VMUX_COMPOSITE1,
1172 .vmux = SAA7115_COMPOSITE0,
1173 .amux = EM28XX_AMUX_LINE_IN,
1174 }, {
1175 .type = EM28XX_VMUX_SVIDEO,
1176 .vmux = SAA7115_SVIDEO3,
1177 .amux = EM28XX_AMUX_LINE_IN,
1178 } },
1180 [EM2800_BOARD_KWORLD_USB2800] = {
1181 .name = "Kworld USB2800",
1182 .is_em2800 = 1,
1183 .tuner_type = TUNER_PHILIPS_FCV1236D,
1184 .tda9887_conf = TDA9887_PRESENT,
1185 .decoder = EM28XX_SAA711X,
1186 .input = { {
1187 .type = EM28XX_VMUX_TELEVISION,
1188 .vmux = SAA7115_COMPOSITE2,
1189 .amux = EM28XX_AMUX_VIDEO,
1190 }, {
1191 .type = EM28XX_VMUX_COMPOSITE1,
1192 .vmux = SAA7115_COMPOSITE0,
1193 .amux = EM28XX_AMUX_LINE_IN,
1194 }, {
1195 .type = EM28XX_VMUX_SVIDEO,
1196 .vmux = SAA7115_SVIDEO3,
1197 .amux = EM28XX_AMUX_LINE_IN,
1198 } },
1200 [EM2820_BOARD_PINNACLE_DVC_90] = {
1201 .name = "Pinnacle Dazzle DVC 90/100/101/107 / Kaiser Baas Video to DVD maker "
1202 "/ Kworld DVD Maker 2",
1203 .tuner_type = TUNER_ABSENT, /* capture only board */
1204 .decoder = EM28XX_SAA711X,
1205 .input = { {
1206 .type = EM28XX_VMUX_COMPOSITE1,
1207 .vmux = SAA7115_COMPOSITE0,
1208 .amux = EM28XX_AMUX_LINE_IN,
1209 }, {
1210 .type = EM28XX_VMUX_SVIDEO,
1211 .vmux = SAA7115_SVIDEO3,
1212 .amux = EM28XX_AMUX_LINE_IN,
1213 } },
1215 [EM2800_BOARD_VGEAR_POCKETTV] = {
1216 .name = "V-Gear PocketTV",
1217 .is_em2800 = 1,
1218 .tuner_type = TUNER_LG_PAL_NEW_TAPC,
1219 .tda9887_conf = TDA9887_PRESENT,
1220 .decoder = EM28XX_SAA711X,
1221 .input = { {
1222 .type = EM28XX_VMUX_TELEVISION,
1223 .vmux = SAA7115_COMPOSITE2,
1224 .amux = EM28XX_AMUX_VIDEO,
1225 }, {
1226 .type = EM28XX_VMUX_COMPOSITE1,
1227 .vmux = SAA7115_COMPOSITE0,
1228 .amux = EM28XX_AMUX_LINE_IN,
1229 }, {
1230 .type = EM28XX_VMUX_SVIDEO,
1231 .vmux = SAA7115_SVIDEO3,
1232 .amux = EM28XX_AMUX_LINE_IN,
1233 } },
1235 [EM2820_BOARD_PROLINK_PLAYTV_BOX4_USB2] = {
1236 .name = "Pixelview PlayTV Box 4 USB 2.0",
1237 .tda9887_conf = TDA9887_PRESENT,
1238 .tuner_type = TUNER_YMEC_TVF_5533MF,
1239 .decoder = EM28XX_SAA711X,
1240 .input = { {
1241 .type = EM28XX_VMUX_TELEVISION,
1242 .vmux = SAA7115_COMPOSITE2,
1243 .amux = EM28XX_AMUX_VIDEO,
1244 .aout = EM28XX_AOUT_MONO | /* I2S */
1245 EM28XX_AOUT_MASTER, /* Line out pin */
1246 }, {
1247 .type = EM28XX_VMUX_COMPOSITE1,
1248 .vmux = SAA7115_COMPOSITE0,
1249 .amux = EM28XX_AMUX_LINE_IN,
1250 }, {
1251 .type = EM28XX_VMUX_SVIDEO,
1252 .vmux = SAA7115_SVIDEO3,
1253 .amux = EM28XX_AMUX_LINE_IN,
1254 } },
1256 [EM2820_BOARD_PROLINK_PLAYTV_USB2] = {
1257 .name = "SIIG AVTuner-PVR / Pixelview Prolink PlayTV USB 2.0",
1258 .has_snapshot_button = 1,
1259 .tda9887_conf = TDA9887_PRESENT,
1260 .tuner_type = TUNER_YMEC_TVF_5533MF,
1261 .decoder = EM28XX_SAA711X,
1262 .input = { {
1263 .type = EM28XX_VMUX_TELEVISION,
1264 .vmux = SAA7115_COMPOSITE2,
1265 .amux = EM28XX_AMUX_VIDEO,
1266 .aout = EM28XX_AOUT_MONO | /* I2S */
1267 EM28XX_AOUT_MASTER, /* Line out pin */
1268 }, {
1269 .type = EM28XX_VMUX_COMPOSITE1,
1270 .vmux = SAA7115_COMPOSITE0,
1271 .amux = EM28XX_AMUX_LINE_IN,
1272 }, {
1273 .type = EM28XX_VMUX_SVIDEO,
1274 .vmux = SAA7115_SVIDEO3,
1275 .amux = EM28XX_AMUX_LINE_IN,
1276 } },
1278 [EM2860_BOARD_SAA711X_REFERENCE_DESIGN] = {
1279 .name = "EM2860/SAA711X Reference Design",
1280 .has_snapshot_button = 1,
1281 .tuner_type = TUNER_ABSENT,
1282 .decoder = EM28XX_SAA711X,
1283 .input = { {
1284 .type = EM28XX_VMUX_SVIDEO,
1285 .vmux = SAA7115_SVIDEO3,
1286 }, {
1287 .type = EM28XX_VMUX_COMPOSITE1,
1288 .vmux = SAA7115_COMPOSITE0,
1289 } },
1292 [EM2874_BOARD_LEADERSHIP_ISDBT] = {
1293 .i2c_speed = EM2874_I2C_SECONDARY_BUS_SELECT |
1294 EM28XX_I2C_CLK_WAIT_ENABLE |
1295 EM28XX_I2C_FREQ_100_KHZ,
1296 .xclk = EM28XX_XCLK_FREQUENCY_10MHZ,
1297 .name = "EM2874 Leadership ISDBT",
1298 .tuner_type = TUNER_ABSENT,
1299 .tuner_gpio = leadership_reset,
1300 .dvb_gpio = leadership_digital,
1301 .has_dvb = 1,
1304 [EM2880_BOARD_MSI_DIGIVOX_AD] = {
1305 .name = "MSI DigiVox A/D",
1306 .valid = EM28XX_BOARD_NOT_VALIDATED,
1307 .tuner_type = TUNER_XC2028,
1308 .tuner_gpio = default_tuner_gpio,
1309 .decoder = EM28XX_TVP5150,
1310 .input = { {
1311 .type = EM28XX_VMUX_TELEVISION,
1312 .vmux = TVP5150_COMPOSITE0,
1313 .amux = EM28XX_AMUX_VIDEO,
1314 .gpio = em2880_msi_digivox_ad_analog,
1315 }, {
1316 .type = EM28XX_VMUX_COMPOSITE1,
1317 .vmux = TVP5150_COMPOSITE1,
1318 .amux = EM28XX_AMUX_LINE_IN,
1319 .gpio = em2880_msi_digivox_ad_analog,
1320 }, {
1321 .type = EM28XX_VMUX_SVIDEO,
1322 .vmux = TVP5150_SVIDEO,
1323 .amux = EM28XX_AMUX_LINE_IN,
1324 .gpio = em2880_msi_digivox_ad_analog,
1325 } },
1327 [EM2880_BOARD_MSI_DIGIVOX_AD_II] = {
1328 .name = "MSI DigiVox A/D II",
1329 .valid = EM28XX_BOARD_NOT_VALIDATED,
1330 .tuner_type = TUNER_XC2028,
1331 .tuner_gpio = default_tuner_gpio,
1332 .decoder = EM28XX_TVP5150,
1333 .input = { {
1334 .type = EM28XX_VMUX_TELEVISION,
1335 .vmux = TVP5150_COMPOSITE0,
1336 .amux = EM28XX_AMUX_VIDEO,
1337 .gpio = em2880_msi_digivox_ad_analog,
1338 }, {
1339 .type = EM28XX_VMUX_COMPOSITE1,
1340 .vmux = TVP5150_COMPOSITE1,
1341 .amux = EM28XX_AMUX_LINE_IN,
1342 .gpio = em2880_msi_digivox_ad_analog,
1343 }, {
1344 .type = EM28XX_VMUX_SVIDEO,
1345 .vmux = TVP5150_SVIDEO,
1346 .amux = EM28XX_AMUX_LINE_IN,
1347 .gpio = em2880_msi_digivox_ad_analog,
1348 } },
1350 [EM2880_BOARD_KWORLD_DVB_305U] = {
1351 .name = "KWorld DVB-T 305U",
1352 .tuner_type = TUNER_XC2028,
1353 .tuner_gpio = default_tuner_gpio,
1354 .decoder = EM28XX_TVP5150,
1355 .input = { {
1356 .type = EM28XX_VMUX_TELEVISION,
1357 .vmux = TVP5150_COMPOSITE0,
1358 .amux = EM28XX_AMUX_VIDEO,
1359 }, {
1360 .type = EM28XX_VMUX_COMPOSITE1,
1361 .vmux = TVP5150_COMPOSITE1,
1362 .amux = EM28XX_AMUX_LINE_IN,
1363 }, {
1364 .type = EM28XX_VMUX_SVIDEO,
1365 .vmux = TVP5150_SVIDEO,
1366 .amux = EM28XX_AMUX_LINE_IN,
1367 } },
1369 [EM2880_BOARD_KWORLD_DVB_310U] = {
1370 .name = "KWorld DVB-T 310U",
1371 .tuner_type = TUNER_XC2028,
1372 .tuner_gpio = default_tuner_gpio,
1373 .has_dvb = 1,
1374 .dvb_gpio = default_digital,
1375 .mts_firmware = 1,
1376 .decoder = EM28XX_TVP5150,
1377 .input = { {
1378 .type = EM28XX_VMUX_TELEVISION,
1379 .vmux = TVP5150_COMPOSITE0,
1380 .amux = EM28XX_AMUX_VIDEO,
1381 .gpio = default_analog,
1382 }, {
1383 .type = EM28XX_VMUX_COMPOSITE1,
1384 .vmux = TVP5150_COMPOSITE1,
1385 .amux = EM28XX_AMUX_LINE_IN,
1386 .gpio = default_analog,
1387 }, { /* S-video has not been tested yet */
1388 .type = EM28XX_VMUX_SVIDEO,
1389 .vmux = TVP5150_SVIDEO,
1390 .amux = EM28XX_AMUX_LINE_IN,
1391 .gpio = default_analog,
1392 } },
1394 [EM2882_BOARD_KWORLD_ATSC_315U] = {
1395 .name = "KWorld ATSC 315U HDTV TV Box",
1396 .valid = EM28XX_BOARD_NOT_VALIDATED,
1397 .tuner_type = TUNER_THOMSON_DTT761X,
1398 .tuner_gpio = em2882_kworld_315u_tuner_gpio,
1399 .tda9887_conf = TDA9887_PRESENT,
1400 .decoder = EM28XX_SAA711X,
1401 .has_dvb = 1,
1402 .dvb_gpio = em2882_kworld_315u_digital,
1403 .ir_codes = RC_MAP_KWORLD_315U,
1404 .xclk = EM28XX_XCLK_FREQUENCY_12MHZ,
1405 .i2c_speed = EM28XX_I2C_CLK_WAIT_ENABLE,
1406 /* Analog mode - still not ready */
1407 /*.input = { {
1408 .type = EM28XX_VMUX_TELEVISION,
1409 .vmux = SAA7115_COMPOSITE2,
1410 .amux = EM28XX_AMUX_VIDEO,
1411 .gpio = em2882_kworld_315u_analog,
1412 .aout = EM28XX_AOUT_PCM_IN | EM28XX_AOUT_PCM_STEREO,
1413 }, {
1414 .type = EM28XX_VMUX_COMPOSITE1,
1415 .vmux = SAA7115_COMPOSITE0,
1416 .amux = EM28XX_AMUX_LINE_IN,
1417 .gpio = em2882_kworld_315u_analog1,
1418 .aout = EM28XX_AOUT_PCM_IN | EM28XX_AOUT_PCM_STEREO,
1419 }, {
1420 .type = EM28XX_VMUX_SVIDEO,
1421 .vmux = SAA7115_SVIDEO3,
1422 .amux = EM28XX_AMUX_LINE_IN,
1423 .gpio = em2882_kworld_315u_analog1,
1424 .aout = EM28XX_AOUT_PCM_IN | EM28XX_AOUT_PCM_STEREO,
1425 } }, */
1427 [EM2880_BOARD_EMPIRE_DUAL_TV] = {
1428 .name = "Empire dual TV",
1429 .tuner_type = TUNER_XC2028,
1430 .tuner_gpio = default_tuner_gpio,
1431 .has_dvb = 1,
1432 .dvb_gpio = default_digital,
1433 .mts_firmware = 1,
1434 .decoder = EM28XX_TVP5150,
1435 .input = { {
1436 .type = EM28XX_VMUX_TELEVISION,
1437 .vmux = TVP5150_COMPOSITE0,
1438 .amux = EM28XX_AMUX_VIDEO,
1439 .gpio = default_analog,
1440 }, {
1441 .type = EM28XX_VMUX_COMPOSITE1,
1442 .vmux = TVP5150_COMPOSITE1,
1443 .amux = EM28XX_AMUX_LINE_IN,
1444 .gpio = default_analog,
1445 }, {
1446 .type = EM28XX_VMUX_SVIDEO,
1447 .vmux = TVP5150_SVIDEO,
1448 .amux = EM28XX_AMUX_LINE_IN,
1449 .gpio = default_analog,
1450 } },
1452 [EM2881_BOARD_DNT_DA2_HYBRID] = {
1453 .name = "DNT DA2 Hybrid",
1454 .valid = EM28XX_BOARD_NOT_VALIDATED,
1455 .tuner_type = TUNER_XC2028,
1456 .tuner_gpio = default_tuner_gpio,
1457 .decoder = EM28XX_TVP5150,
1458 .input = { {
1459 .type = EM28XX_VMUX_TELEVISION,
1460 .vmux = TVP5150_COMPOSITE0,
1461 .amux = EM28XX_AMUX_VIDEO,
1462 .gpio = default_analog,
1463 }, {
1464 .type = EM28XX_VMUX_COMPOSITE1,
1465 .vmux = TVP5150_COMPOSITE1,
1466 .amux = EM28XX_AMUX_LINE_IN,
1467 .gpio = default_analog,
1468 }, {
1469 .type = EM28XX_VMUX_SVIDEO,
1470 .vmux = TVP5150_SVIDEO,
1471 .amux = EM28XX_AMUX_LINE_IN,
1472 .gpio = default_analog,
1473 } },
1475 [EM2881_BOARD_PINNACLE_HYBRID_PRO] = {
1476 .name = "Pinnacle Hybrid Pro",
1477 .tuner_type = TUNER_XC2028,
1478 .tuner_gpio = default_tuner_gpio,
1479 .decoder = EM28XX_TVP5150,
1480 .has_dvb = 1,
1481 .dvb_gpio = pinnacle_hybrid_pro_digital,
1482 .input = { {
1483 .type = EM28XX_VMUX_TELEVISION,
1484 .vmux = TVP5150_COMPOSITE0,
1485 .amux = EM28XX_AMUX_VIDEO,
1486 .gpio = pinnacle_hybrid_pro_analog,
1487 }, {
1488 .type = EM28XX_VMUX_COMPOSITE1,
1489 .vmux = TVP5150_COMPOSITE1,
1490 .amux = EM28XX_AMUX_LINE_IN,
1491 .gpio = pinnacle_hybrid_pro_analog,
1492 }, {
1493 .type = EM28XX_VMUX_SVIDEO,
1494 .vmux = TVP5150_SVIDEO,
1495 .amux = EM28XX_AMUX_LINE_IN,
1496 .gpio = pinnacle_hybrid_pro_analog,
1497 } },
1499 [EM2882_BOARD_PINNACLE_HYBRID_PRO_330E] = {
1500 .name = "Pinnacle Hybrid Pro (330e)",
1501 .tuner_type = TUNER_XC2028,
1502 .tuner_gpio = default_tuner_gpio,
1503 .mts_firmware = 1,
1504 .has_dvb = 1,
1505 .dvb_gpio = hauppauge_wintv_hvr_900R2_digital,
1506 .ir_codes = RC_MAP_PINNACLE_PCTV_HD,
1507 .decoder = EM28XX_TVP5150,
1508 .input = { {
1509 .type = EM28XX_VMUX_TELEVISION,
1510 .vmux = TVP5150_COMPOSITE0,
1511 .amux = EM28XX_AMUX_VIDEO,
1512 .gpio = hauppauge_wintv_hvr_900_analog,
1513 }, {
1514 .type = EM28XX_VMUX_COMPOSITE1,
1515 .vmux = TVP5150_COMPOSITE1,
1516 .amux = EM28XX_AMUX_LINE_IN,
1517 .gpio = hauppauge_wintv_hvr_900_analog,
1518 }, {
1519 .type = EM28XX_VMUX_SVIDEO,
1520 .vmux = TVP5150_SVIDEO,
1521 .amux = EM28XX_AMUX_LINE_IN,
1522 .gpio = hauppauge_wintv_hvr_900_analog,
1523 } },
1525 [EM2882_BOARD_KWORLD_VS_DVBT] = {
1526 .name = "Kworld VS-DVB-T 323UR",
1527 .tuner_type = TUNER_XC2028,
1528 .tuner_gpio = default_tuner_gpio,
1529 .decoder = EM28XX_TVP5150,
1530 .mts_firmware = 1,
1531 .has_dvb = 1,
1532 .dvb_gpio = kworld_330u_digital,
1533 .xclk = EM28XX_XCLK_FREQUENCY_12MHZ, /* NEC IR */
1534 .ir_codes = RC_MAP_KWORLD_315U,
1535 .input = { {
1536 .type = EM28XX_VMUX_TELEVISION,
1537 .vmux = TVP5150_COMPOSITE0,
1538 .amux = EM28XX_AMUX_VIDEO,
1539 }, {
1540 .type = EM28XX_VMUX_COMPOSITE1,
1541 .vmux = TVP5150_COMPOSITE1,
1542 .amux = EM28XX_AMUX_LINE_IN,
1543 }, {
1544 .type = EM28XX_VMUX_SVIDEO,
1545 .vmux = TVP5150_SVIDEO,
1546 .amux = EM28XX_AMUX_LINE_IN,
1547 } },
1549 [EM2882_BOARD_TERRATEC_HYBRID_XS] = {
1550 .name = "Terratec Cinnergy Hybrid T USB XS (em2882)",
1551 .tuner_type = TUNER_XC2028,
1552 .tuner_gpio = default_tuner_gpio,
1553 .mts_firmware = 1,
1554 .decoder = EM28XX_TVP5150,
1555 .has_dvb = 1,
1556 .dvb_gpio = hauppauge_wintv_hvr_900_digital,
1557 .ir_codes = RC_MAP_TERRATEC_CINERGY_XS,
1558 .xclk = EM28XX_XCLK_FREQUENCY_12MHZ,
1559 .input = { {
1560 .type = EM28XX_VMUX_TELEVISION,
1561 .vmux = TVP5150_COMPOSITE0,
1562 .amux = EM28XX_AMUX_VIDEO,
1563 .gpio = hauppauge_wintv_hvr_900_analog,
1564 }, {
1565 .type = EM28XX_VMUX_COMPOSITE1,
1566 .vmux = TVP5150_COMPOSITE1,
1567 .amux = EM28XX_AMUX_LINE_IN,
1568 .gpio = hauppauge_wintv_hvr_900_analog,
1569 }, {
1570 .type = EM28XX_VMUX_SVIDEO,
1571 .vmux = TVP5150_SVIDEO,
1572 .amux = EM28XX_AMUX_LINE_IN,
1573 .gpio = hauppauge_wintv_hvr_900_analog,
1574 } },
1576 [EM2882_BOARD_DIKOM_DK300] = {
1577 .name = "Dikom DK300",
1578 .tuner_type = TUNER_XC2028,
1579 .tuner_gpio = default_tuner_gpio,
1580 .decoder = EM28XX_TVP5150,
1581 .mts_firmware = 1,
1582 .has_dvb = 1,
1583 .dvb_gpio = dikom_dk300_digital,
1584 .input = { {
1585 .type = EM28XX_VMUX_TELEVISION,
1586 .vmux = TVP5150_COMPOSITE0,
1587 .amux = EM28XX_AMUX_VIDEO,
1588 .gpio = default_analog,
1589 } },
1591 [EM2883_BOARD_KWORLD_HYBRID_330U] = {
1592 .name = "Kworld PlusTV HD Hybrid 330",
1593 .tuner_type = TUNER_XC2028,
1594 .tuner_gpio = default_tuner_gpio,
1595 .decoder = EM28XX_TVP5150,
1596 .mts_firmware = 1,
1597 .has_dvb = 1,
1598 .dvb_gpio = kworld_330u_digital,
1599 .xclk = EM28XX_XCLK_FREQUENCY_12MHZ,
1600 .i2c_speed = EM28XX_I2C_CLK_WAIT_ENABLE |
1601 EM28XX_I2C_EEPROM_ON_BOARD |
1602 EM28XX_I2C_EEPROM_KEY_VALID,
1603 .input = { {
1604 .type = EM28XX_VMUX_TELEVISION,
1605 .vmux = TVP5150_COMPOSITE0,
1606 .amux = EM28XX_AMUX_VIDEO,
1607 .gpio = kworld_330u_analog,
1608 .aout = EM28XX_AOUT_PCM_IN | EM28XX_AOUT_PCM_STEREO,
1609 }, {
1610 .type = EM28XX_VMUX_COMPOSITE1,
1611 .vmux = TVP5150_COMPOSITE1,
1612 .amux = EM28XX_AMUX_LINE_IN,
1613 .gpio = kworld_330u_analog,
1614 .aout = EM28XX_AOUT_PCM_IN | EM28XX_AOUT_PCM_STEREO,
1615 }, {
1616 .type = EM28XX_VMUX_SVIDEO,
1617 .vmux = TVP5150_SVIDEO,
1618 .amux = EM28XX_AMUX_LINE_IN,
1619 .gpio = kworld_330u_analog,
1620 } },
1622 [EM2820_BOARD_COMPRO_VIDEOMATE_FORYOU] = {
1623 .name = "Compro VideoMate ForYou/Stereo",
1624 .tuner_type = TUNER_LG_PAL_NEW_TAPC,
1625 .tvaudio_addr = 0xb0,
1626 .tda9887_conf = TDA9887_PRESENT,
1627 .decoder = EM28XX_TVP5150,
1628 .adecoder = EM28XX_TVAUDIO,
1629 .mute_gpio = compro_mute_gpio,
1630 .input = { {
1631 .type = EM28XX_VMUX_TELEVISION,
1632 .vmux = TVP5150_COMPOSITE0,
1633 .amux = EM28XX_AMUX_VIDEO,
1634 .gpio = compro_unmute_tv_gpio,
1635 }, {
1636 .type = EM28XX_VMUX_SVIDEO,
1637 .vmux = TVP5150_SVIDEO,
1638 .amux = EM28XX_AMUX_LINE_IN,
1639 .gpio = compro_unmute_svid_gpio,
1640 } },
1642 [EM2860_BOARD_KAIOMY_TVNPC_U2] = {
1643 .name = "Kaiomy TVnPC U2",
1644 .vchannels = 3,
1645 .tuner_type = TUNER_XC2028,
1646 .tuner_addr = 0x61,
1647 .mts_firmware = 1,
1648 .decoder = EM28XX_TVP5150,
1649 .tuner_gpio = default_tuner_gpio,
1650 .ir_codes = RC_MAP_KAIOMY,
1651 .input = { {
1652 .type = EM28XX_VMUX_TELEVISION,
1653 .vmux = TVP5150_COMPOSITE0,
1654 .amux = EM28XX_AMUX_VIDEO,
1656 }, {
1657 .type = EM28XX_VMUX_COMPOSITE1,
1658 .vmux = TVP5150_COMPOSITE1,
1659 .amux = EM28XX_AMUX_LINE_IN,
1660 }, {
1661 .type = EM28XX_VMUX_SVIDEO,
1662 .vmux = TVP5150_SVIDEO,
1663 .amux = EM28XX_AMUX_LINE_IN,
1664 } },
1665 .radio = {
1666 .type = EM28XX_RADIO,
1667 .amux = EM28XX_AMUX_LINE_IN,
1670 [EM2860_BOARD_EASYCAP] = {
1671 .name = "Easy Cap Capture DC-60",
1672 .vchannels = 2,
1673 .tuner_type = TUNER_ABSENT,
1674 .decoder = EM28XX_SAA711X,
1675 .input = { {
1676 .type = EM28XX_VMUX_COMPOSITE1,
1677 .vmux = SAA7115_COMPOSITE0,
1678 .amux = EM28XX_AMUX_LINE_IN,
1679 }, {
1680 .type = EM28XX_VMUX_SVIDEO,
1681 .vmux = SAA7115_SVIDEO3,
1682 .amux = EM28XX_AMUX_LINE_IN,
1683 } },
1685 [EM2820_BOARD_IODATA_GVMVP_SZ] = {
1686 .name = "IO-DATA GV-MVP/SZ",
1687 .tuner_type = TUNER_PHILIPS_FM1236_MK3,
1688 .tuner_gpio = default_tuner_gpio,
1689 .tda9887_conf = TDA9887_PRESENT,
1690 .decoder = EM28XX_TVP5150,
1691 .input = { {
1692 .type = EM28XX_VMUX_TELEVISION,
1693 .vmux = TVP5150_COMPOSITE0,
1694 .amux = EM28XX_AMUX_VIDEO,
1695 }, { /* Composite has not been tested yet */
1696 .type = EM28XX_VMUX_COMPOSITE1,
1697 .vmux = TVP5150_COMPOSITE1,
1698 .amux = EM28XX_AMUX_VIDEO,
1699 }, { /* S-video has not been tested yet */
1700 .type = EM28XX_VMUX_SVIDEO,
1701 .vmux = TVP5150_SVIDEO,
1702 .amux = EM28XX_AMUX_VIDEO,
1703 } },
1705 [EM2860_BOARD_TERRATEC_GRABBY] = {
1706 .name = "Terratec Grabby",
1707 .vchannels = 2,
1708 .tuner_type = TUNER_ABSENT,
1709 .decoder = EM28XX_SAA711X,
1710 .xclk = EM28XX_XCLK_FREQUENCY_12MHZ,
1711 .input = { {
1712 .type = EM28XX_VMUX_COMPOSITE1,
1713 .vmux = SAA7115_COMPOSITE0,
1714 .amux = EM28XX_AMUX_LINE_IN,
1715 }, {
1716 .type = EM28XX_VMUX_SVIDEO,
1717 .vmux = SAA7115_SVIDEO3,
1718 .amux = EM28XX_AMUX_LINE_IN,
1719 } },
1721 [EM2860_BOARD_TERRATEC_AV350] = {
1722 .name = "Terratec AV350",
1723 .vchannels = 2,
1724 .tuner_type = TUNER_ABSENT,
1725 .decoder = EM28XX_TVP5150,
1726 .xclk = EM28XX_XCLK_FREQUENCY_12MHZ,
1727 .mute_gpio = terratec_av350_mute_gpio,
1728 .input = { {
1729 .type = EM28XX_VMUX_COMPOSITE1,
1730 .vmux = TVP5150_COMPOSITE1,
1731 .amux = EM28XX_AUDIO_SRC_LINE,
1732 .gpio = terratec_av350_unmute_gpio,
1734 }, {
1735 .type = EM28XX_VMUX_SVIDEO,
1736 .vmux = TVP5150_SVIDEO,
1737 .amux = EM28XX_AUDIO_SRC_LINE,
1738 .gpio = terratec_av350_unmute_gpio,
1739 } },
1742 [EM2860_BOARD_ELGATO_VIDEO_CAPTURE] = {
1743 .name = "Elgato Video Capture",
1744 .decoder = EM28XX_SAA711X,
1745 .tuner_type = TUNER_ABSENT, /* Capture only device */
1746 .input = { {
1747 .type = EM28XX_VMUX_COMPOSITE1,
1748 .vmux = SAA7115_COMPOSITE0,
1749 .amux = EM28XX_AMUX_LINE_IN,
1750 }, {
1751 .type = EM28XX_VMUX_SVIDEO,
1752 .vmux = SAA7115_SVIDEO3,
1753 .amux = EM28XX_AMUX_LINE_IN,
1754 } },
1757 [EM2882_BOARD_EVGA_INDTUBE] = {
1758 .name = "Evga inDtube",
1759 .tuner_type = TUNER_XC2028,
1760 .tuner_gpio = default_tuner_gpio,
1761 .decoder = EM28XX_TVP5150,
1762 .xclk = EM28XX_XCLK_FREQUENCY_12MHZ, /* NEC IR */
1763 .mts_firmware = 1,
1764 .has_dvb = 1,
1765 .dvb_gpio = evga_indtube_digital,
1766 .ir_codes = RC_MAP_EVGA_INDTUBE,
1767 .input = { {
1768 .type = EM28XX_VMUX_TELEVISION,
1769 .vmux = TVP5150_COMPOSITE0,
1770 .amux = EM28XX_AMUX_VIDEO,
1771 .gpio = evga_indtube_analog,
1772 }, {
1773 .type = EM28XX_VMUX_COMPOSITE1,
1774 .vmux = TVP5150_COMPOSITE1,
1775 .amux = EM28XX_AMUX_LINE_IN,
1776 .gpio = evga_indtube_analog,
1777 }, {
1778 .type = EM28XX_VMUX_SVIDEO,
1779 .vmux = TVP5150_SVIDEO,
1780 .amux = EM28XX_AMUX_LINE_IN,
1781 .gpio = evga_indtube_analog,
1782 } },
1784 /* eb1a:2868 Empia EM2870 + Philips CU1216L NIM (Philips TDA10023 +
1785 Infineon TUA6034) */
1786 [EM2870_BOARD_REDDO_DVB_C_USB_BOX] = {
1787 .name = "Reddo DVB-C USB TV Box",
1788 .tuner_type = TUNER_ABSENT,
1789 .tuner_gpio = reddo_dvb_c_usb_box,
1790 .has_dvb = 1,
1792 /* 1b80:a340 - Empia EM2870, NXP TDA18271HD and LG DT3304, sold
1793 * initially as the KWorld PlusTV 340U, then as the UB435-Q.
1794 * Early variants have a TDA18271HD/C1, later ones a TDA18271HD/C2 */
1795 [EM2870_BOARD_KWORLD_A340] = {
1796 .name = "KWorld PlusTV 340U or UB435-Q (ATSC)",
1797 .tuner_type = TUNER_ABSENT, /* Digital-only TDA18271HD */
1798 .has_dvb = 1,
1799 .dvb_gpio = kworld_a340_digital,
1800 .tuner_gpio = default_tuner_gpio,
1802 /* 2013:024f PCTV nanoStick T2 290e.
1803 * Empia EM28174, Sony CXD2820R and NXP TDA18271HD/C2 */
1804 [EM28174_BOARD_PCTV_290E] = {
1805 .name = "PCTV nanoStick T2 290e",
1806 .i2c_speed = EM2874_I2C_SECONDARY_BUS_SELECT |
1807 EM28XX_I2C_CLK_WAIT_ENABLE | EM28XX_I2C_FREQ_100_KHZ,
1808 .tuner_type = TUNER_ABSENT,
1809 .tuner_gpio = pctv_290e,
1810 .has_dvb = 1,
1811 .ir_codes = RC_MAP_PINNACLE_PCTV_HD,
1814 const unsigned int em28xx_bcount = ARRAY_SIZE(em28xx_boards);
1816 /* table of devices that work with this driver */
1817 struct usb_device_id em28xx_id_table[] = {
1818 { USB_DEVICE(0xeb1a, 0x2750),
1819 .driver_info = EM2750_BOARD_UNKNOWN },
1820 { USB_DEVICE(0xeb1a, 0x2751),
1821 .driver_info = EM2750_BOARD_UNKNOWN },
1822 { USB_DEVICE(0xeb1a, 0x2800),
1823 .driver_info = EM2800_BOARD_UNKNOWN },
1824 { USB_DEVICE(0xeb1a, 0x2710),
1825 .driver_info = EM2820_BOARD_UNKNOWN },
1826 { USB_DEVICE(0xeb1a, 0x2820),
1827 .driver_info = EM2820_BOARD_UNKNOWN },
1828 { USB_DEVICE(0xeb1a, 0x2821),
1829 .driver_info = EM2820_BOARD_UNKNOWN },
1830 { USB_DEVICE(0xeb1a, 0x2860),
1831 .driver_info = EM2820_BOARD_UNKNOWN },
1832 { USB_DEVICE(0xeb1a, 0x2861),
1833 .driver_info = EM2820_BOARD_UNKNOWN },
1834 { USB_DEVICE(0xeb1a, 0x2862),
1835 .driver_info = EM2820_BOARD_UNKNOWN },
1836 { USB_DEVICE(0xeb1a, 0x2863),
1837 .driver_info = EM2820_BOARD_UNKNOWN },
1838 { USB_DEVICE(0xeb1a, 0x2870),
1839 .driver_info = EM2820_BOARD_UNKNOWN },
1840 { USB_DEVICE(0xeb1a, 0x2881),
1841 .driver_info = EM2820_BOARD_UNKNOWN },
1842 { USB_DEVICE(0xeb1a, 0x2883),
1843 .driver_info = EM2820_BOARD_UNKNOWN },
1844 { USB_DEVICE(0xeb1a, 0x2868),
1845 .driver_info = EM2820_BOARD_UNKNOWN },
1846 { USB_DEVICE(0xeb1a, 0x2875),
1847 .driver_info = EM2820_BOARD_UNKNOWN },
1848 { USB_DEVICE(0xeb1a, 0xe300),
1849 .driver_info = EM2861_BOARD_KWORLD_PVRTV_300U },
1850 { USB_DEVICE(0xeb1a, 0xe303),
1851 .driver_info = EM2860_BOARD_KAIOMY_TVNPC_U2 },
1852 { USB_DEVICE(0xeb1a, 0xe305),
1853 .driver_info = EM2880_BOARD_KWORLD_DVB_305U },
1854 { USB_DEVICE(0xeb1a, 0xe310),
1855 .driver_info = EM2880_BOARD_MSI_DIGIVOX_AD },
1856 { USB_DEVICE(0xeb1a, 0xa313),
1857 .driver_info = EM2882_BOARD_KWORLD_ATSC_315U },
1858 { USB_DEVICE(0xeb1a, 0xa316),
1859 .driver_info = EM2883_BOARD_KWORLD_HYBRID_330U },
1860 { USB_DEVICE(0xeb1a, 0xe320),
1861 .driver_info = EM2880_BOARD_MSI_DIGIVOX_AD_II },
1862 { USB_DEVICE(0xeb1a, 0xe323),
1863 .driver_info = EM2882_BOARD_KWORLD_VS_DVBT },
1864 { USB_DEVICE(0xeb1a, 0xe350),
1865 .driver_info = EM2870_BOARD_KWORLD_350U },
1866 { USB_DEVICE(0xeb1a, 0xe355),
1867 .driver_info = EM2870_BOARD_KWORLD_355U },
1868 { USB_DEVICE(0xeb1a, 0x2801),
1869 .driver_info = EM2800_BOARD_GRABBEEX_USB2800 },
1870 { USB_DEVICE(0xeb1a, 0xe357),
1871 .driver_info = EM2870_BOARD_KWORLD_355U },
1872 { USB_DEVICE(0x1b80, 0xe302),
1873 .driver_info = EM2820_BOARD_PINNACLE_DVC_90 }, /* Kaiser Baas Video to DVD maker */
1874 { USB_DEVICE(0x1b80, 0xe304),
1875 .driver_info = EM2820_BOARD_PINNACLE_DVC_90 }, /* Kworld DVD Maker 2 */
1876 { USB_DEVICE(0x0ccd, 0x0036),
1877 .driver_info = EM2820_BOARD_TERRATEC_CINERGY_250 },
1878 { USB_DEVICE(0x0ccd, 0x004c),
1879 .driver_info = EM2880_BOARD_TERRATEC_HYBRID_XS_FR },
1880 { USB_DEVICE(0x0ccd, 0x004f),
1881 .driver_info = EM2860_BOARD_TERRATEC_HYBRID_XS },
1882 { USB_DEVICE(0x0ccd, 0x005e),
1883 .driver_info = EM2882_BOARD_TERRATEC_HYBRID_XS },
1884 { USB_DEVICE(0x0ccd, 0x0042),
1885 .driver_info = EM2882_BOARD_TERRATEC_HYBRID_XS },
1886 { USB_DEVICE(0x0ccd, 0x0043),
1887 .driver_info = EM2884_BOARD_TERRATEC_H5 },
1888 { USB_DEVICE(0x0ccd, 0x10a2), /* Rev. 1 */
1889 .driver_info = EM2884_BOARD_TERRATEC_H5 },
1890 { USB_DEVICE(0x0ccd, 0x10ad), /* Rev. 2 */
1891 .driver_info = EM2880_BOARD_TERRATEC_PRODIGY_XS },
1892 { USB_DEVICE(0x0ccd, 0x0084),
1893 .driver_info = EM2860_BOARD_TERRATEC_AV350 },
1894 { USB_DEVICE(0x0ccd, 0x0096),
1895 .driver_info = EM2860_BOARD_TERRATEC_GRABBY },
1896 { USB_DEVICE(0x0fd9, 0x0033),
1897 .driver_info = EM2860_BOARD_ELGATO_VIDEO_CAPTURE},
1898 { USB_DEVICE(0x185b, 0x2870),
1899 .driver_info = EM2870_BOARD_COMPRO_VIDEOMATE },
1900 { USB_DEVICE(0x185b, 0x2041),
1901 .driver_info = EM2820_BOARD_COMPRO_VIDEOMATE_FORYOU },
1902 { USB_DEVICE(0x2040, 0x4200),
1903 .driver_info = EM2820_BOARD_HAUPPAUGE_WINTV_USB_2 },
1904 { USB_DEVICE(0x2040, 0x4201),
1905 .driver_info = EM2820_BOARD_HAUPPAUGE_WINTV_USB_2 },
1906 { USB_DEVICE(0x2040, 0x6500),
1907 .driver_info = EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900 },
1908 { USB_DEVICE(0x2040, 0x6502),
1909 .driver_info = EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900_R2 },
1910 { USB_DEVICE(0x2040, 0x6513), /* HCW HVR-980 */
1911 .driver_info = EM2883_BOARD_HAUPPAUGE_WINTV_HVR_950 },
1912 { USB_DEVICE(0x2040, 0x6517), /* HP HVR-950 */
1913 .driver_info = EM2883_BOARD_HAUPPAUGE_WINTV_HVR_950 },
1914 { USB_DEVICE(0x2040, 0x651b), /* RP HVR-950 */
1915 .driver_info = EM2883_BOARD_HAUPPAUGE_WINTV_HVR_950 },
1916 { USB_DEVICE(0x2040, 0x651f),
1917 .driver_info = EM2883_BOARD_HAUPPAUGE_WINTV_HVR_850 },
1918 { USB_DEVICE(0x0438, 0xb002),
1919 .driver_info = EM2880_BOARD_AMD_ATI_TV_WONDER_HD_600 },
1920 { USB_DEVICE(0x2001, 0xf112),
1921 .driver_info = EM2820_BOARD_DLINK_USB_TV },
1922 { USB_DEVICE(0x2304, 0x0207),
1923 .driver_info = EM2820_BOARD_PINNACLE_DVC_90 },
1924 { USB_DEVICE(0x2304, 0x0208),
1925 .driver_info = EM2820_BOARD_PINNACLE_USB_2 },
1926 { USB_DEVICE(0x2304, 0x021a),
1927 .driver_info = EM2820_BOARD_PINNACLE_DVC_90 },
1928 { USB_DEVICE(0x2304, 0x0226),
1929 .driver_info = EM2882_BOARD_PINNACLE_HYBRID_PRO_330E },
1930 { USB_DEVICE(0x2304, 0x0227),
1931 .driver_info = EM2880_BOARD_PINNACLE_PCTV_HD_PRO },
1932 { USB_DEVICE(0x0413, 0x6023),
1933 .driver_info = EM2800_BOARD_LEADTEK_WINFAST_USBII },
1934 { USB_DEVICE(0x093b, 0xa005),
1935 .driver_info = EM2861_BOARD_PLEXTOR_PX_TV100U },
1936 { USB_DEVICE(0x04bb, 0x0515),
1937 .driver_info = EM2820_BOARD_IODATA_GVMVP_SZ },
1938 { USB_DEVICE(0xeb1a, 0x50a6),
1939 .driver_info = EM2860_BOARD_GADMEI_UTV330 },
1940 { USB_DEVICE(0x1b80, 0xa340),
1941 .driver_info = EM2870_BOARD_KWORLD_A340 },
1942 { USB_DEVICE(0x2013, 0x024f),
1943 .driver_info = EM28174_BOARD_PCTV_290E },
1944 { },
1946 MODULE_DEVICE_TABLE(usb, em28xx_id_table);
1949 * EEPROM hash table for devices with generic USB IDs
1951 static struct em28xx_hash_table em28xx_eeprom_hash[] = {
1952 /* P/N: SA 60002070465 Tuner: TVF7533-MF */
1953 {0x6ce05a8f, EM2820_BOARD_PROLINK_PLAYTV_USB2, TUNER_YMEC_TVF_5533MF},
1954 {0x72cc5a8b, EM2820_BOARD_PROLINK_PLAYTV_BOX4_USB2, TUNER_YMEC_TVF_5533MF},
1955 {0x966a0441, EM2880_BOARD_KWORLD_DVB_310U, TUNER_XC2028},
1956 {0x166a0441, EM2880_BOARD_EMPIRE_DUAL_TV, TUNER_XC2028},
1957 {0xcee44a99, EM2882_BOARD_EVGA_INDTUBE, TUNER_XC2028},
1958 {0xb8846b20, EM2881_BOARD_PINNACLE_HYBRID_PRO, TUNER_XC2028},
1959 {0x63f653bd, EM2870_BOARD_REDDO_DVB_C_USB_BOX, TUNER_ABSENT},
1960 {0x4e913442, EM2882_BOARD_DIKOM_DK300, TUNER_XC2028},
1963 /* I2C devicelist hash table for devices with generic USB IDs */
1964 static struct em28xx_hash_table em28xx_i2c_hash[] = {
1965 {0xb06a32c3, EM2800_BOARD_TERRATEC_CINERGY_200, TUNER_LG_PAL_NEW_TAPC},
1966 {0xf51200e3, EM2800_BOARD_VGEAR_POCKETTV, TUNER_LG_PAL_NEW_TAPC},
1967 {0x1ba50080, EM2860_BOARD_SAA711X_REFERENCE_DESIGN, TUNER_ABSENT},
1968 {0x77800080, EM2860_BOARD_TVP5150_REFERENCE_DESIGN, TUNER_ABSENT},
1969 {0xc51200e3, EM2820_BOARD_GADMEI_TVR200, TUNER_LG_PAL_NEW_TAPC},
1970 {0x4ba50080, EM2861_BOARD_GADMEI_UTV330PLUS, TUNER_TNF_5335MF},
1971 {0x6b800080, EM2874_BOARD_LEADERSHIP_ISDBT, TUNER_ABSENT},
1974 /* I2C possible address to saa7115, tvp5150, msp3400, tvaudio */
1975 static unsigned short saa711x_addrs[] = {
1976 0x4a >> 1, 0x48 >> 1, /* SAA7111, SAA7111A and SAA7113 */
1977 0x42 >> 1, 0x40 >> 1, /* SAA7114, SAA7115 and SAA7118 */
1978 I2C_CLIENT_END };
1980 static unsigned short tvp5150_addrs[] = {
1981 0xb8 >> 1,
1982 0xba >> 1,
1983 I2C_CLIENT_END
1986 static unsigned short msp3400_addrs[] = {
1987 0x80 >> 1,
1988 0x88 >> 1,
1989 I2C_CLIENT_END
1992 int em28xx_tuner_callback(void *ptr, int component, int command, int arg)
1994 int rc = 0;
1995 struct em28xx *dev = ptr;
1997 if (dev->tuner_type != TUNER_XC2028)
1998 return 0;
2000 if (command != XC2028_TUNER_RESET)
2001 return 0;
2003 rc = em28xx_gpio_set(dev, dev->board.tuner_gpio);
2005 return rc;
2007 EXPORT_SYMBOL_GPL(em28xx_tuner_callback);
2009 static inline void em28xx_set_model(struct em28xx *dev)
2011 memcpy(&dev->board, &em28xx_boards[dev->model], sizeof(dev->board));
2013 /* Those are the default values for the majority of boards
2014 Use those values if not specified otherwise at boards entry
2016 if (!dev->board.xclk)
2017 dev->board.xclk = EM28XX_XCLK_IR_RC5_MODE |
2018 EM28XX_XCLK_FREQUENCY_12MHZ;
2020 if (!dev->board.i2c_speed)
2021 dev->board.i2c_speed = EM28XX_I2C_CLK_WAIT_ENABLE |
2022 EM28XX_I2C_FREQ_100_KHZ;
2026 /* FIXME: Should be replaced by a proper mt9m111 driver */
2027 static int em28xx_initialize_mt9m111(struct em28xx *dev)
2029 int i;
2030 unsigned char regs[][3] = {
2031 { 0x0d, 0x00, 0x01, }, /* reset and use defaults */
2032 { 0x0d, 0x00, 0x00, },
2033 { 0x0a, 0x00, 0x21, },
2034 { 0x21, 0x04, 0x00, }, /* full readout speed, no row/col skipping */
2037 for (i = 0; i < ARRAY_SIZE(regs); i++)
2038 i2c_master_send(&dev->i2c_client, &regs[i][0], 3);
2040 return 0;
2044 /* FIXME: Should be replaced by a proper mt9m001 driver */
2045 static int em28xx_initialize_mt9m001(struct em28xx *dev)
2047 int i;
2048 unsigned char regs[][3] = {
2049 { 0x0d, 0x00, 0x01, },
2050 { 0x0d, 0x00, 0x00, },
2051 { 0x04, 0x05, 0x00, }, /* hres = 1280 */
2052 { 0x03, 0x04, 0x00, }, /* vres = 1024 */
2053 { 0x20, 0x11, 0x00, },
2054 { 0x06, 0x00, 0x10, },
2055 { 0x2b, 0x00, 0x24, },
2056 { 0x2e, 0x00, 0x24, },
2057 { 0x35, 0x00, 0x24, },
2058 { 0x2d, 0x00, 0x20, },
2059 { 0x2c, 0x00, 0x20, },
2060 { 0x09, 0x0a, 0xd4, },
2061 { 0x35, 0x00, 0x57, },
2064 for (i = 0; i < ARRAY_SIZE(regs); i++)
2065 i2c_master_send(&dev->i2c_client, &regs[i][0], 3);
2067 return 0;
2070 /* HINT method: webcam I2C chips
2072 * This method works for webcams with Micron sensors
2074 static int em28xx_hint_sensor(struct em28xx *dev)
2076 int rc;
2077 char *sensor_name;
2078 unsigned char cmd;
2079 __be16 version_be;
2080 u16 version;
2082 /* Micron sensor detection */
2083 dev->i2c_client.addr = 0xba >> 1;
2084 cmd = 0;
2085 i2c_master_send(&dev->i2c_client, &cmd, 1);
2086 rc = i2c_master_recv(&dev->i2c_client, (char *)&version_be, 2);
2087 if (rc != 2)
2088 return -EINVAL;
2090 version = be16_to_cpu(version_be);
2091 switch (version) {
2092 case 0x8232: /* mt9v011 640x480 1.3 Mpix sensor */
2093 case 0x8243: /* mt9v011 rev B 640x480 1.3 Mpix sensor */
2094 dev->model = EM2820_BOARD_SILVERCREST_WEBCAM;
2095 em28xx_set_model(dev);
2097 sensor_name = "mt9v011";
2098 dev->em28xx_sensor = EM28XX_MT9V011;
2099 dev->sensor_xres = 640;
2100 dev->sensor_yres = 480;
2102 * FIXME: mt9v011 uses I2S speed as xtal clk - at least with
2103 * the Silvercrest cam I have here for testing - for higher
2104 * resolutions, a high clock cause horizontal artifacts, so we
2105 * need to use a lower xclk frequency.
2106 * Yet, it would be possible to adjust xclk depending on the
2107 * desired resolution, since this affects directly the
2108 * frame rate.
2110 dev->board.xclk = EM28XX_XCLK_FREQUENCY_4_3MHZ;
2111 dev->sensor_xtal = 4300000;
2113 /* probably means GRGB 16 bit bayer */
2114 dev->vinmode = 0x0d;
2115 dev->vinctl = 0x00;
2117 break;
2119 case 0x143a: /* MT9M111 as found in the ECS G200 */
2120 dev->model = EM2750_BOARD_UNKNOWN;
2121 em28xx_set_model(dev);
2123 sensor_name = "mt9m111";
2124 dev->board.xclk = EM28XX_XCLK_FREQUENCY_48MHZ;
2125 dev->em28xx_sensor = EM28XX_MT9M111;
2126 em28xx_initialize_mt9m111(dev);
2127 dev->sensor_xres = 640;
2128 dev->sensor_yres = 512;
2130 dev->vinmode = 0x0a;
2131 dev->vinctl = 0x00;
2133 break;
2135 case 0x8431:
2136 dev->model = EM2750_BOARD_UNKNOWN;
2137 em28xx_set_model(dev);
2139 sensor_name = "mt9m001";
2140 dev->em28xx_sensor = EM28XX_MT9M001;
2141 em28xx_initialize_mt9m001(dev);
2142 dev->sensor_xres = 1280;
2143 dev->sensor_yres = 1024;
2145 /* probably means BGGR 16 bit bayer */
2146 dev->vinmode = 0x0c;
2147 dev->vinctl = 0x00;
2149 break;
2150 default:
2151 printk("Unknown Micron Sensor 0x%04x\n", version);
2152 return -EINVAL;
2155 /* Setup webcam defaults */
2156 em28xx_pre_card_setup(dev);
2158 em28xx_errdev("Sensor is %s, using model %s entry.\n",
2159 sensor_name, em28xx_boards[dev->model].name);
2161 return 0;
2164 /* Since em28xx_pre_card_setup() requires a proper dev->model,
2165 * this won't work for boards with generic PCI IDs
2167 void em28xx_pre_card_setup(struct em28xx *dev)
2169 /* Set the initial XCLK and I2C clock values based on the board
2170 definition */
2171 em28xx_write_reg(dev, EM28XX_R0F_XCLK, dev->board.xclk & 0x7f);
2172 em28xx_write_reg(dev, EM28XX_R06_I2C_CLK, dev->board.i2c_speed);
2173 msleep(50);
2175 /* request some modules */
2176 switch (dev->model) {
2177 case EM2861_BOARD_PLEXTOR_PX_TV100U:
2178 /* Sets the msp34xx I2S speed */
2179 dev->i2s_speed = 2048000;
2180 break;
2181 case EM2861_BOARD_KWORLD_PVRTV_300U:
2182 case EM2880_BOARD_KWORLD_DVB_305U:
2183 em28xx_write_reg(dev, EM28XX_R08_GPIO, 0x6d);
2184 msleep(10);
2185 em28xx_write_reg(dev, EM28XX_R08_GPIO, 0x7d);
2186 msleep(10);
2187 break;
2188 case EM2870_BOARD_COMPRO_VIDEOMATE:
2189 /* TODO: someone can do some cleanup here...
2190 not everything's needed */
2191 em28xx_write_reg(dev, EM2880_R04_GPO, 0x00);
2192 msleep(10);
2193 em28xx_write_reg(dev, EM2880_R04_GPO, 0x01);
2194 msleep(10);
2195 em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xfd);
2196 mdelay(70);
2197 em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xfc);
2198 mdelay(70);
2199 em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xdc);
2200 mdelay(70);
2201 em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xfc);
2202 mdelay(70);
2203 break;
2204 case EM2870_BOARD_TERRATEC_XS_MT2060:
2205 /* this device needs some gpio writes to get the DVB-T
2206 demod work */
2207 em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xfe);
2208 mdelay(70);
2209 em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xde);
2210 mdelay(70);
2211 em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xfe);
2212 mdelay(70);
2213 break;
2214 case EM2870_BOARD_PINNACLE_PCTV_DVB:
2215 /* this device needs some gpio writes to get the
2216 DVB-T demod work */
2217 em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xfe);
2218 mdelay(70);
2219 em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xde);
2220 mdelay(70);
2221 em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xfe);
2222 mdelay(70);
2223 break;
2224 case EM2820_BOARD_GADMEI_UTV310:
2225 case EM2820_BOARD_MSI_VOX_USB_2:
2226 /* enables audio for that devices */
2227 em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xfd);
2228 break;
2230 case EM2882_BOARD_KWORLD_ATSC_315U:
2231 em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xff);
2232 msleep(10);
2233 em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xfe);
2234 msleep(10);
2235 em28xx_write_reg(dev, EM2880_R04_GPO, 0x00);
2236 msleep(10);
2237 em28xx_write_reg(dev, EM2880_R04_GPO, 0x08);
2238 msleep(10);
2239 break;
2241 case EM2860_BOARD_KAIOMY_TVNPC_U2:
2242 em28xx_write_regs(dev, EM28XX_R0F_XCLK, "\x07", 1);
2243 em28xx_write_regs(dev, EM28XX_R06_I2C_CLK, "\x40", 1);
2244 em28xx_write_regs(dev, 0x0d, "\x42", 1);
2245 em28xx_write_regs(dev, 0x08, "\xfd", 1);
2246 msleep(10);
2247 em28xx_write_regs(dev, 0x08, "\xff", 1);
2248 msleep(10);
2249 em28xx_write_regs(dev, 0x08, "\x7f", 1);
2250 msleep(10);
2251 em28xx_write_regs(dev, 0x08, "\x6b", 1);
2253 break;
2254 case EM2860_BOARD_EASYCAP:
2255 em28xx_write_regs(dev, 0x08, "\xf8", 1);
2256 break;
2258 case EM2820_BOARD_IODATA_GVMVP_SZ:
2259 em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xff);
2260 msleep(70);
2261 em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xf7);
2262 msleep(10);
2263 em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xfe);
2264 msleep(70);
2265 em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xfd);
2266 msleep(70);
2267 break;
2270 em28xx_gpio_set(dev, dev->board.tuner_gpio);
2271 em28xx_set_mode(dev, EM28XX_ANALOG_MODE);
2273 /* Unlock device */
2274 em28xx_set_mode(dev, EM28XX_SUSPEND);
2277 static void em28xx_setup_xc3028(struct em28xx *dev, struct xc2028_ctrl *ctl)
2279 memset(ctl, 0, sizeof(*ctl));
2281 ctl->fname = XC2028_DEFAULT_FIRMWARE;
2282 ctl->max_len = 64;
2283 ctl->mts = em28xx_boards[dev->model].mts_firmware;
2285 switch (dev->model) {
2286 case EM2880_BOARD_EMPIRE_DUAL_TV:
2287 case EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900:
2288 case EM2882_BOARD_TERRATEC_HYBRID_XS:
2289 ctl->demod = XC3028_FE_ZARLINK456;
2290 break;
2291 case EM2880_BOARD_TERRATEC_HYBRID_XS:
2292 case EM2880_BOARD_TERRATEC_HYBRID_XS_FR:
2293 case EM2881_BOARD_PINNACLE_HYBRID_PRO:
2294 ctl->demod = XC3028_FE_ZARLINK456;
2295 break;
2296 case EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900_R2:
2297 case EM2882_BOARD_PINNACLE_HYBRID_PRO_330E:
2298 ctl->demod = XC3028_FE_DEFAULT;
2299 break;
2300 case EM2880_BOARD_AMD_ATI_TV_WONDER_HD_600:
2301 ctl->demod = XC3028_FE_DEFAULT;
2302 ctl->fname = XC3028L_DEFAULT_FIRMWARE;
2303 break;
2304 case EM2883_BOARD_HAUPPAUGE_WINTV_HVR_850:
2305 case EM2883_BOARD_HAUPPAUGE_WINTV_HVR_950:
2306 case EM2880_BOARD_PINNACLE_PCTV_HD_PRO:
2307 /* FIXME: Better to specify the needed IF */
2308 ctl->demod = XC3028_FE_DEFAULT;
2309 break;
2310 case EM2883_BOARD_KWORLD_HYBRID_330U:
2311 case EM2882_BOARD_DIKOM_DK300:
2312 case EM2882_BOARD_KWORLD_VS_DVBT:
2313 ctl->demod = XC3028_FE_CHINA;
2314 ctl->fname = XC2028_DEFAULT_FIRMWARE;
2315 break;
2316 case EM2882_BOARD_EVGA_INDTUBE:
2317 ctl->demod = XC3028_FE_CHINA;
2318 ctl->fname = XC3028L_DEFAULT_FIRMWARE;
2319 break;
2320 default:
2321 ctl->demod = XC3028_FE_OREN538;
2325 static void em28xx_tuner_setup(struct em28xx *dev)
2327 struct tuner_setup tun_setup;
2328 struct v4l2_frequency f;
2330 if (dev->tuner_type == TUNER_ABSENT)
2331 return;
2333 memset(&tun_setup, 0, sizeof(tun_setup));
2335 tun_setup.mode_mask = T_ANALOG_TV | T_RADIO;
2336 tun_setup.tuner_callback = em28xx_tuner_callback;
2338 if (dev->board.radio.type) {
2339 tun_setup.type = dev->board.radio.type;
2340 tun_setup.addr = dev->board.radio_addr;
2342 v4l2_device_call_all(&dev->v4l2_dev, 0, tuner, s_type_addr, &tun_setup);
2345 if ((dev->tuner_type != TUNER_ABSENT) && (dev->tuner_type)) {
2346 tun_setup.type = dev->tuner_type;
2347 tun_setup.addr = dev->tuner_addr;
2349 v4l2_device_call_all(&dev->v4l2_dev, 0, tuner, s_type_addr, &tun_setup);
2352 if (dev->tda9887_conf) {
2353 struct v4l2_priv_tun_config tda9887_cfg;
2355 tda9887_cfg.tuner = TUNER_TDA9887;
2356 tda9887_cfg.priv = &dev->tda9887_conf;
2358 v4l2_device_call_all(&dev->v4l2_dev, 0, tuner, s_config, &tda9887_cfg);
2361 if (dev->tuner_type == TUNER_XC2028) {
2362 struct v4l2_priv_tun_config xc2028_cfg;
2363 struct xc2028_ctrl ctl;
2365 memset(&xc2028_cfg, 0, sizeof(xc2028_cfg));
2366 memset(&ctl, 0, sizeof(ctl));
2368 em28xx_setup_xc3028(dev, &ctl);
2370 xc2028_cfg.tuner = TUNER_XC2028;
2371 xc2028_cfg.priv = &ctl;
2373 v4l2_device_call_all(&dev->v4l2_dev, 0, tuner, s_config, &xc2028_cfg);
2376 /* configure tuner */
2377 f.tuner = 0;
2378 f.type = V4L2_TUNER_ANALOG_TV;
2379 f.frequency = 9076; /* just a magic number */
2380 dev->ctl_freq = f.frequency;
2381 v4l2_device_call_all(&dev->v4l2_dev, 0, tuner, s_frequency, &f);
2384 static int em28xx_hint_board(struct em28xx *dev)
2386 int i;
2388 /* HINT method: EEPROM
2390 * This method works only for boards with eeprom.
2391 * Uses a hash of all eeprom bytes. The hash should be
2392 * unique for a vendor/tuner pair.
2393 * There are a high chance that tuners for different
2394 * video standards produce different hashes.
2396 for (i = 0; i < ARRAY_SIZE(em28xx_eeprom_hash); i++) {
2397 if (dev->hash == em28xx_eeprom_hash[i].hash) {
2398 dev->model = em28xx_eeprom_hash[i].model;
2399 dev->tuner_type = em28xx_eeprom_hash[i].tuner;
2401 em28xx_errdev("Your board has no unique USB ID.\n");
2402 em28xx_errdev("A hint were successfully done, "
2403 "based on eeprom hash.\n");
2404 em28xx_errdev("This method is not 100%% failproof.\n");
2405 em28xx_errdev("If the board were missdetected, "
2406 "please email this log to:\n");
2407 em28xx_errdev("\tV4L Mailing List "
2408 " <linux-media@vger.kernel.org>\n");
2409 em28xx_errdev("Board detected as %s\n",
2410 em28xx_boards[dev->model].name);
2412 return 0;
2416 /* HINT method: I2C attached devices
2418 * This method works for all boards.
2419 * Uses a hash of i2c scanned devices.
2420 * Devices with the same i2c attached chips will
2421 * be considered equal.
2422 * This method is less precise than the eeprom one.
2425 /* user did not request i2c scanning => do it now */
2426 if (!dev->i2c_hash)
2427 em28xx_do_i2c_scan(dev);
2429 for (i = 0; i < ARRAY_SIZE(em28xx_i2c_hash); i++) {
2430 if (dev->i2c_hash == em28xx_i2c_hash[i].hash) {
2431 dev->model = em28xx_i2c_hash[i].model;
2432 dev->tuner_type = em28xx_i2c_hash[i].tuner;
2433 em28xx_errdev("Your board has no unique USB ID.\n");
2434 em28xx_errdev("A hint were successfully done, "
2435 "based on i2c devicelist hash.\n");
2436 em28xx_errdev("This method is not 100%% failproof.\n");
2437 em28xx_errdev("If the board were missdetected, "
2438 "please email this log to:\n");
2439 em28xx_errdev("\tV4L Mailing List "
2440 " <linux-media@vger.kernel.org>\n");
2441 em28xx_errdev("Board detected as %s\n",
2442 em28xx_boards[dev->model].name);
2444 return 0;
2448 em28xx_errdev("Your board has no unique USB ID and thus need a "
2449 "hint to be detected.\n");
2450 em28xx_errdev("You may try to use card=<n> insmod option to "
2451 "workaround that.\n");
2452 em28xx_errdev("Please send an email with this log to:\n");
2453 em28xx_errdev("\tV4L Mailing List <linux-media@vger.kernel.org>\n");
2454 em28xx_errdev("Board eeprom hash is 0x%08lx\n", dev->hash);
2455 em28xx_errdev("Board i2c devicelist hash is 0x%08lx\n", dev->i2c_hash);
2457 em28xx_errdev("Here is a list of valid choices for the card=<n>"
2458 " insmod option:\n");
2459 for (i = 0; i < em28xx_bcount; i++) {
2460 em28xx_errdev(" card=%d -> %s\n",
2461 i, em28xx_boards[i].name);
2463 return -1;
2466 /* ----------------------------------------------------------------------- */
2467 void em28xx_register_i2c_ir(struct em28xx *dev)
2469 /* Leadtek winfast tv USBII deluxe can find a non working IR-device */
2470 /* at address 0x18, so if that address is needed for another board in */
2471 /* the future, please put it after 0x1f. */
2472 struct i2c_board_info info;
2473 const unsigned short addr_list[] = {
2474 0x1f, 0x30, 0x47, I2C_CLIENT_END
2477 if (disable_ir)
2478 return;
2480 memset(&info, 0, sizeof(struct i2c_board_info));
2481 memset(&dev->init_data, 0, sizeof(dev->init_data));
2482 strlcpy(info.type, "ir_video", I2C_NAME_SIZE);
2484 /* detect & configure */
2485 switch (dev->model) {
2486 case EM2800_BOARD_TERRATEC_CINERGY_200:
2487 case EM2820_BOARD_TERRATEC_CINERGY_250:
2488 dev->init_data.ir_codes = RC_MAP_EM_TERRATEC;
2489 dev->init_data.get_key = em28xx_get_key_terratec;
2490 dev->init_data.name = "i2c IR (EM28XX Terratec)";
2491 break;
2492 case EM2820_BOARD_PINNACLE_USB_2:
2493 dev->init_data.ir_codes = RC_MAP_PINNACLE_GREY;
2494 dev->init_data.get_key = em28xx_get_key_pinnacle_usb_grey;
2495 dev->init_data.name = "i2c IR (EM28XX Pinnacle PCTV)";
2496 break;
2497 case EM2820_BOARD_HAUPPAUGE_WINTV_USB_2:
2498 dev->init_data.ir_codes = RC_MAP_HAUPPAUGE;
2499 dev->init_data.get_key = em28xx_get_key_em_haup;
2500 dev->init_data.name = "i2c IR (EM2840 Hauppauge)";
2501 break;
2502 case EM2820_BOARD_LEADTEK_WINFAST_USBII_DELUXE:
2503 dev->init_data.ir_codes = RC_MAP_WINFAST_USBII_DELUXE;
2504 dev->init_data.get_key = em28xx_get_key_winfast_usbii_deluxe;
2505 dev->init_data.name = "i2c IR (EM2820 Winfast TV USBII Deluxe)";
2506 break;
2509 if (dev->init_data.name)
2510 info.platform_data = &dev->init_data;
2511 i2c_new_probed_device(&dev->i2c_adap, &info, addr_list, NULL);
2514 void em28xx_card_setup(struct em28xx *dev)
2517 * If the device can be a webcam, seek for a sensor.
2518 * If sensor is not found, then it isn't a webcam.
2520 if (dev->board.is_webcam) {
2521 if (em28xx_hint_sensor(dev) < 0)
2522 dev->board.is_webcam = 0;
2523 else
2524 dev->progressive = 1;
2527 if (!dev->board.is_webcam) {
2528 switch (dev->model) {
2529 case EM2820_BOARD_UNKNOWN:
2530 case EM2800_BOARD_UNKNOWN:
2532 * The K-WORLD DVB-T 310U is detected as an MSI Digivox AD.
2534 * This occurs because they share identical USB vendor and
2535 * product IDs.
2537 * What we do here is look up the EEPROM hash of the K-WORLD
2538 * and if it is found then we decide that we do not have
2539 * a DIGIVOX and reset the device to the K-WORLD instead.
2541 * This solution is only valid if they do not share eeprom
2542 * hash identities which has not been determined as yet.
2544 if (em28xx_hint_board(dev) < 0)
2545 em28xx_errdev("Board not discovered\n");
2546 else {
2547 em28xx_set_model(dev);
2548 em28xx_pre_card_setup(dev);
2550 break;
2551 default:
2552 em28xx_set_model(dev);
2556 em28xx_info("Identified as %s (card=%d)\n",
2557 dev->board.name, dev->model);
2559 dev->tuner_type = em28xx_boards[dev->model].tuner_type;
2560 if (em28xx_boards[dev->model].tuner_addr)
2561 dev->tuner_addr = em28xx_boards[dev->model].tuner_addr;
2563 if (em28xx_boards[dev->model].tda9887_conf)
2564 dev->tda9887_conf = em28xx_boards[dev->model].tda9887_conf;
2566 /* request some modules */
2567 switch (dev->model) {
2568 case EM2820_BOARD_HAUPPAUGE_WINTV_USB_2:
2569 case EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900:
2570 case EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900_R2:
2571 case EM2883_BOARD_HAUPPAUGE_WINTV_HVR_850:
2572 case EM2883_BOARD_HAUPPAUGE_WINTV_HVR_950:
2574 struct tveeprom tv;
2575 #if defined(CONFIG_MODULES) && defined(MODULE)
2576 request_module("tveeprom");
2577 #endif
2578 /* Call first TVeeprom */
2580 dev->i2c_client.addr = 0xa0 >> 1;
2581 tveeprom_hauppauge_analog(&dev->i2c_client, &tv, dev->eedata);
2583 dev->tuner_type = tv.tuner_type;
2585 if (tv.audio_processor == V4L2_IDENT_MSPX4XX) {
2586 dev->i2s_speed = 2048000;
2587 dev->board.has_msp34xx = 1;
2589 break;
2591 case EM2882_BOARD_KWORLD_ATSC_315U:
2592 em28xx_write_reg(dev, 0x0d, 0x42);
2593 msleep(10);
2594 em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xfd);
2595 msleep(10);
2596 break;
2597 case EM2820_BOARD_KWORLD_PVRTV2800RF:
2598 /* GPIO enables sound on KWORLD PVR TV 2800RF */
2599 em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xf9);
2600 break;
2601 case EM2820_BOARD_UNKNOWN:
2602 case EM2800_BOARD_UNKNOWN:
2604 * The K-WORLD DVB-T 310U is detected as an MSI Digivox AD.
2606 * This occurs because they share identical USB vendor and
2607 * product IDs.
2609 * What we do here is look up the EEPROM hash of the K-WORLD
2610 * and if it is found then we decide that we do not have
2611 * a DIGIVOX and reset the device to the K-WORLD instead.
2613 * This solution is only valid if they do not share eeprom
2614 * hash identities which has not been determined as yet.
2616 case EM2880_BOARD_MSI_DIGIVOX_AD:
2617 if (!em28xx_hint_board(dev))
2618 em28xx_set_model(dev);
2620 /* In cases where we had to use a board hint, the call to
2621 em28xx_set_mode() in em28xx_pre_card_setup() was a no-op,
2622 so make the call now so the analog GPIOs are set properly
2623 before probing the i2c bus. */
2624 em28xx_gpio_set(dev, dev->board.tuner_gpio);
2625 em28xx_set_mode(dev, EM28XX_ANALOG_MODE);
2626 break;
2629 * The Dikom DK300 is detected as an Kworld VS-DVB-T 323UR.
2631 * This occurs because they share identical USB vendor and
2632 * product IDs.
2634 * What we do here is look up the EEPROM hash of the Dikom
2635 * and if it is found then we decide that we do not have
2636 * a Kworld and reset the device to the Dikom instead.
2638 * This solution is only valid if they do not share eeprom
2639 * hash identities which has not been determined as yet.
2641 case EM2882_BOARD_KWORLD_VS_DVBT:
2642 if (!em28xx_hint_board(dev))
2643 em28xx_set_model(dev);
2645 /* In cases where we had to use a board hint, the call to
2646 em28xx_set_mode() in em28xx_pre_card_setup() was a no-op,
2647 so make the call now so the analog GPIOs are set properly
2648 before probing the i2c bus. */
2649 em28xx_gpio_set(dev, dev->board.tuner_gpio);
2650 em28xx_set_mode(dev, EM28XX_ANALOG_MODE);
2651 break;
2654 #if defined(CONFIG_MODULES) && defined(MODULE)
2655 if (dev->board.has_ir_i2c && !disable_ir)
2656 request_module("ir-kbd-i2c");
2657 #endif
2658 if (dev->board.has_snapshot_button)
2659 em28xx_register_snapshot_button(dev);
2661 if (dev->board.valid == EM28XX_BOARD_NOT_VALIDATED) {
2662 em28xx_errdev("\n\n");
2663 em28xx_errdev("The support for this board weren't "
2664 "valid yet.\n");
2665 em28xx_errdev("Please send a report of having this working\n");
2666 em28xx_errdev("not to V4L mailing list (and/or to other "
2667 "addresses)\n\n");
2670 /* Allow override tuner type by a module parameter */
2671 if (tuner >= 0)
2672 dev->tuner_type = tuner;
2674 /* request some modules */
2675 if (dev->board.has_msp34xx)
2676 v4l2_i2c_new_subdev(&dev->v4l2_dev, &dev->i2c_adap,
2677 "msp3400", 0, msp3400_addrs);
2679 if (dev->board.decoder == EM28XX_SAA711X)
2680 v4l2_i2c_new_subdev(&dev->v4l2_dev, &dev->i2c_adap,
2681 "saa7115_auto", 0, saa711x_addrs);
2683 if (dev->board.decoder == EM28XX_TVP5150)
2684 v4l2_i2c_new_subdev(&dev->v4l2_dev, &dev->i2c_adap,
2685 "tvp5150", 0, tvp5150_addrs);
2687 if (dev->em28xx_sensor == EM28XX_MT9V011) {
2688 struct mt9v011_platform_data pdata;
2689 struct i2c_board_info mt9v011_info = {
2690 .type = "mt9v011",
2691 .addr = 0xba >> 1,
2692 .platform_data = &pdata,
2695 pdata.xtal = dev->sensor_xtal;
2696 v4l2_i2c_new_subdev_board(&dev->v4l2_dev, &dev->i2c_adap,
2697 &mt9v011_info, NULL);
2701 if (dev->board.adecoder == EM28XX_TVAUDIO)
2702 v4l2_i2c_new_subdev(&dev->v4l2_dev, &dev->i2c_adap,
2703 "tvaudio", dev->board.tvaudio_addr, NULL);
2705 if (dev->board.tuner_type != TUNER_ABSENT) {
2706 int has_demod = (dev->tda9887_conf & TDA9887_PRESENT);
2708 if (dev->board.radio.type)
2709 v4l2_i2c_new_subdev(&dev->v4l2_dev, &dev->i2c_adap,
2710 "tuner", dev->board.radio_addr, NULL);
2712 if (has_demod)
2713 v4l2_i2c_new_subdev(&dev->v4l2_dev,
2714 &dev->i2c_adap, "tuner",
2715 0, v4l2_i2c_tuner_addrs(ADDRS_DEMOD));
2716 if (dev->tuner_addr == 0) {
2717 enum v4l2_i2c_tuner_type type =
2718 has_demod ? ADDRS_TV_WITH_DEMOD : ADDRS_TV;
2719 struct v4l2_subdev *sd;
2721 sd = v4l2_i2c_new_subdev(&dev->v4l2_dev,
2722 &dev->i2c_adap, "tuner",
2723 0, v4l2_i2c_tuner_addrs(type));
2725 if (sd)
2726 dev->tuner_addr = v4l2_i2c_subdev_addr(sd);
2727 } else {
2728 v4l2_i2c_new_subdev(&dev->v4l2_dev, &dev->i2c_adap,
2729 "tuner", dev->tuner_addr, NULL);
2733 em28xx_tuner_setup(dev);
2735 if(!disable_ir)
2736 em28xx_ir_init(dev);
2740 #if defined(CONFIG_MODULES) && defined(MODULE)
2741 static void request_module_async(struct work_struct *work)
2743 struct em28xx *dev = container_of(work,
2744 struct em28xx, request_module_wk);
2746 if (dev->has_audio_class)
2747 request_module("snd-usb-audio");
2748 else if (dev->has_alsa_audio)
2749 request_module("em28xx-alsa");
2751 if (dev->board.has_dvb)
2752 request_module("em28xx-dvb");
2755 static void request_modules(struct em28xx *dev)
2757 INIT_WORK(&dev->request_module_wk, request_module_async);
2758 schedule_work(&dev->request_module_wk);
2761 static void flush_request_modules(struct em28xx *dev)
2763 flush_work_sync(&dev->request_module_wk);
2765 #else
2766 #define request_modules(dev)
2767 #define flush_request_modules(dev)
2768 #endif /* CONFIG_MODULES */
2771 * em28xx_realease_resources()
2772 * unregisters the v4l2,i2c and usb devices
2773 * called when the device gets disconected or at module unload
2775 void em28xx_release_resources(struct em28xx *dev)
2777 if (dev->sbutton_input_dev)
2778 em28xx_deregister_snapshot_button(dev);
2780 if (dev->ir)
2781 em28xx_ir_fini(dev);
2783 /*FIXME: I2C IR should be disconnected */
2785 em28xx_release_analog_resources(dev);
2787 em28xx_remove_from_devlist(dev);
2789 em28xx_i2c_unregister(dev);
2791 v4l2_device_unregister(&dev->v4l2_dev);
2793 usb_put_dev(dev->udev);
2795 /* Mark device as unused */
2796 em28xx_devused &= ~(1 << dev->devno);
2800 * em28xx_init_dev()
2801 * allocates and inits the device structs, registers i2c bus and v4l device
2803 static int em28xx_init_dev(struct em28xx **devhandle, struct usb_device *udev,
2804 struct usb_interface *interface,
2805 int minor)
2807 struct em28xx *dev = *devhandle;
2808 int retval;
2809 int errCode;
2811 dev->udev = udev;
2812 mutex_init(&dev->ctrl_urb_lock);
2813 spin_lock_init(&dev->slock);
2814 init_waitqueue_head(&dev->open);
2815 init_waitqueue_head(&dev->wait_frame);
2816 init_waitqueue_head(&dev->wait_stream);
2818 dev->em28xx_write_regs = em28xx_write_regs;
2819 dev->em28xx_read_reg = em28xx_read_reg;
2820 dev->em28xx_read_reg_req_len = em28xx_read_reg_req_len;
2821 dev->em28xx_write_regs_req = em28xx_write_regs_req;
2822 dev->em28xx_read_reg_req = em28xx_read_reg_req;
2823 dev->board.is_em2800 = em28xx_boards[dev->model].is_em2800;
2825 em28xx_set_model(dev);
2827 /* Set the default GPO/GPIO for legacy devices */
2828 dev->reg_gpo_num = EM2880_R04_GPO;
2829 dev->reg_gpio_num = EM28XX_R08_GPIO;
2831 dev->wait_after_write = 5;
2833 /* Based on the Chip ID, set the device configuration */
2834 retval = em28xx_read_reg(dev, EM28XX_R0A_CHIPID);
2835 if (retval > 0) {
2836 dev->chip_id = retval;
2838 switch (dev->chip_id) {
2839 case CHIP_ID_EM2800:
2840 em28xx_info("chip ID is em2800\n");
2841 break;
2842 case CHIP_ID_EM2710:
2843 em28xx_info("chip ID is em2710\n");
2844 break;
2845 case CHIP_ID_EM2750:
2846 em28xx_info("chip ID is em2750\n");
2847 break;
2848 case CHIP_ID_EM2820:
2849 em28xx_info("chip ID is em2820 (or em2710)\n");
2850 break;
2851 case CHIP_ID_EM2840:
2852 em28xx_info("chip ID is em2840\n");
2853 break;
2854 case CHIP_ID_EM2860:
2855 em28xx_info("chip ID is em2860\n");
2856 break;
2857 case CHIP_ID_EM2870:
2858 em28xx_info("chip ID is em2870\n");
2859 dev->wait_after_write = 0;
2860 break;
2861 case CHIP_ID_EM2874:
2862 em28xx_info("chip ID is em2874\n");
2863 dev->reg_gpio_num = EM2874_R80_GPIO;
2864 dev->wait_after_write = 0;
2865 break;
2866 case CHIP_ID_EM28174:
2867 em28xx_info("chip ID is em28174\n");
2868 dev->reg_gpio_num = EM2874_R80_GPIO;
2869 dev->wait_after_write = 0;
2870 break;
2871 case CHIP_ID_EM2883:
2872 em28xx_info("chip ID is em2882/em2883\n");
2873 dev->wait_after_write = 0;
2874 break;
2875 case CHIP_ID_EM2884:
2876 em28xx_info("chip ID is em2884\n");
2877 dev->reg_gpio_num = EM2874_R80_GPIO;
2878 dev->wait_after_write = 0;
2879 break;
2880 default:
2881 em28xx_info("em28xx chip ID = %d\n", dev->chip_id);
2885 if (dev->is_audio_only) {
2886 errCode = em28xx_audio_setup(dev);
2887 if (errCode)
2888 return -ENODEV;
2889 em28xx_add_into_devlist(dev);
2890 em28xx_init_extension(dev);
2892 return 0;
2895 /* Prepopulate cached GPO register content */
2896 retval = em28xx_read_reg(dev, dev->reg_gpo_num);
2897 if (retval >= 0)
2898 dev->reg_gpo = retval;
2900 em28xx_pre_card_setup(dev);
2902 if (!dev->board.is_em2800) {
2903 /* Resets I2C speed */
2904 em28xx_write_reg(dev, EM28XX_R06_I2C_CLK, dev->board.i2c_speed);
2905 if (retval < 0) {
2906 em28xx_errdev("%s: em28xx_write_regs_req failed!"
2907 " retval [%d]\n",
2908 __func__, retval);
2909 return retval;
2913 retval = v4l2_device_register(&interface->dev, &dev->v4l2_dev);
2914 if (retval < 0) {
2915 em28xx_errdev("Call to v4l2_device_register() failed!\n");
2916 return retval;
2919 /* register i2c bus */
2920 errCode = em28xx_i2c_register(dev);
2921 if (errCode < 0) {
2922 v4l2_device_unregister(&dev->v4l2_dev);
2923 em28xx_errdev("%s: em28xx_i2c_register - errCode [%d]!\n",
2924 __func__, errCode);
2925 return errCode;
2929 * Default format, used for tvp5150 or saa711x output formats
2931 dev->vinmode = 0x10;
2932 dev->vinctl = EM28XX_VINCTRL_INTERLACED |
2933 EM28XX_VINCTRL_CCIR656_ENABLE;
2935 /* Do board specific init and eeprom reading */
2936 em28xx_card_setup(dev);
2938 /* Configure audio */
2939 errCode = em28xx_audio_setup(dev);
2940 if (errCode < 0) {
2941 v4l2_device_unregister(&dev->v4l2_dev);
2942 em28xx_errdev("%s: Error while setting audio - errCode [%d]!\n",
2943 __func__, errCode);
2946 /* wake i2c devices */
2947 em28xx_wake_i2c(dev);
2949 /* init video dma queues */
2950 INIT_LIST_HEAD(&dev->vidq.active);
2951 INIT_LIST_HEAD(&dev->vidq.queued);
2952 INIT_LIST_HEAD(&dev->vbiq.active);
2953 INIT_LIST_HEAD(&dev->vbiq.queued);
2955 if (dev->board.has_msp34xx) {
2956 /* Send a reset to other chips via gpio */
2957 errCode = em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xf7);
2958 if (errCode < 0) {
2959 em28xx_errdev("%s: em28xx_write_regs_req - "
2960 "msp34xx(1) failed! errCode [%d]\n",
2961 __func__, errCode);
2962 return errCode;
2964 msleep(3);
2966 errCode = em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xff);
2967 if (errCode < 0) {
2968 em28xx_errdev("%s: em28xx_write_regs_req - "
2969 "msp34xx(2) failed! errCode [%d]\n",
2970 __func__, errCode);
2971 return errCode;
2973 msleep(3);
2976 em28xx_add_into_devlist(dev);
2978 retval = em28xx_register_analog_devices(dev);
2979 if (retval < 0) {
2980 em28xx_release_resources(dev);
2981 goto fail_reg_devices;
2984 em28xx_init_extension(dev);
2986 /* Save some power by putting tuner to sleep */
2987 v4l2_device_call_all(&dev->v4l2_dev, 0, core, s_power, 0);
2989 return 0;
2991 fail_reg_devices:
2992 return retval;
2995 /* high bandwidth multiplier, as encoded in highspeed endpoint descriptors */
2996 #define hb_mult(wMaxPacketSize) (1 + (((wMaxPacketSize) >> 11) & 0x03))
2999 * em28xx_usb_probe()
3000 * checks for supported devices
3002 static int em28xx_usb_probe(struct usb_interface *interface,
3003 const struct usb_device_id *id)
3005 const struct usb_endpoint_descriptor *endpoint;
3006 struct usb_device *udev;
3007 struct em28xx *dev = NULL;
3008 int retval;
3009 bool is_audio_only = false, has_audio = false;
3010 int i, nr, isoc_pipe;
3011 const int ifnum = interface->altsetting[0].desc.bInterfaceNumber;
3012 char *speed;
3013 char descr[255] = "";
3015 udev = usb_get_dev(interface_to_usbdev(interface));
3017 /* Check to see next free device and mark as used */
3018 nr = find_first_zero_bit(&em28xx_devused, EM28XX_MAXBOARDS);
3019 em28xx_devused |= 1<<nr;
3021 /* Don't register audio interfaces */
3022 if (interface->altsetting[0].desc.bInterfaceClass == USB_CLASS_AUDIO) {
3023 em28xx_err(DRIVER_NAME " audio device (%04x:%04x): "
3024 "interface %i, class %i\n",
3025 le16_to_cpu(udev->descriptor.idVendor),
3026 le16_to_cpu(udev->descriptor.idProduct),
3027 ifnum,
3028 interface->altsetting[0].desc.bInterfaceClass);
3030 em28xx_devused &= ~(1<<nr);
3031 retval = -ENODEV;
3032 goto err;
3035 /* Get endpoints */
3036 for (i = 0; i < interface->num_altsetting; i++) {
3037 int ep;
3039 for (ep = 0; ep < interface->altsetting[i].desc.bNumEndpoints; ep++) {
3040 struct usb_host_endpoint *e;
3041 e = &interface->altsetting[i].endpoint[ep];
3043 if (e->desc.bEndpointAddress == 0x83)
3044 has_audio = true;
3048 endpoint = &interface->cur_altsetting->endpoint[0].desc;
3050 /* check if the device has the iso in endpoint at the correct place */
3051 if (usb_endpoint_xfer_isoc(endpoint)
3053 (interface->altsetting[1].endpoint[0].desc.wMaxPacketSize == 940)) {
3054 /* It's a newer em2874/em2875 device */
3055 isoc_pipe = 0;
3056 } else {
3057 int check_interface = 1;
3058 isoc_pipe = 1;
3059 endpoint = &interface->cur_altsetting->endpoint[1].desc;
3060 if (!usb_endpoint_xfer_isoc(endpoint))
3061 check_interface = 0;
3063 if (usb_endpoint_dir_out(endpoint))
3064 check_interface = 0;
3066 if (!check_interface) {
3067 if (has_audio) {
3068 is_audio_only = true;
3069 } else {
3070 em28xx_err(DRIVER_NAME " video device (%04x:%04x): "
3071 "interface %i, class %i found.\n",
3072 le16_to_cpu(udev->descriptor.idVendor),
3073 le16_to_cpu(udev->descriptor.idProduct),
3074 ifnum,
3075 interface->altsetting[0].desc.bInterfaceClass);
3076 em28xx_err(DRIVER_NAME " This is an anciliary "
3077 "interface not used by the driver\n");
3079 em28xx_devused &= ~(1<<nr);
3080 retval = -ENODEV;
3081 goto err;
3086 switch (udev->speed) {
3087 case USB_SPEED_LOW:
3088 speed = "1.5";
3089 break;
3090 case USB_SPEED_UNKNOWN:
3091 case USB_SPEED_FULL:
3092 speed = "12";
3093 break;
3094 case USB_SPEED_HIGH:
3095 speed = "480";
3096 break;
3097 default:
3098 speed = "unknown";
3101 if (udev->manufacturer)
3102 strlcpy(descr, udev->manufacturer, sizeof(descr));
3104 if (udev->product) {
3105 if (*descr)
3106 strlcat(descr, " ", sizeof(descr));
3107 strlcat(descr, udev->product, sizeof(descr));
3109 if (*descr)
3110 strlcat(descr, " ", sizeof(descr));
3112 printk(KERN_INFO DRIVER_NAME
3113 ": New device %s@ %s Mbps (%04x:%04x, interface %d, class %d)\n",
3114 descr,
3115 speed,
3116 le16_to_cpu(udev->descriptor.idVendor),
3117 le16_to_cpu(udev->descriptor.idProduct),
3118 ifnum,
3119 interface->altsetting->desc.bInterfaceNumber);
3121 if (has_audio)
3122 printk(KERN_INFO DRIVER_NAME
3123 ": Audio Vendor Class interface %i found\n",
3124 ifnum);
3127 * Make sure we have 480 Mbps of bandwidth, otherwise things like
3128 * video stream wouldn't likely work, since 12 Mbps is generally
3129 * not enough even for most Digital TV streams.
3131 if (udev->speed != USB_SPEED_HIGH && disable_usb_speed_check == 0) {
3132 printk(DRIVER_NAME ": Device initialization failed.\n");
3133 printk(DRIVER_NAME ": Device must be connected to a high-speed"
3134 " USB 2.0 port.\n");
3135 em28xx_devused &= ~(1<<nr);
3136 retval = -ENODEV;
3137 goto err;
3140 if (nr >= EM28XX_MAXBOARDS) {
3141 printk(DRIVER_NAME ": Supports only %i em28xx boards.\n",
3142 EM28XX_MAXBOARDS);
3143 em28xx_devused &= ~(1<<nr);
3144 retval = -ENOMEM;
3145 goto err;
3148 /* allocate memory for our device state and initialize it */
3149 dev = kzalloc(sizeof(*dev), GFP_KERNEL);
3150 if (dev == NULL) {
3151 em28xx_err(DRIVER_NAME ": out of memory!\n");
3152 em28xx_devused &= ~(1<<nr);
3153 retval = -ENOMEM;
3154 goto err;
3157 snprintf(dev->name, 29, "em28xx #%d", nr);
3158 dev->devno = nr;
3159 dev->model = id->driver_info;
3160 dev->alt = -1;
3161 dev->is_audio_only = is_audio_only;
3162 dev->has_alsa_audio = has_audio;
3163 dev->audio_ifnum = ifnum;
3165 /* Checks if audio is provided by some interface */
3166 for (i = 0; i < udev->config->desc.bNumInterfaces; i++) {
3167 struct usb_interface *uif = udev->config->interface[i];
3168 if (uif->altsetting[0].desc.bInterfaceClass == USB_CLASS_AUDIO) {
3169 dev->has_audio_class = 1;
3170 break;
3174 /* compute alternate max packet sizes */
3175 dev->num_alt = interface->num_altsetting;
3176 dev->alt_max_pkt_size = kmalloc(32 * dev->num_alt, GFP_KERNEL);
3178 if (dev->alt_max_pkt_size == NULL) {
3179 em28xx_errdev("out of memory!\n");
3180 em28xx_devused &= ~(1<<nr);
3181 kfree(dev);
3182 retval = -ENOMEM;
3183 goto err;
3186 for (i = 0; i < dev->num_alt ; i++) {
3187 u16 tmp = le16_to_cpu(interface->altsetting[i].endpoint[isoc_pipe].desc.wMaxPacketSize);
3188 unsigned int size = tmp & 0x7ff;
3190 if (udev->speed == USB_SPEED_HIGH)
3191 size = size * hb_mult(tmp);
3193 dev->alt_max_pkt_size[i] = size;
3196 if ((card[nr] >= 0) && (card[nr] < em28xx_bcount))
3197 dev->model = card[nr];
3199 /* save our data pointer in this interface device */
3200 usb_set_intfdata(interface, dev);
3202 /* allocate device struct */
3203 mutex_init(&dev->lock);
3204 mutex_lock(&dev->lock);
3205 retval = em28xx_init_dev(&dev, udev, interface, nr);
3206 if (retval) {
3207 em28xx_devused &= ~(1<<dev->devno);
3208 mutex_unlock(&dev->lock);
3209 kfree(dev);
3210 goto err;
3213 request_modules(dev);
3215 /* Should be the last thing to do, to avoid newer udev's to
3216 open the device before fully initializing it
3218 mutex_unlock(&dev->lock);
3220 return 0;
3222 err:
3223 return retval;
3227 * em28xx_usb_disconnect()
3228 * called when the device gets diconencted
3229 * video device will be unregistered on v4l2_close in case it is still open
3231 static void em28xx_usb_disconnect(struct usb_interface *interface)
3233 struct em28xx *dev;
3235 dev = usb_get_intfdata(interface);
3236 usb_set_intfdata(interface, NULL);
3238 if (!dev)
3239 return;
3241 if (dev->is_audio_only) {
3242 mutex_lock(&dev->lock);
3243 em28xx_close_extension(dev);
3244 mutex_unlock(&dev->lock);
3245 return;
3248 em28xx_info("disconnecting %s\n", dev->vdev->name);
3250 flush_request_modules(dev);
3252 /* wait until all current v4l2 io is finished then deallocate
3253 resources */
3254 mutex_lock(&dev->lock);
3256 wake_up_interruptible_all(&dev->open);
3258 v4l2_device_disconnect(&dev->v4l2_dev);
3260 if (dev->users) {
3261 em28xx_warn
3262 ("device %s is open! Deregistration and memory "
3263 "deallocation are deferred on close.\n",
3264 video_device_node_name(dev->vdev));
3266 dev->state |= DEV_MISCONFIGURED;
3267 em28xx_uninit_isoc(dev);
3268 dev->state |= DEV_DISCONNECTED;
3269 wake_up_interruptible(&dev->wait_frame);
3270 wake_up_interruptible(&dev->wait_stream);
3271 } else {
3272 dev->state |= DEV_DISCONNECTED;
3273 em28xx_release_resources(dev);
3276 em28xx_close_extension(dev);
3278 mutex_unlock(&dev->lock);
3280 if (!dev->users) {
3281 kfree(dev->alt_max_pkt_size);
3282 kfree(dev);
3286 static struct usb_driver em28xx_usb_driver = {
3287 .name = "em28xx",
3288 .probe = em28xx_usb_probe,
3289 .disconnect = em28xx_usb_disconnect,
3290 .id_table = em28xx_id_table,
3293 static int __init em28xx_module_init(void)
3295 int result;
3297 /* register this driver with the USB subsystem */
3298 result = usb_register(&em28xx_usb_driver);
3299 if (result)
3300 em28xx_err(DRIVER_NAME
3301 " usb_register failed. Error number %d.\n", result);
3303 printk(KERN_INFO DRIVER_NAME " driver loaded\n");
3305 return result;
3308 static void __exit em28xx_module_exit(void)
3310 /* deregister this driver with the USB subsystem */
3311 usb_deregister(&em28xx_usb_driver);
3314 module_init(em28xx_module_init);
3315 module_exit(em28xx_module_exit);