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 #define DRIVER_NAME "em28xx"
42 static int tuner = -1;
43 module_param(tuner, int, 0444);
44 MODULE_PARM_DESC(tuner, "tuner type");
46 static unsigned int disable_ir;
47 module_param(disable_ir, int, 0444);
48 MODULE_PARM_DESC(disable_ir, "disable infrared remote support");
50 static unsigned int card[] = {[0 ... (EM28XX_MAXBOARDS - 1)] = UNSET };
51 module_param_array(card, int, NULL, 0444);
52 MODULE_PARM_DESC(card, "card type");
54 /* Bitmask marking allocated devices from 0 to EM28XX_MAXBOARDS */
55 static unsigned long em28xx_devused;
57 struct em28xx_hash_table {
64 * Reset sequences for analog/digital modes
67 /* Reset for the most [analog] boards */
68 static struct em28xx_reg_seq default_analog[] = {
69 {EM28XX_R08_GPIO, 0x6d, ~EM_GPIO_4, 10},
73 /* Reset for the most [digital] boards */
74 static struct em28xx_reg_seq default_digital[] = {
75 {EM28XX_R08_GPIO, 0x6e, ~EM_GPIO_4, 10},
79 /* Board Hauppauge WinTV HVR 900 analog */
80 static struct em28xx_reg_seq hauppauge_wintv_hvr_900_analog[] = {
81 {EM28XX_R08_GPIO, 0x2d, ~EM_GPIO_4, 10},
82 {0x05, 0xff, 0x10, 10},
86 /* Board Hauppauge WinTV HVR 900 digital */
87 static struct em28xx_reg_seq hauppauge_wintv_hvr_900_digital[] = {
88 {EM28XX_R08_GPIO, 0x2e, ~EM_GPIO_4, 10},
89 {EM2880_R04_GPO, 0x04, 0x0f, 10},
90 {EM2880_R04_GPO, 0x0c, 0x0f, 10},
94 /* Boards - EM2880 MSI DIGIVOX AD and EM2880_BOARD_MSI_DIGIVOX_AD_II */
95 static struct em28xx_reg_seq em2880_msi_digivox_ad_analog[] = {
96 {EM28XX_R08_GPIO, 0x69, ~EM_GPIO_4, 10},
100 /* Boards - EM2880 MSI DIGIVOX AD and EM2880_BOARD_MSI_DIGIVOX_AD_II */
102 /* Board - EM2870 Kworld 355u
103 Analog - No input analog */
105 /* Callback for the most boards */
106 static struct em28xx_reg_seq default_tuner_gpio[] = {
107 {EM28XX_R08_GPIO, EM_GPIO_4, EM_GPIO_4, 10},
108 {EM28XX_R08_GPIO, 0, EM_GPIO_4, 10},
109 {EM28XX_R08_GPIO, EM_GPIO_4, EM_GPIO_4, 10},
116 struct em28xx_board em28xx_boards[] = {
117 [EM2750_BOARD_UNKNOWN] = {
118 .name = "Unknown EM2750/EM2751 webcam grabber",
119 .xclk = EM28XX_XCLK_FREQUENCY_48MHZ,
120 .tuner_type = TUNER_ABSENT, /* This is a webcam */
122 .type = EM28XX_VMUX_COMPOSITE1,
124 .amux = EM28XX_AMUX_VIDEO,
127 [EM2800_BOARD_UNKNOWN] = {
128 .name = "Unknown EM2800 video grabber",
130 .tda9887_conf = TDA9887_PRESENT,
131 .decoder = EM28XX_SAA711X,
132 .tuner_type = TUNER_ABSENT,
134 .type = EM28XX_VMUX_COMPOSITE1,
135 .vmux = SAA7115_COMPOSITE0,
136 .amux = EM28XX_AMUX_LINE_IN,
138 .type = EM28XX_VMUX_SVIDEO,
139 .vmux = SAA7115_SVIDEO3,
140 .amux = EM28XX_AMUX_LINE_IN,
143 [EM2820_BOARD_UNKNOWN] = {
144 .name = "Unknown EM2750/28xx video grabber",
145 .tuner_type = TUNER_ABSENT,
147 [EM2750_BOARD_DLCW_130] = {
148 /* Beijing Huaqi Information Digital Technology Co., Ltd */
149 .name = "Huaqi DLCW-130",
150 .valid = EM28XX_BOARD_NOT_VALIDATED,
151 .xclk = EM28XX_XCLK_FREQUENCY_48MHZ,
152 .tuner_type = TUNER_ABSENT, /* This is a webcam */
154 .type = EM28XX_VMUX_COMPOSITE1,
156 .amux = EM28XX_AMUX_VIDEO,
159 [EM2820_BOARD_KWORLD_PVRTV2800RF] = {
160 .name = "Kworld PVR TV 2800 RF",
161 .tuner_type = TUNER_TEMIC_PAL,
162 .tda9887_conf = TDA9887_PRESENT,
163 .decoder = EM28XX_SAA711X,
165 .type = EM28XX_VMUX_COMPOSITE1,
166 .vmux = SAA7115_COMPOSITE0,
167 .amux = EM28XX_AMUX_LINE_IN,
169 .type = EM28XX_VMUX_SVIDEO,
170 .vmux = SAA7115_SVIDEO3,
171 .amux = EM28XX_AMUX_LINE_IN,
174 [EM2820_BOARD_TERRATEC_CINERGY_250] = {
175 .name = "Terratec Cinergy 250 USB",
176 .tuner_type = TUNER_LG_PAL_NEW_TAPC,
177 .tda9887_conf = TDA9887_PRESENT,
178 .decoder = EM28XX_SAA711X,
180 .type = EM28XX_VMUX_TELEVISION,
181 .vmux = SAA7115_COMPOSITE2,
182 .amux = EM28XX_AMUX_LINE_IN,
184 .type = EM28XX_VMUX_COMPOSITE1,
185 .vmux = SAA7115_COMPOSITE0,
186 .amux = EM28XX_AMUX_LINE_IN,
188 .type = EM28XX_VMUX_SVIDEO,
189 .vmux = SAA7115_SVIDEO3,
190 .amux = EM28XX_AMUX_LINE_IN,
193 [EM2820_BOARD_PINNACLE_USB_2] = {
194 .name = "Pinnacle PCTV USB 2",
195 .tuner_type = TUNER_LG_PAL_NEW_TAPC,
196 .tda9887_conf = TDA9887_PRESENT,
197 .decoder = EM28XX_SAA711X,
199 .type = EM28XX_VMUX_TELEVISION,
200 .vmux = SAA7115_COMPOSITE2,
201 .amux = EM28XX_AMUX_VIDEO,
203 .type = EM28XX_VMUX_COMPOSITE1,
204 .vmux = SAA7115_COMPOSITE0,
205 .amux = EM28XX_AMUX_LINE_IN,
207 .type = EM28XX_VMUX_SVIDEO,
208 .vmux = SAA7115_SVIDEO3,
209 .amux = EM28XX_AMUX_LINE_IN,
212 [EM2820_BOARD_HAUPPAUGE_WINTV_USB_2] = {
213 .name = "Hauppauge WinTV USB 2",
214 .tuner_type = TUNER_PHILIPS_FM1236_MK3,
215 .tda9887_conf = TDA9887_PRESENT |
216 TDA9887_PORT1_ACTIVE|
217 TDA9887_PORT2_ACTIVE,
218 .decoder = EM28XX_TVP5150,
221 .type = EM28XX_VMUX_TELEVISION,
222 .vmux = TVP5150_COMPOSITE0,
223 .amux = MSP_INPUT_DEFAULT,
225 .type = EM28XX_VMUX_SVIDEO,
226 .vmux = TVP5150_SVIDEO,
227 .amux = MSP_INPUT(MSP_IN_SCART1, MSP_IN_TUNER1,
228 MSP_DSP_IN_SCART, MSP_DSP_IN_SCART),
231 [EM2820_BOARD_DLINK_USB_TV] = {
232 .name = "D-Link DUB-T210 TV Tuner",
233 .valid = EM28XX_BOARD_NOT_VALIDATED,
234 .tuner_type = TUNER_LG_PAL_NEW_TAPC,
235 .tda9887_conf = TDA9887_PRESENT,
236 .decoder = EM28XX_SAA711X,
238 .type = EM28XX_VMUX_TELEVISION,
239 .vmux = SAA7115_COMPOSITE2,
240 .amux = EM28XX_AMUX_LINE_IN,
242 .type = EM28XX_VMUX_COMPOSITE1,
243 .vmux = SAA7115_COMPOSITE0,
244 .amux = EM28XX_AMUX_LINE_IN,
246 .type = EM28XX_VMUX_SVIDEO,
247 .vmux = SAA7115_SVIDEO3,
248 .amux = EM28XX_AMUX_LINE_IN,
251 [EM2820_BOARD_HERCULES_SMART_TV_USB2] = {
252 .name = "Hercules Smart TV USB 2.0",
253 .valid = EM28XX_BOARD_NOT_VALIDATED,
254 .tuner_type = TUNER_LG_PAL_NEW_TAPC,
255 .tda9887_conf = TDA9887_PRESENT,
256 .decoder = EM28XX_SAA711X,
258 .type = EM28XX_VMUX_TELEVISION,
259 .vmux = SAA7115_COMPOSITE2,
260 .amux = EM28XX_AMUX_LINE_IN,
262 .type = EM28XX_VMUX_COMPOSITE1,
263 .vmux = SAA7115_COMPOSITE0,
264 .amux = EM28XX_AMUX_LINE_IN,
266 .type = EM28XX_VMUX_SVIDEO,
267 .vmux = SAA7115_SVIDEO3,
268 .amux = EM28XX_AMUX_LINE_IN,
271 [EM2820_BOARD_PINNACLE_USB_2_FM1216ME] = {
272 .name = "Pinnacle PCTV USB 2 (Philips FM1216ME)",
273 .valid = EM28XX_BOARD_NOT_VALIDATED,
274 .tuner_type = TUNER_PHILIPS_FM1216ME_MK3,
275 .tda9887_conf = TDA9887_PRESENT,
276 .decoder = EM28XX_SAA711X,
278 .type = EM28XX_VMUX_TELEVISION,
279 .vmux = SAA7115_COMPOSITE2,
280 .amux = EM28XX_AMUX_VIDEO,
282 .type = EM28XX_VMUX_COMPOSITE1,
283 .vmux = SAA7115_COMPOSITE0,
284 .amux = EM28XX_AMUX_LINE_IN,
286 .type = EM28XX_VMUX_SVIDEO,
287 .vmux = SAA7115_SVIDEO3,
288 .amux = EM28XX_AMUX_LINE_IN,
291 [EM2820_BOARD_GADMEI_UTV310] = {
292 .name = "Gadmei UTV310",
293 .valid = EM28XX_BOARD_NOT_VALIDATED,
294 .tuner_type = TUNER_TNF_5335MF,
295 .tda9887_conf = TDA9887_PRESENT,
296 .decoder = EM28XX_SAA711X,
298 .type = EM28XX_VMUX_TELEVISION,
299 .vmux = SAA7115_COMPOSITE1,
300 .amux = EM28XX_AMUX_LINE_IN,
302 .type = EM28XX_VMUX_COMPOSITE1,
303 .vmux = SAA7115_COMPOSITE0,
304 .amux = EM28XX_AMUX_LINE_IN,
306 .type = EM28XX_VMUX_SVIDEO,
307 .vmux = SAA7115_SVIDEO3,
308 .amux = EM28XX_AMUX_LINE_IN,
311 [EM2820_BOARD_LEADTEK_WINFAST_USBII_DELUXE] = {
312 .name = "Leadtek Winfast USB II Deluxe",
313 .valid = EM28XX_BOARD_NOT_VALIDATED,
314 .tuner_type = TUNER_PHILIPS_FM1216ME_MK3,
315 .tda9887_conf = TDA9887_PRESENT,
316 .decoder = EM28XX_SAA711X,
318 .type = EM28XX_VMUX_TELEVISION,
319 .vmux = SAA7115_COMPOSITE2,
320 .amux = EM28XX_AMUX_VIDEO,
322 .type = EM28XX_VMUX_COMPOSITE1,
323 .vmux = SAA7115_COMPOSITE0,
324 .amux = EM28XX_AMUX_LINE_IN,
326 .type = EM28XX_VMUX_SVIDEO,
327 .vmux = SAA7115_COMPOSITE0,
328 .amux = EM28XX_AMUX_LINE_IN,
331 [EM2820_BOARD_VIDEOLOGY_20K14XUSB] = {
332 .name = "Videology 20K14XUSB USB2.0",
333 .valid = EM28XX_BOARD_NOT_VALIDATED,
334 .tuner_type = TUNER_ABSENT, /* This is a webcam */
336 .type = EM28XX_VMUX_COMPOSITE1,
338 .amux = EM28XX_AMUX_VIDEO,
341 [EM2821_BOARD_PROLINK_PLAYTV_USB2] = {
342 .name = "SIIG AVTuner-PVR/Prolink PlayTV USB 2.0",
343 .valid = EM28XX_BOARD_NOT_VALIDATED,
344 .tuner_type = TUNER_LG_PAL_NEW_TAPC, /* unknown? */
345 .tda9887_conf = TDA9887_PRESENT, /* unknown? */
346 .decoder = EM28XX_SAA711X,
348 .type = EM28XX_VMUX_TELEVISION,
349 .vmux = SAA7115_COMPOSITE2,
350 .amux = EM28XX_AMUX_LINE_IN,
352 .type = EM28XX_VMUX_COMPOSITE1,
353 .vmux = SAA7115_COMPOSITE0,
354 .amux = EM28XX_AMUX_LINE_IN,
356 .type = EM28XX_VMUX_SVIDEO,
357 .vmux = SAA7115_SVIDEO3,
358 .amux = EM28XX_AMUX_LINE_IN,
361 [EM2821_BOARD_SUPERCOMP_USB_2] = {
362 .name = "Supercomp USB 2.0 TV",
363 .valid = EM28XX_BOARD_NOT_VALIDATED,
364 .tuner_type = TUNER_PHILIPS_FM1236_MK3,
365 .tda9887_conf = TDA9887_PRESENT |
366 TDA9887_PORT1_ACTIVE |
367 TDA9887_PORT2_ACTIVE,
368 .decoder = EM28XX_SAA711X,
370 .type = EM28XX_VMUX_TELEVISION,
371 .vmux = SAA7115_COMPOSITE2,
372 .amux = EM28XX_AMUX_LINE_IN,
374 .type = EM28XX_VMUX_COMPOSITE1,
375 .vmux = SAA7115_COMPOSITE0,
376 .amux = EM28XX_AMUX_VIDEO,
378 .type = EM28XX_VMUX_SVIDEO,
379 .vmux = SAA7115_SVIDEO3,
380 .amux = EM28XX_AMUX_LINE_IN,
383 [EM2821_BOARD_USBGEAR_VD204] = {
384 .name = "Usbgear VD204v9",
385 .valid = EM28XX_BOARD_NOT_VALIDATED,
386 .tuner_type = TUNER_ABSENT, /* Capture only device */
387 .decoder = EM28XX_SAA711X,
389 .type = EM28XX_VMUX_COMPOSITE1,
390 .vmux = SAA7115_COMPOSITE0,
391 .amux = EM28XX_AMUX_LINE_IN,
393 .type = EM28XX_VMUX_SVIDEO,
394 .vmux = SAA7115_SVIDEO3,
395 .amux = EM28XX_AMUX_LINE_IN,
398 [EM2860_BOARD_NETGMBH_CAM] = {
399 /* Beijing Huaqi Information Digital Technology Co., Ltd */
400 .name = "NetGMBH Cam",
401 .valid = EM28XX_BOARD_NOT_VALIDATED,
402 .tuner_type = TUNER_ABSENT, /* This is a webcam */
404 .type = EM28XX_VMUX_COMPOSITE1,
406 .amux = EM28XX_AMUX_VIDEO,
409 [EM2860_BOARD_TYPHOON_DVD_MAKER] = {
410 .name = "Typhoon DVD Maker",
411 .decoder = EM28XX_SAA711X,
412 .tuner_type = TUNER_ABSENT, /* Capture only device */
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 [EM2860_BOARD_GADMEI_UTV330] = {
424 .name = "Gadmei UTV330",
425 .valid = EM28XX_BOARD_NOT_VALIDATED,
426 .tuner_type = TUNER_TNF_5335MF,
427 .tda9887_conf = TDA9887_PRESENT,
428 .decoder = EM28XX_SAA711X,
430 .type = EM28XX_VMUX_TELEVISION,
431 .vmux = SAA7115_COMPOSITE2,
432 .amux = EM28XX_AMUX_VIDEO,
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 [EM2860_BOARD_TERRATEC_HYBRID_XS] = {
444 .name = "Terratec Cinergy A Hybrid XS",
445 .valid = EM28XX_BOARD_NOT_VALIDATED,
446 .tuner_type = TUNER_XC2028,
447 .tuner_gpio = default_tuner_gpio,
448 .decoder = EM28XX_TVP5150,
451 .type = EM28XX_VMUX_TELEVISION,
452 .vmux = TVP5150_COMPOSITE0,
453 .amux = EM28XX_AMUX_VIDEO,
454 .gpio = hauppauge_wintv_hvr_900_analog,
456 .type = EM28XX_VMUX_COMPOSITE1,
457 .vmux = TVP5150_COMPOSITE1,
458 .amux = EM28XX_AMUX_LINE_IN,
459 .gpio = hauppauge_wintv_hvr_900_analog,
461 .type = EM28XX_VMUX_SVIDEO,
462 .vmux = TVP5150_SVIDEO,
463 .amux = EM28XX_AMUX_LINE_IN,
464 .gpio = hauppauge_wintv_hvr_900_analog,
467 [EM2861_BOARD_KWORLD_PVRTV_300U] = {
468 .name = "KWorld PVRTV 300U",
469 .valid = EM28XX_BOARD_NOT_VALIDATED,
470 .tuner_type = TUNER_XC2028,
471 .tuner_gpio = default_tuner_gpio,
472 .decoder = EM28XX_TVP5150,
474 .type = EM28XX_VMUX_TELEVISION,
475 .vmux = TVP5150_COMPOSITE0,
476 .amux = EM28XX_AMUX_VIDEO,
478 .type = EM28XX_VMUX_COMPOSITE1,
479 .vmux = TVP5150_COMPOSITE1,
480 .amux = EM28XX_AMUX_LINE_IN,
482 .type = EM28XX_VMUX_SVIDEO,
483 .vmux = TVP5150_SVIDEO,
484 .amux = EM28XX_AMUX_LINE_IN,
487 [EM2861_BOARD_YAKUMO_MOVIE_MIXER] = {
488 .name = "Yakumo MovieMixer",
489 .tuner_type = TUNER_ABSENT, /* Capture only device */
490 .decoder = EM28XX_TVP5150,
492 .type = EM28XX_VMUX_TELEVISION,
493 .vmux = TVP5150_COMPOSITE0,
494 .amux = EM28XX_AMUX_VIDEO,
496 .type = EM28XX_VMUX_COMPOSITE1,
497 .vmux = TVP5150_COMPOSITE1,
498 .amux = EM28XX_AMUX_LINE_IN,
500 .type = EM28XX_VMUX_SVIDEO,
501 .vmux = TVP5150_SVIDEO,
502 .amux = EM28XX_AMUX_LINE_IN,
505 [EM2861_BOARD_PLEXTOR_PX_TV100U] = {
506 .name = "Plextor ConvertX PX-TV100U",
507 .valid = EM28XX_BOARD_NOT_VALIDATED,
508 .tuner_type = TUNER_TNF_5335MF,
509 .tda9887_conf = TDA9887_PRESENT,
510 .decoder = EM28XX_TVP5150,
512 .type = EM28XX_VMUX_TELEVISION,
513 .vmux = TVP5150_COMPOSITE0,
514 .amux = EM28XX_AMUX_LINE_IN,
516 .type = EM28XX_VMUX_COMPOSITE1,
517 .vmux = TVP5150_COMPOSITE1,
518 .amux = EM28XX_AMUX_LINE_IN,
520 .type = EM28XX_VMUX_SVIDEO,
521 .vmux = TVP5150_SVIDEO,
522 .amux = EM28XX_AMUX_LINE_IN,
526 /* Those boards with em2870 are DVB Only*/
528 [EM2870_BOARD_TERRATEC_XS] = {
529 .name = "Terratec Cinergy T XS",
530 .valid = EM28XX_BOARD_NOT_VALIDATED,
531 .tuner_type = TUNER_XC2028,
532 .tuner_gpio = default_tuner_gpio,
534 [EM2870_BOARD_TERRATEC_XS_MT2060] = {
535 .name = "Terratec Cinergy T XS (MT2060)",
536 .valid = EM28XX_BOARD_NOT_VALIDATED,
537 .tuner_type = TUNER_ABSENT, /* MT2060 */
539 [EM2870_BOARD_KWORLD_350U] = {
540 .name = "Kworld 350 U DVB-T",
541 .valid = EM28XX_BOARD_NOT_VALIDATED,
542 .tuner_type = TUNER_XC2028,
543 .tuner_gpio = default_tuner_gpio,
545 [EM2870_BOARD_KWORLD_355U] = {
546 .name = "Kworld 355 U DVB-T",
547 .valid = EM28XX_BOARD_NOT_VALIDATED,
549 [EM2870_BOARD_PINNACLE_PCTV_DVB] = {
550 .name = "Pinnacle PCTV DVB-T",
551 .valid = EM28XX_BOARD_NOT_VALIDATED,
552 .tuner_type = TUNER_ABSENT, /* MT2060 */
553 /* djh - I have serious doubts this is right... */
554 .xclk = EM28XX_XCLK_IR_RC5_MODE |
555 EM28XX_XCLK_FREQUENCY_10MHZ,
557 [EM2870_BOARD_COMPRO_VIDEOMATE] = {
558 .name = "Compro, VideoMate U3",
559 .valid = EM28XX_BOARD_NOT_VALIDATED,
560 .tuner_type = TUNER_ABSENT, /* MT2060 */
563 [EM2880_BOARD_TERRATEC_HYBRID_XS_FR] = {
564 .name = "Terratec Hybrid XS Secam",
565 .valid = EM28XX_BOARD_NOT_VALIDATED,
567 .tuner_type = TUNER_XC2028,
568 .tuner_gpio = default_tuner_gpio,
569 .decoder = EM28XX_TVP5150,
571 .type = EM28XX_VMUX_TELEVISION,
572 .vmux = TVP5150_COMPOSITE0,
573 .amux = EM28XX_AMUX_VIDEO,
574 .gpio = default_analog,
576 .type = EM28XX_VMUX_COMPOSITE1,
577 .vmux = TVP5150_COMPOSITE1,
578 .amux = EM28XX_AMUX_LINE_IN,
579 .gpio = default_analog,
581 .type = EM28XX_VMUX_SVIDEO,
582 .vmux = TVP5150_SVIDEO,
583 .amux = EM28XX_AMUX_LINE_IN,
584 .gpio = default_analog,
587 [EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900] = {
588 .name = "Hauppauge WinTV HVR 900",
589 .tda9887_conf = TDA9887_PRESENT,
590 .tuner_type = TUNER_XC2028,
591 .tuner_gpio = default_tuner_gpio,
594 .dvb_gpio = hauppauge_wintv_hvr_900_digital,
595 .decoder = EM28XX_TVP5150,
597 .type = EM28XX_VMUX_TELEVISION,
598 .vmux = TVP5150_COMPOSITE0,
599 .amux = EM28XX_AMUX_VIDEO,
600 .gpio = hauppauge_wintv_hvr_900_analog,
602 .type = EM28XX_VMUX_COMPOSITE1,
603 .vmux = TVP5150_COMPOSITE1,
604 .amux = EM28XX_AMUX_LINE_IN,
605 .gpio = hauppauge_wintv_hvr_900_analog,
607 .type = EM28XX_VMUX_SVIDEO,
608 .vmux = TVP5150_SVIDEO,
609 .amux = EM28XX_AMUX_LINE_IN,
610 .gpio = hauppauge_wintv_hvr_900_analog,
613 [EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900_R2] = {
614 .name = "Hauppauge WinTV HVR 900 (R2)",
615 .tda9887_conf = TDA9887_PRESENT,
616 .tuner_type = TUNER_XC2028,
617 .tuner_gpio = default_tuner_gpio,
619 .decoder = EM28XX_TVP5150,
621 .type = EM28XX_VMUX_TELEVISION,
622 .vmux = TVP5150_COMPOSITE0,
623 .amux = EM28XX_AMUX_VIDEO,
624 .gpio = hauppauge_wintv_hvr_900_analog,
626 .type = EM28XX_VMUX_COMPOSITE1,
627 .vmux = TVP5150_COMPOSITE1,
628 .amux = EM28XX_AMUX_LINE_IN,
629 .gpio = hauppauge_wintv_hvr_900_analog,
631 .type = EM28XX_VMUX_SVIDEO,
632 .vmux = TVP5150_SVIDEO,
633 .amux = EM28XX_AMUX_LINE_IN,
634 .gpio = hauppauge_wintv_hvr_900_analog,
637 [EM2883_BOARD_HAUPPAUGE_WINTV_HVR_850] = {
638 .name = "Hauppauge WinTV HVR 850",
639 .tuner_type = TUNER_XC2028,
640 .tuner_gpio = default_tuner_gpio,
643 .dvb_gpio = hauppauge_wintv_hvr_900_digital,
644 .ir_codes = ir_codes_hauppauge_new,
645 .decoder = EM28XX_TVP5150,
647 .type = EM28XX_VMUX_TELEVISION,
648 .vmux = TVP5150_COMPOSITE0,
649 .amux = EM28XX_AMUX_VIDEO,
650 .gpio = hauppauge_wintv_hvr_900_analog,
652 .type = EM28XX_VMUX_COMPOSITE1,
653 .vmux = TVP5150_COMPOSITE1,
654 .amux = EM28XX_AMUX_LINE_IN,
655 .gpio = hauppauge_wintv_hvr_900_analog,
657 .type = EM28XX_VMUX_SVIDEO,
658 .vmux = TVP5150_SVIDEO,
659 .amux = EM28XX_AMUX_LINE_IN,
660 .gpio = hauppauge_wintv_hvr_900_analog,
663 [EM2883_BOARD_HAUPPAUGE_WINTV_HVR_950] = {
664 .name = "Hauppauge WinTV HVR 950",
665 .tuner_type = TUNER_XC2028,
666 .tuner_gpio = default_tuner_gpio,
669 .dvb_gpio = hauppauge_wintv_hvr_900_digital,
670 .ir_codes = ir_codes_hauppauge_new,
671 .decoder = EM28XX_TVP5150,
673 .type = EM28XX_VMUX_TELEVISION,
674 .vmux = TVP5150_COMPOSITE0,
675 .amux = EM28XX_AMUX_VIDEO,
676 .gpio = hauppauge_wintv_hvr_900_analog,
678 .type = EM28XX_VMUX_COMPOSITE1,
679 .vmux = TVP5150_COMPOSITE1,
680 .amux = EM28XX_AMUX_LINE_IN,
681 .gpio = hauppauge_wintv_hvr_900_analog,
683 .type = EM28XX_VMUX_SVIDEO,
684 .vmux = TVP5150_SVIDEO,
685 .amux = EM28XX_AMUX_LINE_IN,
686 .gpio = hauppauge_wintv_hvr_900_analog,
689 [EM2880_BOARD_PINNACLE_PCTV_HD_PRO] = {
690 .name = "Pinnacle PCTV HD Pro Stick",
691 .tuner_type = TUNER_XC2028,
692 .tuner_gpio = default_tuner_gpio,
695 .dvb_gpio = hauppauge_wintv_hvr_900_digital,
696 .ir_codes = ir_codes_pinnacle_pctv_hd,
697 .decoder = EM28XX_TVP5150,
699 .type = EM28XX_VMUX_TELEVISION,
700 .vmux = TVP5150_COMPOSITE0,
701 .amux = EM28XX_AMUX_VIDEO,
702 .gpio = hauppauge_wintv_hvr_900_analog,
704 .type = EM28XX_VMUX_COMPOSITE1,
705 .vmux = TVP5150_COMPOSITE1,
706 .amux = EM28XX_AMUX_LINE_IN,
707 .gpio = hauppauge_wintv_hvr_900_analog,
709 .type = EM28XX_VMUX_SVIDEO,
710 .vmux = TVP5150_SVIDEO,
711 .amux = EM28XX_AMUX_LINE_IN,
712 .gpio = hauppauge_wintv_hvr_900_analog,
715 [EM2880_BOARD_AMD_ATI_TV_WONDER_HD_600] = {
716 .name = "AMD ATI TV Wonder HD 600",
717 .tuner_type = TUNER_XC2028,
718 .tuner_gpio = default_tuner_gpio,
721 .dvb_gpio = hauppauge_wintv_hvr_900_digital,
722 .ir_codes = ir_codes_ati_tv_wonder_hd_600,
723 .decoder = EM28XX_TVP5150,
725 .type = EM28XX_VMUX_TELEVISION,
726 .vmux = TVP5150_COMPOSITE0,
727 .amux = EM28XX_AMUX_VIDEO,
728 .gpio = hauppauge_wintv_hvr_900_analog,
730 .type = EM28XX_VMUX_COMPOSITE1,
731 .vmux = TVP5150_COMPOSITE1,
732 .amux = EM28XX_AMUX_LINE_IN,
733 .gpio = hauppauge_wintv_hvr_900_analog,
735 .type = EM28XX_VMUX_SVIDEO,
736 .vmux = TVP5150_SVIDEO,
737 .amux = EM28XX_AMUX_LINE_IN,
738 .gpio = hauppauge_wintv_hvr_900_analog,
741 [EM2880_BOARD_TERRATEC_HYBRID_XS] = {
742 .name = "Terratec Hybrid XS",
743 .tuner_type = TUNER_XC2028,
744 .tuner_gpio = default_tuner_gpio,
745 .decoder = EM28XX_TVP5150,
747 .dvb_gpio = default_analog,
749 .type = EM28XX_VMUX_TELEVISION,
750 .vmux = TVP5150_COMPOSITE0,
751 .amux = EM28XX_AMUX_VIDEO,
752 .gpio = default_analog,
754 .type = EM28XX_VMUX_COMPOSITE1,
755 .vmux = TVP5150_COMPOSITE1,
756 .amux = EM28XX_AMUX_LINE_IN,
757 .gpio = default_analog,
759 .type = EM28XX_VMUX_SVIDEO,
760 .vmux = TVP5150_SVIDEO,
761 .amux = EM28XX_AMUX_LINE_IN,
762 .gpio = default_analog,
765 /* maybe there's a reason behind it why Terratec sells the Hybrid XS
766 as Prodigy XS with a different PID, let's keep it separated for now
767 maybe we'll need it lateron */
768 [EM2880_BOARD_TERRATEC_PRODIGY_XS] = {
769 .name = "Terratec Prodigy XS",
770 .tuner_type = TUNER_XC2028,
771 .tuner_gpio = default_tuner_gpio,
772 .decoder = EM28XX_TVP5150,
774 .type = EM28XX_VMUX_TELEVISION,
775 .vmux = TVP5150_COMPOSITE0,
776 .amux = EM28XX_AMUX_VIDEO,
777 .gpio = hauppauge_wintv_hvr_900_analog,
779 .type = EM28XX_VMUX_COMPOSITE1,
780 .vmux = TVP5150_COMPOSITE1,
781 .amux = EM28XX_AMUX_LINE_IN,
782 .gpio = hauppauge_wintv_hvr_900_analog,
784 .type = EM28XX_VMUX_SVIDEO,
785 .vmux = TVP5150_SVIDEO,
786 .amux = EM28XX_AMUX_LINE_IN,
787 .gpio = hauppauge_wintv_hvr_900_analog,
790 [EM2820_BOARD_MSI_VOX_USB_2] = {
791 .name = "MSI VOX USB 2.0",
792 .tuner_type = TUNER_LG_PAL_NEW_TAPC,
793 .tda9887_conf = TDA9887_PRESENT |
794 TDA9887_PORT1_ACTIVE |
795 TDA9887_PORT2_ACTIVE,
796 .max_range_640_480 = 1,
797 .decoder = EM28XX_SAA711X,
799 .type = EM28XX_VMUX_TELEVISION,
800 .vmux = SAA7115_COMPOSITE4,
801 .amux = EM28XX_AMUX_VIDEO,
803 .type = EM28XX_VMUX_COMPOSITE1,
804 .vmux = SAA7115_COMPOSITE0,
805 .amux = EM28XX_AMUX_LINE_IN,
807 .type = EM28XX_VMUX_SVIDEO,
808 .vmux = SAA7115_SVIDEO3,
809 .amux = EM28XX_AMUX_LINE_IN,
812 [EM2800_BOARD_TERRATEC_CINERGY_200] = {
813 .name = "Terratec Cinergy 200 USB",
815 .tuner_type = TUNER_LG_PAL_NEW_TAPC,
816 .tda9887_conf = TDA9887_PRESENT,
817 .decoder = EM28XX_SAA711X,
819 .type = EM28XX_VMUX_TELEVISION,
820 .vmux = SAA7115_COMPOSITE2,
821 .amux = EM28XX_AMUX_VIDEO,
823 .type = EM28XX_VMUX_COMPOSITE1,
824 .vmux = SAA7115_COMPOSITE0,
825 .amux = EM28XX_AMUX_LINE_IN,
827 .type = EM28XX_VMUX_SVIDEO,
828 .vmux = SAA7115_SVIDEO3,
829 .amux = EM28XX_AMUX_LINE_IN,
832 [EM2800_BOARD_GRABBEEX_USB2800] = {
833 .name = "eMPIA Technology, Inc. GrabBeeX+ Video Encoder",
835 .decoder = EM28XX_SAA711X,
836 .tuner_type = TUNER_ABSENT, /* capture only board */
838 .type = EM28XX_VMUX_COMPOSITE1,
839 .vmux = SAA7115_COMPOSITE0,
840 .amux = EM28XX_AMUX_LINE_IN,
842 .type = EM28XX_VMUX_SVIDEO,
843 .vmux = SAA7115_SVIDEO3,
844 .amux = EM28XX_AMUX_LINE_IN,
847 [EM2800_BOARD_LEADTEK_WINFAST_USBII] = {
848 .name = "Leadtek Winfast USB II",
850 .tuner_type = TUNER_LG_PAL_NEW_TAPC,
851 .tda9887_conf = TDA9887_PRESENT,
852 .decoder = EM28XX_SAA711X,
854 .type = EM28XX_VMUX_TELEVISION,
855 .vmux = SAA7115_COMPOSITE2,
856 .amux = EM28XX_AMUX_VIDEO,
858 .type = EM28XX_VMUX_COMPOSITE1,
859 .vmux = SAA7115_COMPOSITE0,
860 .amux = EM28XX_AMUX_LINE_IN,
862 .type = EM28XX_VMUX_SVIDEO,
863 .vmux = SAA7115_SVIDEO3,
864 .amux = EM28XX_AMUX_LINE_IN,
867 [EM2800_BOARD_KWORLD_USB2800] = {
868 .name = "Kworld USB2800",
870 .tuner_type = TUNER_PHILIPS_FCV1236D,
871 .tda9887_conf = TDA9887_PRESENT,
872 .decoder = EM28XX_SAA711X,
874 .type = EM28XX_VMUX_TELEVISION,
875 .vmux = SAA7115_COMPOSITE2,
876 .amux = EM28XX_AMUX_VIDEO,
878 .type = EM28XX_VMUX_COMPOSITE1,
879 .vmux = SAA7115_COMPOSITE0,
880 .amux = EM28XX_AMUX_LINE_IN,
882 .type = EM28XX_VMUX_SVIDEO,
883 .vmux = SAA7115_SVIDEO3,
884 .amux = EM28XX_AMUX_LINE_IN,
887 [EM2820_BOARD_PINNACLE_DVC_90] = {
888 .name = "Pinnacle Dazzle DVC 90/DVC 100",
889 .tuner_type = TUNER_ABSENT, /* capture only board */
890 .decoder = EM28XX_SAA711X,
892 .type = EM28XX_VMUX_COMPOSITE1,
893 .vmux = SAA7115_COMPOSITE0,
894 .amux = EM28XX_AMUX_LINE_IN,
896 .type = EM28XX_VMUX_SVIDEO,
897 .vmux = SAA7115_SVIDEO3,
898 .amux = EM28XX_AMUX_LINE_IN,
901 [EM2800_BOARD_VGEAR_POCKETTV] = {
902 .name = "V-Gear PocketTV",
904 .tuner_type = TUNER_LG_PAL_NEW_TAPC,
905 .tda9887_conf = TDA9887_PRESENT,
906 .decoder = EM28XX_SAA711X,
908 .type = EM28XX_VMUX_TELEVISION,
909 .vmux = SAA7115_COMPOSITE2,
910 .amux = EM28XX_AMUX_VIDEO,
912 .type = EM28XX_VMUX_COMPOSITE1,
913 .vmux = SAA7115_COMPOSITE0,
914 .amux = EM28XX_AMUX_LINE_IN,
916 .type = EM28XX_VMUX_SVIDEO,
917 .vmux = SAA7115_SVIDEO3,
918 .amux = EM28XX_AMUX_LINE_IN,
921 [EM2820_BOARD_PROLINK_PLAYTV_BOX4_USB2] = {
922 .name = "Pixelview PlayTV Box 4 USB 2.0",
923 .tda9887_conf = TDA9887_PRESENT,
924 .tuner_type = TUNER_YMEC_TVF_5533MF,
925 .decoder = EM28XX_SAA711X,
927 .type = EM28XX_VMUX_TELEVISION,
928 .vmux = SAA7115_COMPOSITE2,
929 .amux = EM28XX_AMUX_VIDEO,
930 .aout = EM28XX_AOUT_MONO | /* I2S */
931 EM28XX_AOUT_MASTER, /* Line out pin */
933 .type = EM28XX_VMUX_COMPOSITE1,
934 .vmux = SAA7115_COMPOSITE0,
935 .amux = EM28XX_AMUX_LINE_IN,
937 .type = EM28XX_VMUX_SVIDEO,
938 .vmux = SAA7115_SVIDEO3,
939 .amux = EM28XX_AMUX_LINE_IN,
942 [EM2820_BOARD_PROLINK_PLAYTV_USB2] = {
943 .name = "Pixelview Prolink PlayTV USB 2.0",
944 .has_snapshot_button = 1,
945 .tda9887_conf = TDA9887_PRESENT,
946 .tuner_type = TUNER_YMEC_TVF_5533MF,
947 .decoder = EM28XX_SAA711X,
949 .type = EM28XX_VMUX_TELEVISION,
950 .vmux = SAA7115_COMPOSITE2,
951 .amux = EM28XX_AMUX_VIDEO,
952 .aout = EM28XX_AOUT_MONO | /* I2S */
953 EM28XX_AOUT_MASTER, /* Line out pin */
955 .type = EM28XX_VMUX_COMPOSITE1,
956 .vmux = SAA7115_COMPOSITE0,
957 .amux = EM28XX_AMUX_LINE_IN,
959 .type = EM28XX_VMUX_SVIDEO,
960 .vmux = SAA7115_SVIDEO3,
961 .amux = EM28XX_AMUX_LINE_IN,
964 [EM2860_BOARD_POINTNIX_INTRAORAL_CAMERA] = {
965 .name = "PointNix Intra-Oral Camera",
966 .has_snapshot_button = 1,
967 .tda9887_conf = TDA9887_PRESENT,
968 .tuner_type = TUNER_ABSENT,
969 .decoder = EM28XX_SAA711X,
971 .type = EM28XX_VMUX_SVIDEO,
972 .vmux = SAA7115_SVIDEO3,
973 .amux = EM28XX_AMUX_VIDEO,
976 [EM2880_BOARD_MSI_DIGIVOX_AD] = {
977 .name = "MSI DigiVox A/D",
978 .valid = EM28XX_BOARD_NOT_VALIDATED,
979 .tuner_type = TUNER_XC2028,
980 .tuner_gpio = default_tuner_gpio,
981 .decoder = EM28XX_TVP5150,
983 .type = EM28XX_VMUX_TELEVISION,
984 .vmux = TVP5150_COMPOSITE0,
985 .amux = EM28XX_AMUX_VIDEO,
986 .gpio = em2880_msi_digivox_ad_analog,
988 .type = EM28XX_VMUX_COMPOSITE1,
989 .vmux = TVP5150_COMPOSITE1,
990 .amux = EM28XX_AMUX_LINE_IN,
991 .gpio = em2880_msi_digivox_ad_analog,
993 .type = EM28XX_VMUX_SVIDEO,
994 .vmux = TVP5150_SVIDEO,
995 .amux = EM28XX_AMUX_LINE_IN,
996 .gpio = em2880_msi_digivox_ad_analog,
999 [EM2880_BOARD_MSI_DIGIVOX_AD_II] = {
1000 .name = "MSI DigiVox A/D II",
1001 .valid = EM28XX_BOARD_NOT_VALIDATED,
1002 .tuner_type = TUNER_XC2028,
1003 .tuner_gpio = default_tuner_gpio,
1004 .decoder = EM28XX_TVP5150,
1006 .type = EM28XX_VMUX_TELEVISION,
1007 .vmux = TVP5150_COMPOSITE0,
1008 .amux = EM28XX_AMUX_VIDEO,
1009 .gpio = em2880_msi_digivox_ad_analog,
1011 .type = EM28XX_VMUX_COMPOSITE1,
1012 .vmux = TVP5150_COMPOSITE1,
1013 .amux = EM28XX_AMUX_LINE_IN,
1014 .gpio = em2880_msi_digivox_ad_analog,
1016 .type = EM28XX_VMUX_SVIDEO,
1017 .vmux = TVP5150_SVIDEO,
1018 .amux = EM28XX_AMUX_LINE_IN,
1019 .gpio = em2880_msi_digivox_ad_analog,
1022 [EM2880_BOARD_KWORLD_DVB_305U] = {
1023 .name = "KWorld DVB-T 305U",
1024 .valid = EM28XX_BOARD_NOT_VALIDATED,
1025 .tuner_type = TUNER_XC2028,
1026 .tuner_gpio = default_tuner_gpio,
1027 .decoder = EM28XX_TVP5150,
1029 .type = EM28XX_VMUX_TELEVISION,
1030 .vmux = TVP5150_COMPOSITE0,
1031 .amux = EM28XX_AMUX_VIDEO,
1033 .type = EM28XX_VMUX_COMPOSITE1,
1034 .vmux = TVP5150_COMPOSITE1,
1035 .amux = EM28XX_AMUX_LINE_IN,
1037 .type = EM28XX_VMUX_SVIDEO,
1038 .vmux = TVP5150_SVIDEO,
1039 .amux = EM28XX_AMUX_LINE_IN,
1042 [EM2880_BOARD_KWORLD_DVB_310U] = {
1043 .name = "KWorld DVB-T 310U",
1044 .tuner_type = TUNER_XC2028,
1045 .tuner_gpio = default_tuner_gpio,
1047 .dvb_gpio = default_digital,
1049 .decoder = EM28XX_TVP5150,
1051 .type = EM28XX_VMUX_TELEVISION,
1052 .vmux = TVP5150_COMPOSITE0,
1053 .amux = EM28XX_AMUX_VIDEO,
1054 .gpio = default_analog,
1056 .type = EM28XX_VMUX_COMPOSITE1,
1057 .vmux = TVP5150_COMPOSITE1,
1058 .amux = EM28XX_AMUX_LINE_IN,
1059 .gpio = default_analog,
1060 }, { /* S-video has not been tested yet */
1061 .type = EM28XX_VMUX_SVIDEO,
1062 .vmux = TVP5150_SVIDEO,
1063 .amux = EM28XX_AMUX_LINE_IN,
1064 .gpio = default_analog,
1067 [EM2881_BOARD_DNT_DA2_HYBRID] = {
1068 .name = "DNT DA2 Hybrid",
1069 .valid = EM28XX_BOARD_NOT_VALIDATED,
1070 .tuner_type = TUNER_XC2028,
1071 .tuner_gpio = default_tuner_gpio,
1072 .decoder = EM28XX_TVP5150,
1074 .type = EM28XX_VMUX_TELEVISION,
1075 .vmux = TVP5150_COMPOSITE0,
1076 .amux = EM28XX_AMUX_VIDEO,
1077 .gpio = default_analog,
1079 .type = EM28XX_VMUX_COMPOSITE1,
1080 .vmux = TVP5150_COMPOSITE1,
1081 .amux = EM28XX_AMUX_LINE_IN,
1082 .gpio = default_analog,
1084 .type = EM28XX_VMUX_SVIDEO,
1085 .vmux = TVP5150_SVIDEO,
1086 .amux = EM28XX_AMUX_LINE_IN,
1087 .gpio = default_analog,
1090 [EM2881_BOARD_PINNACLE_HYBRID_PRO] = {
1091 .name = "Pinnacle Hybrid Pro",
1092 .valid = EM28XX_BOARD_NOT_VALIDATED,
1093 .tuner_type = TUNER_XC2028,
1094 .tuner_gpio = default_tuner_gpio,
1095 .decoder = EM28XX_TVP5150,
1097 .type = EM28XX_VMUX_TELEVISION,
1098 .vmux = TVP5150_COMPOSITE0,
1099 .amux = EM28XX_AMUX_VIDEO,
1100 .gpio = default_analog,
1102 .type = EM28XX_VMUX_COMPOSITE1,
1103 .vmux = TVP5150_COMPOSITE1,
1104 .amux = EM28XX_AMUX_LINE_IN,
1105 .gpio = default_analog,
1107 .type = EM28XX_VMUX_SVIDEO,
1108 .vmux = TVP5150_SVIDEO,
1109 .amux = EM28XX_AMUX_LINE_IN,
1110 .gpio = default_analog,
1113 [EM2882_BOARD_PINNACLE_HYBRID_PRO] = {
1114 .name = "Pinnacle Hybrid Pro (2)",
1115 .valid = EM28XX_BOARD_NOT_VALIDATED,
1116 .tuner_type = TUNER_XC2028,
1117 .tuner_gpio = default_tuner_gpio,
1119 .decoder = EM28XX_TVP5150,
1121 .type = EM28XX_VMUX_TELEVISION,
1122 .vmux = TVP5150_COMPOSITE0,
1123 .amux = EM28XX_AMUX_VIDEO,
1124 .gpio = hauppauge_wintv_hvr_900_analog,
1126 .type = EM28XX_VMUX_COMPOSITE1,
1127 .vmux = TVP5150_COMPOSITE1,
1128 .amux = EM28XX_AMUX_LINE_IN,
1129 .gpio = hauppauge_wintv_hvr_900_analog,
1131 .type = EM28XX_VMUX_SVIDEO,
1132 .vmux = TVP5150_SVIDEO,
1133 .amux = EM28XX_AMUX_LINE_IN,
1134 .gpio = hauppauge_wintv_hvr_900_analog,
1137 [EM2882_BOARD_KWORLD_VS_DVBT] = {
1138 .name = "Kworld VS-DVB-T 323UR",
1139 .valid = EM28XX_BOARD_NOT_VALIDATED,
1140 .tuner_type = TUNER_XC2028,
1141 .tuner_gpio = default_tuner_gpio,
1142 .decoder = EM28XX_TVP5150,
1144 .type = EM28XX_VMUX_TELEVISION,
1145 .vmux = TVP5150_COMPOSITE0,
1146 .amux = EM28XX_AMUX_VIDEO,
1148 .type = EM28XX_VMUX_COMPOSITE1,
1149 .vmux = TVP5150_COMPOSITE1,
1150 .amux = EM28XX_AMUX_LINE_IN,
1152 .type = EM28XX_VMUX_SVIDEO,
1153 .vmux = TVP5150_SVIDEO,
1154 .amux = EM28XX_AMUX_LINE_IN,
1157 [EM2882_BOARD_TERRATEC_HYBRID_XS] = {
1158 .name = "Terratec Hybrid XS (em2882)",
1159 .valid = EM28XX_BOARD_NOT_VALIDATED,
1160 .tuner_type = TUNER_XC2028,
1161 .tuner_gpio = default_tuner_gpio,
1162 .decoder = EM28XX_TVP5150,
1164 .type = EM28XX_VMUX_TELEVISION,
1165 .vmux = TVP5150_COMPOSITE0,
1166 .amux = EM28XX_AMUX_VIDEO,
1167 .gpio = hauppauge_wintv_hvr_900_analog,
1169 .type = EM28XX_VMUX_COMPOSITE1,
1170 .vmux = TVP5150_COMPOSITE1,
1171 .amux = EM28XX_AMUX_LINE_IN,
1172 .gpio = hauppauge_wintv_hvr_900_analog,
1174 .type = EM28XX_VMUX_SVIDEO,
1175 .vmux = TVP5150_SVIDEO,
1176 .amux = EM28XX_AMUX_LINE_IN,
1177 .gpio = hauppauge_wintv_hvr_900_analog,
1180 [EM2883_BOARD_KWORLD_HYBRID_A316] = {
1181 .name = "Kworld PlusTV HD Hybrid 330",
1182 .tuner_type = TUNER_XC2028,
1183 .tuner_gpio = default_tuner_gpio,
1184 .decoder = EM28XX_TVP5150,
1187 .dvb_gpio = default_digital,
1189 .type = EM28XX_VMUX_TELEVISION,
1190 .vmux = TVP5150_COMPOSITE0,
1191 .amux = EM28XX_AMUX_VIDEO,
1192 .gpio = default_analog,
1194 .type = EM28XX_VMUX_COMPOSITE1,
1195 .vmux = TVP5150_COMPOSITE1,
1196 .amux = EM28XX_AMUX_LINE_IN,
1197 .gpio = hauppauge_wintv_hvr_900_analog,
1199 .type = EM28XX_VMUX_SVIDEO,
1200 .vmux = TVP5150_SVIDEO,
1201 .amux = EM28XX_AMUX_LINE_IN,
1202 .gpio = hauppauge_wintv_hvr_900_analog,
1205 [EM2820_BOARD_COMPRO_VIDEOMATE_FORYOU] = {
1206 .name = "Compro VideoMate ForYou/Stereo",
1207 .tuner_type = TUNER_LG_PAL_NEW_TAPC,
1208 .tda9887_conf = TDA9887_PRESENT,
1209 .decoder = EM28XX_TVP5150,
1211 .type = EM28XX_VMUX_TELEVISION,
1212 .vmux = TVP5150_COMPOSITE0,
1213 .amux = EM28XX_AMUX_LINE_IN,
1215 .type = EM28XX_VMUX_SVIDEO,
1216 .vmux = TVP5150_SVIDEO,
1217 .amux = EM28XX_AMUX_LINE_IN,
1221 const unsigned int em28xx_bcount = ARRAY_SIZE(em28xx_boards);
1223 /* table of devices that work with this driver */
1224 struct usb_device_id em28xx_id_table [] = {
1225 { USB_DEVICE(0xeb1a, 0x2750),
1226 .driver_info = EM2750_BOARD_UNKNOWN },
1227 { USB_DEVICE(0xeb1a, 0x2751),
1228 .driver_info = EM2750_BOARD_UNKNOWN },
1229 { USB_DEVICE(0xeb1a, 0x2800),
1230 .driver_info = EM2800_BOARD_UNKNOWN },
1231 { USB_DEVICE(0xeb1a, 0x2820),
1232 .driver_info = EM2820_BOARD_UNKNOWN },
1233 { USB_DEVICE(0xeb1a, 0x2821),
1234 .driver_info = EM2820_BOARD_UNKNOWN },
1235 { USB_DEVICE(0xeb1a, 0x2860),
1236 .driver_info = EM2820_BOARD_UNKNOWN },
1237 { USB_DEVICE(0xeb1a, 0x2861),
1238 .driver_info = EM2820_BOARD_UNKNOWN },
1239 { USB_DEVICE(0xeb1a, 0x2870),
1240 .driver_info = EM2820_BOARD_UNKNOWN },
1241 { USB_DEVICE(0xeb1a, 0x2881),
1242 .driver_info = EM2820_BOARD_UNKNOWN },
1243 { USB_DEVICE(0xeb1a, 0x2883),
1244 .driver_info = EM2820_BOARD_UNKNOWN },
1245 { USB_DEVICE(0xeb1a, 0xe300),
1246 .driver_info = EM2861_BOARD_KWORLD_PVRTV_300U },
1247 { USB_DEVICE(0xeb1a, 0xe305),
1248 .driver_info = EM2880_BOARD_KWORLD_DVB_305U },
1249 { USB_DEVICE(0xeb1a, 0xe310),
1250 .driver_info = EM2880_BOARD_MSI_DIGIVOX_AD },
1251 { USB_DEVICE(0xeb1a, 0xa316),
1252 .driver_info = EM2883_BOARD_KWORLD_HYBRID_A316 },
1253 { USB_DEVICE(0xeb1a, 0xe320),
1254 .driver_info = EM2880_BOARD_MSI_DIGIVOX_AD_II },
1255 { USB_DEVICE(0xeb1a, 0xe323),
1256 .driver_info = EM2882_BOARD_KWORLD_VS_DVBT },
1257 { USB_DEVICE(0xeb1a, 0xe350),
1258 .driver_info = EM2870_BOARD_KWORLD_350U },
1259 { USB_DEVICE(0xeb1a, 0xe355),
1260 .driver_info = EM2870_BOARD_KWORLD_355U },
1261 { USB_DEVICE(0xeb1a, 0x2801),
1262 .driver_info = EM2800_BOARD_GRABBEEX_USB2800 },
1263 { USB_DEVICE(0xeb1a, 0xe357),
1264 .driver_info = EM2870_BOARD_KWORLD_355U },
1265 { USB_DEVICE(0x0ccd, 0x0036),
1266 .driver_info = EM2820_BOARD_TERRATEC_CINERGY_250 },
1267 { USB_DEVICE(0x0ccd, 0x004c),
1268 .driver_info = EM2880_BOARD_TERRATEC_HYBRID_XS_FR },
1269 { USB_DEVICE(0x0ccd, 0x004f),
1270 .driver_info = EM2860_BOARD_TERRATEC_HYBRID_XS },
1271 { USB_DEVICE(0x0ccd, 0x005e),
1272 .driver_info = EM2882_BOARD_TERRATEC_HYBRID_XS },
1273 { USB_DEVICE(0x0ccd, 0x0042),
1274 .driver_info = EM2880_BOARD_TERRATEC_HYBRID_XS },
1275 { USB_DEVICE(0x0ccd, 0x0043),
1276 .driver_info = EM2870_BOARD_TERRATEC_XS },
1277 { USB_DEVICE(0x0ccd, 0x0047),
1278 .driver_info = EM2880_BOARD_TERRATEC_PRODIGY_XS },
1279 { USB_DEVICE(0x185b, 0x2870),
1280 .driver_info = EM2870_BOARD_COMPRO_VIDEOMATE },
1281 { USB_DEVICE(0x185b, 0x2041),
1282 .driver_info = EM2820_BOARD_COMPRO_VIDEOMATE_FORYOU },
1283 { USB_DEVICE(0x2040, 0x4200),
1284 .driver_info = EM2820_BOARD_HAUPPAUGE_WINTV_USB_2 },
1285 { USB_DEVICE(0x2040, 0x4201),
1286 .driver_info = EM2820_BOARD_HAUPPAUGE_WINTV_USB_2 },
1287 { USB_DEVICE(0x2040, 0x6500),
1288 .driver_info = EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900 },
1289 { USB_DEVICE(0x2040, 0x6502),
1290 .driver_info = EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900_R2 },
1291 { USB_DEVICE(0x2040, 0x6513), /* HCW HVR-980 */
1292 .driver_info = EM2883_BOARD_HAUPPAUGE_WINTV_HVR_950 },
1293 { USB_DEVICE(0x2040, 0x6517), /* HP HVR-950 */
1294 .driver_info = EM2883_BOARD_HAUPPAUGE_WINTV_HVR_950 },
1295 { USB_DEVICE(0x2040, 0x651b), /* RP HVR-950 */
1296 .driver_info = EM2883_BOARD_HAUPPAUGE_WINTV_HVR_950 },
1297 { USB_DEVICE(0x2040, 0x651f),
1298 .driver_info = EM2883_BOARD_HAUPPAUGE_WINTV_HVR_850 },
1299 { USB_DEVICE(0x0438, 0xb002),
1300 .driver_info = EM2880_BOARD_AMD_ATI_TV_WONDER_HD_600 },
1301 { USB_DEVICE(0x2001, 0xf112),
1302 .driver_info = EM2820_BOARD_DLINK_USB_TV },
1303 { USB_DEVICE(0x2304, 0x0207),
1304 .driver_info = EM2820_BOARD_PINNACLE_DVC_90 },
1305 { USB_DEVICE(0x2304, 0x0208),
1306 .driver_info = EM2820_BOARD_PINNACLE_USB_2 },
1307 { USB_DEVICE(0x2304, 0x021a),
1308 .driver_info = EM2820_BOARD_PINNACLE_DVC_90 },
1309 { USB_DEVICE(0x2304, 0x0226),
1310 .driver_info = EM2882_BOARD_PINNACLE_HYBRID_PRO },
1311 { USB_DEVICE(0x2304, 0x0227),
1312 .driver_info = EM2880_BOARD_PINNACLE_PCTV_HD_PRO },
1313 { USB_DEVICE(0x0413, 0x6023),
1314 .driver_info = EM2800_BOARD_LEADTEK_WINFAST_USBII },
1315 { USB_DEVICE(0x093b, 0xa005),
1316 .driver_info = EM2861_BOARD_PLEXTOR_PX_TV100U },
1319 MODULE_DEVICE_TABLE(usb, em28xx_id_table);
1322 * EEPROM hash table for devices with generic USB IDs
1324 static struct em28xx_hash_table em28xx_eeprom_hash [] = {
1325 /* P/N: SA 60002070465 Tuner: TVF7533-MF */
1326 {0x6ce05a8f, EM2820_BOARD_PROLINK_PLAYTV_USB2, TUNER_YMEC_TVF_5533MF},
1327 {0x72cc5a8b, EM2820_BOARD_PROLINK_PLAYTV_BOX4_USB2, TUNER_YMEC_TVF_5533MF},
1328 {0x966a0441, EM2880_BOARD_KWORLD_DVB_310U, TUNER_XC2028},
1331 /* I2C devicelist hash table for devices with generic USB IDs */
1332 static struct em28xx_hash_table em28xx_i2c_hash[] = {
1333 {0xb06a32c3, EM2800_BOARD_TERRATEC_CINERGY_200, TUNER_LG_PAL_NEW_TAPC},
1334 {0xf51200e3, EM2800_BOARD_VGEAR_POCKETTV, TUNER_LG_PAL_NEW_TAPC},
1335 {0x1ba50080, EM2860_BOARD_POINTNIX_INTRAORAL_CAMERA, TUNER_ABSENT},
1338 int em28xx_tuner_callback(void *ptr, int component, int command, int arg)
1341 struct em28xx *dev = ptr;
1343 if (dev->tuner_type != TUNER_XC2028)
1346 if (command != XC2028_TUNER_RESET)
1349 rc = em28xx_gpio_set(dev, dev->board.tuner_gpio);
1353 EXPORT_SYMBOL_GPL(em28xx_tuner_callback);
1355 static void inline em28xx_set_model(struct em28xx *dev)
1357 memcpy(&dev->board, &em28xx_boards[dev->model], sizeof(dev->board));
1359 /* Those are the default values for the majority of boards
1360 Use those values if not specified otherwise at boards entry
1362 if (!dev->board.xclk)
1363 dev->board.xclk = EM28XX_XCLK_IR_RC5_MODE |
1364 EM28XX_XCLK_FREQUENCY_12MHZ;
1366 if (!dev->board.i2c_speed)
1367 dev->board.i2c_speed = EM28XX_I2C_CLK_WAIT_ENABLE |
1368 EM28XX_I2C_FREQ_100_KHZ;
1371 /* Since em28xx_pre_card_setup() requires a proper dev->model,
1372 * this won't work for boards with generic PCI IDs
1374 void em28xx_pre_card_setup(struct em28xx *dev)
1378 em28xx_set_model(dev);
1380 em28xx_info("Identified as %s (card=%d)\n",
1381 dev->board.name, dev->model);
1383 /* Set the default GPO/GPIO for legacy devices */
1384 dev->reg_gpo_num = EM2880_R04_GPO;
1385 dev->reg_gpio_num = EM28XX_R08_GPIO;
1387 dev->wait_after_write = 5;
1389 /* Based on the Chip ID, set the device configuration */
1390 rc = em28xx_read_reg(dev, EM28XX_R0A_CHIPID);
1394 switch (dev->chip_id) {
1395 case CHIP_ID_EM2750:
1396 em28xx_info("chip ID is em2750\n");
1398 case CHIP_ID_EM2820:
1399 em28xx_info("chip ID is em2820\n");
1401 case CHIP_ID_EM2840:
1402 em28xx_info("chip ID is em2840\n");
1404 case CHIP_ID_EM2860:
1405 em28xx_info("chip ID is em2860\n");
1407 case CHIP_ID_EM2870:
1408 em28xx_info("chip ID is em2870\n");
1409 dev->wait_after_write = 0;
1411 case CHIP_ID_EM2874:
1412 em28xx_info("chip ID is em2874\n");
1413 dev->reg_gpio_num = EM2874_R80_GPIO;
1414 dev->wait_after_write = 0;
1416 case CHIP_ID_EM2883:
1417 em28xx_info("chip ID is em2882/em2883\n");
1418 dev->wait_after_write = 0;
1421 em28xx_info("em28xx chip ID = %d\n", dev->chip_id);
1425 /* Prepopulate cached GPO register content */
1426 rc = em28xx_read_reg(dev, dev->reg_gpo_num);
1430 /* Set the initial XCLK and I2C clock values based on the board
1432 em28xx_write_reg(dev, EM28XX_R0F_XCLK, dev->board.xclk & 0x7f);
1433 em28xx_write_reg(dev, EM28XX_R06_I2C_CLK, dev->board.i2c_speed);
1436 /* request some modules */
1437 switch (dev->model) {
1438 case EM2861_BOARD_PLEXTOR_PX_TV100U:
1440 /* Turn on analog audio output */
1441 em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xfd);
1443 case EM2861_BOARD_KWORLD_PVRTV_300U:
1444 case EM2880_BOARD_KWORLD_DVB_305U:
1445 em28xx_write_reg(dev, EM28XX_R08_GPIO, 0x6d);
1447 em28xx_write_reg(dev, EM28XX_R08_GPIO, 0x7d);
1450 case EM2870_BOARD_COMPRO_VIDEOMATE:
1451 /* TODO: someone can do some cleanup here...
1452 not everything's needed */
1453 em28xx_write_reg(dev, EM2880_R04_GPO, 0x00);
1455 em28xx_write_reg(dev, EM2880_R04_GPO, 0x01);
1457 em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xfd);
1459 em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xfc);
1461 em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xdc);
1463 em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xfc);
1466 case EM2870_BOARD_TERRATEC_XS_MT2060:
1467 /* this device needs some gpio writes to get the DVB-T
1469 em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xfe);
1471 em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xde);
1473 em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xfe);
1476 case EM2870_BOARD_PINNACLE_PCTV_DVB:
1477 /* this device needs some gpio writes to get the
1479 em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xfe);
1481 em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xde);
1483 em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xfe);
1486 case EM2820_BOARD_GADMEI_UTV310:
1487 case EM2820_BOARD_MSI_VOX_USB_2:
1488 /* enables audio for that devices */
1489 em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xfd);
1493 em28xx_gpio_set(dev, dev->board.tuner_gpio);
1494 em28xx_set_mode(dev, EM28XX_ANALOG_MODE);
1497 em28xx_set_mode(dev, EM28XX_SUSPEND);
1500 static void em28xx_setup_xc3028(struct em28xx *dev, struct xc2028_ctrl *ctl)
1502 memset(ctl, 0, sizeof(*ctl));
1504 ctl->fname = XC2028_DEFAULT_FIRMWARE;
1506 ctl->mts = em28xx_boards[dev->model].mts_firmware;
1508 switch (dev->model) {
1509 case EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900:
1510 ctl->demod = XC3028_FE_ZARLINK456;
1512 case EM2880_BOARD_TERRATEC_HYBRID_XS:
1513 ctl->demod = XC3028_FE_ZARLINK456;
1515 case EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900_R2:
1516 /* djh - Not sure which demod we need here */
1517 ctl->demod = XC3028_FE_DEFAULT;
1519 case EM2880_BOARD_AMD_ATI_TV_WONDER_HD_600:
1520 ctl->demod = XC3028_FE_DEFAULT;
1521 ctl->fname = XC3028L_DEFAULT_FIRMWARE;
1523 case EM2883_BOARD_HAUPPAUGE_WINTV_HVR_850:
1524 case EM2883_BOARD_HAUPPAUGE_WINTV_HVR_950:
1525 case EM2880_BOARD_PINNACLE_PCTV_HD_PRO:
1526 /* FIXME: Better to specify the needed IF */
1527 ctl->demod = XC3028_FE_DEFAULT;
1530 ctl->demod = XC3028_FE_OREN538;
1534 static void em28xx_config_tuner(struct em28xx *dev)
1536 struct v4l2_priv_tun_config xc2028_cfg;
1537 struct tuner_setup tun_setup;
1538 struct v4l2_frequency f;
1540 if (dev->tuner_type == TUNER_ABSENT)
1543 tun_setup.mode_mask = T_ANALOG_TV | T_RADIO;
1544 tun_setup.type = dev->tuner_type;
1545 tun_setup.addr = dev->tuner_addr;
1546 tun_setup.tuner_callback = em28xx_tuner_callback;
1548 em28xx_i2c_call_clients(dev, TUNER_SET_TYPE_ADDR, &tun_setup);
1550 if (dev->tuner_type == TUNER_XC2028) {
1551 struct xc2028_ctrl ctl;
1553 em28xx_setup_xc3028(dev, &ctl);
1555 xc2028_cfg.tuner = TUNER_XC2028;
1556 xc2028_cfg.priv = &ctl;
1558 em28xx_i2c_call_clients(dev, TUNER_SET_CONFIG, &xc2028_cfg);
1561 /* configure tuner */
1563 f.type = V4L2_TUNER_ANALOG_TV;
1564 f.frequency = 9076; /* just a magic number */
1565 dev->ctl_freq = f.frequency;
1566 em28xx_i2c_call_clients(dev, VIDIOC_S_FREQUENCY, &f);
1569 static int em28xx_hint_board(struct em28xx *dev)
1573 /* HINT method: EEPROM
1575 * This method works only for boards with eeprom.
1576 * Uses a hash of all eeprom bytes. The hash should be
1577 * unique for a vendor/tuner pair.
1578 * There are a high chance that tuners for different
1579 * video standards produce different hashes.
1581 for (i = 0; i < ARRAY_SIZE(em28xx_eeprom_hash); i++) {
1582 if (dev->hash == em28xx_eeprom_hash[i].hash) {
1583 dev->model = em28xx_eeprom_hash[i].model;
1584 dev->tuner_type = em28xx_eeprom_hash[i].tuner;
1586 em28xx_errdev("Your board has no unique USB ID.\n");
1587 em28xx_errdev("A hint were successfully done, "
1588 "based on eeprom hash.\n");
1589 em28xx_errdev("This method is not 100%% failproof.\n");
1590 em28xx_errdev("If the board were missdetected, "
1591 "please email this log to:\n");
1592 em28xx_errdev("\tV4L Mailing List "
1593 " <video4linux-list@redhat.com>\n");
1594 em28xx_errdev("Board detected as %s\n",
1595 em28xx_boards[dev->model].name);
1601 /* HINT method: I2C attached devices
1603 * This method works for all boards.
1604 * Uses a hash of i2c scanned devices.
1605 * Devices with the same i2c attached chips will
1606 * be considered equal.
1607 * This method is less precise than the eeprom one.
1610 /* user did not request i2c scanning => do it now */
1612 em28xx_do_i2c_scan(dev);
1614 for (i = 0; i < ARRAY_SIZE(em28xx_i2c_hash); i++) {
1615 if (dev->i2c_hash == em28xx_i2c_hash[i].hash) {
1616 dev->model = em28xx_i2c_hash[i].model;
1617 dev->tuner_type = em28xx_i2c_hash[i].tuner;
1618 em28xx_errdev("Your board has no unique USB ID.\n");
1619 em28xx_errdev("A hint were successfully done, "
1620 "based on i2c devicelist hash.\n");
1621 em28xx_errdev("This method is not 100%% failproof.\n");
1622 em28xx_errdev("If the board were missdetected, "
1623 "please email this log to:\n");
1624 em28xx_errdev("\tV4L Mailing List "
1625 " <video4linux-list@redhat.com>\n");
1626 em28xx_errdev("Board detected as %s\n",
1627 em28xx_boards[dev->model].name);
1633 em28xx_errdev("Your board has no unique USB ID and thus need a "
1634 "hint to be detected.\n");
1635 em28xx_errdev("You may try to use card=<n> insmod option to "
1636 "workaround that.\n");
1637 em28xx_errdev("Please send an email with this log to:\n");
1638 em28xx_errdev("\tV4L Mailing List <video4linux-list@redhat.com>\n");
1639 em28xx_errdev("Board eeprom hash is 0x%08lx\n", dev->hash);
1640 em28xx_errdev("Board i2c devicelist hash is 0x%08lx\n", dev->i2c_hash);
1642 em28xx_errdev("Here is a list of valid choices for the card=<n>"
1643 " insmod option:\n");
1644 for (i = 0; i < em28xx_bcount; i++) {
1645 em28xx_errdev(" card=%d -> %s\n",
1646 i, em28xx_boards[i].name);
1651 /* ----------------------------------------------------------------------- */
1652 void em28xx_set_ir(struct em28xx *dev, struct IR_i2c *ir)
1659 /* detect & configure */
1660 switch (dev->model) {
1661 case (EM2800_BOARD_UNKNOWN):
1663 case (EM2820_BOARD_UNKNOWN):
1665 case (EM2800_BOARD_TERRATEC_CINERGY_200):
1666 case (EM2820_BOARD_TERRATEC_CINERGY_250):
1667 ir->ir_codes = ir_codes_em_terratec;
1668 ir->get_key = em28xx_get_key_terratec;
1669 snprintf(ir->c.name, sizeof(ir->c.name),
1670 "i2c IR (EM28XX Terratec)");
1672 case (EM2820_BOARD_PINNACLE_USB_2):
1673 ir->ir_codes = ir_codes_pinnacle_grey;
1674 ir->get_key = em28xx_get_key_pinnacle_usb_grey;
1675 snprintf(ir->c.name, sizeof(ir->c.name),
1676 "i2c IR (EM28XX Pinnacle PCTV)");
1678 case (EM2820_BOARD_HAUPPAUGE_WINTV_USB_2):
1679 ir->ir_codes = ir_codes_hauppauge_new;
1680 ir->get_key = em28xx_get_key_em_haup;
1681 snprintf(ir->c.name, sizeof(ir->c.name),
1682 "i2c IR (EM2840 Hauppauge)");
1684 case (EM2820_BOARD_MSI_VOX_USB_2):
1686 case (EM2800_BOARD_LEADTEK_WINFAST_USBII):
1688 case (EM2800_BOARD_KWORLD_USB2800):
1690 case (EM2800_BOARD_GRABBEEX_USB2800):
1695 void em28xx_card_setup(struct em28xx *dev)
1697 em28xx_set_model(dev);
1699 dev->tuner_type = em28xx_boards[dev->model].tuner_type;
1700 if (em28xx_boards[dev->model].tuner_addr)
1701 dev->tuner_addr = em28xx_boards[dev->model].tuner_addr;
1703 /* request some modules */
1704 switch (dev->model) {
1705 case EM2820_BOARD_HAUPPAUGE_WINTV_USB_2:
1706 case EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900:
1707 case EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900_R2:
1708 case EM2883_BOARD_HAUPPAUGE_WINTV_HVR_850:
1709 case EM2883_BOARD_HAUPPAUGE_WINTV_HVR_950:
1712 #ifdef CONFIG_MODULES
1713 request_module("tveeprom");
1715 /* Call first TVeeprom */
1717 dev->i2c_client.addr = 0xa0 >> 1;
1718 tveeprom_hauppauge_analog(&dev->i2c_client, &tv, dev->eedata);
1720 dev->tuner_type = tv.tuner_type;
1722 if (tv.audio_processor == V4L2_IDENT_MSPX4XX) {
1723 dev->i2s_speed = 2048000;
1724 dev->board.has_msp34xx = 1;
1726 #ifdef CONFIG_MODULES
1728 request_module("ir-kbd-i2c");
1732 case EM2820_BOARD_KWORLD_PVRTV2800RF:
1733 /* GPIO enables sound on KWORLD PVR TV 2800RF */
1734 em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xf9);
1736 case EM2820_BOARD_UNKNOWN:
1737 case EM2800_BOARD_UNKNOWN:
1739 * The K-WORLD DVB-T 310U is detected as an MSI Digivox AD.
1741 * This occurs because they share identical USB vendor and
1744 * What we do here is look up the EEPROM hash of the K-WORLD
1745 * and if it is found then we decide that we do not have
1746 * a DIGIVOX and reset the device to the K-WORLD instead.
1748 * This solution is only valid if they do not share eeprom
1749 * hash identities which has not been determined as yet.
1751 case EM2880_BOARD_MSI_DIGIVOX_AD:
1752 if (!em28xx_hint_board(dev))
1753 em28xx_set_model(dev);
1757 if (dev->board.has_snapshot_button)
1758 em28xx_register_snapshot_button(dev);
1760 if (dev->board.valid == EM28XX_BOARD_NOT_VALIDATED) {
1761 em28xx_errdev("\n\n");
1762 em28xx_errdev("The support for this board weren't "
1764 em28xx_errdev("Please send a report of having this working\n");
1765 em28xx_errdev("not to V4L mailing list (and/or to other "
1769 /* Allow override tuner type by a module parameter */
1771 dev->tuner_type = tuner;
1773 #ifdef CONFIG_MODULES
1774 /* request some modules */
1775 if (dev->board.has_msp34xx)
1776 request_module("msp3400");
1777 if (dev->board.decoder == EM28XX_SAA711X)
1778 request_module("saa7115");
1779 if (dev->board.decoder == EM28XX_TVP5150)
1780 request_module("tvp5150");
1781 if (dev->board.tuner_type != TUNER_ABSENT)
1782 request_module("tuner");
1785 em28xx_config_tuner(dev);
1787 em28xx_ir_init(dev);
1791 #if defined(CONFIG_MODULES) && defined(MODULE)
1792 static void request_module_async(struct work_struct *work)
1794 struct em28xx *dev = container_of(work,
1795 struct em28xx, request_module_wk);
1797 if (dev->has_audio_class)
1798 request_module("snd-usb-audio");
1799 else if (dev->has_alsa_audio)
1800 request_module("em28xx-alsa");
1802 if (dev->board.has_dvb)
1803 request_module("em28xx-dvb");
1806 static void request_modules(struct em28xx *dev)
1808 INIT_WORK(&dev->request_module_wk, request_module_async);
1809 schedule_work(&dev->request_module_wk);
1812 #define request_modules(dev)
1813 #endif /* CONFIG_MODULES */
1816 * em28xx_realease_resources()
1817 * unregisters the v4l2,i2c and usb devices
1818 * called when the device gets disconected or at module unload
1820 void em28xx_release_resources(struct em28xx *dev)
1822 if (dev->sbutton_input_dev)
1823 em28xx_deregister_snapshot_button(dev);
1826 em28xx_ir_fini(dev);
1828 /*FIXME: I2C IR should be disconnected */
1830 em28xx_release_analog_resources(dev);
1832 em28xx_remove_from_devlist(dev);
1834 em28xx_i2c_unregister(dev);
1835 usb_put_dev(dev->udev);
1837 /* Mark device as unused */
1838 em28xx_devused &= ~(1 << dev->devno);
1843 * allocates and inits the device structs, registers i2c bus and v4l device
1845 static int em28xx_init_dev(struct em28xx **devhandle, struct usb_device *udev,
1848 struct em28xx *dev = *devhandle;
1849 int retval = -ENOMEM;
1853 mutex_init(&dev->ctrl_urb_lock);
1854 spin_lock_init(&dev->slock);
1855 init_waitqueue_head(&dev->open);
1856 init_waitqueue_head(&dev->wait_frame);
1857 init_waitqueue_head(&dev->wait_stream);
1859 dev->em28xx_write_regs = em28xx_write_regs;
1860 dev->em28xx_read_reg = em28xx_read_reg;
1861 dev->em28xx_read_reg_req_len = em28xx_read_reg_req_len;
1862 dev->em28xx_write_regs_req = em28xx_write_regs_req;
1863 dev->em28xx_read_reg_req = em28xx_read_reg_req;
1864 dev->board.is_em2800 = em28xx_boards[dev->model].is_em2800;
1866 em28xx_pre_card_setup(dev);
1868 if (!dev->board.is_em2800) {
1869 /* Sets I2C speed to 100 KHz */
1870 retval = em28xx_write_reg(dev, EM28XX_R06_I2C_CLK, 0x40);
1872 em28xx_errdev("%s: em28xx_write_regs_req failed!"
1879 /* register i2c bus */
1880 errCode = em28xx_i2c_register(dev);
1882 em28xx_errdev("%s: em28xx_i2c_register - errCode [%d]!\n",
1887 /* Do board specific init and eeprom reading */
1888 em28xx_card_setup(dev);
1890 /* Configure audio */
1891 errCode = em28xx_audio_setup(dev);
1893 em28xx_errdev("%s: Error while setting audio - errCode [%d]!\n",
1897 /* wake i2c devices */
1898 em28xx_wake_i2c(dev);
1900 /* init video dma queues */
1901 INIT_LIST_HEAD(&dev->vidq.active);
1902 INIT_LIST_HEAD(&dev->vidq.queued);
1905 if (dev->board.has_msp34xx) {
1906 /* Send a reset to other chips via gpio */
1907 errCode = em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xf7);
1909 em28xx_errdev("%s: em28xx_write_regs_req - "
1910 "msp34xx(1) failed! errCode [%d]\n",
1916 errCode = em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xff);
1918 em28xx_errdev("%s: em28xx_write_regs_req - "
1919 "msp34xx(2) failed! errCode [%d]\n",
1926 em28xx_add_into_devlist(dev);
1928 retval = em28xx_register_analog_devices(dev);
1930 em28xx_release_resources(dev);
1931 goto fail_reg_devices;
1934 em28xx_init_extension(dev);
1936 /* Save some power by putting tuner to sleep */
1937 em28xx_i2c_call_clients(dev, TUNER_SET_STANDBY, NULL);
1946 * em28xx_usb_probe()
1947 * checks for supported devices
1949 static int em28xx_usb_probe(struct usb_interface *interface,
1950 const struct usb_device_id *id)
1952 const struct usb_endpoint_descriptor *endpoint;
1953 struct usb_device *udev;
1954 struct usb_interface *uif;
1955 struct em28xx *dev = NULL;
1956 int retval = -ENODEV;
1957 int i, nr, ifnum, isoc_pipe;
1959 char descr[255] = "";
1961 udev = usb_get_dev(interface_to_usbdev(interface));
1962 ifnum = interface->altsetting[0].desc.bInterfaceNumber;
1964 /* Check to see next free device and mark as used */
1965 nr = find_first_zero_bit(&em28xx_devused, EM28XX_MAXBOARDS);
1966 em28xx_devused |= 1<<nr;
1968 /* Don't register audio interfaces */
1969 if (interface->altsetting[0].desc.bInterfaceClass == USB_CLASS_AUDIO) {
1970 em28xx_err(DRIVER_NAME " audio device (%04x:%04x): "
1971 "interface %i, class %i\n",
1972 le16_to_cpu(udev->descriptor.idVendor),
1973 le16_to_cpu(udev->descriptor.idProduct),
1975 interface->altsetting[0].desc.bInterfaceClass);
1977 em28xx_devused &= ~(1<<nr);
1981 endpoint = &interface->cur_altsetting->endpoint[0].desc;
1983 /* check if the device has the iso in endpoint at the correct place */
1984 if (usb_endpoint_xfer_isoc(endpoint)
1986 (interface->altsetting[1].endpoint[0].desc.wMaxPacketSize == 940)) {
1987 /* It's a newer em2874/em2875 device */
1990 int check_interface = 1;
1992 endpoint = &interface->cur_altsetting->endpoint[1].desc;
1993 if (!usb_endpoint_xfer_isoc(endpoint))
1994 check_interface = 0;
1996 if (usb_endpoint_dir_out(endpoint))
1997 check_interface = 0;
1999 if (!check_interface) {
2000 em28xx_err(DRIVER_NAME " video device (%04x:%04x): "
2001 "interface %i, class %i found.\n",
2002 le16_to_cpu(udev->descriptor.idVendor),
2003 le16_to_cpu(udev->descriptor.idProduct),
2005 interface->altsetting[0].desc.bInterfaceClass);
2007 em28xx_err(DRIVER_NAME " This is an anciliary "
2008 "interface not used by the driver\n");
2010 em28xx_devused &= ~(1<<nr);
2015 switch (udev->speed) {
2019 case USB_SPEED_UNKNOWN:
2020 case USB_SPEED_FULL:
2023 case USB_SPEED_HIGH:
2030 if (udev->manufacturer)
2031 strlcpy(descr, udev->manufacturer, sizeof(descr));
2033 if (udev->product) {
2035 strlcat(descr, " ", sizeof(descr));
2036 strlcat(descr, udev->product, sizeof(descr));
2039 strlcat(descr, " ", sizeof(descr));
2041 printk(DRIVER_NAME ": New device %s@ %s Mbps "
2042 "(%04x:%04x, interface %d, class %d)\n",
2045 le16_to_cpu(udev->descriptor.idVendor),
2046 le16_to_cpu(udev->descriptor.idProduct),
2048 interface->altsetting->desc.bInterfaceNumber);
2050 if (nr >= EM28XX_MAXBOARDS) {
2051 printk(DRIVER_NAME ": Supports only %i em28xx boards.\n",
2053 em28xx_devused &= ~(1<<nr);
2057 /* allocate memory for our device state and initialize it */
2058 dev = kzalloc(sizeof(*dev), GFP_KERNEL);
2060 em28xx_err(DRIVER_NAME ": out of memory!\n");
2061 em28xx_devused &= ~(1<<nr);
2065 snprintf(dev->name, 29, "em28xx #%d", nr);
2067 dev->model = id->driver_info;
2070 /* Checks if audio is provided by some interface */
2071 for (i = 0; i < udev->config->desc.bNumInterfaces; i++) {
2072 uif = udev->config->interface[i];
2073 if (uif->altsetting[0].desc.bInterfaceClass == USB_CLASS_AUDIO) {
2074 dev->has_audio_class = 1;
2079 /* compute alternate max packet sizes */
2080 uif = udev->actconfig->interface[0];
2082 dev->num_alt = uif->num_altsetting;
2083 dev->alt_max_pkt_size = kmalloc(32 * dev->num_alt, GFP_KERNEL);
2085 if (dev->alt_max_pkt_size == NULL) {
2086 em28xx_errdev("out of memory!\n");
2087 em28xx_devused &= ~(1<<nr);
2092 for (i = 0; i < dev->num_alt ; i++) {
2093 u16 tmp = le16_to_cpu(uif->altsetting[i].endpoint[isoc_pipe].desc.wMaxPacketSize);
2094 dev->alt_max_pkt_size[i] =
2095 (tmp & 0x07ff) * (((tmp & 0x1800) >> 11) + 1);
2098 if ((card[nr] >= 0) && (card[nr] < em28xx_bcount))
2099 dev->model = card[nr];
2101 /* allocate device struct */
2102 mutex_init(&dev->lock);
2103 mutex_lock(&dev->lock);
2104 retval = em28xx_init_dev(&dev, udev, nr);
2106 em28xx_devused &= ~(1<<dev->devno);
2112 /* save our data pointer in this interface device */
2113 usb_set_intfdata(interface, dev);
2115 request_modules(dev);
2117 /* Should be the last thing to do, to avoid newer udev's to
2118 open the device before fully initializing it
2120 mutex_unlock(&dev->lock);
2126 * em28xx_usb_disconnect()
2127 * called when the device gets diconencted
2128 * video device will be unregistered on v4l2_close in case it is still open
2130 static void em28xx_usb_disconnect(struct usb_interface *interface)
2134 dev = usb_get_intfdata(interface);
2135 usb_set_intfdata(interface, NULL);
2140 em28xx_info("disconnecting %s\n", dev->vdev->name);
2142 /* wait until all current v4l2 io is finished then deallocate
2144 mutex_lock(&dev->lock);
2146 wake_up_interruptible_all(&dev->open);
2150 ("device /dev/video%d is open! Deregistration and memory "
2151 "deallocation are deferred on close.\n",
2154 dev->state |= DEV_MISCONFIGURED;
2155 em28xx_uninit_isoc(dev);
2156 dev->state |= DEV_DISCONNECTED;
2157 wake_up_interruptible(&dev->wait_frame);
2158 wake_up_interruptible(&dev->wait_stream);
2160 dev->state |= DEV_DISCONNECTED;
2161 em28xx_release_resources(dev);
2164 em28xx_close_extension(dev);
2166 mutex_unlock(&dev->lock);
2169 kfree(dev->alt_max_pkt_size);
2174 static struct usb_driver em28xx_usb_driver = {
2176 .probe = em28xx_usb_probe,
2177 .disconnect = em28xx_usb_disconnect,
2178 .id_table = em28xx_id_table,
2181 static int __init em28xx_module_init(void)
2185 /* register this driver with the USB subsystem */
2186 result = usb_register(&em28xx_usb_driver);
2188 em28xx_err(DRIVER_NAME
2189 " usb_register failed. Error number %d.\n", result);
2191 printk(KERN_INFO DRIVER_NAME " driver loaded\n");
2196 static void __exit em28xx_module_exit(void)
2198 /* deregister this driver with the USB subsystem */
2199 usb_deregister(&em28xx_usb_driver);
2202 module_init(em28xx_module_init);
2203 module_exit(em28xx_module_exit);