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/delay.h>
28 #include <linux/i2c.h>
29 #include <linux/usb.h>
30 #include <media/tuner.h>
31 #include <media/msp3400.h>
32 #include <media/saa7115.h>
33 #include <media/tvp5150.h>
34 #include <media/tveeprom.h>
35 #include <media/v4l2-common.h>
36 #include <media/v4l2-chip-ident.h>
40 static int tuner = -1;
41 module_param(tuner, int, 0444);
42 MODULE_PARM_DESC(tuner, "tuner type");
44 static unsigned int disable_ir;
45 module_param(disable_ir, int, 0444);
46 MODULE_PARM_DESC(disable_ir, "disable infrared remote support");
48 struct em28xx_hash_table {
54 struct em28xx_board em28xx_boards[] = {
55 [EM2750_BOARD_UNKNOWN] = {
56 .name = "Unknown EM2750/EM2751 webcam grabber",
59 .type = EM28XX_VMUX_COMPOSITE1,
64 [EM2800_BOARD_UNKNOWN] = {
65 .name = "Unknown EM2800 video grabber",
68 .tda9887_conf = TDA9887_PRESENT,
69 .decoder = EM28XX_SAA7113,
71 .type = EM28XX_VMUX_COMPOSITE1,
72 .vmux = SAA7115_COMPOSITE0,
75 .type = EM28XX_VMUX_SVIDEO,
76 .vmux = SAA7115_SVIDEO3,
80 [EM2820_BOARD_UNKNOWN] = {
81 .name = "Unknown EM2750/28xx video grabber",
83 .tuner_type = TUNER_ABSENT,
85 [EM2750_BOARD_DLCW_130] = {
86 /* Beijing Huaqi Information Digital Technology Co., Ltd */
87 .name = "Huaqi DLCW-130",
88 .valid = EM28XX_BOARD_NOT_VALIDATED,
91 .type = EM28XX_VMUX_COMPOSITE1,
96 [EM2820_BOARD_KWORLD_PVRTV2800RF] = {
97 .name = "Kworld PVR TV 2800 RF",
100 .tuner_type = TUNER_TEMIC_PAL,
101 .tda9887_conf = TDA9887_PRESENT,
102 .decoder = EM28XX_SAA7113,
104 .type = EM28XX_VMUX_COMPOSITE1,
105 .vmux = SAA7115_COMPOSITE0,
108 .type = EM28XX_VMUX_SVIDEO,
109 .vmux = SAA7115_SVIDEO3,
113 [EM2820_BOARD_TERRATEC_CINERGY_250] = {
114 .name = "Terratec Cinergy 250 USB",
116 .tuner_type = TUNER_LG_PAL_NEW_TAPC,
117 .tda9887_conf = TDA9887_PRESENT,
118 .decoder = EM28XX_SAA7113,
120 .type = EM28XX_VMUX_TELEVISION,
121 .vmux = SAA7115_COMPOSITE2,
124 .type = EM28XX_VMUX_COMPOSITE1,
125 .vmux = SAA7115_COMPOSITE0,
128 .type = EM28XX_VMUX_SVIDEO,
129 .vmux = SAA7115_SVIDEO3,
133 [EM2820_BOARD_PINNACLE_USB_2] = {
134 .name = "Pinnacle PCTV USB 2",
136 .tuner_type = TUNER_LG_PAL_NEW_TAPC,
137 .tda9887_conf = TDA9887_PRESENT,
138 .decoder = EM28XX_SAA7113,
140 .type = EM28XX_VMUX_TELEVISION,
141 .vmux = SAA7115_COMPOSITE2,
144 .type = EM28XX_VMUX_COMPOSITE1,
145 .vmux = SAA7115_COMPOSITE0,
148 .type = EM28XX_VMUX_SVIDEO,
149 .vmux = SAA7115_SVIDEO3,
153 [EM2820_BOARD_HAUPPAUGE_WINTV_USB_2] = {
154 .name = "Hauppauge WinTV USB 2",
156 .tuner_type = TUNER_PHILIPS_FM1236_MK3,
157 .tda9887_conf = TDA9887_PRESENT |
158 TDA9887_PORT1_ACTIVE|
159 TDA9887_PORT2_ACTIVE,
160 .decoder = EM28XX_TVP5150,
162 /*FIXME: S-Video not tested */
164 .type = EM28XX_VMUX_TELEVISION,
165 .vmux = TVP5150_COMPOSITE0,
166 .amux = MSP_INPUT_DEFAULT,
168 .type = EM28XX_VMUX_SVIDEO,
169 .vmux = TVP5150_SVIDEO,
170 .amux = MSP_INPUT(MSP_IN_SCART1, MSP_IN_TUNER1,
171 MSP_DSP_IN_SCART, MSP_DSP_IN_SCART),
174 [EM2820_BOARD_DLINK_USB_TV] = {
175 .name = "D-Link DUB-T210 TV Tuner",
176 .valid = EM28XX_BOARD_NOT_VALIDATED,
179 .tuner_type = TUNER_LG_PAL_NEW_TAPC,
180 .tda9887_conf = TDA9887_PRESENT,
181 .decoder = EM28XX_SAA7113,
183 .type = EM28XX_VMUX_TELEVISION,
184 .vmux = SAA7115_COMPOSITE2,
187 .type = EM28XX_VMUX_COMPOSITE1,
188 .vmux = SAA7115_COMPOSITE0,
191 .type = EM28XX_VMUX_SVIDEO,
192 .vmux = SAA7115_SVIDEO3,
196 [EM2820_BOARD_HERCULES_SMART_TV_USB2] = {
197 .name = "Hercules Smart TV USB 2.0",
198 .valid = EM28XX_BOARD_NOT_VALIDATED,
200 .tuner_type = TUNER_LG_PAL_NEW_TAPC,
201 .tda9887_conf = TDA9887_PRESENT,
202 .decoder = EM28XX_SAA7113,
204 .type = EM28XX_VMUX_TELEVISION,
205 .vmux = SAA7115_COMPOSITE2,
208 .type = EM28XX_VMUX_COMPOSITE1,
209 .vmux = SAA7115_COMPOSITE0,
212 .type = EM28XX_VMUX_SVIDEO,
213 .vmux = SAA7115_SVIDEO3,
217 [EM2820_BOARD_PINNACLE_USB_2_FM1216ME] = {
218 .name = "Pinnacle PCTV USB 2 (Philips FM1216ME)",
219 .valid = EM28XX_BOARD_NOT_VALIDATED,
222 .tuner_type = TUNER_PHILIPS_FM1216ME_MK3,
223 .tda9887_conf = TDA9887_PRESENT,
224 .decoder = EM28XX_SAA7113,
226 .type = EM28XX_VMUX_TELEVISION,
227 .vmux = SAA7115_COMPOSITE2,
230 .type = EM28XX_VMUX_COMPOSITE1,
231 .vmux = SAA7115_COMPOSITE0,
234 .type = EM28XX_VMUX_SVIDEO,
235 .vmux = SAA7115_SVIDEO3,
239 [EM2820_BOARD_GADMEI_UTV310] = {
240 .name = "Gadmei UTV310",
241 .valid = EM28XX_BOARD_NOT_VALIDATED,
243 .tuner_type = TUNER_TNF_5335MF,
244 .tda9887_conf = TDA9887_PRESENT,
245 .decoder = EM28XX_SAA7113,
247 .type = EM28XX_VMUX_TELEVISION,
248 .vmux = SAA7115_COMPOSITE1,
251 .type = EM28XX_VMUX_COMPOSITE1,
252 .vmux = SAA7115_COMPOSITE0,
255 .type = EM28XX_VMUX_SVIDEO,
256 .vmux = SAA7115_SVIDEO3,
260 [EM2820_BOARD_LEADTEK_WINFAST_USBII_DELUXE] = {
261 .name = "Leadtek Winfast USB II Deluxe",
262 .valid = EM28XX_BOARD_NOT_VALIDATED,
264 .tuner_type = TUNER_PHILIPS_FM1216ME_MK3,
265 .tda9887_conf = TDA9887_PRESENT,
266 .decoder = EM28XX_SAA7114,
268 .type = EM28XX_VMUX_TELEVISION,
272 .type = EM28XX_VMUX_COMPOSITE1,
276 .type = EM28XX_VMUX_SVIDEO,
281 [EM2820_BOARD_PINNACLE_DVC_100] = {
282 .name = "Pinnacle Dazzle DVC 100",
283 .valid = EM28XX_BOARD_NOT_VALIDATED,
285 .decoder = EM28XX_SAA7113,
287 .type = EM28XX_VMUX_COMPOSITE1,
288 .vmux = SAA7115_COMPOSITE0,
291 .type = EM28XX_VMUX_SVIDEO,
292 .vmux = SAA7115_SVIDEO3,
296 [EM2820_BOARD_VIDEOLOGY_20K14XUSB] = {
297 .name = "Videology 20K14XUSB USB2.0",
298 .valid = EM28XX_BOARD_NOT_VALIDATED,
301 .type = EM28XX_VMUX_COMPOSITE1,
306 [EM2821_BOARD_PROLINK_PLAYTV_USB2] = {
307 .name = "SIIG AVTuner-PVR/Prolink PlayTV USB 2.0",
308 .valid = EM28XX_BOARD_NOT_VALIDATED,
311 .tuner_type = TUNER_LG_PAL_NEW_TAPC, /* unknown? */
312 .tda9887_conf = TDA9887_PRESENT, /* unknown? */
313 .decoder = EM28XX_SAA7113,
315 .type = EM28XX_VMUX_TELEVISION,
316 .vmux = SAA7115_COMPOSITE2,
319 .type = EM28XX_VMUX_COMPOSITE1,
320 .vmux = SAA7115_COMPOSITE0,
323 .type = EM28XX_VMUX_SVIDEO,
324 .vmux = SAA7115_SVIDEO3,
328 [EM2821_BOARD_SUPERCOMP_USB_2] = {
329 .name = "Supercomp USB 2.0 TV",
330 .valid = EM28XX_BOARD_NOT_VALIDATED,
333 .tuner_type = TUNER_PHILIPS_FM1236_MK3,
334 .tda9887_conf = TDA9887_PRESENT |
335 TDA9887_PORT1_ACTIVE |
336 TDA9887_PORT2_ACTIVE,
337 .decoder = EM28XX_SAA7113,
339 .type = EM28XX_VMUX_TELEVISION,
340 .vmux = SAA7115_COMPOSITE2,
343 .type = EM28XX_VMUX_COMPOSITE1,
344 .vmux = SAA7115_COMPOSITE0,
347 .type = EM28XX_VMUX_SVIDEO,
348 .vmux = SAA7115_SVIDEO3,
352 [EM2821_BOARD_USBGEAR_VD204] = {
353 .name = "Usbgear VD204v9",
354 .valid = EM28XX_BOARD_NOT_VALIDATED,
356 .decoder = EM28XX_SAA7113,
358 .type = EM28XX_VMUX_COMPOSITE1,
359 .vmux = SAA7115_COMPOSITE0,
362 .type = EM28XX_VMUX_SVIDEO,
363 .vmux = SAA7115_SVIDEO3,
367 [EM2860_BOARD_NETGMBH_CAM] = {
368 /* Beijing Huaqi Information Digital Technology Co., Ltd */
369 .name = "NetGMBH Cam",
370 .valid = EM28XX_BOARD_NOT_VALIDATED,
373 .type = EM28XX_VMUX_COMPOSITE1,
378 [EM2860_BOARD_TYPHOON_DVD_MAKER] = {
379 .name = "Typhoon DVD Maker",
380 .valid = EM28XX_BOARD_NOT_VALIDATED,
382 .decoder = EM28XX_SAA7113,
384 .type = EM28XX_VMUX_COMPOSITE1,
385 .vmux = SAA7115_COMPOSITE0,
388 .type = EM28XX_VMUX_SVIDEO,
389 .vmux = SAA7115_SVIDEO3,
393 [EM2860_BOARD_GADMEI_UTV330] = {
394 .name = "Gadmei UTV330",
395 .valid = EM28XX_BOARD_NOT_VALIDATED,
397 .tuner_type = TUNER_TNF_5335MF,
398 .tda9887_conf = TDA9887_PRESENT,
399 .decoder = EM28XX_SAA7113,
401 .type = EM28XX_VMUX_TELEVISION,
402 .vmux = SAA7115_COMPOSITE2,
405 .type = EM28XX_VMUX_COMPOSITE1,
406 .vmux = SAA7115_COMPOSITE0,
409 .type = EM28XX_VMUX_SVIDEO,
410 .vmux = SAA7115_SVIDEO3,
414 [EM2860_BOARD_TERRATEC_HYBRID_XS] = {
415 .name = "Terratec Cinergy A Hybrid XS",
416 .valid = EM28XX_BOARD_NOT_VALIDATED,
418 .tuner_type = TUNER_XC2028,
419 .decoder = EM28XX_TVP5150,
421 .type = EM28XX_VMUX_TELEVISION,
422 .vmux = TVP5150_COMPOSITE0,
425 .type = EM28XX_VMUX_COMPOSITE1,
426 .vmux = TVP5150_COMPOSITE1,
429 .type = EM28XX_VMUX_SVIDEO,
430 .vmux = TVP5150_SVIDEO,
434 [EM2861_BOARD_KWORLD_PVRTV_300U] = {
435 .name = "KWorld PVRTV 300U",
436 .valid = EM28XX_BOARD_NOT_VALIDATED,
438 .tuner_type = TUNER_XC2028,
439 .decoder = EM28XX_TVP5150,
441 .type = EM28XX_VMUX_TELEVISION,
442 .vmux = TVP5150_COMPOSITE0,
445 .type = EM28XX_VMUX_COMPOSITE1,
446 .vmux = TVP5150_COMPOSITE1,
449 .type = EM28XX_VMUX_SVIDEO,
450 .vmux = TVP5150_SVIDEO,
454 [EM2861_BOARD_YAKUMO_MOVIE_MIXER] = {
455 .name = "Yakumo MovieMixer",
456 .valid = EM28XX_BOARD_NOT_VALIDATED,
458 .decoder = EM28XX_TVP5150,
460 .type = EM28XX_VMUX_TELEVISION,
461 .vmux = TVP5150_COMPOSITE0,
464 .type = EM28XX_VMUX_COMPOSITE1,
465 .vmux = TVP5150_COMPOSITE1,
468 .type = EM28XX_VMUX_SVIDEO,
469 .vmux = TVP5150_SVIDEO,
473 [EM2861_BOARD_PLEXTOR_PX_TV100U] = {
474 .name = "Plextor ConvertX PX-TV100U",
475 .valid = EM28XX_BOARD_NOT_VALIDATED,
477 .tuner_type = TUNER_TNF_5335MF,
478 .tda9887_conf = TDA9887_PRESENT,
479 .decoder = EM28XX_TVP5150,
481 .type = EM28XX_VMUX_TELEVISION,
482 .vmux = TVP5150_COMPOSITE0,
485 .type = EM28XX_VMUX_COMPOSITE1,
486 .vmux = TVP5150_COMPOSITE1,
489 .type = EM28XX_VMUX_SVIDEO,
490 .vmux = TVP5150_SVIDEO,
494 [EM2870_BOARD_TERRATEC_XS] = {
495 .name = "Terratec Cinergy T XS",
496 .valid = EM28XX_BOARD_NOT_VALIDATED,
497 .tuner_type = TUNER_XC2028,
499 [EM2870_BOARD_TERRATEC_XS_MT2060] = {
500 .name = "Terratec Cinergy T XS (MT2060)",
501 .valid = EM28XX_BOARD_NOT_VALIDATED,
502 .tuner_type = TUNER_ABSENT, /* MT2060 */
504 [EM2870_BOARD_KWORLD_350U] = {
505 .name = "Kworld 350 U DVB-T",
506 .valid = EM28XX_BOARD_NOT_VALIDATED,
507 .tuner_type = TUNER_XC2028,
509 [EM2870_BOARD_KWORLD_355U] = {
510 .name = "Kworld 355 U DVB-T",
511 .valid = EM28XX_BOARD_NOT_VALIDATED,
513 [EM2870_BOARD_PINNACLE_PCTV_DVB] = {
514 .name = "Pinnacle PCTV DVB-T",
515 .valid = EM28XX_BOARD_NOT_VALIDATED,
516 .tuner_type = TUNER_ABSENT, /* MT2060 */
518 [EM2870_BOARD_COMPRO_VIDEOMATE] = {
519 .name = "Compro, VideoMate U3",
520 .valid = EM28XX_BOARD_NOT_VALIDATED,
521 .tuner_type = TUNER_ABSENT, /* MT2060 */
523 [EM2880_BOARD_TERRATEC_HYBRID_XS_FR] = {
524 .name = "Terratec Hybrid XS Secam",
525 .valid = EM28XX_BOARD_NOT_VALIDATED,
528 .tuner_type = TUNER_XC2028,
529 .decoder = EM28XX_TVP5150,
531 .type = EM28XX_VMUX_TELEVISION,
532 .vmux = TVP5150_COMPOSITE0,
535 .type = EM28XX_VMUX_COMPOSITE1,
536 .vmux = TVP5150_COMPOSITE1,
539 .type = EM28XX_VMUX_SVIDEO,
540 .vmux = TVP5150_SVIDEO,
544 [EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900] = {
545 .name = "Hauppauge WinTV HVR 900",
547 .tda9887_conf = TDA9887_PRESENT,
548 .tuner_type = TUNER_XC2028,
551 .decoder = EM28XX_TVP5150,
553 .type = EM28XX_VMUX_TELEVISION,
554 .vmux = TVP5150_COMPOSITE0,
557 .type = EM28XX_VMUX_COMPOSITE1,
558 .vmux = TVP5150_COMPOSITE1,
561 .type = EM28XX_VMUX_SVIDEO,
562 .vmux = TVP5150_SVIDEO,
566 [EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900_R2] = {
567 .name = "Hauppauge WinTV HVR 900 (R2)",
569 .tda9887_conf = TDA9887_PRESENT,
570 .tuner_type = TUNER_XC2028,
572 .decoder = EM28XX_TVP5150,
574 .type = EM28XX_VMUX_TELEVISION,
575 .vmux = TVP5150_COMPOSITE0,
578 .type = EM28XX_VMUX_COMPOSITE1,
579 .vmux = TVP5150_COMPOSITE1,
582 .type = EM28XX_VMUX_SVIDEO,
583 .vmux = TVP5150_SVIDEO,
587 [EM2883_BOARD_HAUPPAUGE_WINTV_HVR_950] = {
588 .name = "Hauppauge WinTV HVR 950",
590 .tda9887_conf = TDA9887_PRESENT,
591 .tuner_type = TUNER_XC2028,
595 .decoder = EM28XX_TVP5150,
597 .type = EM28XX_VMUX_TELEVISION,
598 .vmux = TVP5150_COMPOSITE0,
601 .type = EM28XX_VMUX_COMPOSITE1,
602 .vmux = TVP5150_COMPOSITE1,
605 .type = EM28XX_VMUX_SVIDEO,
606 .vmux = TVP5150_SVIDEO,
610 [EM2880_BOARD_PINNACLE_PCTV_HD_PRO] = {
611 .name = "Pinnacle PCTV HD Pro Stick",
613 .tda9887_conf = TDA9887_PRESENT,
614 .tuner_type = TUNER_XC2028,
618 .decoder = EM28XX_TVP5150,
620 .type = EM28XX_VMUX_TELEVISION,
621 .vmux = TVP5150_COMPOSITE0,
624 .type = EM28XX_VMUX_COMPOSITE1,
625 .vmux = TVP5150_COMPOSITE1,
628 .type = EM28XX_VMUX_SVIDEO,
629 .vmux = TVP5150_SVIDEO,
633 [EM2880_BOARD_AMD_ATI_TV_WONDER_HD_600] = {
634 .name = "AMD ATI TV Wonder HD 600",
636 .tda9887_conf = TDA9887_PRESENT,
637 .tuner_type = TUNER_XC2028,
641 .decoder = EM28XX_TVP5150,
643 .type = EM28XX_VMUX_TELEVISION,
644 .vmux = TVP5150_COMPOSITE0,
647 .type = EM28XX_VMUX_COMPOSITE1,
648 .vmux = TVP5150_COMPOSITE1,
651 .type = EM28XX_VMUX_SVIDEO,
652 .vmux = TVP5150_SVIDEO,
656 [EM2880_BOARD_TERRATEC_HYBRID_XS] = {
657 .name = "Terratec Hybrid XS",
659 .tda9887_conf = TDA9887_PRESENT,
660 .tuner_type = TUNER_XC2028,
661 .decoder = EM28XX_TVP5150,
664 .type = EM28XX_VMUX_TELEVISION,
665 .vmux = TVP5150_COMPOSITE0,
668 .type = EM28XX_VMUX_COMPOSITE1,
669 .vmux = TVP5150_COMPOSITE1,
672 .type = EM28XX_VMUX_SVIDEO,
673 .vmux = TVP5150_SVIDEO,
677 /* maybe there's a reason behind it why Terratec sells the Hybrid XS
678 as Prodigy XS with a different PID, let's keep it separated for now
679 maybe we'll need it lateron */
680 [EM2880_BOARD_TERRATEC_PRODIGY_XS] = {
681 .name = "Terratec Prodigy XS",
683 .tda9887_conf = TDA9887_PRESENT,
684 .tuner_type = TUNER_XC2028,
685 .decoder = EM28XX_TVP5150,
687 .type = EM28XX_VMUX_TELEVISION,
688 .vmux = TVP5150_COMPOSITE0,
691 .type = EM28XX_VMUX_COMPOSITE1,
692 .vmux = TVP5150_COMPOSITE1,
695 .type = EM28XX_VMUX_SVIDEO,
696 .vmux = TVP5150_SVIDEO,
700 [EM2820_BOARD_MSI_VOX_USB_2] = {
701 .name = "MSI VOX USB 2.0",
703 .tuner_type = TUNER_LG_PAL_NEW_TAPC,
704 .tda9887_conf = TDA9887_PRESENT |
705 TDA9887_PORT1_ACTIVE |
706 TDA9887_PORT2_ACTIVE,
707 .max_range_640_480 = 1,
709 .decoder = EM28XX_SAA7114,
711 .type = EM28XX_VMUX_TELEVISION,
712 .vmux = SAA7115_COMPOSITE4,
715 .type = EM28XX_VMUX_COMPOSITE1,
716 .vmux = SAA7115_COMPOSITE0,
719 .type = EM28XX_VMUX_SVIDEO,
720 .vmux = SAA7115_SVIDEO3,
724 [EM2800_BOARD_TERRATEC_CINERGY_200] = {
725 .name = "Terratec Cinergy 200 USB",
728 .tuner_type = TUNER_LG_PAL_NEW_TAPC,
729 .tda9887_conf = TDA9887_PRESENT,
730 .decoder = EM28XX_SAA7113,
732 .type = EM28XX_VMUX_TELEVISION,
733 .vmux = SAA7115_COMPOSITE2,
736 .type = EM28XX_VMUX_COMPOSITE1,
737 .vmux = SAA7115_COMPOSITE0,
740 .type = EM28XX_VMUX_SVIDEO,
741 .vmux = SAA7115_SVIDEO3,
745 [EM2800_BOARD_GRABBEEX_USB2800] = {
746 .name = "eMPIA Technology, Inc. GrabBeeX+ Video Encoder",
749 .decoder = EM28XX_SAA7113,
751 .type = EM28XX_VMUX_COMPOSITE1,
752 .vmux = SAA7115_COMPOSITE0,
755 .type = EM28XX_VMUX_SVIDEO,
756 .vmux = SAA7115_SVIDEO3,
760 [EM2800_BOARD_LEADTEK_WINFAST_USBII] = {
761 .name = "Leadtek Winfast USB II",
764 .tuner_type = TUNER_LG_PAL_NEW_TAPC,
765 .tda9887_conf = TDA9887_PRESENT,
766 .decoder = EM28XX_SAA7113,
768 .type = EM28XX_VMUX_TELEVISION,
769 .vmux = SAA7115_COMPOSITE2,
772 .type = EM28XX_VMUX_COMPOSITE1,
773 .vmux = SAA7115_COMPOSITE0,
776 .type = EM28XX_VMUX_SVIDEO,
777 .vmux = SAA7115_SVIDEO3,
781 [EM2800_BOARD_KWORLD_USB2800] = {
782 .name = "Kworld USB2800",
785 .tuner_type = TUNER_PHILIPS_FCV1236D,
786 .tda9887_conf = TDA9887_PRESENT,
787 .decoder = EM28XX_SAA7113,
789 .type = EM28XX_VMUX_TELEVISION,
790 .vmux = SAA7115_COMPOSITE2,
793 .type = EM28XX_VMUX_COMPOSITE1,
794 .vmux = SAA7115_COMPOSITE0,
797 .type = EM28XX_VMUX_SVIDEO,
798 .vmux = SAA7115_SVIDEO3,
802 [EM2820_BOARD_PINNACLE_DVC_90] = {
803 .name = "Pinnacle Dazzle DVC 90/DVC 100",
805 .tuner_type = TUNER_ABSENT,
806 .decoder = EM28XX_SAA7113,
808 .type = EM28XX_VMUX_COMPOSITE1,
809 .vmux = SAA7115_COMPOSITE0,
812 .type = EM28XX_VMUX_SVIDEO,
813 .vmux = SAA7115_SVIDEO3,
817 [EM2800_BOARD_VGEAR_POCKETTV] = {
818 .name = "V-Gear PocketTV",
821 .tuner_type = TUNER_LG_PAL_NEW_TAPC,
822 .tda9887_conf = TDA9887_PRESENT,
823 .decoder = EM28XX_SAA7113,
825 .type = EM28XX_VMUX_TELEVISION,
826 .vmux = SAA7115_COMPOSITE2,
829 .type = EM28XX_VMUX_COMPOSITE1,
830 .vmux = SAA7115_COMPOSITE0,
833 .type = EM28XX_VMUX_SVIDEO,
834 .vmux = SAA7115_SVIDEO3,
838 [EM2820_BOARD_PROLINK_PLAYTV_USB2] = {
839 .name = "Pixelview Prolink PlayTV USB 2.0",
841 .tda9887_conf = TDA9887_PRESENT,
842 .tuner_type = TUNER_YMEC_TVF_5533MF,
843 .decoder = EM28XX_SAA7113,
845 .type = EM28XX_VMUX_TELEVISION,
846 .vmux = SAA7115_COMPOSITE2,
847 .amux = EM28XX_AMUX_LINE_IN,
849 .type = EM28XX_VMUX_COMPOSITE1,
850 .vmux = SAA7115_COMPOSITE0,
851 .amux = EM28XX_AMUX_LINE_IN,
853 .type = EM28XX_VMUX_SVIDEO,
854 .vmux = SAA7115_SVIDEO3,
855 .amux = EM28XX_AMUX_LINE_IN,
858 [EM2860_BOARD_POINTNIX_INTRAORAL_CAMERA] = {
859 .name = "PointNix Intra-Oral Camera",
860 .has_snapshot_button = 1,
862 .tda9887_conf = TDA9887_PRESENT,
863 .tuner_type = TUNER_ABSENT,
864 .decoder = EM28XX_SAA7113,
866 .type = EM28XX_VMUX_SVIDEO,
867 .vmux = SAA7115_SVIDEO3,
871 [EM2880_BOARD_MSI_DIGIVOX_AD] = {
872 .name = "MSI DigiVox A/D",
873 .valid = EM28XX_BOARD_NOT_VALIDATED,
875 .tuner_type = TUNER_XC2028,
876 .decoder = EM28XX_TVP5150,
878 .type = EM28XX_VMUX_TELEVISION,
879 .vmux = TVP5150_COMPOSITE0,
882 .type = EM28XX_VMUX_COMPOSITE1,
883 .vmux = TVP5150_COMPOSITE1,
886 .type = EM28XX_VMUX_SVIDEO,
887 .vmux = TVP5150_SVIDEO,
891 [EM2880_BOARD_MSI_DIGIVOX_AD_II] = {
892 .name = "MSI DigiVox A/D II",
893 .valid = EM28XX_BOARD_NOT_VALIDATED,
895 .tuner_type = TUNER_XC2028,
896 .decoder = EM28XX_TVP5150,
898 .type = EM28XX_VMUX_TELEVISION,
899 .vmux = TVP5150_COMPOSITE0,
902 .type = EM28XX_VMUX_COMPOSITE1,
903 .vmux = TVP5150_COMPOSITE1,
906 .type = EM28XX_VMUX_SVIDEO,
907 .vmux = TVP5150_SVIDEO,
911 [EM2880_BOARD_KWORLD_DVB_305U] = {
912 .name = "KWorld DVB-T 305U",
913 .valid = EM28XX_BOARD_NOT_VALIDATED,
915 .tuner_type = TUNER_XC2028,
916 .decoder = EM28XX_TVP5150,
918 .type = EM28XX_VMUX_TELEVISION,
919 .vmux = TVP5150_COMPOSITE0,
922 .type = EM28XX_VMUX_COMPOSITE1,
923 .vmux = TVP5150_COMPOSITE1,
926 .type = EM28XX_VMUX_SVIDEO,
927 .vmux = TVP5150_SVIDEO,
931 [EM2880_BOARD_KWORLD_DVB_310U] = {
932 .name = "KWorld DVB-T 310U",
933 .valid = EM28XX_BOARD_NOT_VALIDATED,
935 .tuner_type = TUNER_XC2028,
936 .decoder = EM28XX_TVP5150,
938 .type = EM28XX_VMUX_TELEVISION,
939 .vmux = TVP5150_COMPOSITE0,
942 .type = EM28XX_VMUX_COMPOSITE1,
943 .vmux = TVP5150_COMPOSITE1,
946 .type = EM28XX_VMUX_SVIDEO,
947 .vmux = TVP5150_SVIDEO,
951 [EM2881_BOARD_DNT_DA2_HYBRID] = {
952 .name = "DNT DA2 Hybrid",
953 .valid = EM28XX_BOARD_NOT_VALIDATED,
955 .tuner_type = TUNER_XC2028,
956 .decoder = EM28XX_TVP5150,
958 .type = EM28XX_VMUX_TELEVISION,
959 .vmux = TVP5150_COMPOSITE0,
962 .type = EM28XX_VMUX_COMPOSITE1,
963 .vmux = TVP5150_COMPOSITE1,
966 .type = EM28XX_VMUX_SVIDEO,
967 .vmux = TVP5150_SVIDEO,
971 [EM2881_BOARD_PINNACLE_HYBRID_PRO] = {
972 .name = "Pinnacle Hybrid Pro",
973 .valid = EM28XX_BOARD_NOT_VALIDATED,
975 .tuner_type = TUNER_XC2028,
976 .decoder = EM28XX_TVP5150,
978 .type = EM28XX_VMUX_TELEVISION,
979 .vmux = TVP5150_COMPOSITE0,
982 .type = EM28XX_VMUX_COMPOSITE1,
983 .vmux = TVP5150_COMPOSITE1,
986 .type = EM28XX_VMUX_SVIDEO,
987 .vmux = TVP5150_SVIDEO,
991 [EM2882_BOARD_PINNACLE_HYBRID_PRO] = {
992 .name = "Pinnacle Hybrid Pro (2)",
993 .valid = EM28XX_BOARD_NOT_VALIDATED,
995 .tuner_type = TUNER_XC2028,
997 .decoder = EM28XX_TVP5150,
999 .type = EM28XX_VMUX_TELEVISION,
1000 .vmux = TVP5150_COMPOSITE0,
1003 .type = EM28XX_VMUX_COMPOSITE1,
1004 .vmux = TVP5150_COMPOSITE1,
1007 .type = EM28XX_VMUX_SVIDEO,
1008 .vmux = TVP5150_SVIDEO,
1012 [EM2882_BOARD_KWORLD_VS_DVBT] = {
1013 .name = "Kworld VS-DVB-T 323UR",
1014 .valid = EM28XX_BOARD_NOT_VALIDATED,
1016 .tuner_type = TUNER_XC2028,
1017 .decoder = EM28XX_TVP5150,
1019 .type = EM28XX_VMUX_TELEVISION,
1020 .vmux = TVP5150_COMPOSITE0,
1023 .type = EM28XX_VMUX_COMPOSITE1,
1024 .vmux = TVP5150_COMPOSITE1,
1027 .type = EM28XX_VMUX_SVIDEO,
1028 .vmux = TVP5150_SVIDEO,
1032 [EM2882_BOARD_TERRATEC_HYBRID_XS] = {
1033 .name = "Terratec Hybrid XS (em2882)",
1034 .valid = EM28XX_BOARD_NOT_VALIDATED,
1036 .tuner_type = TUNER_XC2028,
1037 .decoder = EM28XX_TVP5150,
1039 .type = EM28XX_VMUX_TELEVISION,
1040 .vmux = TVP5150_COMPOSITE0,
1043 .type = EM28XX_VMUX_COMPOSITE1,
1044 .vmux = TVP5150_COMPOSITE1,
1047 .type = EM28XX_VMUX_SVIDEO,
1048 .vmux = TVP5150_SVIDEO,
1052 [EM2883_BOARD_KWORLD_HYBRID_A316] = {
1053 .name = "Kworld PlusTV HD Hybrid 330",
1054 .valid = EM28XX_BOARD_NOT_VALIDATED,
1057 .tuner_type = TUNER_XC2028,
1058 .decoder = EM28XX_TVP5150,
1060 .type = EM28XX_VMUX_TELEVISION,
1061 .vmux = TVP5150_COMPOSITE0,
1064 .type = EM28XX_VMUX_COMPOSITE1,
1065 .vmux = TVP5150_COMPOSITE1,
1068 .type = EM28XX_VMUX_SVIDEO,
1069 .vmux = TVP5150_SVIDEO,
1073 [EM2820_BOARD_COMPRO_VIDEOMATE_FORYOU] = {
1074 .name = "Compro VideoMate ForYou/Stereo",
1076 .tuner_type = TUNER_LG_PAL_NEW_TAPC,
1077 .tda9887_conf = TDA9887_PRESENT,
1078 .decoder = EM28XX_TVP5150,
1080 .type = EM28XX_VMUX_TELEVISION,
1081 .vmux = TVP5150_COMPOSITE0,
1082 .amux = EM28XX_AMUX_LINE_IN,
1084 .type = EM28XX_VMUX_SVIDEO,
1085 .vmux = TVP5150_SVIDEO,
1086 .amux = EM28XX_AMUX_LINE_IN,
1090 const unsigned int em28xx_bcount = ARRAY_SIZE(em28xx_boards);
1092 /* table of devices that work with this driver */
1093 struct usb_device_id em28xx_id_table [] = {
1094 { USB_DEVICE(0xeb1a, 0x2750),
1095 .driver_info = EM2750_BOARD_UNKNOWN },
1096 { USB_DEVICE(0xeb1a, 0x2751),
1097 .driver_info = EM2750_BOARD_UNKNOWN },
1098 { USB_DEVICE(0xeb1a, 0x2800),
1099 .driver_info = EM2800_BOARD_UNKNOWN },
1100 { USB_DEVICE(0xeb1a, 0x2820),
1101 .driver_info = EM2820_BOARD_UNKNOWN },
1102 { USB_DEVICE(0xeb1a, 0x2821),
1103 .driver_info = EM2820_BOARD_UNKNOWN },
1104 { USB_DEVICE(0xeb1a, 0x2860),
1105 .driver_info = EM2820_BOARD_UNKNOWN },
1106 { USB_DEVICE(0xeb1a, 0x2861),
1107 .driver_info = EM2820_BOARD_UNKNOWN },
1108 { USB_DEVICE(0xeb1a, 0x2870),
1109 .driver_info = EM2820_BOARD_UNKNOWN },
1110 { USB_DEVICE(0xeb1a, 0x2881),
1111 .driver_info = EM2820_BOARD_UNKNOWN },
1112 { USB_DEVICE(0xeb1a, 0x2883),
1113 .driver_info = EM2820_BOARD_UNKNOWN },
1114 { USB_DEVICE(0xeb1a, 0xe300),
1115 .driver_info = EM2861_BOARD_KWORLD_PVRTV_300U },
1116 { USB_DEVICE(0xeb1a, 0xe305),
1117 .driver_info = EM2880_BOARD_KWORLD_DVB_305U },
1118 { USB_DEVICE(0xeb1a, 0xe310),
1119 .driver_info = EM2880_BOARD_MSI_DIGIVOX_AD },
1120 { USB_DEVICE(0xeb1a, 0xa316),
1121 .driver_info = EM2883_BOARD_KWORLD_HYBRID_A316 },
1122 { USB_DEVICE(0xeb1a, 0xe320),
1123 .driver_info = EM2880_BOARD_MSI_DIGIVOX_AD_II },
1124 { USB_DEVICE(0xeb1a, 0xe323),
1125 .driver_info = EM2882_BOARD_KWORLD_VS_DVBT },
1126 { USB_DEVICE(0xeb1a, 0xe350),
1127 .driver_info = EM2870_BOARD_KWORLD_350U },
1128 { USB_DEVICE(0xeb1a, 0xe355),
1129 .driver_info = EM2870_BOARD_KWORLD_355U },
1130 { USB_DEVICE(0xeb1a, 0x2801),
1131 .driver_info = EM2800_BOARD_GRABBEEX_USB2800 },
1132 { USB_DEVICE(0xeb1a, 0xe357),
1133 .driver_info = EM2870_BOARD_KWORLD_355U },
1134 { USB_DEVICE(0x0ccd, 0x0036),
1135 .driver_info = EM2820_BOARD_TERRATEC_CINERGY_250 },
1136 { USB_DEVICE(0x0ccd, 0x004c),
1137 .driver_info = EM2880_BOARD_TERRATEC_HYBRID_XS_FR },
1138 { USB_DEVICE(0x0ccd, 0x004f),
1139 .driver_info = EM2860_BOARD_TERRATEC_HYBRID_XS },
1140 { USB_DEVICE(0x0ccd, 0x005e),
1141 .driver_info = EM2882_BOARD_TERRATEC_HYBRID_XS },
1142 { USB_DEVICE(0x0ccd, 0x0042),
1143 .driver_info = EM2880_BOARD_TERRATEC_HYBRID_XS },
1144 { USB_DEVICE(0x0ccd, 0x0043),
1145 .driver_info = EM2870_BOARD_TERRATEC_XS },
1146 { USB_DEVICE(0x0ccd, 0x0047),
1147 .driver_info = EM2880_BOARD_TERRATEC_PRODIGY_XS },
1148 { USB_DEVICE(0x185b, 0x2870),
1149 .driver_info = EM2870_BOARD_COMPRO_VIDEOMATE },
1150 { USB_DEVICE(0x185b, 0x2041),
1151 .driver_info = EM2820_BOARD_COMPRO_VIDEOMATE_FORYOU },
1152 { USB_DEVICE(0x2040, 0x4200),
1153 .driver_info = EM2820_BOARD_HAUPPAUGE_WINTV_USB_2 },
1154 { USB_DEVICE(0x2040, 0x4201),
1155 .driver_info = EM2820_BOARD_HAUPPAUGE_WINTV_USB_2 },
1156 { USB_DEVICE(0x2040, 0x6500),
1157 .driver_info = EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900 },
1158 { USB_DEVICE(0x2040, 0x6502),
1159 .driver_info = EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900_R2 },
1160 { USB_DEVICE(0x2040, 0x6513), /* HCW HVR-980 */
1161 .driver_info = EM2883_BOARD_HAUPPAUGE_WINTV_HVR_950 },
1162 { USB_DEVICE(0x2040, 0x6517), /* HP HVR-950 */
1163 .driver_info = EM2883_BOARD_HAUPPAUGE_WINTV_HVR_950 },
1164 { USB_DEVICE(0x2040, 0x651b), /* RP HVR-950 */
1165 .driver_info = EM2883_BOARD_HAUPPAUGE_WINTV_HVR_950 },
1166 { USB_DEVICE(0x2040, 0x651f), /* HCW HVR-850 */
1167 .driver_info = EM2883_BOARD_HAUPPAUGE_WINTV_HVR_950 },
1168 { USB_DEVICE(0x0438, 0xb002),
1169 .driver_info = EM2880_BOARD_AMD_ATI_TV_WONDER_HD_600 },
1170 { USB_DEVICE(0x2001, 0xf112),
1171 .driver_info = EM2820_BOARD_DLINK_USB_TV },
1172 { USB_DEVICE(0x2304, 0x0207),
1173 .driver_info = EM2820_BOARD_PINNACLE_DVC_90 },
1174 { USB_DEVICE(0x2304, 0x0208),
1175 .driver_info = EM2820_BOARD_PINNACLE_USB_2 },
1176 { USB_DEVICE(0x2304, 0x021a),
1177 .driver_info = EM2820_BOARD_PINNACLE_DVC_90 },
1178 { USB_DEVICE(0x2304, 0x0226),
1179 .driver_info = EM2882_BOARD_PINNACLE_HYBRID_PRO },
1180 { USB_DEVICE(0x2304, 0x0227),
1181 .driver_info = EM2880_BOARD_PINNACLE_PCTV_HD_PRO },
1182 { USB_DEVICE(0x0413, 0x6023),
1183 .driver_info = EM2800_BOARD_LEADTEK_WINFAST_USBII },
1184 { USB_DEVICE(0x093b, 0xa005),
1185 .driver_info = EM2861_BOARD_PLEXTOR_PX_TV100U },
1188 MODULE_DEVICE_TABLE(usb, em28xx_id_table);
1191 * Reset sequences for analog/digital modes
1194 /* Reset for the most [analog] boards */
1195 static struct em28xx_reg_seq default_analog[] = {
1196 {EM28XX_R08_GPIO, 0x6d, ~EM_GPIO_4, 10},
1200 /* Reset for the most [digital] boards */
1201 static struct em28xx_reg_seq default_digital[] = {
1202 {EM28XX_R08_GPIO, 0x6e, ~EM_GPIO_4, 10},
1206 /* Board Hauppauge WinTV HVR 900 analog */
1207 static struct em28xx_reg_seq hauppauge_wintv_hvr_900_analog[] = {
1208 {EM28XX_R08_GPIO, 0x2d, ~EM_GPIO_4, 10},
1209 {0x05, 0xff, 0x10, 10},
1213 /* Board Hauppauge WinTV HVR 900 digital */
1214 static struct em28xx_reg_seq hauppauge_wintv_hvr_900_digital[] = {
1215 {EM28XX_R08_GPIO, 0x2e, ~EM_GPIO_4, 10},
1216 {EM2880_R04_GPO, 0x04, 0x0f, 10},
1217 {EM2880_R04_GPO, 0x0c, 0x0f, 10},
1221 /* Boards - EM2880 MSI DIGIVOX AD and EM2880_BOARD_MSI_DIGIVOX_AD_II */
1222 static struct em28xx_reg_seq em2880_msi_digivox_ad_analog[] = {
1223 {EM28XX_R08_GPIO, 0x69, ~EM_GPIO_4, 10},
1227 /* Boards - EM2880 MSI DIGIVOX AD and EM2880_BOARD_MSI_DIGIVOX_AD_II */
1228 static struct em28xx_reg_seq em2880_msi_digivox_ad_digital[] = {
1229 {EM28XX_R08_GPIO, 0x6a, ~EM_GPIO_4, 10},
1233 /* Board - EM2870 Kworld 355u
1234 Analog - No input analog */
1235 static struct em28xx_reg_seq em2870_kworld_355u_digital[] = {
1236 {EM2880_R04_GPO, 0x01, 0xff, 10},
1240 /* Callback for the most boards */
1241 static struct em28xx_reg_seq default_callback[] = {
1242 {EM28XX_R08_GPIO, EM_GPIO_4, EM_GPIO_4, 10},
1243 {EM28XX_R08_GPIO, 0, EM_GPIO_4, 10},
1244 {EM28XX_R08_GPIO, EM_GPIO_4, EM_GPIO_4, 10},
1248 /* Callback for EM2882 TERRATEC HYBRID XS */
1249 static struct em28xx_reg_seq em2882_terratec_hybrid_xs_digital[] = {
1250 {EM28XX_R08_GPIO, 0x2e, 0xff, 6},
1251 {EM28XX_R08_GPIO, 0x3e, ~EM_GPIO_4, 6},
1252 {EM2880_R04_GPO, 0x04, 0xff, 10},
1253 {EM2880_R04_GPO, 0x0c, 0xff, 10},
1258 * EEPROM hash table for devices with generic USB IDs
1260 static struct em28xx_hash_table em28xx_eeprom_hash [] = {
1261 /* P/N: SA 60002070465 Tuner: TVF7533-MF */
1262 {0x6ce05a8f, EM2820_BOARD_PROLINK_PLAYTV_USB2, TUNER_YMEC_TVF_5533MF},
1265 /* I2C devicelist hash table for devices with generic USB IDs */
1266 static struct em28xx_hash_table em28xx_i2c_hash[] = {
1267 {0xb06a32c3, EM2800_BOARD_TERRATEC_CINERGY_200, TUNER_LG_PAL_NEW_TAPC},
1268 {0xf51200e3, EM2800_BOARD_VGEAR_POCKETTV, TUNER_LG_PAL_NEW_TAPC},
1269 {0x1ba50080, EM2860_BOARD_POINTNIX_INTRAORAL_CAMERA, TUNER_ABSENT},
1272 int em28xx_tuner_callback(void *ptr, int command, int arg)
1275 struct em28xx *dev = ptr;
1277 if (dev->tuner_type != TUNER_XC2028)
1280 if (command != XC2028_TUNER_RESET)
1283 if (dev->mode == EM28XX_ANALOG_MODE)
1284 rc = em28xx_gpio_set(dev, dev->tun_analog_gpio);
1286 rc = em28xx_gpio_set(dev, dev->tun_digital_gpio);
1290 EXPORT_SYMBOL_GPL(em28xx_tuner_callback);
1292 static void em28xx_set_model(struct em28xx *dev)
1294 dev->is_em2800 = em28xx_boards[dev->model].is_em2800;
1295 dev->has_msp34xx = em28xx_boards[dev->model].has_msp34xx;
1296 dev->tda9887_conf = em28xx_boards[dev->model].tda9887_conf;
1297 dev->decoder = em28xx_boards[dev->model].decoder;
1298 dev->video_inputs = em28xx_boards[dev->model].vchannels;
1299 dev->has_12mhz_i2s = em28xx_boards[dev->model].has_12mhz_i2s;
1300 dev->max_range_640_480 = em28xx_boards[dev->model].max_range_640_480;
1301 dev->has_dvb = em28xx_boards[dev->model].has_dvb;
1302 dev->has_snapshot_button = em28xx_boards[dev->model].has_snapshot_button;
1303 dev->valid = em28xx_boards[dev->model].valid;
1306 /* Since em28xx_pre_card_setup() requires a proper dev->model,
1307 * this won't work for boards with generic PCI IDs
1309 void em28xx_pre_card_setup(struct em28xx *dev)
1313 rc = em28xx_read_reg(dev, EM2880_R04_GPO);
1317 dev->wait_after_write = 5;
1318 rc = em28xx_read_reg(dev, EM28XX_R0A_CHIPID);
1321 case CHIP_ID_EM2860:
1322 em28xx_info("chip ID is em2860\n");
1324 case CHIP_ID_EM2883:
1325 em28xx_info("chip ID is em2882/em2883\n");
1326 dev->wait_after_write = 0;
1329 em28xx_info("em28xx chip ID = %d\n", rc);
1332 em28xx_set_model(dev);
1334 /* request some modules */
1335 switch (dev->model) {
1336 case EM2880_BOARD_TERRATEC_PRODIGY_XS:
1337 case EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900:
1338 case EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900_R2:
1339 case EM2860_BOARD_TERRATEC_HYBRID_XS:
1340 case EM2883_BOARD_HAUPPAUGE_WINTV_HVR_950:
1341 case EM2880_BOARD_PINNACLE_PCTV_HD_PRO:
1342 case EM2882_BOARD_PINNACLE_HYBRID_PRO:
1343 case EM2883_BOARD_KWORLD_HYBRID_A316:
1344 case EM2880_BOARD_AMD_ATI_TV_WONDER_HD_600:
1345 em28xx_write_regs(dev, EM28XX_R0F_XCLK, "\x27", 1);
1346 em28xx_write_regs(dev, EM28XX_R06_I2C_CLK, "\x40", 1);
1349 /* Sets GPO/GPIO sequences for this device */
1350 dev->analog_gpio = hauppauge_wintv_hvr_900_analog;
1351 dev->digital_gpio = hauppauge_wintv_hvr_900_digital;
1352 dev->tun_analog_gpio = default_callback;
1353 dev->tun_digital_gpio = default_callback;
1356 case EM2882_BOARD_TERRATEC_HYBRID_XS:
1357 em28xx_write_regs(dev, EM28XX_R0F_XCLK, "\x27", 1);
1358 em28xx_write_regs(dev, EM28XX_R06_I2C_CLK, "\x40", 1);
1361 /* should be added ir_codes here */
1363 /* Sets GPO/GPIO sequences for this device */
1364 dev->analog_gpio = hauppauge_wintv_hvr_900_analog;
1365 dev->digital_gpio = hauppauge_wintv_hvr_900_digital;
1366 dev->tun_analog_gpio = default_callback;
1367 dev->tun_digital_gpio = em2882_terratec_hybrid_xs_digital;
1370 case EM2880_BOARD_TERRATEC_HYBRID_XS_FR:
1371 case EM2880_BOARD_TERRATEC_HYBRID_XS:
1372 case EM2870_BOARD_TERRATEC_XS:
1373 case EM2881_BOARD_PINNACLE_HYBRID_PRO:
1374 case EM2880_BOARD_KWORLD_DVB_310U:
1375 case EM2870_BOARD_KWORLD_350U:
1376 case EM2881_BOARD_DNT_DA2_HYBRID:
1377 em28xx_write_regs(dev, EM28XX_R0F_XCLK, "\x27", 1);
1378 em28xx_write_regs(dev, EM28XX_R06_I2C_CLK, "\x40", 1);
1381 /* NOTE: EM2881_DNT_DA2_HYBRID spend 140 msleep for digital
1382 and analog commands. If this commands doesn't work,
1385 /* Sets GPO/GPIO sequences for this device */
1386 dev->analog_gpio = default_analog;
1387 dev->digital_gpio = default_digital;
1388 dev->tun_analog_gpio = default_callback;
1389 dev->tun_digital_gpio = default_callback;
1392 case EM2880_BOARD_MSI_DIGIVOX_AD:
1393 case EM2880_BOARD_MSI_DIGIVOX_AD_II:
1394 em28xx_write_regs(dev, EM28XX_R0F_XCLK, "\x27", 1);
1395 em28xx_write_regs(dev, EM28XX_R06_I2C_CLK, "\x40", 1);
1398 /* Sets GPO/GPIO sequences for this device */
1399 dev->analog_gpio = em2880_msi_digivox_ad_analog;
1400 dev->digital_gpio = em2880_msi_digivox_ad_digital;
1401 dev->tun_analog_gpio = default_callback;
1402 dev->tun_digital_gpio = default_callback;
1405 case EM2750_BOARD_UNKNOWN:
1406 case EM2750_BOARD_DLCW_130:
1407 em28xx_write_regs(dev, EM28XX_R0F_XCLK, "\x0a", 1);
1410 case EM2861_BOARD_PLEXTOR_PX_TV100U:
1411 em28xx_write_regs(dev, EM28XX_R0F_XCLK, "\x27", 1);
1412 em28xx_write_regs(dev, EM28XX_R06_I2C_CLK, "\x40", 1);
1414 /* Turn on analog audio output */
1415 em28xx_write_regs_req(dev, 0x00, 0x08, "\xfd", 1);
1418 case EM2861_BOARD_KWORLD_PVRTV_300U:
1419 case EM2880_BOARD_KWORLD_DVB_305U:
1420 em28xx_write_regs(dev, EM28XX_R0F_XCLK, "\x27", 1);
1421 em28xx_write_regs(dev, EM28XX_R06_I2C_CLK, "\x4c", 1);
1423 em28xx_write_regs(dev, 0x08, "\x6d", 1);
1425 em28xx_write_regs(dev, 0x08, "\x7d", 1);
1429 case EM2870_BOARD_KWORLD_355U:
1430 em28xx_write_regs(dev, EM28XX_R0F_XCLK, "\x27", 1);
1431 em28xx_write_regs(dev, EM28XX_R06_I2C_CLK, "\x40", 1);
1434 /* Sets GPO/GPIO sequences for this device */
1435 dev->digital_gpio = em2870_kworld_355u_digital;
1438 case EM2870_BOARD_COMPRO_VIDEOMATE:
1439 em28xx_write_regs(dev, EM28XX_R0F_XCLK, "\x27", 1);
1440 em28xx_write_regs(dev, EM28XX_R06_I2C_CLK, "\x40", 1);
1441 /* TODO: someone can do some cleanup here...
1442 not everything's needed */
1443 em28xx_write_regs(dev, 0x04, "\x00", 1);
1445 em28xx_write_regs(dev, 0x04, "\x01", 1);
1447 em28xx_write_regs(dev, 0x08, "\xfd", 1);
1449 em28xx_write_regs(dev, 0x08, "\xfc", 1);
1451 em28xx_write_regs(dev, 0x08, "\xdc", 1);
1453 em28xx_write_regs(dev, 0x08, "\xfc", 1);
1457 case EM2870_BOARD_TERRATEC_XS_MT2060:
1458 em28xx_write_regs(dev, EM28XX_R0F_XCLK, "\x27", 1);
1459 em28xx_write_regs(dev, EM28XX_R06_I2C_CLK, "\x40", 1);
1460 /* this device needs some gpio writes to get the DVB-T
1462 em28xx_write_regs(dev, 0x08, "\xfe", 1);
1464 em28xx_write_regs(dev, 0x08, "\xde", 1);
1466 dev->em28xx_write_regs(dev, 0x08, "\xfe", 1);
1470 case EM2870_BOARD_PINNACLE_PCTV_DVB:
1471 em28xx_write_regs(dev, EM28XX_R06_I2C_CLK, "\x40", 1);
1472 /* this device needs some gpio writes to get the
1474 em28xx_write_regs(dev, 0x08, "\xfe", 1);
1476 em28xx_write_regs(dev, 0x08, "\xde", 1);
1478 em28xx_write_regs(dev, 0x08, "\xfe", 1);
1480 /* switch em2880 rc protocol */
1481 em28xx_write_regs(dev, EM28XX_R0F_XCLK, "\x22", 1);
1482 /* should be added ir_codes here */
1485 case EM2820_BOARD_GADMEI_UTV310:
1486 em28xx_write_regs(dev, EM28XX_R0F_XCLK, "\x27", 1);
1487 em28xx_write_regs(dev, EM28XX_R06_I2C_CLK, "\x40", 1);
1488 /* Turn on analog audio output */
1489 em28xx_write_regs_req(dev, 0x00, 0x08, "\xfd", 1);
1492 case EM2860_BOARD_GADMEI_UTV330:
1494 em28xx_write_regs(dev, EM28XX_R0F_XCLK, "\x07", 1);
1495 em28xx_write_regs(dev, EM28XX_R06_I2C_CLK, "\x40", 1);
1496 /* should be added ir_codes here */
1499 case EM2820_BOARD_MSI_VOX_USB_2:
1500 em28xx_write_regs(dev, EM28XX_R0F_XCLK, "\x27", 1);
1501 em28xx_write_regs(dev, EM28XX_R06_I2C_CLK, "\x40", 1);
1502 /* enables audio for that device */
1503 em28xx_write_regs_req(dev, 0x00, 0x08, "\xfd", 1);
1507 em28xx_gpio_set(dev, dev->tun_analog_gpio);
1508 em28xx_set_mode(dev, EM28XX_ANALOG_MODE);
1511 em28xx_set_mode(dev, EM28XX_MODE_UNDEFINED);
1514 static void em28xx_setup_xc3028(struct em28xx *dev, struct xc2028_ctrl *ctl)
1516 memset(ctl, 0, sizeof(*ctl));
1518 ctl->fname = XC2028_DEFAULT_FIRMWARE;
1520 ctl->mts = em28xx_boards[dev->model].mts_firmware;
1522 switch (dev->model) {
1523 case EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900:
1524 ctl->demod = XC3028_FE_ZARLINK456;
1526 case EM2880_BOARD_TERRATEC_HYBRID_XS:
1527 ctl->demod = XC3028_FE_ZARLINK456;
1529 case EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900_R2:
1530 /* djh - Not sure which demod we need here */
1531 ctl->demod = XC3028_FE_DEFAULT;
1533 case EM2883_BOARD_HAUPPAUGE_WINTV_HVR_950:
1534 case EM2880_BOARD_PINNACLE_PCTV_HD_PRO:
1535 case EM2880_BOARD_AMD_ATI_TV_WONDER_HD_600:
1536 /* FIXME: Better to specify the needed IF */
1537 ctl->demod = XC3028_FE_DEFAULT;
1540 ctl->demod = XC3028_FE_OREN538;
1544 static void em28xx_config_tuner(struct em28xx *dev)
1546 struct v4l2_priv_tun_config xc2028_cfg;
1547 struct tuner_setup tun_setup;
1548 struct v4l2_frequency f;
1550 if (dev->tuner_type == TUNER_ABSENT)
1553 tun_setup.mode_mask = T_ANALOG_TV | T_RADIO;
1554 tun_setup.type = dev->tuner_type;
1555 tun_setup.addr = dev->tuner_addr;
1556 tun_setup.tuner_callback = em28xx_tuner_callback;
1558 em28xx_i2c_call_clients(dev, TUNER_SET_TYPE_ADDR, &tun_setup);
1560 if (dev->tuner_type == TUNER_XC2028) {
1561 struct xc2028_ctrl ctl;
1563 em28xx_setup_xc3028(dev, &ctl);
1565 xc2028_cfg.tuner = TUNER_XC2028;
1566 xc2028_cfg.priv = &ctl;
1568 em28xx_i2c_call_clients(dev, TUNER_SET_CONFIG, &xc2028_cfg);
1571 /* configure tuner */
1573 f.type = V4L2_TUNER_ANALOG_TV;
1574 f.frequency = 9076; /* just a magic number */
1575 dev->ctl_freq = f.frequency;
1576 em28xx_i2c_call_clients(dev, VIDIOC_S_FREQUENCY, &f);
1579 static int em28xx_hint_board(struct em28xx *dev)
1583 /* HINT method: EEPROM
1585 * This method works only for boards with eeprom.
1586 * Uses a hash of all eeprom bytes. The hash should be
1587 * unique for a vendor/tuner pair.
1588 * There are a high chance that tuners for different
1589 * video standards produce different hashes.
1591 for (i = 0; i < ARRAY_SIZE(em28xx_eeprom_hash); i++) {
1592 if (dev->hash == em28xx_eeprom_hash[i].hash) {
1593 dev->model = em28xx_eeprom_hash[i].model;
1594 dev->tuner_type = em28xx_eeprom_hash[i].tuner;
1596 em28xx_errdev("Your board has no unique USB ID.\n");
1597 em28xx_errdev("A hint were successfully done, "
1598 "based on eeprom hash.\n");
1599 em28xx_errdev("This method is not 100%% failproof.\n");
1600 em28xx_errdev("If the board were missdetected, "
1601 "please email this log to:\n");
1602 em28xx_errdev("\tV4L Mailing List "
1603 " <video4linux-list@redhat.com>\n");
1604 em28xx_errdev("Board detected as %s\n",
1605 em28xx_boards[dev->model].name);
1611 /* HINT method: I2C attached devices
1613 * This method works for all boards.
1614 * Uses a hash of i2c scanned devices.
1615 * Devices with the same i2c attached chips will
1616 * be considered equal.
1617 * This method is less precise than the eeprom one.
1620 /* user did not request i2c scanning => do it now */
1622 em28xx_do_i2c_scan(dev);
1624 for (i = 0; i < ARRAY_SIZE(em28xx_i2c_hash); i++) {
1625 if (dev->i2c_hash == em28xx_i2c_hash[i].hash) {
1626 dev->model = em28xx_i2c_hash[i].model;
1627 dev->tuner_type = em28xx_i2c_hash[i].tuner;
1628 em28xx_errdev("Your board has no unique USB ID.\n");
1629 em28xx_errdev("A hint were successfully done, "
1630 "based on i2c devicelist hash.\n");
1631 em28xx_errdev("This method is not 100%% failproof.\n");
1632 em28xx_errdev("If the board were missdetected, "
1633 "please email this log to:\n");
1634 em28xx_errdev("\tV4L Mailing List "
1635 " <video4linux-list@redhat.com>\n");
1636 em28xx_errdev("Board detected as %s\n",
1637 em28xx_boards[dev->model].name);
1643 em28xx_errdev("Your board has no unique USB ID and thus need a "
1644 "hint to be detected.\n");
1645 em28xx_errdev("You may try to use card=<n> insmod option to "
1646 "workaround that.\n");
1647 em28xx_errdev("Please send an email with this log to:\n");
1648 em28xx_errdev("\tV4L Mailing List <video4linux-list@redhat.com>\n");
1649 em28xx_errdev("Board eeprom hash is 0x%08lx\n", dev->hash);
1650 em28xx_errdev("Board i2c devicelist hash is 0x%08lx\n", dev->i2c_hash);
1652 em28xx_errdev("Here is a list of valid choices for the card=<n>"
1653 " insmod option:\n");
1654 for (i = 0; i < em28xx_bcount; i++) {
1655 em28xx_errdev(" card=%d -> %s\n",
1656 i, em28xx_boards[i].name);
1661 /* ----------------------------------------------------------------------- */
1662 void em28xx_set_ir(struct em28xx *dev, struct IR_i2c *ir)
1669 /* detect & configure */
1670 switch (dev->model) {
1671 case (EM2800_BOARD_UNKNOWN):
1673 case (EM2820_BOARD_UNKNOWN):
1675 case (EM2800_BOARD_TERRATEC_CINERGY_200):
1676 case (EM2820_BOARD_TERRATEC_CINERGY_250):
1677 ir->ir_codes = ir_codes_em_terratec;
1678 ir->get_key = em28xx_get_key_terratec;
1679 snprintf(ir->c.name, sizeof(ir->c.name),
1680 "i2c IR (EM28XX Terratec)");
1682 case (EM2820_BOARD_PINNACLE_USB_2):
1683 ir->ir_codes = ir_codes_pinnacle_grey;
1684 ir->get_key = em28xx_get_key_pinnacle_usb_grey;
1685 snprintf(ir->c.name, sizeof(ir->c.name),
1686 "i2c IR (EM28XX Pinnacle PCTV)");
1688 case (EM2820_BOARD_HAUPPAUGE_WINTV_USB_2):
1689 ir->ir_codes = ir_codes_hauppauge_new;
1690 ir->get_key = em28xx_get_key_em_haup;
1691 snprintf(ir->c.name, sizeof(ir->c.name),
1692 "i2c IR (EM2840 Hauppauge)");
1694 case (EM2820_BOARD_MSI_VOX_USB_2):
1696 case (EM2800_BOARD_LEADTEK_WINFAST_USBII):
1698 case (EM2800_BOARD_KWORLD_USB2800):
1700 case (EM2800_BOARD_GRABBEEX_USB2800):
1705 void em28xx_card_setup(struct em28xx *dev)
1707 em28xx_set_model(dev);
1709 dev->tuner_type = em28xx_boards[dev->model].tuner_type;
1711 /* request some modules */
1712 switch (dev->model) {
1713 case EM2820_BOARD_HAUPPAUGE_WINTV_USB_2:
1714 case EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900:
1715 case EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900_R2:
1716 case EM2883_BOARD_HAUPPAUGE_WINTV_HVR_950:
1719 #ifdef CONFIG_MODULES
1720 request_module("tveeprom");
1722 /* Call first TVeeprom */
1724 dev->i2c_client.addr = 0xa0 >> 1;
1725 tveeprom_hauppauge_analog(&dev->i2c_client, &tv, dev->eedata);
1727 dev->tuner_type = tv.tuner_type;
1729 if (tv.audio_processor == V4L2_IDENT_MSPX4XX) {
1730 dev->i2s_speed = 2048000;
1731 dev->has_msp34xx = 1;
1733 #ifdef CONFIG_MODULES
1735 request_module("ir-kbd-i2c");
1739 case EM2820_BOARD_KWORLD_PVRTV2800RF:
1740 /* GPIO enables sound on KWORLD PVR TV 2800RF */
1741 em28xx_write_regs_req(dev, 0x00, 0x08, "\xf9", 1);
1743 case EM2820_BOARD_UNKNOWN:
1744 case EM2800_BOARD_UNKNOWN:
1745 if (!em28xx_hint_board(dev))
1746 em28xx_set_model(dev);
1750 if (dev->has_snapshot_button)
1751 em28xx_register_snapshot_button(dev);
1753 if (dev->valid == EM28XX_BOARD_NOT_VALIDATED) {
1754 em28xx_errdev("\n\n");
1755 em28xx_errdev("The support for this board weren't "
1757 em28xx_errdev("Please send a report of having this working\n");
1758 em28xx_errdev("not to V4L mailing list (and/or to other "
1762 /* Allow override tuner type by a module parameter */
1764 dev->tuner_type = tuner;
1766 #ifdef CONFIG_MODULES
1767 /* request some modules */
1768 if (dev->has_msp34xx)
1769 request_module("msp3400");
1770 if (dev->decoder == EM28XX_SAA7113 || dev->decoder == EM28XX_SAA7114)
1771 request_module("saa7115");
1772 if (dev->decoder == EM28XX_TVP5150)
1773 request_module("tvp5150");
1774 if (dev->tuner_type != TUNER_ABSENT)
1775 request_module("tuner");
1778 em28xx_config_tuner(dev);