2 em28xx-cards.c - driver for Empia EM2800/EM2820/2840 USB
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>
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 - 1 */
64 static unsigned long em28xx_devused;
66 struct em28xx_hash_table {
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},
82 /* Reset for the most [digital] boards */
83 static struct em28xx_reg_seq default_digital[] = {
84 {EM28XX_R08_GPIO, 0x6e, ~EM_GPIO_4, 10},
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},
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},
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},
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},
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},
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},
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},
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},
152 GPIO0 - Enable digital power (s5h1409) - low to enable
153 GPIO1 - Enable analog power (tvp5150/emp202) - low to enable
157 static struct em28xx_reg_seq evga_indtube_analog[] = {
158 {EM28XX_R08_GPIO, 0x79, 0xff, 60},
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},
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},
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},
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},
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},
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},
210 /* eb1a:2868 Reddo DVB-C USB TV Box
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},
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},
233 static struct em28xx_reg_seq compro_unmute_tv_gpio[] = {
234 {EM28XX_R08_GPIO, 5, 7, 10},
238 static struct em28xx_reg_seq compro_unmute_svid_gpio[] = {
239 {EM28XX_R08_GPIO, 4, 7, 10},
243 static struct em28xx_reg_seq compro_mute_gpio[] = {
244 {EM28XX_R08_GPIO, 6, 7, 10},
249 static struct em28xx_reg_seq terratec_av350_mute_gpio[] = {
250 {EM28XX_R08_GPIO, 0xff, 0x7f, 10},
254 static struct em28xx_reg_seq terratec_av350_unmute_gpio[] = {
255 {EM28XX_R08_GPIO, 0xff, 0xff, 10},
259 static struct em28xx_reg_seq silvercrest_reg_seq[] = {
260 {EM28XX_R08_GPIO, 0xff, 0xff, 10},
261 {EM28XX_R08_GPIO, 0x01, 0xf7, 10},
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},
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},
279 /* Reset for the most [digital] boards */
280 static struct em28xx_reg_seq leadership_digital[] = {
281 {EM2874_R80_GPIO, 0x70, 0xff, 10},
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},
292 /* 2013:024f PCTV nanoStick T2 290e
293 * GPIO_6 - demod reset
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 */
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},
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},
320 /* 2013:024f PCTV DVB-S2 Stick 460e
323 * GPIO_2 - VUV_LNB (red LED)
325 * GPIO_4 - INT_DEM (DEMOD GPIO_0)
328 * GPIO_7 - LED (green LED)
330 static struct em28xx_reg_seq pctv_460e[] = {
331 {EM2874_R80_GPIO, 0x01, 0xff, 50},
332 {0x0d, 0xff, 0xff, 50},
333 {EM2874_R80_GPIO, 0x41, 0xff, 50}, /* GPIO_6=1 */
334 {0x0d, 0x42, 0xff, 50},
335 {EM2874_R80_GPIO, 0x61, 0xff, 50}, /* GPIO_5=1 */
342 struct em28xx_board em28xx_boards[] = {
343 [EM2750_BOARD_UNKNOWN] = {
344 .name = "EM2710/EM2750/EM2751 webcam grabber",
345 .xclk = EM28XX_XCLK_FREQUENCY_20MHZ,
346 .tuner_type = TUNER_ABSENT,
349 .type = EM28XX_VMUX_COMPOSITE1,
351 .amux = EM28XX_AMUX_VIDEO,
352 .gpio = silvercrest_reg_seq,
355 [EM2800_BOARD_UNKNOWN] = {
356 .name = "Unknown EM2800 video grabber",
358 .tda9887_conf = TDA9887_PRESENT,
359 .decoder = EM28XX_SAA711X,
360 .tuner_type = TUNER_ABSENT,
362 .type = EM28XX_VMUX_COMPOSITE1,
363 .vmux = SAA7115_COMPOSITE0,
364 .amux = EM28XX_AMUX_LINE_IN,
366 .type = EM28XX_VMUX_SVIDEO,
367 .vmux = SAA7115_SVIDEO3,
368 .amux = EM28XX_AMUX_LINE_IN,
371 [EM2820_BOARD_UNKNOWN] = {
372 .name = "Unknown EM2750/28xx video grabber",
373 .tuner_type = TUNER_ABSENT,
374 .is_webcam = 1, /* To enable sensor probe */
376 [EM2750_BOARD_DLCW_130] = {
377 /* Beijing Huaqi Information Digital Technology Co., Ltd */
378 .name = "Huaqi DLCW-130",
379 .valid = EM28XX_BOARD_NOT_VALIDATED,
380 .xclk = EM28XX_XCLK_FREQUENCY_48MHZ,
381 .tuner_type = TUNER_ABSENT,
384 .type = EM28XX_VMUX_COMPOSITE1,
386 .amux = EM28XX_AMUX_VIDEO,
389 [EM2820_BOARD_KWORLD_PVRTV2800RF] = {
390 .name = "Kworld PVR TV 2800 RF",
391 .tuner_type = TUNER_TEMIC_PAL,
392 .tda9887_conf = TDA9887_PRESENT,
393 .decoder = EM28XX_SAA711X,
395 .type = EM28XX_VMUX_COMPOSITE1,
396 .vmux = SAA7115_COMPOSITE0,
397 .amux = EM28XX_AMUX_LINE_IN,
399 .type = EM28XX_VMUX_SVIDEO,
400 .vmux = SAA7115_SVIDEO3,
401 .amux = EM28XX_AMUX_LINE_IN,
404 [EM2820_BOARD_GADMEI_TVR200] = {
405 .name = "Gadmei TVR200",
406 .tuner_type = TUNER_LG_PAL_NEW_TAPC,
407 .tda9887_conf = TDA9887_PRESENT,
408 .decoder = EM28XX_SAA711X,
410 .type = EM28XX_VMUX_TELEVISION,
411 .vmux = SAA7115_COMPOSITE2,
412 .amux = EM28XX_AMUX_LINE_IN,
414 .type = EM28XX_VMUX_COMPOSITE1,
415 .vmux = SAA7115_COMPOSITE0,
416 .amux = EM28XX_AMUX_LINE_IN,
418 .type = EM28XX_VMUX_SVIDEO,
419 .vmux = SAA7115_SVIDEO3,
420 .amux = EM28XX_AMUX_LINE_IN,
423 [EM2820_BOARD_TERRATEC_CINERGY_250] = {
424 .name = "Terratec Cinergy 250 USB",
425 .tuner_type = TUNER_LG_PAL_NEW_TAPC,
427 .tda9887_conf = TDA9887_PRESENT,
428 .decoder = EM28XX_SAA711X,
430 .type = EM28XX_VMUX_TELEVISION,
431 .vmux = SAA7115_COMPOSITE2,
432 .amux = EM28XX_AMUX_LINE_IN,
434 .type = EM28XX_VMUX_COMPOSITE1,
435 .vmux = SAA7115_COMPOSITE0,
436 .amux = EM28XX_AMUX_LINE_IN,
438 .type = EM28XX_VMUX_SVIDEO,
439 .vmux = SAA7115_SVIDEO3,
440 .amux = EM28XX_AMUX_LINE_IN,
443 [EM2820_BOARD_PINNACLE_USB_2] = {
444 .name = "Pinnacle PCTV USB 2",
445 .tuner_type = TUNER_LG_PAL_NEW_TAPC,
447 .tda9887_conf = TDA9887_PRESENT,
448 .decoder = EM28XX_SAA711X,
450 .type = EM28XX_VMUX_TELEVISION,
451 .vmux = SAA7115_COMPOSITE2,
452 .amux = EM28XX_AMUX_VIDEO,
454 .type = EM28XX_VMUX_COMPOSITE1,
455 .vmux = SAA7115_COMPOSITE0,
456 .amux = EM28XX_AMUX_LINE_IN,
458 .type = EM28XX_VMUX_SVIDEO,
459 .vmux = SAA7115_SVIDEO3,
460 .amux = EM28XX_AMUX_LINE_IN,
463 [EM2820_BOARD_HAUPPAUGE_WINTV_USB_2] = {
464 .name = "Hauppauge WinTV USB 2",
465 .tuner_type = TUNER_PHILIPS_FM1236_MK3,
466 .tda9887_conf = TDA9887_PRESENT |
467 TDA9887_PORT1_ACTIVE |
468 TDA9887_PORT2_ACTIVE,
469 .decoder = EM28XX_TVP5150,
473 .type = EM28XX_VMUX_TELEVISION,
474 .vmux = TVP5150_COMPOSITE0,
475 .amux = MSP_INPUT_DEFAULT,
477 .type = EM28XX_VMUX_SVIDEO,
478 .vmux = TVP5150_SVIDEO,
479 .amux = MSP_INPUT(MSP_IN_SCART1, MSP_IN_TUNER1,
480 MSP_DSP_IN_SCART, MSP_DSP_IN_SCART),
483 [EM2820_BOARD_DLINK_USB_TV] = {
484 .name = "D-Link DUB-T210 TV Tuner",
485 .valid = EM28XX_BOARD_NOT_VALIDATED,
486 .tuner_type = TUNER_LG_PAL_NEW_TAPC,
487 .tda9887_conf = TDA9887_PRESENT,
488 .decoder = EM28XX_SAA711X,
490 .type = EM28XX_VMUX_TELEVISION,
491 .vmux = SAA7115_COMPOSITE2,
492 .amux = EM28XX_AMUX_LINE_IN,
494 .type = EM28XX_VMUX_COMPOSITE1,
495 .vmux = SAA7115_COMPOSITE0,
496 .amux = EM28XX_AMUX_LINE_IN,
498 .type = EM28XX_VMUX_SVIDEO,
499 .vmux = SAA7115_SVIDEO3,
500 .amux = EM28XX_AMUX_LINE_IN,
503 [EM2820_BOARD_HERCULES_SMART_TV_USB2] = {
504 .name = "Hercules Smart TV USB 2.0",
505 .valid = EM28XX_BOARD_NOT_VALIDATED,
506 .tuner_type = TUNER_LG_PAL_NEW_TAPC,
507 .tda9887_conf = TDA9887_PRESENT,
508 .decoder = EM28XX_SAA711X,
510 .type = EM28XX_VMUX_TELEVISION,
511 .vmux = SAA7115_COMPOSITE2,
512 .amux = EM28XX_AMUX_LINE_IN,
514 .type = EM28XX_VMUX_COMPOSITE1,
515 .vmux = SAA7115_COMPOSITE0,
516 .amux = EM28XX_AMUX_LINE_IN,
518 .type = EM28XX_VMUX_SVIDEO,
519 .vmux = SAA7115_SVIDEO3,
520 .amux = EM28XX_AMUX_LINE_IN,
523 [EM2820_BOARD_PINNACLE_USB_2_FM1216ME] = {
524 .name = "Pinnacle PCTV USB 2 (Philips FM1216ME)",
525 .valid = EM28XX_BOARD_NOT_VALIDATED,
526 .tuner_type = TUNER_PHILIPS_FM1216ME_MK3,
527 .tda9887_conf = TDA9887_PRESENT,
528 .decoder = EM28XX_SAA711X,
530 .type = EM28XX_VMUX_TELEVISION,
531 .vmux = SAA7115_COMPOSITE2,
532 .amux = EM28XX_AMUX_VIDEO,
534 .type = EM28XX_VMUX_COMPOSITE1,
535 .vmux = SAA7115_COMPOSITE0,
536 .amux = EM28XX_AMUX_LINE_IN,
538 .type = EM28XX_VMUX_SVIDEO,
539 .vmux = SAA7115_SVIDEO3,
540 .amux = EM28XX_AMUX_LINE_IN,
543 [EM2820_BOARD_GADMEI_UTV310] = {
544 .name = "Gadmei UTV310",
545 .valid = EM28XX_BOARD_NOT_VALIDATED,
546 .tuner_type = TUNER_TNF_5335MF,
547 .tda9887_conf = TDA9887_PRESENT,
548 .decoder = EM28XX_SAA711X,
550 .type = EM28XX_VMUX_TELEVISION,
551 .vmux = SAA7115_COMPOSITE1,
552 .amux = EM28XX_AMUX_LINE_IN,
554 .type = EM28XX_VMUX_COMPOSITE1,
555 .vmux = SAA7115_COMPOSITE0,
556 .amux = EM28XX_AMUX_LINE_IN,
558 .type = EM28XX_VMUX_SVIDEO,
559 .vmux = SAA7115_SVIDEO3,
560 .amux = EM28XX_AMUX_LINE_IN,
563 [EM2820_BOARD_LEADTEK_WINFAST_USBII_DELUXE] = {
564 .name = "Leadtek Winfast USB II Deluxe",
565 .valid = EM28XX_BOARD_NOT_VALIDATED,
566 .tuner_type = TUNER_PHILIPS_FM1216ME_MK3,
568 .tvaudio_addr = 0x58,
569 .tda9887_conf = TDA9887_PRESENT |
570 TDA9887_PORT2_ACTIVE |
572 .decoder = EM28XX_SAA711X,
573 .adecoder = EM28XX_TVAUDIO,
575 .type = EM28XX_VMUX_TELEVISION,
576 .vmux = SAA7115_COMPOSITE4,
577 .amux = EM28XX_AMUX_AUX,
579 .type = EM28XX_VMUX_COMPOSITE1,
580 .vmux = SAA7115_COMPOSITE5,
581 .amux = EM28XX_AMUX_LINE_IN,
583 .type = EM28XX_VMUX_SVIDEO,
584 .vmux = SAA7115_SVIDEO3,
585 .amux = EM28XX_AMUX_LINE_IN,
588 .type = EM28XX_RADIO,
589 .amux = EM28XX_AMUX_AUX,
592 [EM2820_BOARD_VIDEOLOGY_20K14XUSB] = {
593 .name = "Videology 20K14XUSB USB2.0",
594 .valid = EM28XX_BOARD_NOT_VALIDATED,
595 .tuner_type = TUNER_ABSENT,
598 .type = EM28XX_VMUX_COMPOSITE1,
600 .amux = EM28XX_AMUX_VIDEO,
603 [EM2820_BOARD_SILVERCREST_WEBCAM] = {
604 .name = "Silvercrest Webcam 1.3mpix",
605 .tuner_type = TUNER_ABSENT,
608 .type = EM28XX_VMUX_COMPOSITE1,
610 .amux = EM28XX_AMUX_VIDEO,
611 .gpio = silvercrest_reg_seq,
614 [EM2821_BOARD_SUPERCOMP_USB_2] = {
615 .name = "Supercomp USB 2.0 TV",
616 .valid = EM28XX_BOARD_NOT_VALIDATED,
617 .tuner_type = TUNER_PHILIPS_FM1236_MK3,
618 .tda9887_conf = TDA9887_PRESENT |
619 TDA9887_PORT1_ACTIVE |
620 TDA9887_PORT2_ACTIVE,
621 .decoder = EM28XX_SAA711X,
623 .type = EM28XX_VMUX_TELEVISION,
624 .vmux = SAA7115_COMPOSITE2,
625 .amux = EM28XX_AMUX_LINE_IN,
627 .type = EM28XX_VMUX_COMPOSITE1,
628 .vmux = SAA7115_COMPOSITE0,
629 .amux = EM28XX_AMUX_VIDEO,
631 .type = EM28XX_VMUX_SVIDEO,
632 .vmux = SAA7115_SVIDEO3,
633 .amux = EM28XX_AMUX_LINE_IN,
636 [EM2821_BOARD_USBGEAR_VD204] = {
637 .name = "Usbgear VD204v9",
638 .valid = EM28XX_BOARD_NOT_VALIDATED,
639 .tuner_type = TUNER_ABSENT, /* Capture only device */
640 .decoder = EM28XX_SAA711X,
642 .type = EM28XX_VMUX_COMPOSITE1,
643 .vmux = SAA7115_COMPOSITE0,
644 .amux = EM28XX_AMUX_LINE_IN,
646 .type = EM28XX_VMUX_SVIDEO,
647 .vmux = SAA7115_SVIDEO3,
648 .amux = EM28XX_AMUX_LINE_IN,
651 [EM2860_BOARD_NETGMBH_CAM] = {
652 /* Beijing Huaqi Information Digital Technology Co., Ltd */
653 .name = "NetGMBH Cam",
654 .valid = EM28XX_BOARD_NOT_VALIDATED,
655 .tuner_type = TUNER_ABSENT,
658 .type = EM28XX_VMUX_COMPOSITE1,
660 .amux = EM28XX_AMUX_VIDEO,
663 [EM2860_BOARD_TYPHOON_DVD_MAKER] = {
664 .name = "Typhoon DVD Maker",
665 .decoder = EM28XX_SAA711X,
666 .tuner_type = TUNER_ABSENT, /* Capture only device */
668 .type = EM28XX_VMUX_COMPOSITE1,
669 .vmux = SAA7115_COMPOSITE0,
670 .amux = EM28XX_AMUX_LINE_IN,
672 .type = EM28XX_VMUX_SVIDEO,
673 .vmux = SAA7115_SVIDEO3,
674 .amux = EM28XX_AMUX_LINE_IN,
677 [EM2860_BOARD_GADMEI_UTV330] = {
678 .name = "Gadmei UTV330",
679 .valid = EM28XX_BOARD_NOT_VALIDATED,
680 .tuner_type = TUNER_TNF_5335MF,
681 .tda9887_conf = TDA9887_PRESENT,
682 .decoder = EM28XX_SAA711X,
684 .type = EM28XX_VMUX_TELEVISION,
685 .vmux = SAA7115_COMPOSITE2,
686 .amux = EM28XX_AMUX_VIDEO,
688 .type = EM28XX_VMUX_COMPOSITE1,
689 .vmux = SAA7115_COMPOSITE0,
690 .amux = EM28XX_AMUX_LINE_IN,
692 .type = EM28XX_VMUX_SVIDEO,
693 .vmux = SAA7115_SVIDEO3,
694 .amux = EM28XX_AMUX_LINE_IN,
697 [EM2861_BOARD_GADMEI_UTV330PLUS] = {
698 .name = "Gadmei UTV330+",
699 .tuner_type = TUNER_TNF_5335MF,
700 .tda9887_conf = TDA9887_PRESENT,
701 .ir_codes = RC_MAP_GADMEI_RM008Z,
702 .decoder = EM28XX_SAA711X,
703 .xclk = EM28XX_XCLK_FREQUENCY_12MHZ,
705 .type = EM28XX_VMUX_TELEVISION,
706 .vmux = SAA7115_COMPOSITE2,
707 .amux = EM28XX_AMUX_VIDEO,
709 .type = EM28XX_VMUX_COMPOSITE1,
710 .vmux = SAA7115_COMPOSITE0,
711 .amux = EM28XX_AMUX_LINE_IN,
713 .type = EM28XX_VMUX_SVIDEO,
714 .vmux = SAA7115_SVIDEO3,
715 .amux = EM28XX_AMUX_LINE_IN,
718 [EM2860_BOARD_TERRATEC_HYBRID_XS] = {
719 .name = "Terratec Cinergy A Hybrid XS",
720 .valid = EM28XX_BOARD_NOT_VALIDATED,
721 .tuner_type = TUNER_XC2028,
722 .tuner_gpio = default_tuner_gpio,
723 .decoder = EM28XX_TVP5150,
726 .type = EM28XX_VMUX_TELEVISION,
727 .vmux = TVP5150_COMPOSITE0,
728 .amux = EM28XX_AMUX_VIDEO,
729 .gpio = hauppauge_wintv_hvr_900_analog,
731 .type = EM28XX_VMUX_COMPOSITE1,
732 .vmux = TVP5150_COMPOSITE1,
733 .amux = EM28XX_AMUX_LINE_IN,
734 .gpio = hauppauge_wintv_hvr_900_analog,
736 .type = EM28XX_VMUX_SVIDEO,
737 .vmux = TVP5150_SVIDEO,
738 .amux = EM28XX_AMUX_LINE_IN,
739 .gpio = hauppauge_wintv_hvr_900_analog,
742 [EM2861_BOARD_KWORLD_PVRTV_300U] = {
743 .name = "KWorld PVRTV 300U",
744 .valid = EM28XX_BOARD_NOT_VALIDATED,
745 .tuner_type = TUNER_XC2028,
746 .tuner_gpio = default_tuner_gpio,
747 .decoder = EM28XX_TVP5150,
749 .type = EM28XX_VMUX_TELEVISION,
750 .vmux = TVP5150_COMPOSITE0,
751 .amux = EM28XX_AMUX_VIDEO,
753 .type = EM28XX_VMUX_COMPOSITE1,
754 .vmux = TVP5150_COMPOSITE1,
755 .amux = EM28XX_AMUX_LINE_IN,
757 .type = EM28XX_VMUX_SVIDEO,
758 .vmux = TVP5150_SVIDEO,
759 .amux = EM28XX_AMUX_LINE_IN,
762 [EM2861_BOARD_YAKUMO_MOVIE_MIXER] = {
763 .name = "Yakumo MovieMixer",
764 .tuner_type = TUNER_ABSENT, /* Capture only device */
765 .decoder = EM28XX_TVP5150,
767 .type = EM28XX_VMUX_TELEVISION,
768 .vmux = TVP5150_COMPOSITE0,
769 .amux = EM28XX_AMUX_VIDEO,
771 .type = EM28XX_VMUX_COMPOSITE1,
772 .vmux = TVP5150_COMPOSITE1,
773 .amux = EM28XX_AMUX_LINE_IN,
775 .type = EM28XX_VMUX_SVIDEO,
776 .vmux = TVP5150_SVIDEO,
777 .amux = EM28XX_AMUX_LINE_IN,
780 [EM2860_BOARD_TVP5150_REFERENCE_DESIGN] = {
781 .name = "EM2860/TVP5150 Reference Design",
782 .tuner_type = TUNER_ABSENT, /* Capture only device */
783 .decoder = EM28XX_TVP5150,
785 .type = EM28XX_VMUX_COMPOSITE1,
786 .vmux = TVP5150_COMPOSITE1,
787 .amux = EM28XX_AMUX_LINE_IN,
789 .type = EM28XX_VMUX_SVIDEO,
790 .vmux = TVP5150_SVIDEO,
791 .amux = EM28XX_AMUX_LINE_IN,
794 [EM2861_BOARD_PLEXTOR_PX_TV100U] = {
795 .name = "Plextor ConvertX PX-TV100U",
796 .tuner_type = TUNER_TNF_5335MF,
797 .xclk = EM28XX_XCLK_I2S_MSB_TIMING |
798 EM28XX_XCLK_FREQUENCY_12MHZ,
799 .tda9887_conf = TDA9887_PRESENT,
800 .decoder = EM28XX_TVP5150,
803 .type = EM28XX_VMUX_TELEVISION,
804 .vmux = TVP5150_COMPOSITE0,
805 .amux = EM28XX_AMUX_LINE_IN,
806 .gpio = pinnacle_hybrid_pro_analog,
808 .type = EM28XX_VMUX_COMPOSITE1,
809 .vmux = TVP5150_COMPOSITE1,
810 .amux = EM28XX_AMUX_LINE_IN,
811 .gpio = pinnacle_hybrid_pro_analog,
813 .type = EM28XX_VMUX_SVIDEO,
814 .vmux = TVP5150_SVIDEO,
815 .amux = EM28XX_AMUX_LINE_IN,
816 .gpio = pinnacle_hybrid_pro_analog,
820 /* Those boards with em2870 are DVB Only*/
822 [EM2870_BOARD_TERRATEC_XS] = {
823 .name = "Terratec Cinergy T XS",
824 .valid = EM28XX_BOARD_NOT_VALIDATED,
825 .tuner_type = TUNER_XC2028,
826 .tuner_gpio = default_tuner_gpio,
828 [EM2870_BOARD_TERRATEC_XS_MT2060] = {
829 .name = "Terratec Cinergy T XS (MT2060)",
830 .valid = EM28XX_BOARD_NOT_VALIDATED,
831 .tuner_type = TUNER_ABSENT, /* MT2060 */
833 [EM2870_BOARD_KWORLD_350U] = {
834 .name = "Kworld 350 U DVB-T",
835 .valid = EM28XX_BOARD_NOT_VALIDATED,
836 .tuner_type = TUNER_XC2028,
837 .tuner_gpio = default_tuner_gpio,
839 [EM2870_BOARD_KWORLD_355U] = {
840 .name = "Kworld 355 U DVB-T",
841 .valid = EM28XX_BOARD_NOT_VALIDATED,
843 [EM2870_BOARD_PINNACLE_PCTV_DVB] = {
844 .name = "Pinnacle PCTV DVB-T",
845 .valid = EM28XX_BOARD_NOT_VALIDATED,
846 .tuner_type = TUNER_ABSENT, /* MT2060 */
847 /* djh - I have serious doubts this is right... */
848 .xclk = EM28XX_XCLK_IR_RC5_MODE |
849 EM28XX_XCLK_FREQUENCY_10MHZ,
851 [EM2870_BOARD_COMPRO_VIDEOMATE] = {
852 .name = "Compro, VideoMate U3",
853 .valid = EM28XX_BOARD_NOT_VALIDATED,
854 .tuner_type = TUNER_ABSENT, /* MT2060 */
857 [EM2880_BOARD_TERRATEC_HYBRID_XS_FR] = {
858 .name = "Terratec Hybrid XS Secam",
860 .tuner_type = TUNER_XC2028,
861 .tuner_gpio = default_tuner_gpio,
862 .decoder = EM28XX_TVP5150,
864 .dvb_gpio = terratec_cinergy_USB_XS_FR_digital,
866 .type = EM28XX_VMUX_TELEVISION,
867 .vmux = TVP5150_COMPOSITE0,
868 .amux = EM28XX_AMUX_VIDEO,
869 .gpio = terratec_cinergy_USB_XS_FR_analog,
871 .type = EM28XX_VMUX_COMPOSITE1,
872 .vmux = TVP5150_COMPOSITE1,
873 .amux = EM28XX_AMUX_LINE_IN,
874 .gpio = terratec_cinergy_USB_XS_FR_analog,
876 .type = EM28XX_VMUX_SVIDEO,
877 .vmux = TVP5150_SVIDEO,
878 .amux = EM28XX_AMUX_LINE_IN,
879 .gpio = terratec_cinergy_USB_XS_FR_analog,
882 [EM2884_BOARD_TERRATEC_H5] = {
883 .name = "Terratec Cinergy H5",
886 .tuner_type = TUNER_PHILIPS_TDA8290,
888 .dvb_gpio = terratec_h5_digital, /* FIXME: probably wrong */
889 .tuner_gpio = terratec_h5_gpio,
891 .i2c_speed = EM2874_I2C_SECONDARY_BUS_SELECT |
892 EM28XX_I2C_CLK_WAIT_ENABLE |
893 EM28XX_I2C_FREQ_400_KHZ,
895 [EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900] = {
896 .name = "Hauppauge WinTV HVR 900",
897 .tda9887_conf = TDA9887_PRESENT,
898 .tuner_type = TUNER_XC2028,
899 .tuner_gpio = default_tuner_gpio,
902 .dvb_gpio = hauppauge_wintv_hvr_900_digital,
903 .ir_codes = RC_MAP_HAUPPAUGE,
904 .decoder = EM28XX_TVP5150,
906 .type = EM28XX_VMUX_TELEVISION,
907 .vmux = TVP5150_COMPOSITE0,
908 .amux = EM28XX_AMUX_VIDEO,
909 .gpio = hauppauge_wintv_hvr_900_analog,
911 .type = EM28XX_VMUX_COMPOSITE1,
912 .vmux = TVP5150_COMPOSITE1,
913 .amux = EM28XX_AMUX_LINE_IN,
914 .gpio = hauppauge_wintv_hvr_900_analog,
916 .type = EM28XX_VMUX_SVIDEO,
917 .vmux = TVP5150_SVIDEO,
918 .amux = EM28XX_AMUX_LINE_IN,
919 .gpio = hauppauge_wintv_hvr_900_analog,
922 [EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900_R2] = {
923 .name = "Hauppauge WinTV HVR 900 (R2)",
924 .tda9887_conf = TDA9887_PRESENT,
925 .tuner_type = TUNER_XC2028,
926 .tuner_gpio = default_tuner_gpio,
929 .dvb_gpio = hauppauge_wintv_hvr_900R2_digital,
930 .ir_codes = RC_MAP_HAUPPAUGE,
931 .decoder = EM28XX_TVP5150,
933 .type = EM28XX_VMUX_TELEVISION,
934 .vmux = TVP5150_COMPOSITE0,
935 .amux = EM28XX_AMUX_VIDEO,
936 .gpio = hauppauge_wintv_hvr_900_analog,
938 .type = EM28XX_VMUX_COMPOSITE1,
939 .vmux = TVP5150_COMPOSITE1,
940 .amux = EM28XX_AMUX_LINE_IN,
941 .gpio = hauppauge_wintv_hvr_900_analog,
943 .type = EM28XX_VMUX_SVIDEO,
944 .vmux = TVP5150_SVIDEO,
945 .amux = EM28XX_AMUX_LINE_IN,
946 .gpio = hauppauge_wintv_hvr_900_analog,
949 [EM2883_BOARD_HAUPPAUGE_WINTV_HVR_850] = {
950 .name = "Hauppauge WinTV HVR 850",
951 .tuner_type = TUNER_XC2028,
952 .tuner_gpio = default_tuner_gpio,
955 .dvb_gpio = hauppauge_wintv_hvr_900_digital,
956 .ir_codes = RC_MAP_HAUPPAUGE,
957 .decoder = EM28XX_TVP5150,
959 .type = EM28XX_VMUX_TELEVISION,
960 .vmux = TVP5150_COMPOSITE0,
961 .amux = EM28XX_AMUX_VIDEO,
962 .gpio = hauppauge_wintv_hvr_900_analog,
964 .type = EM28XX_VMUX_COMPOSITE1,
965 .vmux = TVP5150_COMPOSITE1,
966 .amux = EM28XX_AMUX_LINE_IN,
967 .gpio = hauppauge_wintv_hvr_900_analog,
969 .type = EM28XX_VMUX_SVIDEO,
970 .vmux = TVP5150_SVIDEO,
971 .amux = EM28XX_AMUX_LINE_IN,
972 .gpio = hauppauge_wintv_hvr_900_analog,
975 [EM2883_BOARD_HAUPPAUGE_WINTV_HVR_950] = {
976 .name = "Hauppauge WinTV HVR 950",
977 .tuner_type = TUNER_XC2028,
978 .tuner_gpio = default_tuner_gpio,
981 .dvb_gpio = hauppauge_wintv_hvr_900_digital,
982 .ir_codes = RC_MAP_HAUPPAUGE,
983 .decoder = EM28XX_TVP5150,
985 .type = EM28XX_VMUX_TELEVISION,
986 .vmux = TVP5150_COMPOSITE0,
987 .amux = EM28XX_AMUX_VIDEO,
988 .gpio = hauppauge_wintv_hvr_900_analog,
990 .type = EM28XX_VMUX_COMPOSITE1,
991 .vmux = TVP5150_COMPOSITE1,
992 .amux = EM28XX_AMUX_LINE_IN,
993 .gpio = hauppauge_wintv_hvr_900_analog,
995 .type = EM28XX_VMUX_SVIDEO,
996 .vmux = TVP5150_SVIDEO,
997 .amux = EM28XX_AMUX_LINE_IN,
998 .gpio = hauppauge_wintv_hvr_900_analog,
1001 [EM2880_BOARD_PINNACLE_PCTV_HD_PRO] = {
1002 .name = "Pinnacle PCTV HD Pro Stick",
1003 .tuner_type = TUNER_XC2028,
1004 .tuner_gpio = default_tuner_gpio,
1007 .dvb_gpio = hauppauge_wintv_hvr_900_digital,
1008 .ir_codes = RC_MAP_PINNACLE_PCTV_HD,
1009 .decoder = EM28XX_TVP5150,
1011 .type = EM28XX_VMUX_TELEVISION,
1012 .vmux = TVP5150_COMPOSITE0,
1013 .amux = EM28XX_AMUX_VIDEO,
1014 .gpio = hauppauge_wintv_hvr_900_analog,
1016 .type = EM28XX_VMUX_COMPOSITE1,
1017 .vmux = TVP5150_COMPOSITE1,
1018 .amux = EM28XX_AMUX_LINE_IN,
1019 .gpio = hauppauge_wintv_hvr_900_analog,
1021 .type = EM28XX_VMUX_SVIDEO,
1022 .vmux = TVP5150_SVIDEO,
1023 .amux = EM28XX_AMUX_LINE_IN,
1024 .gpio = hauppauge_wintv_hvr_900_analog,
1027 [EM2880_BOARD_AMD_ATI_TV_WONDER_HD_600] = {
1028 .name = "AMD ATI TV Wonder HD 600",
1029 .tuner_type = TUNER_XC2028,
1030 .tuner_gpio = default_tuner_gpio,
1033 .dvb_gpio = hauppauge_wintv_hvr_900_digital,
1034 .ir_codes = RC_MAP_ATI_TV_WONDER_HD_600,
1035 .decoder = EM28XX_TVP5150,
1037 .type = EM28XX_VMUX_TELEVISION,
1038 .vmux = TVP5150_COMPOSITE0,
1039 .amux = EM28XX_AMUX_VIDEO,
1040 .gpio = hauppauge_wintv_hvr_900_analog,
1042 .type = EM28XX_VMUX_COMPOSITE1,
1043 .vmux = TVP5150_COMPOSITE1,
1044 .amux = EM28XX_AMUX_LINE_IN,
1045 .gpio = hauppauge_wintv_hvr_900_analog,
1047 .type = EM28XX_VMUX_SVIDEO,
1048 .vmux = TVP5150_SVIDEO,
1049 .amux = EM28XX_AMUX_LINE_IN,
1050 .gpio = hauppauge_wintv_hvr_900_analog,
1053 [EM2880_BOARD_TERRATEC_HYBRID_XS] = {
1054 .name = "Terratec Hybrid XS",
1055 .tuner_type = TUNER_XC2028,
1056 .tuner_gpio = default_tuner_gpio,
1057 .decoder = EM28XX_TVP5150,
1059 .dvb_gpio = default_digital,
1060 .ir_codes = RC_MAP_TERRATEC_CINERGY_XS,
1061 .xclk = EM28XX_XCLK_FREQUENCY_12MHZ, /* NEC IR */
1063 .type = EM28XX_VMUX_TELEVISION,
1064 .vmux = TVP5150_COMPOSITE0,
1065 .amux = EM28XX_AMUX_VIDEO,
1066 .gpio = default_analog,
1068 .type = EM28XX_VMUX_COMPOSITE1,
1069 .vmux = TVP5150_COMPOSITE1,
1070 .amux = EM28XX_AMUX_LINE_IN,
1071 .gpio = default_analog,
1073 .type = EM28XX_VMUX_SVIDEO,
1074 .vmux = TVP5150_SVIDEO,
1075 .amux = EM28XX_AMUX_LINE_IN,
1076 .gpio = default_analog,
1079 /* maybe there's a reason behind it why Terratec sells the Hybrid XS
1080 as Prodigy XS with a different PID, let's keep it separated for now
1081 maybe we'll need it lateron */
1082 [EM2880_BOARD_TERRATEC_PRODIGY_XS] = {
1083 .name = "Terratec Prodigy XS",
1084 .tuner_type = TUNER_XC2028,
1085 .tuner_gpio = default_tuner_gpio,
1086 .decoder = EM28XX_TVP5150,
1088 .type = EM28XX_VMUX_TELEVISION,
1089 .vmux = TVP5150_COMPOSITE0,
1090 .amux = EM28XX_AMUX_VIDEO,
1091 .gpio = hauppauge_wintv_hvr_900_analog,
1093 .type = EM28XX_VMUX_COMPOSITE1,
1094 .vmux = TVP5150_COMPOSITE1,
1095 .amux = EM28XX_AMUX_LINE_IN,
1096 .gpio = hauppauge_wintv_hvr_900_analog,
1098 .type = EM28XX_VMUX_SVIDEO,
1099 .vmux = TVP5150_SVIDEO,
1100 .amux = EM28XX_AMUX_LINE_IN,
1101 .gpio = hauppauge_wintv_hvr_900_analog,
1104 [EM2820_BOARD_MSI_VOX_USB_2] = {
1105 .name = "MSI VOX USB 2.0",
1106 .tuner_type = TUNER_LG_PAL_NEW_TAPC,
1107 .tda9887_conf = TDA9887_PRESENT |
1108 TDA9887_PORT1_ACTIVE |
1109 TDA9887_PORT2_ACTIVE,
1110 .max_range_640_480 = 1,
1111 .decoder = EM28XX_SAA711X,
1113 .type = EM28XX_VMUX_TELEVISION,
1114 .vmux = SAA7115_COMPOSITE4,
1115 .amux = EM28XX_AMUX_VIDEO,
1117 .type = EM28XX_VMUX_COMPOSITE1,
1118 .vmux = SAA7115_COMPOSITE0,
1119 .amux = EM28XX_AMUX_LINE_IN,
1121 .type = EM28XX_VMUX_SVIDEO,
1122 .vmux = SAA7115_SVIDEO3,
1123 .amux = EM28XX_AMUX_LINE_IN,
1126 [EM2800_BOARD_TERRATEC_CINERGY_200] = {
1127 .name = "Terratec Cinergy 200 USB",
1130 .tuner_type = TUNER_LG_PAL_NEW_TAPC,
1131 .tda9887_conf = TDA9887_PRESENT,
1132 .decoder = EM28XX_SAA711X,
1134 .type = EM28XX_VMUX_TELEVISION,
1135 .vmux = SAA7115_COMPOSITE2,
1136 .amux = EM28XX_AMUX_VIDEO,
1138 .type = EM28XX_VMUX_COMPOSITE1,
1139 .vmux = SAA7115_COMPOSITE0,
1140 .amux = EM28XX_AMUX_LINE_IN,
1142 .type = EM28XX_VMUX_SVIDEO,
1143 .vmux = SAA7115_SVIDEO3,
1144 .amux = EM28XX_AMUX_LINE_IN,
1147 [EM2800_BOARD_GRABBEEX_USB2800] = {
1148 .name = "eMPIA Technology, Inc. GrabBeeX+ Video Encoder",
1150 .decoder = EM28XX_SAA711X,
1151 .tuner_type = TUNER_ABSENT, /* capture only board */
1153 .type = EM28XX_VMUX_COMPOSITE1,
1154 .vmux = SAA7115_COMPOSITE0,
1155 .amux = EM28XX_AMUX_LINE_IN,
1157 .type = EM28XX_VMUX_SVIDEO,
1158 .vmux = SAA7115_SVIDEO3,
1159 .amux = EM28XX_AMUX_LINE_IN,
1162 [EM2800_BOARD_VC211A] = {
1163 .name = "Actionmaster/LinXcel/Digitus VC211A",
1165 .tuner_type = TUNER_ABSENT, /* Capture-only board */
1166 .decoder = EM28XX_SAA711X,
1168 .type = EM28XX_VMUX_COMPOSITE1,
1169 .vmux = SAA7115_COMPOSITE0,
1170 .amux = EM28XX_AMUX_LINE_IN,
1171 .gpio = vc211a_enable,
1173 .type = EM28XX_VMUX_SVIDEO,
1174 .vmux = SAA7115_SVIDEO3,
1175 .amux = EM28XX_AMUX_LINE_IN,
1176 .gpio = vc211a_enable,
1179 [EM2800_BOARD_LEADTEK_WINFAST_USBII] = {
1180 .name = "Leadtek Winfast USB II",
1182 .tuner_type = TUNER_LG_PAL_NEW_TAPC,
1183 .tda9887_conf = TDA9887_PRESENT,
1184 .decoder = EM28XX_SAA711X,
1186 .type = EM28XX_VMUX_TELEVISION,
1187 .vmux = SAA7115_COMPOSITE2,
1188 .amux = EM28XX_AMUX_VIDEO,
1190 .type = EM28XX_VMUX_COMPOSITE1,
1191 .vmux = SAA7115_COMPOSITE0,
1192 .amux = EM28XX_AMUX_LINE_IN,
1194 .type = EM28XX_VMUX_SVIDEO,
1195 .vmux = SAA7115_SVIDEO3,
1196 .amux = EM28XX_AMUX_LINE_IN,
1199 [EM2800_BOARD_KWORLD_USB2800] = {
1200 .name = "Kworld USB2800",
1202 .tuner_type = TUNER_PHILIPS_FCV1236D,
1203 .tda9887_conf = TDA9887_PRESENT,
1204 .decoder = EM28XX_SAA711X,
1206 .type = EM28XX_VMUX_TELEVISION,
1207 .vmux = SAA7115_COMPOSITE2,
1208 .amux = EM28XX_AMUX_VIDEO,
1210 .type = EM28XX_VMUX_COMPOSITE1,
1211 .vmux = SAA7115_COMPOSITE0,
1212 .amux = EM28XX_AMUX_LINE_IN,
1214 .type = EM28XX_VMUX_SVIDEO,
1215 .vmux = SAA7115_SVIDEO3,
1216 .amux = EM28XX_AMUX_LINE_IN,
1219 [EM2820_BOARD_PINNACLE_DVC_90] = {
1220 .name = "Pinnacle Dazzle DVC 90/100/101/107 / Kaiser Baas Video to DVD maker "
1221 "/ Kworld DVD Maker 2",
1222 .tuner_type = TUNER_ABSENT, /* capture only board */
1223 .decoder = EM28XX_SAA711X,
1225 .type = EM28XX_VMUX_COMPOSITE1,
1226 .vmux = SAA7115_COMPOSITE0,
1227 .amux = EM28XX_AMUX_LINE_IN,
1229 .type = EM28XX_VMUX_SVIDEO,
1230 .vmux = SAA7115_SVIDEO3,
1231 .amux = EM28XX_AMUX_LINE_IN,
1234 [EM2800_BOARD_VGEAR_POCKETTV] = {
1235 .name = "V-Gear PocketTV",
1237 .tuner_type = TUNER_LG_PAL_NEW_TAPC,
1238 .tda9887_conf = TDA9887_PRESENT,
1239 .decoder = EM28XX_SAA711X,
1241 .type = EM28XX_VMUX_TELEVISION,
1242 .vmux = SAA7115_COMPOSITE2,
1243 .amux = EM28XX_AMUX_VIDEO,
1245 .type = EM28XX_VMUX_COMPOSITE1,
1246 .vmux = SAA7115_COMPOSITE0,
1247 .amux = EM28XX_AMUX_LINE_IN,
1249 .type = EM28XX_VMUX_SVIDEO,
1250 .vmux = SAA7115_SVIDEO3,
1251 .amux = EM28XX_AMUX_LINE_IN,
1254 [EM2820_BOARD_PROLINK_PLAYTV_BOX4_USB2] = {
1255 .name = "Pixelview PlayTV Box 4 USB 2.0",
1256 .tda9887_conf = TDA9887_PRESENT,
1257 .tuner_type = TUNER_YMEC_TVF_5533MF,
1258 .decoder = EM28XX_SAA711X,
1260 .type = EM28XX_VMUX_TELEVISION,
1261 .vmux = SAA7115_COMPOSITE2,
1262 .amux = EM28XX_AMUX_VIDEO,
1263 .aout = EM28XX_AOUT_MONO | /* I2S */
1264 EM28XX_AOUT_MASTER, /* Line out pin */
1266 .type = EM28XX_VMUX_COMPOSITE1,
1267 .vmux = SAA7115_COMPOSITE0,
1268 .amux = EM28XX_AMUX_LINE_IN,
1270 .type = EM28XX_VMUX_SVIDEO,
1271 .vmux = SAA7115_SVIDEO3,
1272 .amux = EM28XX_AMUX_LINE_IN,
1275 [EM2820_BOARD_PROLINK_PLAYTV_USB2] = {
1276 .name = "SIIG AVTuner-PVR / Pixelview Prolink PlayTV USB 2.0",
1277 .has_snapshot_button = 1,
1278 .tda9887_conf = TDA9887_PRESENT,
1279 .tuner_type = TUNER_YMEC_TVF_5533MF,
1280 .decoder = EM28XX_SAA711X,
1282 .type = EM28XX_VMUX_TELEVISION,
1283 .vmux = SAA7115_COMPOSITE2,
1284 .amux = EM28XX_AMUX_VIDEO,
1285 .aout = EM28XX_AOUT_MONO | /* I2S */
1286 EM28XX_AOUT_MASTER, /* Line out pin */
1288 .type = EM28XX_VMUX_COMPOSITE1,
1289 .vmux = SAA7115_COMPOSITE0,
1290 .amux = EM28XX_AMUX_LINE_IN,
1292 .type = EM28XX_VMUX_SVIDEO,
1293 .vmux = SAA7115_SVIDEO3,
1294 .amux = EM28XX_AMUX_LINE_IN,
1297 [EM2860_BOARD_SAA711X_REFERENCE_DESIGN] = {
1298 .name = "EM2860/SAA711X Reference Design",
1299 .has_snapshot_button = 1,
1300 .tuner_type = TUNER_ABSENT,
1301 .decoder = EM28XX_SAA711X,
1303 .type = EM28XX_VMUX_SVIDEO,
1304 .vmux = SAA7115_SVIDEO3,
1306 .type = EM28XX_VMUX_COMPOSITE1,
1307 .vmux = SAA7115_COMPOSITE0,
1311 [EM2874_BOARD_LEADERSHIP_ISDBT] = {
1312 .i2c_speed = EM2874_I2C_SECONDARY_BUS_SELECT |
1313 EM28XX_I2C_CLK_WAIT_ENABLE |
1314 EM28XX_I2C_FREQ_100_KHZ,
1315 .xclk = EM28XX_XCLK_FREQUENCY_10MHZ,
1316 .name = "EM2874 Leadership ISDBT",
1317 .tuner_type = TUNER_ABSENT,
1318 .tuner_gpio = leadership_reset,
1319 .dvb_gpio = leadership_digital,
1323 [EM2880_BOARD_MSI_DIGIVOX_AD] = {
1324 .name = "MSI DigiVox A/D",
1325 .valid = EM28XX_BOARD_NOT_VALIDATED,
1326 .tuner_type = TUNER_XC2028,
1327 .tuner_gpio = default_tuner_gpio,
1328 .decoder = EM28XX_TVP5150,
1330 .type = EM28XX_VMUX_TELEVISION,
1331 .vmux = TVP5150_COMPOSITE0,
1332 .amux = EM28XX_AMUX_VIDEO,
1333 .gpio = em2880_msi_digivox_ad_analog,
1335 .type = EM28XX_VMUX_COMPOSITE1,
1336 .vmux = TVP5150_COMPOSITE1,
1337 .amux = EM28XX_AMUX_LINE_IN,
1338 .gpio = em2880_msi_digivox_ad_analog,
1340 .type = EM28XX_VMUX_SVIDEO,
1341 .vmux = TVP5150_SVIDEO,
1342 .amux = EM28XX_AMUX_LINE_IN,
1343 .gpio = em2880_msi_digivox_ad_analog,
1346 [EM2880_BOARD_MSI_DIGIVOX_AD_II] = {
1347 .name = "MSI DigiVox A/D II",
1348 .valid = EM28XX_BOARD_NOT_VALIDATED,
1349 .tuner_type = TUNER_XC2028,
1350 .tuner_gpio = default_tuner_gpio,
1351 .decoder = EM28XX_TVP5150,
1353 .type = EM28XX_VMUX_TELEVISION,
1354 .vmux = TVP5150_COMPOSITE0,
1355 .amux = EM28XX_AMUX_VIDEO,
1356 .gpio = em2880_msi_digivox_ad_analog,
1358 .type = EM28XX_VMUX_COMPOSITE1,
1359 .vmux = TVP5150_COMPOSITE1,
1360 .amux = EM28XX_AMUX_LINE_IN,
1361 .gpio = em2880_msi_digivox_ad_analog,
1363 .type = EM28XX_VMUX_SVIDEO,
1364 .vmux = TVP5150_SVIDEO,
1365 .amux = EM28XX_AMUX_LINE_IN,
1366 .gpio = em2880_msi_digivox_ad_analog,
1369 [EM2880_BOARD_KWORLD_DVB_305U] = {
1370 .name = "KWorld DVB-T 305U",
1371 .tuner_type = TUNER_XC2028,
1372 .tuner_gpio = default_tuner_gpio,
1373 .decoder = EM28XX_TVP5150,
1375 .type = EM28XX_VMUX_TELEVISION,
1376 .vmux = TVP5150_COMPOSITE0,
1377 .amux = EM28XX_AMUX_VIDEO,
1379 .type = EM28XX_VMUX_COMPOSITE1,
1380 .vmux = TVP5150_COMPOSITE1,
1381 .amux = EM28XX_AMUX_LINE_IN,
1383 .type = EM28XX_VMUX_SVIDEO,
1384 .vmux = TVP5150_SVIDEO,
1385 .amux = EM28XX_AMUX_LINE_IN,
1388 [EM2880_BOARD_KWORLD_DVB_310U] = {
1389 .name = "KWorld DVB-T 310U",
1390 .tuner_type = TUNER_XC2028,
1391 .tuner_gpio = default_tuner_gpio,
1393 .dvb_gpio = default_digital,
1395 .decoder = EM28XX_TVP5150,
1397 .type = EM28XX_VMUX_TELEVISION,
1398 .vmux = TVP5150_COMPOSITE0,
1399 .amux = EM28XX_AMUX_VIDEO,
1400 .gpio = default_analog,
1402 .type = EM28XX_VMUX_COMPOSITE1,
1403 .vmux = TVP5150_COMPOSITE1,
1404 .amux = EM28XX_AMUX_LINE_IN,
1405 .gpio = default_analog,
1406 }, { /* S-video has not been tested yet */
1407 .type = EM28XX_VMUX_SVIDEO,
1408 .vmux = TVP5150_SVIDEO,
1409 .amux = EM28XX_AMUX_LINE_IN,
1410 .gpio = default_analog,
1413 [EM2882_BOARD_KWORLD_ATSC_315U] = {
1414 .name = "KWorld ATSC 315U HDTV TV Box",
1415 .valid = EM28XX_BOARD_NOT_VALIDATED,
1416 .tuner_type = TUNER_THOMSON_DTT761X,
1417 .tuner_gpio = em2882_kworld_315u_tuner_gpio,
1418 .tda9887_conf = TDA9887_PRESENT,
1419 .decoder = EM28XX_SAA711X,
1421 .dvb_gpio = em2882_kworld_315u_digital,
1422 .ir_codes = RC_MAP_KWORLD_315U,
1423 .xclk = EM28XX_XCLK_FREQUENCY_12MHZ,
1424 .i2c_speed = EM28XX_I2C_CLK_WAIT_ENABLE,
1425 /* Analog mode - still not ready */
1427 .type = EM28XX_VMUX_TELEVISION,
1428 .vmux = SAA7115_COMPOSITE2,
1429 .amux = EM28XX_AMUX_VIDEO,
1430 .gpio = em2882_kworld_315u_analog,
1431 .aout = EM28XX_AOUT_PCM_IN | EM28XX_AOUT_PCM_STEREO,
1433 .type = EM28XX_VMUX_COMPOSITE1,
1434 .vmux = SAA7115_COMPOSITE0,
1435 .amux = EM28XX_AMUX_LINE_IN,
1436 .gpio = em2882_kworld_315u_analog1,
1437 .aout = EM28XX_AOUT_PCM_IN | EM28XX_AOUT_PCM_STEREO,
1439 .type = EM28XX_VMUX_SVIDEO,
1440 .vmux = SAA7115_SVIDEO3,
1441 .amux = EM28XX_AMUX_LINE_IN,
1442 .gpio = em2882_kworld_315u_analog1,
1443 .aout = EM28XX_AOUT_PCM_IN | EM28XX_AOUT_PCM_STEREO,
1446 [EM2880_BOARD_EMPIRE_DUAL_TV] = {
1447 .name = "Empire dual TV",
1448 .tuner_type = TUNER_XC2028,
1449 .tuner_gpio = default_tuner_gpio,
1451 .dvb_gpio = default_digital,
1453 .decoder = EM28XX_TVP5150,
1455 .type = EM28XX_VMUX_TELEVISION,
1456 .vmux = TVP5150_COMPOSITE0,
1457 .amux = EM28XX_AMUX_VIDEO,
1458 .gpio = default_analog,
1460 .type = EM28XX_VMUX_COMPOSITE1,
1461 .vmux = TVP5150_COMPOSITE1,
1462 .amux = EM28XX_AMUX_LINE_IN,
1463 .gpio = default_analog,
1465 .type = EM28XX_VMUX_SVIDEO,
1466 .vmux = TVP5150_SVIDEO,
1467 .amux = EM28XX_AMUX_LINE_IN,
1468 .gpio = default_analog,
1471 [EM2881_BOARD_DNT_DA2_HYBRID] = {
1472 .name = "DNT DA2 Hybrid",
1473 .valid = EM28XX_BOARD_NOT_VALIDATED,
1474 .tuner_type = TUNER_XC2028,
1475 .tuner_gpio = default_tuner_gpio,
1476 .decoder = EM28XX_TVP5150,
1478 .type = EM28XX_VMUX_TELEVISION,
1479 .vmux = TVP5150_COMPOSITE0,
1480 .amux = EM28XX_AMUX_VIDEO,
1481 .gpio = default_analog,
1483 .type = EM28XX_VMUX_COMPOSITE1,
1484 .vmux = TVP5150_COMPOSITE1,
1485 .amux = EM28XX_AMUX_LINE_IN,
1486 .gpio = default_analog,
1488 .type = EM28XX_VMUX_SVIDEO,
1489 .vmux = TVP5150_SVIDEO,
1490 .amux = EM28XX_AMUX_LINE_IN,
1491 .gpio = default_analog,
1494 [EM2881_BOARD_PINNACLE_HYBRID_PRO] = {
1495 .name = "Pinnacle Hybrid Pro",
1496 .tuner_type = TUNER_XC2028,
1497 .tuner_gpio = default_tuner_gpio,
1498 .decoder = EM28XX_TVP5150,
1500 .dvb_gpio = pinnacle_hybrid_pro_digital,
1502 .type = EM28XX_VMUX_TELEVISION,
1503 .vmux = TVP5150_COMPOSITE0,
1504 .amux = EM28XX_AMUX_VIDEO,
1505 .gpio = pinnacle_hybrid_pro_analog,
1507 .type = EM28XX_VMUX_COMPOSITE1,
1508 .vmux = TVP5150_COMPOSITE1,
1509 .amux = EM28XX_AMUX_LINE_IN,
1510 .gpio = pinnacle_hybrid_pro_analog,
1512 .type = EM28XX_VMUX_SVIDEO,
1513 .vmux = TVP5150_SVIDEO,
1514 .amux = EM28XX_AMUX_LINE_IN,
1515 .gpio = pinnacle_hybrid_pro_analog,
1518 [EM2882_BOARD_PINNACLE_HYBRID_PRO_330E] = {
1519 .name = "Pinnacle Hybrid Pro (330e)",
1520 .tuner_type = TUNER_XC2028,
1521 .tuner_gpio = default_tuner_gpio,
1524 .dvb_gpio = hauppauge_wintv_hvr_900R2_digital,
1525 .ir_codes = RC_MAP_PINNACLE_PCTV_HD,
1526 .decoder = EM28XX_TVP5150,
1528 .type = EM28XX_VMUX_TELEVISION,
1529 .vmux = TVP5150_COMPOSITE0,
1530 .amux = EM28XX_AMUX_VIDEO,
1531 .gpio = hauppauge_wintv_hvr_900_analog,
1533 .type = EM28XX_VMUX_COMPOSITE1,
1534 .vmux = TVP5150_COMPOSITE1,
1535 .amux = EM28XX_AMUX_LINE_IN,
1536 .gpio = hauppauge_wintv_hvr_900_analog,
1538 .type = EM28XX_VMUX_SVIDEO,
1539 .vmux = TVP5150_SVIDEO,
1540 .amux = EM28XX_AMUX_LINE_IN,
1541 .gpio = hauppauge_wintv_hvr_900_analog,
1544 [EM2882_BOARD_KWORLD_VS_DVBT] = {
1545 .name = "Kworld VS-DVB-T 323UR",
1546 .tuner_type = TUNER_XC2028,
1547 .tuner_gpio = default_tuner_gpio,
1548 .decoder = EM28XX_TVP5150,
1551 .dvb_gpio = kworld_330u_digital,
1552 .xclk = EM28XX_XCLK_FREQUENCY_12MHZ, /* NEC IR */
1553 .ir_codes = RC_MAP_KWORLD_315U,
1555 .type = EM28XX_VMUX_TELEVISION,
1556 .vmux = TVP5150_COMPOSITE0,
1557 .amux = EM28XX_AMUX_VIDEO,
1559 .type = EM28XX_VMUX_COMPOSITE1,
1560 .vmux = TVP5150_COMPOSITE1,
1561 .amux = EM28XX_AMUX_LINE_IN,
1563 .type = EM28XX_VMUX_SVIDEO,
1564 .vmux = TVP5150_SVIDEO,
1565 .amux = EM28XX_AMUX_LINE_IN,
1568 [EM2882_BOARD_TERRATEC_HYBRID_XS] = {
1569 .name = "Terratec Cinnergy Hybrid T USB XS (em2882)",
1570 .tuner_type = TUNER_XC2028,
1571 .tuner_gpio = default_tuner_gpio,
1573 .decoder = EM28XX_TVP5150,
1575 .dvb_gpio = hauppauge_wintv_hvr_900_digital,
1576 .ir_codes = RC_MAP_TERRATEC_CINERGY_XS,
1577 .xclk = EM28XX_XCLK_FREQUENCY_12MHZ,
1579 .type = EM28XX_VMUX_TELEVISION,
1580 .vmux = TVP5150_COMPOSITE0,
1581 .amux = EM28XX_AMUX_VIDEO,
1582 .gpio = hauppauge_wintv_hvr_900_analog,
1584 .type = EM28XX_VMUX_COMPOSITE1,
1585 .vmux = TVP5150_COMPOSITE1,
1586 .amux = EM28XX_AMUX_LINE_IN,
1587 .gpio = hauppauge_wintv_hvr_900_analog,
1589 .type = EM28XX_VMUX_SVIDEO,
1590 .vmux = TVP5150_SVIDEO,
1591 .amux = EM28XX_AMUX_LINE_IN,
1592 .gpio = hauppauge_wintv_hvr_900_analog,
1595 [EM2882_BOARD_DIKOM_DK300] = {
1596 .name = "Dikom DK300",
1597 .tuner_type = TUNER_XC2028,
1598 .tuner_gpio = default_tuner_gpio,
1599 .decoder = EM28XX_TVP5150,
1602 .dvb_gpio = dikom_dk300_digital,
1604 .type = EM28XX_VMUX_TELEVISION,
1605 .vmux = TVP5150_COMPOSITE0,
1606 .amux = EM28XX_AMUX_VIDEO,
1607 .gpio = default_analog,
1610 [EM2883_BOARD_KWORLD_HYBRID_330U] = {
1611 .name = "Kworld PlusTV HD Hybrid 330",
1612 .tuner_type = TUNER_XC2028,
1613 .tuner_gpio = default_tuner_gpio,
1614 .decoder = EM28XX_TVP5150,
1617 .dvb_gpio = kworld_330u_digital,
1618 .xclk = EM28XX_XCLK_FREQUENCY_12MHZ,
1619 .i2c_speed = EM28XX_I2C_CLK_WAIT_ENABLE |
1620 EM28XX_I2C_EEPROM_ON_BOARD |
1621 EM28XX_I2C_EEPROM_KEY_VALID,
1623 .type = EM28XX_VMUX_TELEVISION,
1624 .vmux = TVP5150_COMPOSITE0,
1625 .amux = EM28XX_AMUX_VIDEO,
1626 .gpio = kworld_330u_analog,
1627 .aout = EM28XX_AOUT_PCM_IN | EM28XX_AOUT_PCM_STEREO,
1629 .type = EM28XX_VMUX_COMPOSITE1,
1630 .vmux = TVP5150_COMPOSITE1,
1631 .amux = EM28XX_AMUX_LINE_IN,
1632 .gpio = kworld_330u_analog,
1633 .aout = EM28XX_AOUT_PCM_IN | EM28XX_AOUT_PCM_STEREO,
1635 .type = EM28XX_VMUX_SVIDEO,
1636 .vmux = TVP5150_SVIDEO,
1637 .amux = EM28XX_AMUX_LINE_IN,
1638 .gpio = kworld_330u_analog,
1641 [EM2820_BOARD_COMPRO_VIDEOMATE_FORYOU] = {
1642 .name = "Compro VideoMate ForYou/Stereo",
1643 .tuner_type = TUNER_LG_PAL_NEW_TAPC,
1644 .tvaudio_addr = 0xb0,
1645 .tda9887_conf = TDA9887_PRESENT,
1646 .decoder = EM28XX_TVP5150,
1647 .adecoder = EM28XX_TVAUDIO,
1648 .mute_gpio = compro_mute_gpio,
1650 .type = EM28XX_VMUX_TELEVISION,
1651 .vmux = TVP5150_COMPOSITE0,
1652 .amux = EM28XX_AMUX_VIDEO,
1653 .gpio = compro_unmute_tv_gpio,
1655 .type = EM28XX_VMUX_SVIDEO,
1656 .vmux = TVP5150_SVIDEO,
1657 .amux = EM28XX_AMUX_LINE_IN,
1658 .gpio = compro_unmute_svid_gpio,
1661 [EM2860_BOARD_KAIOMY_TVNPC_U2] = {
1662 .name = "Kaiomy TVnPC U2",
1664 .tuner_type = TUNER_XC2028,
1667 .decoder = EM28XX_TVP5150,
1668 .tuner_gpio = default_tuner_gpio,
1669 .ir_codes = RC_MAP_KAIOMY,
1671 .type = EM28XX_VMUX_TELEVISION,
1672 .vmux = TVP5150_COMPOSITE0,
1673 .amux = EM28XX_AMUX_VIDEO,
1676 .type = EM28XX_VMUX_COMPOSITE1,
1677 .vmux = TVP5150_COMPOSITE1,
1678 .amux = EM28XX_AMUX_LINE_IN,
1680 .type = EM28XX_VMUX_SVIDEO,
1681 .vmux = TVP5150_SVIDEO,
1682 .amux = EM28XX_AMUX_LINE_IN,
1685 .type = EM28XX_RADIO,
1686 .amux = EM28XX_AMUX_LINE_IN,
1689 [EM2860_BOARD_EASYCAP] = {
1690 .name = "Easy Cap Capture DC-60",
1692 .tuner_type = TUNER_ABSENT,
1693 .decoder = EM28XX_SAA711X,
1695 .type = EM28XX_VMUX_COMPOSITE1,
1696 .vmux = SAA7115_COMPOSITE0,
1697 .amux = EM28XX_AMUX_LINE_IN,
1699 .type = EM28XX_VMUX_SVIDEO,
1700 .vmux = SAA7115_SVIDEO3,
1701 .amux = EM28XX_AMUX_LINE_IN,
1704 [EM2820_BOARD_IODATA_GVMVP_SZ] = {
1705 .name = "IO-DATA GV-MVP/SZ",
1706 .tuner_type = TUNER_PHILIPS_FM1236_MK3,
1707 .tuner_gpio = default_tuner_gpio,
1708 .tda9887_conf = TDA9887_PRESENT,
1709 .decoder = EM28XX_TVP5150,
1711 .type = EM28XX_VMUX_TELEVISION,
1712 .vmux = TVP5150_COMPOSITE0,
1713 .amux = EM28XX_AMUX_VIDEO,
1714 }, { /* Composite has not been tested yet */
1715 .type = EM28XX_VMUX_COMPOSITE1,
1716 .vmux = TVP5150_COMPOSITE1,
1717 .amux = EM28XX_AMUX_VIDEO,
1718 }, { /* S-video has not been tested yet */
1719 .type = EM28XX_VMUX_SVIDEO,
1720 .vmux = TVP5150_SVIDEO,
1721 .amux = EM28XX_AMUX_VIDEO,
1724 [EM2860_BOARD_TERRATEC_GRABBY] = {
1725 .name = "Terratec Grabby",
1727 .tuner_type = TUNER_ABSENT,
1728 .decoder = EM28XX_SAA711X,
1729 .xclk = EM28XX_XCLK_FREQUENCY_12MHZ,
1731 .type = EM28XX_VMUX_COMPOSITE1,
1732 .vmux = SAA7115_COMPOSITE0,
1733 .amux = EM28XX_AMUX_LINE_IN,
1735 .type = EM28XX_VMUX_SVIDEO,
1736 .vmux = SAA7115_SVIDEO3,
1737 .amux = EM28XX_AMUX_LINE_IN,
1740 [EM2860_BOARD_TERRATEC_AV350] = {
1741 .name = "Terratec AV350",
1743 .tuner_type = TUNER_ABSENT,
1744 .decoder = EM28XX_TVP5150,
1745 .xclk = EM28XX_XCLK_FREQUENCY_12MHZ,
1746 .mute_gpio = terratec_av350_mute_gpio,
1748 .type = EM28XX_VMUX_COMPOSITE1,
1749 .vmux = TVP5150_COMPOSITE1,
1750 .amux = EM28XX_AUDIO_SRC_LINE,
1751 .gpio = terratec_av350_unmute_gpio,
1754 .type = EM28XX_VMUX_SVIDEO,
1755 .vmux = TVP5150_SVIDEO,
1756 .amux = EM28XX_AUDIO_SRC_LINE,
1757 .gpio = terratec_av350_unmute_gpio,
1761 [EM2860_BOARD_ELGATO_VIDEO_CAPTURE] = {
1762 .name = "Elgato Video Capture",
1763 .decoder = EM28XX_SAA711X,
1764 .tuner_type = TUNER_ABSENT, /* Capture only device */
1766 .type = EM28XX_VMUX_COMPOSITE1,
1767 .vmux = SAA7115_COMPOSITE0,
1768 .amux = EM28XX_AMUX_LINE_IN,
1770 .type = EM28XX_VMUX_SVIDEO,
1771 .vmux = SAA7115_SVIDEO3,
1772 .amux = EM28XX_AMUX_LINE_IN,
1776 [EM2882_BOARD_EVGA_INDTUBE] = {
1777 .name = "Evga inDtube",
1778 .tuner_type = TUNER_XC2028,
1779 .tuner_gpio = default_tuner_gpio,
1780 .decoder = EM28XX_TVP5150,
1781 .xclk = EM28XX_XCLK_FREQUENCY_12MHZ, /* NEC IR */
1784 .dvb_gpio = evga_indtube_digital,
1785 .ir_codes = RC_MAP_EVGA_INDTUBE,
1787 .type = EM28XX_VMUX_TELEVISION,
1788 .vmux = TVP5150_COMPOSITE0,
1789 .amux = EM28XX_AMUX_VIDEO,
1790 .gpio = evga_indtube_analog,
1792 .type = EM28XX_VMUX_COMPOSITE1,
1793 .vmux = TVP5150_COMPOSITE1,
1794 .amux = EM28XX_AMUX_LINE_IN,
1795 .gpio = evga_indtube_analog,
1797 .type = EM28XX_VMUX_SVIDEO,
1798 .vmux = TVP5150_SVIDEO,
1799 .amux = EM28XX_AMUX_LINE_IN,
1800 .gpio = evga_indtube_analog,
1803 /* eb1a:2868 Empia EM2870 + Philips CU1216L NIM (Philips TDA10023 +
1804 Infineon TUA6034) */
1805 [EM2870_BOARD_REDDO_DVB_C_USB_BOX] = {
1806 .name = "Reddo DVB-C USB TV Box",
1807 .tuner_type = TUNER_ABSENT,
1808 .tuner_gpio = reddo_dvb_c_usb_box,
1811 /* 1b80:a340 - Empia EM2870, NXP TDA18271HD and LG DT3304, sold
1812 * initially as the KWorld PlusTV 340U, then as the UB435-Q.
1813 * Early variants have a TDA18271HD/C1, later ones a TDA18271HD/C2 */
1814 [EM2870_BOARD_KWORLD_A340] = {
1815 .name = "KWorld PlusTV 340U or UB435-Q (ATSC)",
1816 .tuner_type = TUNER_ABSENT, /* Digital-only TDA18271HD */
1818 .dvb_gpio = kworld_a340_digital,
1819 .tuner_gpio = default_tuner_gpio,
1821 /* 2013:024f PCTV nanoStick T2 290e.
1822 * Empia EM28174, Sony CXD2820R and NXP TDA18271HD/C2 */
1823 [EM28174_BOARD_PCTV_290E] = {
1824 .name = "PCTV nanoStick T2 290e",
1825 .i2c_speed = EM2874_I2C_SECONDARY_BUS_SELECT |
1826 EM28XX_I2C_CLK_WAIT_ENABLE | EM28XX_I2C_FREQ_100_KHZ,
1827 .tuner_type = TUNER_ABSENT,
1828 .tuner_gpio = pctv_290e,
1830 .ir_codes = RC_MAP_PINNACLE_PCTV_HD,
1832 /* 2013:024f PCTV DVB-S2 Stick 460e
1833 * Empia EM28174, NXP TDA10071, Conexant CX24118A and Allegro A8293 */
1834 [EM28174_BOARD_PCTV_460E] = {
1835 .i2c_speed = EM2874_I2C_SECONDARY_BUS_SELECT |
1836 EM28XX_I2C_CLK_WAIT_ENABLE | EM28XX_I2C_FREQ_400_KHZ,
1837 .name = "PCTV DVB-S2 Stick (460e)",
1838 .tuner_type = TUNER_ABSENT,
1839 .tuner_gpio = pctv_460e,
1841 .ir_codes = RC_MAP_PINNACLE_PCTV_HD,
1844 const unsigned int em28xx_bcount = ARRAY_SIZE(em28xx_boards);
1846 /* table of devices that work with this driver */
1847 struct usb_device_id em28xx_id_table[] = {
1848 { USB_DEVICE(0xeb1a, 0x2750),
1849 .driver_info = EM2750_BOARD_UNKNOWN },
1850 { USB_DEVICE(0xeb1a, 0x2751),
1851 .driver_info = EM2750_BOARD_UNKNOWN },
1852 { USB_DEVICE(0xeb1a, 0x2800),
1853 .driver_info = EM2800_BOARD_UNKNOWN },
1854 { USB_DEVICE(0xeb1a, 0x2710),
1855 .driver_info = EM2820_BOARD_UNKNOWN },
1856 { USB_DEVICE(0xeb1a, 0x2820),
1857 .driver_info = EM2820_BOARD_UNKNOWN },
1858 { USB_DEVICE(0xeb1a, 0x2821),
1859 .driver_info = EM2820_BOARD_UNKNOWN },
1860 { USB_DEVICE(0xeb1a, 0x2860),
1861 .driver_info = EM2820_BOARD_UNKNOWN },
1862 { USB_DEVICE(0xeb1a, 0x2861),
1863 .driver_info = EM2820_BOARD_UNKNOWN },
1864 { USB_DEVICE(0xeb1a, 0x2862),
1865 .driver_info = EM2820_BOARD_UNKNOWN },
1866 { USB_DEVICE(0xeb1a, 0x2863),
1867 .driver_info = EM2820_BOARD_UNKNOWN },
1868 { USB_DEVICE(0xeb1a, 0x2870),
1869 .driver_info = EM2820_BOARD_UNKNOWN },
1870 { USB_DEVICE(0xeb1a, 0x2881),
1871 .driver_info = EM2820_BOARD_UNKNOWN },
1872 { USB_DEVICE(0xeb1a, 0x2883),
1873 .driver_info = EM2820_BOARD_UNKNOWN },
1874 { USB_DEVICE(0xeb1a, 0x2868),
1875 .driver_info = EM2820_BOARD_UNKNOWN },
1876 { USB_DEVICE(0xeb1a, 0x2875),
1877 .driver_info = EM2820_BOARD_UNKNOWN },
1878 { USB_DEVICE(0xeb1a, 0xe300),
1879 .driver_info = EM2861_BOARD_KWORLD_PVRTV_300U },
1880 { USB_DEVICE(0xeb1a, 0xe303),
1881 .driver_info = EM2860_BOARD_KAIOMY_TVNPC_U2 },
1882 { USB_DEVICE(0xeb1a, 0xe305),
1883 .driver_info = EM2880_BOARD_KWORLD_DVB_305U },
1884 { USB_DEVICE(0xeb1a, 0xe310),
1885 .driver_info = EM2880_BOARD_MSI_DIGIVOX_AD },
1886 { USB_DEVICE(0xeb1a, 0xa313),
1887 .driver_info = EM2882_BOARD_KWORLD_ATSC_315U },
1888 { USB_DEVICE(0xeb1a, 0xa316),
1889 .driver_info = EM2883_BOARD_KWORLD_HYBRID_330U },
1890 { USB_DEVICE(0xeb1a, 0xe320),
1891 .driver_info = EM2880_BOARD_MSI_DIGIVOX_AD_II },
1892 { USB_DEVICE(0xeb1a, 0xe323),
1893 .driver_info = EM2882_BOARD_KWORLD_VS_DVBT },
1894 { USB_DEVICE(0xeb1a, 0xe350),
1895 .driver_info = EM2870_BOARD_KWORLD_350U },
1896 { USB_DEVICE(0xeb1a, 0xe355),
1897 .driver_info = EM2870_BOARD_KWORLD_355U },
1898 { USB_DEVICE(0xeb1a, 0x2801),
1899 .driver_info = EM2800_BOARD_GRABBEEX_USB2800 },
1900 { USB_DEVICE(0xeb1a, 0xe357),
1901 .driver_info = EM2870_BOARD_KWORLD_355U },
1902 { USB_DEVICE(0x1b80, 0xe302),
1903 .driver_info = EM2820_BOARD_PINNACLE_DVC_90 }, /* Kaiser Baas Video to DVD maker */
1904 { USB_DEVICE(0x1b80, 0xe304),
1905 .driver_info = EM2820_BOARD_PINNACLE_DVC_90 }, /* Kworld DVD Maker 2 */
1906 { USB_DEVICE(0x0ccd, 0x0036),
1907 .driver_info = EM2820_BOARD_TERRATEC_CINERGY_250 },
1908 { USB_DEVICE(0x0ccd, 0x004c),
1909 .driver_info = EM2880_BOARD_TERRATEC_HYBRID_XS_FR },
1910 { USB_DEVICE(0x0ccd, 0x004f),
1911 .driver_info = EM2860_BOARD_TERRATEC_HYBRID_XS },
1912 { USB_DEVICE(0x0ccd, 0x005e),
1913 .driver_info = EM2882_BOARD_TERRATEC_HYBRID_XS },
1914 { USB_DEVICE(0x0ccd, 0x0042),
1915 .driver_info = EM2882_BOARD_TERRATEC_HYBRID_XS },
1916 { USB_DEVICE(0x0ccd, 0x0043),
1917 .driver_info = EM2884_BOARD_TERRATEC_H5 },
1918 { USB_DEVICE(0x0ccd, 0x10a2), /* Rev. 1 */
1919 .driver_info = EM2884_BOARD_TERRATEC_H5 },
1920 { USB_DEVICE(0x0ccd, 0x10ad), /* Rev. 2 */
1921 .driver_info = EM2880_BOARD_TERRATEC_PRODIGY_XS },
1922 { USB_DEVICE(0x0ccd, 0x0084),
1923 .driver_info = EM2860_BOARD_TERRATEC_AV350 },
1924 { USB_DEVICE(0x0ccd, 0x0096),
1925 .driver_info = EM2860_BOARD_TERRATEC_GRABBY },
1926 { USB_DEVICE(0x0ccd, 0x10AF),
1927 .driver_info = EM2860_BOARD_TERRATEC_GRABBY },
1928 { USB_DEVICE(0x0fd9, 0x0033),
1929 .driver_info = EM2860_BOARD_ELGATO_VIDEO_CAPTURE},
1930 { USB_DEVICE(0x185b, 0x2870),
1931 .driver_info = EM2870_BOARD_COMPRO_VIDEOMATE },
1932 { USB_DEVICE(0x185b, 0x2041),
1933 .driver_info = EM2820_BOARD_COMPRO_VIDEOMATE_FORYOU },
1934 { USB_DEVICE(0x2040, 0x4200),
1935 .driver_info = EM2820_BOARD_HAUPPAUGE_WINTV_USB_2 },
1936 { USB_DEVICE(0x2040, 0x4201),
1937 .driver_info = EM2820_BOARD_HAUPPAUGE_WINTV_USB_2 },
1938 { USB_DEVICE(0x2040, 0x6500),
1939 .driver_info = EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900 },
1940 { USB_DEVICE(0x2040, 0x6502),
1941 .driver_info = EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900_R2 },
1942 { USB_DEVICE(0x2040, 0x6513), /* HCW HVR-980 */
1943 .driver_info = EM2883_BOARD_HAUPPAUGE_WINTV_HVR_950 },
1944 { USB_DEVICE(0x2040, 0x6517), /* HP HVR-950 */
1945 .driver_info = EM2883_BOARD_HAUPPAUGE_WINTV_HVR_950 },
1946 { USB_DEVICE(0x2040, 0x651b), /* RP HVR-950 */
1947 .driver_info = EM2883_BOARD_HAUPPAUGE_WINTV_HVR_950 },
1948 { USB_DEVICE(0x2040, 0x651f),
1949 .driver_info = EM2883_BOARD_HAUPPAUGE_WINTV_HVR_850 },
1950 { USB_DEVICE(0x0438, 0xb002),
1951 .driver_info = EM2880_BOARD_AMD_ATI_TV_WONDER_HD_600 },
1952 { USB_DEVICE(0x2001, 0xf112),
1953 .driver_info = EM2820_BOARD_DLINK_USB_TV },
1954 { USB_DEVICE(0x2304, 0x0207),
1955 .driver_info = EM2820_BOARD_PINNACLE_DVC_90 },
1956 { USB_DEVICE(0x2304, 0x0208),
1957 .driver_info = EM2820_BOARD_PINNACLE_USB_2 },
1958 { USB_DEVICE(0x2304, 0x021a),
1959 .driver_info = EM2820_BOARD_PINNACLE_DVC_90 },
1960 { USB_DEVICE(0x2304, 0x0226),
1961 .driver_info = EM2882_BOARD_PINNACLE_HYBRID_PRO_330E },
1962 { USB_DEVICE(0x2304, 0x0227),
1963 .driver_info = EM2880_BOARD_PINNACLE_PCTV_HD_PRO },
1964 { USB_DEVICE(0x0413, 0x6023),
1965 .driver_info = EM2800_BOARD_LEADTEK_WINFAST_USBII },
1966 { USB_DEVICE(0x093b, 0xa005),
1967 .driver_info = EM2861_BOARD_PLEXTOR_PX_TV100U },
1968 { USB_DEVICE(0x04bb, 0x0515),
1969 .driver_info = EM2820_BOARD_IODATA_GVMVP_SZ },
1970 { USB_DEVICE(0xeb1a, 0x50a6),
1971 .driver_info = EM2860_BOARD_GADMEI_UTV330 },
1972 { USB_DEVICE(0x1b80, 0xa340),
1973 .driver_info = EM2870_BOARD_KWORLD_A340 },
1974 { USB_DEVICE(0x2013, 0x024f),
1975 .driver_info = EM28174_BOARD_PCTV_290E },
1976 { USB_DEVICE(0x2013, 0x024c),
1977 .driver_info = EM28174_BOARD_PCTV_460E },
1980 MODULE_DEVICE_TABLE(usb, em28xx_id_table);
1983 * EEPROM hash table for devices with generic USB IDs
1985 static struct em28xx_hash_table em28xx_eeprom_hash[] = {
1986 /* P/N: SA 60002070465 Tuner: TVF7533-MF */
1987 {0x6ce05a8f, EM2820_BOARD_PROLINK_PLAYTV_USB2, TUNER_YMEC_TVF_5533MF},
1988 {0x72cc5a8b, EM2820_BOARD_PROLINK_PLAYTV_BOX4_USB2, TUNER_YMEC_TVF_5533MF},
1989 {0x966a0441, EM2880_BOARD_KWORLD_DVB_310U, TUNER_XC2028},
1990 {0x166a0441, EM2880_BOARD_EMPIRE_DUAL_TV, TUNER_XC2028},
1991 {0xcee44a99, EM2882_BOARD_EVGA_INDTUBE, TUNER_XC2028},
1992 {0xb8846b20, EM2881_BOARD_PINNACLE_HYBRID_PRO, TUNER_XC2028},
1993 {0x63f653bd, EM2870_BOARD_REDDO_DVB_C_USB_BOX, TUNER_ABSENT},
1994 {0x4e913442, EM2882_BOARD_DIKOM_DK300, TUNER_XC2028},
1997 /* I2C devicelist hash table for devices with generic USB IDs */
1998 static struct em28xx_hash_table em28xx_i2c_hash[] = {
1999 {0xb06a32c3, EM2800_BOARD_TERRATEC_CINERGY_200, TUNER_LG_PAL_NEW_TAPC},
2000 {0xf51200e3, EM2800_BOARD_VGEAR_POCKETTV, TUNER_LG_PAL_NEW_TAPC},
2001 {0x1ba50080, EM2860_BOARD_SAA711X_REFERENCE_DESIGN, TUNER_ABSENT},
2002 {0x77800080, EM2860_BOARD_TVP5150_REFERENCE_DESIGN, TUNER_ABSENT},
2003 {0xc51200e3, EM2820_BOARD_GADMEI_TVR200, TUNER_LG_PAL_NEW_TAPC},
2004 {0x4ba50080, EM2861_BOARD_GADMEI_UTV330PLUS, TUNER_TNF_5335MF},
2005 {0x6b800080, EM2874_BOARD_LEADERSHIP_ISDBT, TUNER_ABSENT},
2008 /* I2C possible address to saa7115, tvp5150, msp3400, tvaudio */
2009 static unsigned short saa711x_addrs[] = {
2010 0x4a >> 1, 0x48 >> 1, /* SAA7111, SAA7111A and SAA7113 */
2011 0x42 >> 1, 0x40 >> 1, /* SAA7114, SAA7115 and SAA7118 */
2014 static unsigned short tvp5150_addrs[] = {
2020 static unsigned short msp3400_addrs[] = {
2026 int em28xx_tuner_callback(void *ptr, int component, int command, int arg)
2029 struct em28xx *dev = ptr;
2031 if (dev->tuner_type != TUNER_XC2028)
2034 if (command != XC2028_TUNER_RESET)
2037 rc = em28xx_gpio_set(dev, dev->board.tuner_gpio);
2041 EXPORT_SYMBOL_GPL(em28xx_tuner_callback);
2043 static inline void em28xx_set_model(struct em28xx *dev)
2045 memcpy(&dev->board, &em28xx_boards[dev->model], sizeof(dev->board));
2047 /* Those are the default values for the majority of boards
2048 Use those values if not specified otherwise at boards entry
2050 if (!dev->board.xclk)
2051 dev->board.xclk = EM28XX_XCLK_IR_RC5_MODE |
2052 EM28XX_XCLK_FREQUENCY_12MHZ;
2054 if (!dev->board.i2c_speed)
2055 dev->board.i2c_speed = EM28XX_I2C_CLK_WAIT_ENABLE |
2056 EM28XX_I2C_FREQ_100_KHZ;
2060 /* FIXME: Should be replaced by a proper mt9m111 driver */
2061 static int em28xx_initialize_mt9m111(struct em28xx *dev)
2064 unsigned char regs[][3] = {
2065 { 0x0d, 0x00, 0x01, }, /* reset and use defaults */
2066 { 0x0d, 0x00, 0x00, },
2067 { 0x0a, 0x00, 0x21, },
2068 { 0x21, 0x04, 0x00, }, /* full readout speed, no row/col skipping */
2071 for (i = 0; i < ARRAY_SIZE(regs); i++)
2072 i2c_master_send(&dev->i2c_client, ®s[i][0], 3);
2078 /* FIXME: Should be replaced by a proper mt9m001 driver */
2079 static int em28xx_initialize_mt9m001(struct em28xx *dev)
2082 unsigned char regs[][3] = {
2083 { 0x0d, 0x00, 0x01, },
2084 { 0x0d, 0x00, 0x00, },
2085 { 0x04, 0x05, 0x00, }, /* hres = 1280 */
2086 { 0x03, 0x04, 0x00, }, /* vres = 1024 */
2087 { 0x20, 0x11, 0x00, },
2088 { 0x06, 0x00, 0x10, },
2089 { 0x2b, 0x00, 0x24, },
2090 { 0x2e, 0x00, 0x24, },
2091 { 0x35, 0x00, 0x24, },
2092 { 0x2d, 0x00, 0x20, },
2093 { 0x2c, 0x00, 0x20, },
2094 { 0x09, 0x0a, 0xd4, },
2095 { 0x35, 0x00, 0x57, },
2098 for (i = 0; i < ARRAY_SIZE(regs); i++)
2099 i2c_master_send(&dev->i2c_client, ®s[i][0], 3);
2104 /* HINT method: webcam I2C chips
2106 * This method works for webcams with Micron sensors
2108 static int em28xx_hint_sensor(struct em28xx *dev)
2116 /* Micron sensor detection */
2117 dev->i2c_client.addr = 0xba >> 1;
2119 i2c_master_send(&dev->i2c_client, &cmd, 1);
2120 rc = i2c_master_recv(&dev->i2c_client, (char *)&version_be, 2);
2124 version = be16_to_cpu(version_be);
2126 case 0x8232: /* mt9v011 640x480 1.3 Mpix sensor */
2127 case 0x8243: /* mt9v011 rev B 640x480 1.3 Mpix sensor */
2128 dev->model = EM2820_BOARD_SILVERCREST_WEBCAM;
2129 em28xx_set_model(dev);
2131 sensor_name = "mt9v011";
2132 dev->em28xx_sensor = EM28XX_MT9V011;
2133 dev->sensor_xres = 640;
2134 dev->sensor_yres = 480;
2136 * FIXME: mt9v011 uses I2S speed as xtal clk - at least with
2137 * the Silvercrest cam I have here for testing - for higher
2138 * resolutions, a high clock cause horizontal artifacts, so we
2139 * need to use a lower xclk frequency.
2140 * Yet, it would be possible to adjust xclk depending on the
2141 * desired resolution, since this affects directly the
2144 dev->board.xclk = EM28XX_XCLK_FREQUENCY_4_3MHZ;
2145 dev->sensor_xtal = 4300000;
2147 /* probably means GRGB 16 bit bayer */
2148 dev->vinmode = 0x0d;
2153 case 0x143a: /* MT9M111 as found in the ECS G200 */
2154 dev->model = EM2750_BOARD_UNKNOWN;
2155 em28xx_set_model(dev);
2157 sensor_name = "mt9m111";
2158 dev->board.xclk = EM28XX_XCLK_FREQUENCY_48MHZ;
2159 dev->em28xx_sensor = EM28XX_MT9M111;
2160 em28xx_initialize_mt9m111(dev);
2161 dev->sensor_xres = 640;
2162 dev->sensor_yres = 512;
2164 dev->vinmode = 0x0a;
2170 dev->model = EM2750_BOARD_UNKNOWN;
2171 em28xx_set_model(dev);
2173 sensor_name = "mt9m001";
2174 dev->em28xx_sensor = EM28XX_MT9M001;
2175 em28xx_initialize_mt9m001(dev);
2176 dev->sensor_xres = 1280;
2177 dev->sensor_yres = 1024;
2179 /* probably means BGGR 16 bit bayer */
2180 dev->vinmode = 0x0c;
2185 printk("Unknown Micron Sensor 0x%04x\n", version);
2189 /* Setup webcam defaults */
2190 em28xx_pre_card_setup(dev);
2192 em28xx_errdev("Sensor is %s, using model %s entry.\n",
2193 sensor_name, em28xx_boards[dev->model].name);
2198 /* Since em28xx_pre_card_setup() requires a proper dev->model,
2199 * this won't work for boards with generic PCI IDs
2201 void em28xx_pre_card_setup(struct em28xx *dev)
2203 /* Set the initial XCLK and I2C clock values based on the board
2205 em28xx_write_reg(dev, EM28XX_R0F_XCLK, dev->board.xclk & 0x7f);
2206 em28xx_write_reg(dev, EM28XX_R06_I2C_CLK, dev->board.i2c_speed);
2209 /* request some modules */
2210 switch (dev->model) {
2211 case EM2861_BOARD_PLEXTOR_PX_TV100U:
2212 /* Sets the msp34xx I2S speed */
2213 dev->i2s_speed = 2048000;
2215 case EM2861_BOARD_KWORLD_PVRTV_300U:
2216 case EM2880_BOARD_KWORLD_DVB_305U:
2217 em28xx_write_reg(dev, EM28XX_R08_GPIO, 0x6d);
2219 em28xx_write_reg(dev, EM28XX_R08_GPIO, 0x7d);
2222 case EM2870_BOARD_COMPRO_VIDEOMATE:
2223 /* TODO: someone can do some cleanup here...
2224 not everything's needed */
2225 em28xx_write_reg(dev, EM2880_R04_GPO, 0x00);
2227 em28xx_write_reg(dev, EM2880_R04_GPO, 0x01);
2229 em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xfd);
2231 em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xfc);
2233 em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xdc);
2235 em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xfc);
2238 case EM2870_BOARD_TERRATEC_XS_MT2060:
2239 /* this device needs some gpio writes to get the DVB-T
2241 em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xfe);
2243 em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xde);
2245 em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xfe);
2248 case EM2870_BOARD_PINNACLE_PCTV_DVB:
2249 /* this device needs some gpio writes to get the
2251 em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xfe);
2253 em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xde);
2255 em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xfe);
2258 case EM2820_BOARD_GADMEI_UTV310:
2259 case EM2820_BOARD_MSI_VOX_USB_2:
2260 /* enables audio for that devices */
2261 em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xfd);
2264 case EM2882_BOARD_KWORLD_ATSC_315U:
2265 em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xff);
2267 em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xfe);
2269 em28xx_write_reg(dev, EM2880_R04_GPO, 0x00);
2271 em28xx_write_reg(dev, EM2880_R04_GPO, 0x08);
2275 case EM2860_BOARD_KAIOMY_TVNPC_U2:
2276 em28xx_write_regs(dev, EM28XX_R0F_XCLK, "\x07", 1);
2277 em28xx_write_regs(dev, EM28XX_R06_I2C_CLK, "\x40", 1);
2278 em28xx_write_regs(dev, 0x0d, "\x42", 1);
2279 em28xx_write_regs(dev, 0x08, "\xfd", 1);
2281 em28xx_write_regs(dev, 0x08, "\xff", 1);
2283 em28xx_write_regs(dev, 0x08, "\x7f", 1);
2285 em28xx_write_regs(dev, 0x08, "\x6b", 1);
2288 case EM2860_BOARD_EASYCAP:
2289 em28xx_write_regs(dev, 0x08, "\xf8", 1);
2292 case EM2820_BOARD_IODATA_GVMVP_SZ:
2293 em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xff);
2295 em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xf7);
2297 em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xfe);
2299 em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xfd);
2304 em28xx_gpio_set(dev, dev->board.tuner_gpio);
2305 em28xx_set_mode(dev, EM28XX_ANALOG_MODE);
2308 em28xx_set_mode(dev, EM28XX_SUSPEND);
2311 static void em28xx_setup_xc3028(struct em28xx *dev, struct xc2028_ctrl *ctl)
2313 memset(ctl, 0, sizeof(*ctl));
2315 ctl->fname = XC2028_DEFAULT_FIRMWARE;
2317 ctl->mts = em28xx_boards[dev->model].mts_firmware;
2319 switch (dev->model) {
2320 case EM2880_BOARD_EMPIRE_DUAL_TV:
2321 case EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900:
2322 case EM2882_BOARD_TERRATEC_HYBRID_XS:
2323 ctl->demod = XC3028_FE_ZARLINK456;
2325 case EM2880_BOARD_TERRATEC_HYBRID_XS:
2326 case EM2880_BOARD_TERRATEC_HYBRID_XS_FR:
2327 case EM2881_BOARD_PINNACLE_HYBRID_PRO:
2328 ctl->demod = XC3028_FE_ZARLINK456;
2330 case EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900_R2:
2331 case EM2882_BOARD_PINNACLE_HYBRID_PRO_330E:
2332 ctl->demod = XC3028_FE_DEFAULT;
2334 case EM2880_BOARD_AMD_ATI_TV_WONDER_HD_600:
2335 ctl->demod = XC3028_FE_DEFAULT;
2336 ctl->fname = XC3028L_DEFAULT_FIRMWARE;
2338 case EM2883_BOARD_HAUPPAUGE_WINTV_HVR_850:
2339 case EM2883_BOARD_HAUPPAUGE_WINTV_HVR_950:
2340 case EM2880_BOARD_PINNACLE_PCTV_HD_PRO:
2341 /* FIXME: Better to specify the needed IF */
2342 ctl->demod = XC3028_FE_DEFAULT;
2344 case EM2883_BOARD_KWORLD_HYBRID_330U:
2345 case EM2882_BOARD_DIKOM_DK300:
2346 case EM2882_BOARD_KWORLD_VS_DVBT:
2347 ctl->demod = XC3028_FE_CHINA;
2348 ctl->fname = XC2028_DEFAULT_FIRMWARE;
2350 case EM2882_BOARD_EVGA_INDTUBE:
2351 ctl->demod = XC3028_FE_CHINA;
2352 ctl->fname = XC3028L_DEFAULT_FIRMWARE;
2355 ctl->demod = XC3028_FE_OREN538;
2359 static void em28xx_tuner_setup(struct em28xx *dev)
2361 struct tuner_setup tun_setup;
2362 struct v4l2_frequency f;
2364 if (dev->tuner_type == TUNER_ABSENT)
2367 memset(&tun_setup, 0, sizeof(tun_setup));
2369 tun_setup.mode_mask = T_ANALOG_TV | T_RADIO;
2370 tun_setup.tuner_callback = em28xx_tuner_callback;
2372 if (dev->board.radio.type) {
2373 tun_setup.type = dev->board.radio.type;
2374 tun_setup.addr = dev->board.radio_addr;
2376 v4l2_device_call_all(&dev->v4l2_dev, 0, tuner, s_type_addr, &tun_setup);
2379 if ((dev->tuner_type != TUNER_ABSENT) && (dev->tuner_type)) {
2380 tun_setup.type = dev->tuner_type;
2381 tun_setup.addr = dev->tuner_addr;
2383 v4l2_device_call_all(&dev->v4l2_dev, 0, tuner, s_type_addr, &tun_setup);
2386 if (dev->tda9887_conf) {
2387 struct v4l2_priv_tun_config tda9887_cfg;
2389 tda9887_cfg.tuner = TUNER_TDA9887;
2390 tda9887_cfg.priv = &dev->tda9887_conf;
2392 v4l2_device_call_all(&dev->v4l2_dev, 0, tuner, s_config, &tda9887_cfg);
2395 if (dev->tuner_type == TUNER_XC2028) {
2396 struct v4l2_priv_tun_config xc2028_cfg;
2397 struct xc2028_ctrl ctl;
2399 memset(&xc2028_cfg, 0, sizeof(xc2028_cfg));
2400 memset(&ctl, 0, sizeof(ctl));
2402 em28xx_setup_xc3028(dev, &ctl);
2404 xc2028_cfg.tuner = TUNER_XC2028;
2405 xc2028_cfg.priv = &ctl;
2407 v4l2_device_call_all(&dev->v4l2_dev, 0, tuner, s_config, &xc2028_cfg);
2410 /* configure tuner */
2412 f.type = V4L2_TUNER_ANALOG_TV;
2413 f.frequency = 9076; /* just a magic number */
2414 dev->ctl_freq = f.frequency;
2415 v4l2_device_call_all(&dev->v4l2_dev, 0, tuner, s_frequency, &f);
2418 static int em28xx_hint_board(struct em28xx *dev)
2422 /* HINT method: EEPROM
2424 * This method works only for boards with eeprom.
2425 * Uses a hash of all eeprom bytes. The hash should be
2426 * unique for a vendor/tuner pair.
2427 * There are a high chance that tuners for different
2428 * video standards produce different hashes.
2430 for (i = 0; i < ARRAY_SIZE(em28xx_eeprom_hash); i++) {
2431 if (dev->hash == em28xx_eeprom_hash[i].hash) {
2432 dev->model = em28xx_eeprom_hash[i].model;
2433 dev->tuner_type = em28xx_eeprom_hash[i].tuner;
2435 em28xx_errdev("Your board has no unique USB ID.\n");
2436 em28xx_errdev("A hint were successfully done, "
2437 "based on eeprom hash.\n");
2438 em28xx_errdev("This method is not 100%% failproof.\n");
2439 em28xx_errdev("If the board were missdetected, "
2440 "please email this log to:\n");
2441 em28xx_errdev("\tV4L Mailing List "
2442 " <linux-media@vger.kernel.org>\n");
2443 em28xx_errdev("Board detected as %s\n",
2444 em28xx_boards[dev->model].name);
2450 /* HINT method: I2C attached devices
2452 * This method works for all boards.
2453 * Uses a hash of i2c scanned devices.
2454 * Devices with the same i2c attached chips will
2455 * be considered equal.
2456 * This method is less precise than the eeprom one.
2459 /* user did not request i2c scanning => do it now */
2461 em28xx_do_i2c_scan(dev);
2463 for (i = 0; i < ARRAY_SIZE(em28xx_i2c_hash); i++) {
2464 if (dev->i2c_hash == em28xx_i2c_hash[i].hash) {
2465 dev->model = em28xx_i2c_hash[i].model;
2466 dev->tuner_type = em28xx_i2c_hash[i].tuner;
2467 em28xx_errdev("Your board has no unique USB ID.\n");
2468 em28xx_errdev("A hint were successfully done, "
2469 "based on i2c devicelist hash.\n");
2470 em28xx_errdev("This method is not 100%% failproof.\n");
2471 em28xx_errdev("If the board were missdetected, "
2472 "please email this log to:\n");
2473 em28xx_errdev("\tV4L Mailing List "
2474 " <linux-media@vger.kernel.org>\n");
2475 em28xx_errdev("Board detected as %s\n",
2476 em28xx_boards[dev->model].name);
2482 em28xx_errdev("Your board has no unique USB ID and thus need a "
2483 "hint to be detected.\n");
2484 em28xx_errdev("You may try to use card=<n> insmod option to "
2485 "workaround that.\n");
2486 em28xx_errdev("Please send an email with this log to:\n");
2487 em28xx_errdev("\tV4L Mailing List <linux-media@vger.kernel.org>\n");
2488 em28xx_errdev("Board eeprom hash is 0x%08lx\n", dev->hash);
2489 em28xx_errdev("Board i2c devicelist hash is 0x%08lx\n", dev->i2c_hash);
2491 em28xx_errdev("Here is a list of valid choices for the card=<n>"
2492 " insmod option:\n");
2493 for (i = 0; i < em28xx_bcount; i++) {
2494 em28xx_errdev(" card=%d -> %s\n",
2495 i, em28xx_boards[i].name);
2500 /* ----------------------------------------------------------------------- */
2501 void em28xx_register_i2c_ir(struct em28xx *dev)
2503 /* Leadtek winfast tv USBII deluxe can find a non working IR-device */
2504 /* at address 0x18, so if that address is needed for another board in */
2505 /* the future, please put it after 0x1f. */
2506 struct i2c_board_info info;
2507 const unsigned short addr_list[] = {
2508 0x1f, 0x30, 0x47, I2C_CLIENT_END
2514 memset(&info, 0, sizeof(struct i2c_board_info));
2515 memset(&dev->init_data, 0, sizeof(dev->init_data));
2516 strlcpy(info.type, "ir_video", I2C_NAME_SIZE);
2518 /* detect & configure */
2519 switch (dev->model) {
2520 case EM2800_BOARD_TERRATEC_CINERGY_200:
2521 case EM2820_BOARD_TERRATEC_CINERGY_250:
2522 dev->init_data.ir_codes = RC_MAP_EM_TERRATEC;
2523 dev->init_data.get_key = em28xx_get_key_terratec;
2524 dev->init_data.name = "i2c IR (EM28XX Terratec)";
2526 case EM2820_BOARD_PINNACLE_USB_2:
2527 dev->init_data.ir_codes = RC_MAP_PINNACLE_GREY;
2528 dev->init_data.get_key = em28xx_get_key_pinnacle_usb_grey;
2529 dev->init_data.name = "i2c IR (EM28XX Pinnacle PCTV)";
2531 case EM2820_BOARD_HAUPPAUGE_WINTV_USB_2:
2532 dev->init_data.ir_codes = RC_MAP_HAUPPAUGE;
2533 dev->init_data.get_key = em28xx_get_key_em_haup;
2534 dev->init_data.name = "i2c IR (EM2840 Hauppauge)";
2536 case EM2820_BOARD_LEADTEK_WINFAST_USBII_DELUXE:
2537 dev->init_data.ir_codes = RC_MAP_WINFAST_USBII_DELUXE;
2538 dev->init_data.get_key = em28xx_get_key_winfast_usbii_deluxe;
2539 dev->init_data.name = "i2c IR (EM2820 Winfast TV USBII Deluxe)";
2543 if (dev->init_data.name)
2544 info.platform_data = &dev->init_data;
2545 i2c_new_probed_device(&dev->i2c_adap, &info, addr_list, NULL);
2548 void em28xx_card_setup(struct em28xx *dev)
2551 * If the device can be a webcam, seek for a sensor.
2552 * If sensor is not found, then it isn't a webcam.
2554 if (dev->board.is_webcam) {
2555 if (em28xx_hint_sensor(dev) < 0)
2556 dev->board.is_webcam = 0;
2558 dev->progressive = 1;
2561 if (!dev->board.is_webcam) {
2562 switch (dev->model) {
2563 case EM2820_BOARD_UNKNOWN:
2564 case EM2800_BOARD_UNKNOWN:
2566 * The K-WORLD DVB-T 310U is detected as an MSI Digivox AD.
2568 * This occurs because they share identical USB vendor and
2571 * What we do here is look up the EEPROM hash of the K-WORLD
2572 * and if it is found then we decide that we do not have
2573 * a DIGIVOX and reset the device to the K-WORLD instead.
2575 * This solution is only valid if they do not share eeprom
2576 * hash identities which has not been determined as yet.
2578 if (em28xx_hint_board(dev) < 0)
2579 em28xx_errdev("Board not discovered\n");
2581 em28xx_set_model(dev);
2582 em28xx_pre_card_setup(dev);
2586 em28xx_set_model(dev);
2590 em28xx_info("Identified as %s (card=%d)\n",
2591 dev->board.name, dev->model);
2593 dev->tuner_type = em28xx_boards[dev->model].tuner_type;
2594 if (em28xx_boards[dev->model].tuner_addr)
2595 dev->tuner_addr = em28xx_boards[dev->model].tuner_addr;
2597 if (em28xx_boards[dev->model].tda9887_conf)
2598 dev->tda9887_conf = em28xx_boards[dev->model].tda9887_conf;
2600 /* request some modules */
2601 switch (dev->model) {
2602 case EM2820_BOARD_HAUPPAUGE_WINTV_USB_2:
2603 case EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900:
2604 case EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900_R2:
2605 case EM2883_BOARD_HAUPPAUGE_WINTV_HVR_850:
2606 case EM2883_BOARD_HAUPPAUGE_WINTV_HVR_950:
2609 #if defined(CONFIG_MODULES) && defined(MODULE)
2610 request_module("tveeprom");
2612 /* Call first TVeeprom */
2614 dev->i2c_client.addr = 0xa0 >> 1;
2615 tveeprom_hauppauge_analog(&dev->i2c_client, &tv, dev->eedata);
2617 dev->tuner_type = tv.tuner_type;
2619 if (tv.audio_processor == V4L2_IDENT_MSPX4XX) {
2620 dev->i2s_speed = 2048000;
2621 dev->board.has_msp34xx = 1;
2625 case EM2882_BOARD_KWORLD_ATSC_315U:
2626 em28xx_write_reg(dev, 0x0d, 0x42);
2628 em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xfd);
2631 case EM2820_BOARD_KWORLD_PVRTV2800RF:
2632 /* GPIO enables sound on KWORLD PVR TV 2800RF */
2633 em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xf9);
2635 case EM2820_BOARD_UNKNOWN:
2636 case EM2800_BOARD_UNKNOWN:
2638 * The K-WORLD DVB-T 310U is detected as an MSI Digivox AD.
2640 * This occurs because they share identical USB vendor and
2643 * What we do here is look up the EEPROM hash of the K-WORLD
2644 * and if it is found then we decide that we do not have
2645 * a DIGIVOX and reset the device to the K-WORLD instead.
2647 * This solution is only valid if they do not share eeprom
2648 * hash identities which has not been determined as yet.
2650 case EM2880_BOARD_MSI_DIGIVOX_AD:
2651 if (!em28xx_hint_board(dev))
2652 em28xx_set_model(dev);
2654 /* In cases where we had to use a board hint, the call to
2655 em28xx_set_mode() in em28xx_pre_card_setup() was a no-op,
2656 so make the call now so the analog GPIOs are set properly
2657 before probing the i2c bus. */
2658 em28xx_gpio_set(dev, dev->board.tuner_gpio);
2659 em28xx_set_mode(dev, EM28XX_ANALOG_MODE);
2663 * The Dikom DK300 is detected as an Kworld VS-DVB-T 323UR.
2665 * This occurs because they share identical USB vendor and
2668 * What we do here is look up the EEPROM hash of the Dikom
2669 * and if it is found then we decide that we do not have
2670 * a Kworld and reset the device to the Dikom instead.
2672 * This solution is only valid if they do not share eeprom
2673 * hash identities which has not been determined as yet.
2675 case EM2882_BOARD_KWORLD_VS_DVBT:
2676 if (!em28xx_hint_board(dev))
2677 em28xx_set_model(dev);
2679 /* In cases where we had to use a board hint, the call to
2680 em28xx_set_mode() in em28xx_pre_card_setup() was a no-op,
2681 so make the call now so the analog GPIOs are set properly
2682 before probing the i2c bus. */
2683 em28xx_gpio_set(dev, dev->board.tuner_gpio);
2684 em28xx_set_mode(dev, EM28XX_ANALOG_MODE);
2688 #if defined(CONFIG_MODULES) && defined(MODULE)
2689 if (dev->board.has_ir_i2c && !disable_ir)
2690 request_module("ir-kbd-i2c");
2692 if (dev->board.has_snapshot_button)
2693 em28xx_register_snapshot_button(dev);
2695 if (dev->board.valid == EM28XX_BOARD_NOT_VALIDATED) {
2696 em28xx_errdev("\n\n");
2697 em28xx_errdev("The support for this board weren't "
2699 em28xx_errdev("Please send a report of having this working\n");
2700 em28xx_errdev("not to V4L mailing list (and/or to other "
2704 /* Allow override tuner type by a module parameter */
2706 dev->tuner_type = tuner;
2708 /* request some modules */
2709 if (dev->board.has_msp34xx)
2710 v4l2_i2c_new_subdev(&dev->v4l2_dev, &dev->i2c_adap,
2711 "msp3400", 0, msp3400_addrs);
2713 if (dev->board.decoder == EM28XX_SAA711X)
2714 v4l2_i2c_new_subdev(&dev->v4l2_dev, &dev->i2c_adap,
2715 "saa7115_auto", 0, saa711x_addrs);
2717 if (dev->board.decoder == EM28XX_TVP5150)
2718 v4l2_i2c_new_subdev(&dev->v4l2_dev, &dev->i2c_adap,
2719 "tvp5150", 0, tvp5150_addrs);
2721 if (dev->em28xx_sensor == EM28XX_MT9V011) {
2722 struct mt9v011_platform_data pdata;
2723 struct i2c_board_info mt9v011_info = {
2726 .platform_data = &pdata,
2729 pdata.xtal = dev->sensor_xtal;
2730 v4l2_i2c_new_subdev_board(&dev->v4l2_dev, &dev->i2c_adap,
2731 &mt9v011_info, NULL);
2735 if (dev->board.adecoder == EM28XX_TVAUDIO)
2736 v4l2_i2c_new_subdev(&dev->v4l2_dev, &dev->i2c_adap,
2737 "tvaudio", dev->board.tvaudio_addr, NULL);
2739 if (dev->board.tuner_type != TUNER_ABSENT) {
2740 int has_demod = (dev->tda9887_conf & TDA9887_PRESENT);
2742 if (dev->board.radio.type)
2743 v4l2_i2c_new_subdev(&dev->v4l2_dev, &dev->i2c_adap,
2744 "tuner", dev->board.radio_addr, NULL);
2747 v4l2_i2c_new_subdev(&dev->v4l2_dev,
2748 &dev->i2c_adap, "tuner",
2749 0, v4l2_i2c_tuner_addrs(ADDRS_DEMOD));
2750 if (dev->tuner_addr == 0) {
2751 enum v4l2_i2c_tuner_type type =
2752 has_demod ? ADDRS_TV_WITH_DEMOD : ADDRS_TV;
2753 struct v4l2_subdev *sd;
2755 sd = v4l2_i2c_new_subdev(&dev->v4l2_dev,
2756 &dev->i2c_adap, "tuner",
2757 0, v4l2_i2c_tuner_addrs(type));
2760 dev->tuner_addr = v4l2_i2c_subdev_addr(sd);
2762 v4l2_i2c_new_subdev(&dev->v4l2_dev, &dev->i2c_adap,
2763 "tuner", dev->tuner_addr, NULL);
2767 em28xx_tuner_setup(dev);
2770 em28xx_ir_init(dev);
2774 #if defined(CONFIG_MODULES) && defined(MODULE)
2775 static void request_module_async(struct work_struct *work)
2777 struct em28xx *dev = container_of(work,
2778 struct em28xx, request_module_wk);
2780 if (dev->has_audio_class)
2781 request_module("snd-usb-audio");
2782 else if (dev->has_alsa_audio)
2783 request_module("em28xx-alsa");
2785 if (dev->board.has_dvb)
2786 request_module("em28xx-dvb");
2789 static void request_modules(struct em28xx *dev)
2791 INIT_WORK(&dev->request_module_wk, request_module_async);
2792 schedule_work(&dev->request_module_wk);
2795 static void flush_request_modules(struct em28xx *dev)
2797 flush_work_sync(&dev->request_module_wk);
2800 #define request_modules(dev)
2801 #define flush_request_modules(dev)
2802 #endif /* CONFIG_MODULES */
2805 * em28xx_release_resources()
2806 * unregisters the v4l2,i2c and usb devices
2807 * called when the device gets disconnected or at module unload
2809 void em28xx_release_resources(struct em28xx *dev)
2811 if (dev->sbutton_input_dev)
2812 em28xx_deregister_snapshot_button(dev);
2815 em28xx_ir_fini(dev);
2817 /*FIXME: I2C IR should be disconnected */
2819 em28xx_release_analog_resources(dev);
2821 em28xx_i2c_unregister(dev);
2823 v4l2_device_unregister(&dev->v4l2_dev);
2825 usb_put_dev(dev->udev);
2827 /* Mark device as unused */
2828 clear_bit(dev->devno, &em28xx_devused);
2833 * allocates and inits the device structs, registers i2c bus and v4l device
2835 static int em28xx_init_dev(struct em28xx **devhandle, struct usb_device *udev,
2836 struct usb_interface *interface,
2839 struct em28xx *dev = *devhandle;
2843 mutex_init(&dev->ctrl_urb_lock);
2844 spin_lock_init(&dev->slock);
2845 init_waitqueue_head(&dev->open);
2846 init_waitqueue_head(&dev->wait_frame);
2847 init_waitqueue_head(&dev->wait_stream);
2849 dev->em28xx_write_regs = em28xx_write_regs;
2850 dev->em28xx_read_reg = em28xx_read_reg;
2851 dev->em28xx_read_reg_req_len = em28xx_read_reg_req_len;
2852 dev->em28xx_write_regs_req = em28xx_write_regs_req;
2853 dev->em28xx_read_reg_req = em28xx_read_reg_req;
2854 dev->board.is_em2800 = em28xx_boards[dev->model].is_em2800;
2856 em28xx_set_model(dev);
2858 /* Set the default GPO/GPIO for legacy devices */
2859 dev->reg_gpo_num = EM2880_R04_GPO;
2860 dev->reg_gpio_num = EM28XX_R08_GPIO;
2862 dev->wait_after_write = 5;
2864 /* Based on the Chip ID, set the device configuration */
2865 retval = em28xx_read_reg(dev, EM28XX_R0A_CHIPID);
2867 dev->chip_id = retval;
2869 switch (dev->chip_id) {
2870 case CHIP_ID_EM2800:
2871 em28xx_info("chip ID is em2800\n");
2873 case CHIP_ID_EM2710:
2874 em28xx_info("chip ID is em2710\n");
2876 case CHIP_ID_EM2750:
2877 em28xx_info("chip ID is em2750\n");
2879 case CHIP_ID_EM2820:
2880 em28xx_info("chip ID is em2820 (or em2710)\n");
2882 case CHIP_ID_EM2840:
2883 em28xx_info("chip ID is em2840\n");
2885 case CHIP_ID_EM2860:
2886 em28xx_info("chip ID is em2860\n");
2888 case CHIP_ID_EM2870:
2889 em28xx_info("chip ID is em2870\n");
2890 dev->wait_after_write = 0;
2892 case CHIP_ID_EM2874:
2893 em28xx_info("chip ID is em2874\n");
2894 dev->reg_gpio_num = EM2874_R80_GPIO;
2895 dev->wait_after_write = 0;
2897 case CHIP_ID_EM28174:
2898 em28xx_info("chip ID is em28174\n");
2899 dev->reg_gpio_num = EM2874_R80_GPIO;
2900 dev->wait_after_write = 0;
2902 case CHIP_ID_EM2883:
2903 em28xx_info("chip ID is em2882/em2883\n");
2904 dev->wait_after_write = 0;
2906 case CHIP_ID_EM2884:
2907 em28xx_info("chip ID is em2884\n");
2908 dev->reg_gpio_num = EM2874_R80_GPIO;
2909 dev->wait_after_write = 0;
2912 em28xx_info("em28xx chip ID = %d\n", dev->chip_id);
2916 if (dev->is_audio_only) {
2917 retval = em28xx_audio_setup(dev);
2920 em28xx_init_extension(dev);
2925 /* Prepopulate cached GPO register content */
2926 retval = em28xx_read_reg(dev, dev->reg_gpo_num);
2928 dev->reg_gpo = retval;
2930 em28xx_pre_card_setup(dev);
2932 if (!dev->board.is_em2800) {
2933 /* Resets I2C speed */
2934 em28xx_write_reg(dev, EM28XX_R06_I2C_CLK, dev->board.i2c_speed);
2936 em28xx_errdev("%s: em28xx_write_reg failed!"
2943 retval = v4l2_device_register(&interface->dev, &dev->v4l2_dev);
2945 em28xx_errdev("Call to v4l2_device_register() failed!\n");
2949 /* register i2c bus */
2950 retval = em28xx_i2c_register(dev);
2952 em28xx_errdev("%s: em28xx_i2c_register - error [%d]!\n",
2954 goto unregister_dev;
2958 * Default format, used for tvp5150 or saa711x output formats
2960 dev->vinmode = 0x10;
2961 dev->vinctl = EM28XX_VINCTRL_INTERLACED |
2962 EM28XX_VINCTRL_CCIR656_ENABLE;
2964 /* Do board specific init and eeprom reading */
2965 em28xx_card_setup(dev);
2967 /* Configure audio */
2968 retval = em28xx_audio_setup(dev);
2970 em28xx_errdev("%s: Error while setting audio - error [%d]!\n",
2975 /* wake i2c devices */
2976 em28xx_wake_i2c(dev);
2978 /* init video dma queues */
2979 INIT_LIST_HEAD(&dev->vidq.active);
2980 INIT_LIST_HEAD(&dev->vidq.queued);
2981 INIT_LIST_HEAD(&dev->vbiq.active);
2982 INIT_LIST_HEAD(&dev->vbiq.queued);
2984 if (dev->board.has_msp34xx) {
2985 /* Send a reset to other chips via gpio */
2986 retval = em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xf7);
2988 em28xx_errdev("%s: em28xx_write_reg - "
2989 "msp34xx(1) failed! error [%d]\n",
2995 retval = em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xff);
2997 em28xx_errdev("%s: em28xx_write_reg - "
2998 "msp34xx(2) failed! error [%d]\n",
3005 retval = em28xx_register_analog_devices(dev);
3010 /* Save some power by putting tuner to sleep */
3011 v4l2_device_call_all(&dev->v4l2_dev, 0, core, s_power, 0);
3016 em28xx_i2c_unregister(dev);
3019 v4l2_device_unregister(&dev->v4l2_dev);
3024 /* high bandwidth multiplier, as encoded in highspeed endpoint descriptors */
3025 #define hb_mult(wMaxPacketSize) (1 + (((wMaxPacketSize) >> 11) & 0x03))
3028 * em28xx_usb_probe()
3029 * checks for supported devices
3031 static int em28xx_usb_probe(struct usb_interface *interface,
3032 const struct usb_device_id *id)
3034 const struct usb_endpoint_descriptor *endpoint;
3035 struct usb_device *udev;
3036 struct em28xx *dev = NULL;
3038 bool is_audio_only = false, has_audio = false;
3039 int i, nr, isoc_pipe;
3040 const int ifnum = interface->altsetting[0].desc.bInterfaceNumber;
3042 char descr[255] = "";
3044 udev = usb_get_dev(interface_to_usbdev(interface));
3046 /* Check to see next free device and mark as used */
3048 nr = find_first_zero_bit(&em28xx_devused, EM28XX_MAXBOARDS);
3049 if (nr >= EM28XX_MAXBOARDS) {
3050 /* No free device slots */
3051 printk(DRIVER_NAME ": Supports only %i em28xx boards.\n",
3056 } while (test_and_set_bit(nr, &em28xx_devused));
3058 /* Don't register audio interfaces */
3059 if (interface->altsetting[0].desc.bInterfaceClass == USB_CLASS_AUDIO) {
3060 em28xx_err(DRIVER_NAME " audio device (%04x:%04x): "
3061 "interface %i, class %i\n",
3062 le16_to_cpu(udev->descriptor.idVendor),
3063 le16_to_cpu(udev->descriptor.idProduct),
3065 interface->altsetting[0].desc.bInterfaceClass);
3072 for (i = 0; i < interface->num_altsetting; i++) {
3075 for (ep = 0; ep < interface->altsetting[i].desc.bNumEndpoints; ep++) {
3076 struct usb_host_endpoint *e;
3077 e = &interface->altsetting[i].endpoint[ep];
3079 if (e->desc.bEndpointAddress == 0x83)
3084 endpoint = &interface->cur_altsetting->endpoint[0].desc;
3086 /* check if the device has the iso in endpoint at the correct place */
3087 if (usb_endpoint_xfer_isoc(endpoint)
3089 (interface->altsetting[1].endpoint[0].desc.wMaxPacketSize == 940)) {
3090 /* It's a newer em2874/em2875 device */
3093 int check_interface = 1;
3095 endpoint = &interface->cur_altsetting->endpoint[1].desc;
3096 if (!usb_endpoint_xfer_isoc(endpoint))
3097 check_interface = 0;
3099 if (usb_endpoint_dir_out(endpoint))
3100 check_interface = 0;
3102 if (!check_interface) {
3104 is_audio_only = true;
3106 em28xx_err(DRIVER_NAME " video device (%04x:%04x): "
3107 "interface %i, class %i found.\n",
3108 le16_to_cpu(udev->descriptor.idVendor),
3109 le16_to_cpu(udev->descriptor.idProduct),
3111 interface->altsetting[0].desc.bInterfaceClass);
3112 em28xx_err(DRIVER_NAME " This is an anciliary "
3113 "interface not used by the driver\n");
3121 switch (udev->speed) {
3125 case USB_SPEED_UNKNOWN:
3126 case USB_SPEED_FULL:
3129 case USB_SPEED_HIGH:
3136 if (udev->manufacturer)
3137 strlcpy(descr, udev->manufacturer, sizeof(descr));
3139 if (udev->product) {
3141 strlcat(descr, " ", sizeof(descr));
3142 strlcat(descr, udev->product, sizeof(descr));
3145 strlcat(descr, " ", sizeof(descr));
3147 printk(KERN_INFO DRIVER_NAME
3148 ": New device %s@ %s Mbps (%04x:%04x, interface %d, class %d)\n",
3151 le16_to_cpu(udev->descriptor.idVendor),
3152 le16_to_cpu(udev->descriptor.idProduct),
3154 interface->altsetting->desc.bInterfaceNumber);
3157 printk(KERN_INFO DRIVER_NAME
3158 ": Audio Vendor Class interface %i found\n",
3162 * Make sure we have 480 Mbps of bandwidth, otherwise things like
3163 * video stream wouldn't likely work, since 12 Mbps is generally
3164 * not enough even for most Digital TV streams.
3166 if (udev->speed != USB_SPEED_HIGH && disable_usb_speed_check == 0) {
3167 printk(DRIVER_NAME ": Device initialization failed.\n");
3168 printk(DRIVER_NAME ": Device must be connected to a high-speed"
3169 " USB 2.0 port.\n");
3174 /* allocate memory for our device state and initialize it */
3175 dev = kzalloc(sizeof(*dev), GFP_KERNEL);
3177 em28xx_err(DRIVER_NAME ": out of memory!\n");
3182 snprintf(dev->name, sizeof(dev->name), "em28xx #%d", nr);
3184 dev->model = id->driver_info;
3186 dev->is_audio_only = is_audio_only;
3187 dev->has_alsa_audio = has_audio;
3188 dev->audio_ifnum = ifnum;
3190 /* Checks if audio is provided by some interface */
3191 for (i = 0; i < udev->config->desc.bNumInterfaces; i++) {
3192 struct usb_interface *uif = udev->config->interface[i];
3193 if (uif->altsetting[0].desc.bInterfaceClass == USB_CLASS_AUDIO) {
3194 dev->has_audio_class = 1;
3199 /* compute alternate max packet sizes */
3200 dev->num_alt = interface->num_altsetting;
3201 dev->alt_max_pkt_size = kmalloc(32 * dev->num_alt, GFP_KERNEL);
3203 if (dev->alt_max_pkt_size == NULL) {
3204 em28xx_errdev("out of memory!\n");
3210 for (i = 0; i < dev->num_alt ; i++) {
3211 u16 tmp = le16_to_cpu(interface->altsetting[i].endpoint[isoc_pipe].desc.wMaxPacketSize);
3212 unsigned int size = tmp & 0x7ff;
3214 if (udev->speed == USB_SPEED_HIGH)
3215 size = size * hb_mult(tmp);
3217 dev->alt_max_pkt_size[i] = size;
3220 if ((card[nr] >= 0) && (card[nr] < em28xx_bcount))
3221 dev->model = card[nr];
3223 /* save our data pointer in this interface device */
3224 usb_set_intfdata(interface, dev);
3226 /* allocate device struct */
3227 mutex_init(&dev->lock);
3228 mutex_lock(&dev->lock);
3229 retval = em28xx_init_dev(&dev, udev, interface, nr);
3231 mutex_unlock(&dev->lock);
3232 kfree(dev->alt_max_pkt_size);
3237 request_modules(dev);
3239 /* Should be the last thing to do, to avoid newer udev's to
3240 open the device before fully initializing it
3242 mutex_unlock(&dev->lock);
3245 * These extensions can be modules. If the modules are already
3246 * loaded then we can initialise the device now, otherwise we
3247 * will initialise it when the modules load instead.
3249 em28xx_init_extension(dev);
3254 clear_bit(nr, &em28xx_devused);
3262 * em28xx_usb_disconnect()
3263 * called when the device gets disconnected
3264 * video device will be unregistered on v4l2_close in case it is still open
3266 static void em28xx_usb_disconnect(struct usb_interface *interface)
3270 dev = usb_get_intfdata(interface);
3271 usb_set_intfdata(interface, NULL);
3276 if (dev->is_audio_only) {
3277 mutex_lock(&dev->lock);
3278 em28xx_close_extension(dev);
3279 mutex_unlock(&dev->lock);
3283 em28xx_info("disconnecting %s\n", dev->vdev->name);
3285 flush_request_modules(dev);
3287 /* wait until all current v4l2 io is finished then deallocate
3289 mutex_lock(&dev->lock);
3291 wake_up_interruptible_all(&dev->open);
3293 v4l2_device_disconnect(&dev->v4l2_dev);
3297 ("device %s is open! Deregistration and memory "
3298 "deallocation are deferred on close.\n",
3299 video_device_node_name(dev->vdev));
3301 dev->state |= DEV_MISCONFIGURED;
3302 em28xx_uninit_isoc(dev);
3303 dev->state |= DEV_DISCONNECTED;
3304 wake_up_interruptible(&dev->wait_frame);
3305 wake_up_interruptible(&dev->wait_stream);
3307 dev->state |= DEV_DISCONNECTED;
3308 em28xx_release_resources(dev);
3311 mutex_unlock(&dev->lock);
3313 em28xx_close_extension(dev);
3316 kfree(dev->alt_max_pkt_size);
3321 static struct usb_driver em28xx_usb_driver = {
3323 .probe = em28xx_usb_probe,
3324 .disconnect = em28xx_usb_disconnect,
3325 .id_table = em28xx_id_table,
3328 static int __init em28xx_module_init(void)
3332 /* register this driver with the USB subsystem */
3333 result = usb_register(&em28xx_usb_driver);
3335 em28xx_err(DRIVER_NAME
3336 " usb_register failed. Error number %d.\n", result);
3338 printk(KERN_INFO DRIVER_NAME " driver loaded\n");
3343 static void __exit em28xx_module_exit(void)
3345 /* deregister this driver with the USB subsystem */
3346 usb_deregister(&em28xx_usb_driver);
3349 module_init(em28xx_module_init);
3350 module_exit(em28xx_module_exit);