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 static struct em28xx_reg_seq kworld_330u_analog[] = {
106 {EM28XX_R08_GPIO, 0x6d, ~EM_GPIO_4, 10},
107 {EM2880_R04_GPO, 0x00, 0xff, 10},
111 static struct em28xx_reg_seq kworld_330u_digital[] = {
112 {EM28XX_R08_GPIO, 0x6e, ~EM_GPIO_4, 10},
113 {EM2880_R04_GPO, 0x08, 0xff, 10},
117 /* Callback for the most boards */
118 static struct em28xx_reg_seq default_tuner_gpio[] = {
119 {EM28XX_R08_GPIO, EM_GPIO_4, EM_GPIO_4, 10},
120 {EM28XX_R08_GPIO, 0, EM_GPIO_4, 10},
121 {EM28XX_R08_GPIO, EM_GPIO_4, EM_GPIO_4, 10},
128 struct em28xx_board em28xx_boards[] = {
129 [EM2750_BOARD_UNKNOWN] = {
130 .name = "Unknown EM2750/EM2751 webcam grabber",
131 .xclk = EM28XX_XCLK_FREQUENCY_48MHZ,
132 .tuner_type = TUNER_ABSENT, /* This is a webcam */
134 .type = EM28XX_VMUX_COMPOSITE1,
136 .amux = EM28XX_AMUX_VIDEO,
139 [EM2800_BOARD_UNKNOWN] = {
140 .name = "Unknown EM2800 video grabber",
142 .tda9887_conf = TDA9887_PRESENT,
143 .decoder = EM28XX_SAA711X,
144 .tuner_type = TUNER_ABSENT,
146 .type = EM28XX_VMUX_COMPOSITE1,
147 .vmux = SAA7115_COMPOSITE0,
148 .amux = EM28XX_AMUX_LINE_IN,
150 .type = EM28XX_VMUX_SVIDEO,
151 .vmux = SAA7115_SVIDEO3,
152 .amux = EM28XX_AMUX_LINE_IN,
155 [EM2820_BOARD_UNKNOWN] = {
156 .name = "Unknown EM2750/28xx video grabber",
157 .tuner_type = TUNER_ABSENT,
159 [EM2750_BOARD_DLCW_130] = {
160 /* Beijing Huaqi Information Digital Technology Co., Ltd */
161 .name = "Huaqi DLCW-130",
162 .valid = EM28XX_BOARD_NOT_VALIDATED,
163 .xclk = EM28XX_XCLK_FREQUENCY_48MHZ,
164 .tuner_type = TUNER_ABSENT, /* This is a webcam */
166 .type = EM28XX_VMUX_COMPOSITE1,
168 .amux = EM28XX_AMUX_VIDEO,
171 [EM2820_BOARD_KWORLD_PVRTV2800RF] = {
172 .name = "Kworld PVR TV 2800 RF",
173 .tuner_type = TUNER_TEMIC_PAL,
174 .tda9887_conf = TDA9887_PRESENT,
175 .decoder = EM28XX_SAA711X,
177 .type = EM28XX_VMUX_COMPOSITE1,
178 .vmux = SAA7115_COMPOSITE0,
179 .amux = EM28XX_AMUX_LINE_IN,
181 .type = EM28XX_VMUX_SVIDEO,
182 .vmux = SAA7115_SVIDEO3,
183 .amux = EM28XX_AMUX_LINE_IN,
186 [EM2820_BOARD_GADMEI_TVR200] = {
187 .name = "Gadmei TVR200",
188 .tuner_type = TUNER_LG_PAL_NEW_TAPC,
189 .tda9887_conf = TDA9887_PRESENT,
190 .decoder = EM28XX_SAA711X,
192 .type = EM28XX_VMUX_TELEVISION,
193 .vmux = SAA7115_COMPOSITE2,
194 .amux = EM28XX_AMUX_LINE_IN,
196 .type = EM28XX_VMUX_COMPOSITE1,
197 .vmux = SAA7115_COMPOSITE0,
198 .amux = EM28XX_AMUX_LINE_IN,
200 .type = EM28XX_VMUX_SVIDEO,
201 .vmux = SAA7115_SVIDEO3,
202 .amux = EM28XX_AMUX_LINE_IN,
205 [EM2820_BOARD_TERRATEC_CINERGY_250] = {
206 .name = "Terratec Cinergy 250 USB",
207 .tuner_type = TUNER_LG_PAL_NEW_TAPC,
208 .tda9887_conf = TDA9887_PRESENT,
209 .decoder = EM28XX_SAA711X,
211 .type = EM28XX_VMUX_TELEVISION,
212 .vmux = SAA7115_COMPOSITE2,
213 .amux = EM28XX_AMUX_LINE_IN,
215 .type = EM28XX_VMUX_COMPOSITE1,
216 .vmux = SAA7115_COMPOSITE0,
217 .amux = EM28XX_AMUX_LINE_IN,
219 .type = EM28XX_VMUX_SVIDEO,
220 .vmux = SAA7115_SVIDEO3,
221 .amux = EM28XX_AMUX_LINE_IN,
224 [EM2820_BOARD_PINNACLE_USB_2] = {
225 .name = "Pinnacle PCTV USB 2",
226 .tuner_type = TUNER_LG_PAL_NEW_TAPC,
227 .tda9887_conf = TDA9887_PRESENT,
228 .decoder = EM28XX_SAA711X,
230 .type = EM28XX_VMUX_TELEVISION,
231 .vmux = SAA7115_COMPOSITE2,
232 .amux = EM28XX_AMUX_VIDEO,
234 .type = EM28XX_VMUX_COMPOSITE1,
235 .vmux = SAA7115_COMPOSITE0,
236 .amux = EM28XX_AMUX_LINE_IN,
238 .type = EM28XX_VMUX_SVIDEO,
239 .vmux = SAA7115_SVIDEO3,
240 .amux = EM28XX_AMUX_LINE_IN,
243 [EM2820_BOARD_HAUPPAUGE_WINTV_USB_2] = {
244 .name = "Hauppauge WinTV USB 2",
245 .tuner_type = TUNER_PHILIPS_FM1236_MK3,
246 .tda9887_conf = TDA9887_PRESENT |
247 TDA9887_PORT1_ACTIVE |
248 TDA9887_PORT2_ACTIVE,
249 .decoder = EM28XX_TVP5150,
252 .type = EM28XX_VMUX_TELEVISION,
253 .vmux = TVP5150_COMPOSITE0,
254 .amux = MSP_INPUT_DEFAULT,
256 .type = EM28XX_VMUX_SVIDEO,
257 .vmux = TVP5150_SVIDEO,
258 .amux = MSP_INPUT(MSP_IN_SCART1, MSP_IN_TUNER1,
259 MSP_DSP_IN_SCART, MSP_DSP_IN_SCART),
262 [EM2820_BOARD_DLINK_USB_TV] = {
263 .name = "D-Link DUB-T210 TV Tuner",
264 .valid = EM28XX_BOARD_NOT_VALIDATED,
265 .tuner_type = TUNER_LG_PAL_NEW_TAPC,
266 .tda9887_conf = TDA9887_PRESENT,
267 .decoder = EM28XX_SAA711X,
269 .type = EM28XX_VMUX_TELEVISION,
270 .vmux = SAA7115_COMPOSITE2,
271 .amux = EM28XX_AMUX_LINE_IN,
273 .type = EM28XX_VMUX_COMPOSITE1,
274 .vmux = SAA7115_COMPOSITE0,
275 .amux = EM28XX_AMUX_LINE_IN,
277 .type = EM28XX_VMUX_SVIDEO,
278 .vmux = SAA7115_SVIDEO3,
279 .amux = EM28XX_AMUX_LINE_IN,
282 [EM2820_BOARD_HERCULES_SMART_TV_USB2] = {
283 .name = "Hercules Smart TV USB 2.0",
284 .valid = EM28XX_BOARD_NOT_VALIDATED,
285 .tuner_type = TUNER_LG_PAL_NEW_TAPC,
286 .tda9887_conf = TDA9887_PRESENT,
287 .decoder = EM28XX_SAA711X,
289 .type = EM28XX_VMUX_TELEVISION,
290 .vmux = SAA7115_COMPOSITE2,
291 .amux = EM28XX_AMUX_LINE_IN,
293 .type = EM28XX_VMUX_COMPOSITE1,
294 .vmux = SAA7115_COMPOSITE0,
295 .amux = EM28XX_AMUX_LINE_IN,
297 .type = EM28XX_VMUX_SVIDEO,
298 .vmux = SAA7115_SVIDEO3,
299 .amux = EM28XX_AMUX_LINE_IN,
302 [EM2820_BOARD_PINNACLE_USB_2_FM1216ME] = {
303 .name = "Pinnacle PCTV USB 2 (Philips FM1216ME)",
304 .valid = EM28XX_BOARD_NOT_VALIDATED,
305 .tuner_type = TUNER_PHILIPS_FM1216ME_MK3,
306 .tda9887_conf = TDA9887_PRESENT,
307 .decoder = EM28XX_SAA711X,
309 .type = EM28XX_VMUX_TELEVISION,
310 .vmux = SAA7115_COMPOSITE2,
311 .amux = EM28XX_AMUX_VIDEO,
313 .type = EM28XX_VMUX_COMPOSITE1,
314 .vmux = SAA7115_COMPOSITE0,
315 .amux = EM28XX_AMUX_LINE_IN,
317 .type = EM28XX_VMUX_SVIDEO,
318 .vmux = SAA7115_SVIDEO3,
319 .amux = EM28XX_AMUX_LINE_IN,
322 [EM2820_BOARD_GADMEI_UTV310] = {
323 .name = "Gadmei UTV310",
324 .valid = EM28XX_BOARD_NOT_VALIDATED,
325 .tuner_type = TUNER_TNF_5335MF,
326 .tda9887_conf = TDA9887_PRESENT,
327 .decoder = EM28XX_SAA711X,
329 .type = EM28XX_VMUX_TELEVISION,
330 .vmux = SAA7115_COMPOSITE1,
331 .amux = EM28XX_AMUX_LINE_IN,
333 .type = EM28XX_VMUX_COMPOSITE1,
334 .vmux = SAA7115_COMPOSITE0,
335 .amux = EM28XX_AMUX_LINE_IN,
337 .type = EM28XX_VMUX_SVIDEO,
338 .vmux = SAA7115_SVIDEO3,
339 .amux = EM28XX_AMUX_LINE_IN,
342 [EM2820_BOARD_LEADTEK_WINFAST_USBII_DELUXE] = {
343 .name = "Leadtek Winfast USB II Deluxe",
344 .valid = EM28XX_BOARD_NOT_VALIDATED,
345 .tuner_type = TUNER_PHILIPS_FM1216ME_MK3,
346 .tda9887_conf = TDA9887_PRESENT,
347 .decoder = EM28XX_SAA711X,
349 .type = EM28XX_VMUX_TELEVISION,
350 .vmux = SAA7115_COMPOSITE2,
351 .amux = EM28XX_AMUX_VIDEO,
353 .type = EM28XX_VMUX_COMPOSITE1,
354 .vmux = SAA7115_COMPOSITE0,
355 .amux = EM28XX_AMUX_LINE_IN,
357 .type = EM28XX_VMUX_SVIDEO,
358 .vmux = SAA7115_COMPOSITE0,
359 .amux = EM28XX_AMUX_LINE_IN,
362 [EM2820_BOARD_VIDEOLOGY_20K14XUSB] = {
363 .name = "Videology 20K14XUSB USB2.0",
364 .valid = EM28XX_BOARD_NOT_VALIDATED,
365 .tuner_type = TUNER_ABSENT, /* This is a webcam */
367 .type = EM28XX_VMUX_COMPOSITE1,
369 .amux = EM28XX_AMUX_VIDEO,
372 [EM2821_BOARD_PROLINK_PLAYTV_USB2] = {
373 .name = "SIIG AVTuner-PVR/Prolink PlayTV USB 2.0",
374 .valid = EM28XX_BOARD_NOT_VALIDATED,
375 .tuner_type = TUNER_LG_PAL_NEW_TAPC, /* unknown? */
376 .tda9887_conf = TDA9887_PRESENT, /* unknown? */
377 .decoder = EM28XX_SAA711X,
379 .type = EM28XX_VMUX_TELEVISION,
380 .vmux = SAA7115_COMPOSITE2,
381 .amux = EM28XX_AMUX_LINE_IN,
383 .type = EM28XX_VMUX_COMPOSITE1,
384 .vmux = SAA7115_COMPOSITE0,
385 .amux = EM28XX_AMUX_LINE_IN,
387 .type = EM28XX_VMUX_SVIDEO,
388 .vmux = SAA7115_SVIDEO3,
389 .amux = EM28XX_AMUX_LINE_IN,
392 [EM2821_BOARD_SUPERCOMP_USB_2] = {
393 .name = "Supercomp USB 2.0 TV",
394 .valid = EM28XX_BOARD_NOT_VALIDATED,
395 .tuner_type = TUNER_PHILIPS_FM1236_MK3,
396 .tda9887_conf = TDA9887_PRESENT |
397 TDA9887_PORT1_ACTIVE |
398 TDA9887_PORT2_ACTIVE,
399 .decoder = EM28XX_SAA711X,
401 .type = EM28XX_VMUX_TELEVISION,
402 .vmux = SAA7115_COMPOSITE2,
403 .amux = EM28XX_AMUX_LINE_IN,
405 .type = EM28XX_VMUX_COMPOSITE1,
406 .vmux = SAA7115_COMPOSITE0,
407 .amux = EM28XX_AMUX_VIDEO,
409 .type = EM28XX_VMUX_SVIDEO,
410 .vmux = SAA7115_SVIDEO3,
411 .amux = EM28XX_AMUX_LINE_IN,
414 [EM2821_BOARD_USBGEAR_VD204] = {
415 .name = "Usbgear VD204v9",
416 .valid = EM28XX_BOARD_NOT_VALIDATED,
417 .tuner_type = TUNER_ABSENT, /* Capture only device */
418 .decoder = EM28XX_SAA711X,
420 .type = EM28XX_VMUX_COMPOSITE1,
421 .vmux = SAA7115_COMPOSITE0,
422 .amux = EM28XX_AMUX_LINE_IN,
424 .type = EM28XX_VMUX_SVIDEO,
425 .vmux = SAA7115_SVIDEO3,
426 .amux = EM28XX_AMUX_LINE_IN,
429 [EM2860_BOARD_NETGMBH_CAM] = {
430 /* Beijing Huaqi Information Digital Technology Co., Ltd */
431 .name = "NetGMBH Cam",
432 .valid = EM28XX_BOARD_NOT_VALIDATED,
433 .tuner_type = TUNER_ABSENT, /* This is a webcam */
435 .type = EM28XX_VMUX_COMPOSITE1,
437 .amux = EM28XX_AMUX_VIDEO,
440 [EM2860_BOARD_TYPHOON_DVD_MAKER] = {
441 .name = "Typhoon DVD Maker",
442 .decoder = EM28XX_SAA711X,
443 .tuner_type = TUNER_ABSENT, /* Capture only device */
445 .type = EM28XX_VMUX_COMPOSITE1,
446 .vmux = SAA7115_COMPOSITE0,
447 .amux = EM28XX_AMUX_LINE_IN,
449 .type = EM28XX_VMUX_SVIDEO,
450 .vmux = SAA7115_SVIDEO3,
451 .amux = EM28XX_AMUX_LINE_IN,
454 [EM2860_BOARD_GADMEI_UTV330] = {
455 .name = "Gadmei UTV330",
456 .valid = EM28XX_BOARD_NOT_VALIDATED,
457 .tuner_type = TUNER_TNF_5335MF,
458 .tda9887_conf = TDA9887_PRESENT,
459 .decoder = EM28XX_SAA711X,
461 .type = EM28XX_VMUX_TELEVISION,
462 .vmux = SAA7115_COMPOSITE2,
463 .amux = EM28XX_AMUX_VIDEO,
465 .type = EM28XX_VMUX_COMPOSITE1,
466 .vmux = SAA7115_COMPOSITE0,
467 .amux = EM28XX_AMUX_LINE_IN,
469 .type = EM28XX_VMUX_SVIDEO,
470 .vmux = SAA7115_SVIDEO3,
471 .amux = EM28XX_AMUX_LINE_IN,
474 [EM2860_BOARD_TERRATEC_HYBRID_XS] = {
475 .name = "Terratec Cinergy A Hybrid XS",
476 .valid = EM28XX_BOARD_NOT_VALIDATED,
477 .tuner_type = TUNER_XC2028,
478 .tuner_gpio = default_tuner_gpio,
479 .decoder = EM28XX_TVP5150,
482 .type = EM28XX_VMUX_TELEVISION,
483 .vmux = TVP5150_COMPOSITE0,
484 .amux = EM28XX_AMUX_VIDEO,
485 .gpio = hauppauge_wintv_hvr_900_analog,
487 .type = EM28XX_VMUX_COMPOSITE1,
488 .vmux = TVP5150_COMPOSITE1,
489 .amux = EM28XX_AMUX_LINE_IN,
490 .gpio = hauppauge_wintv_hvr_900_analog,
492 .type = EM28XX_VMUX_SVIDEO,
493 .vmux = TVP5150_SVIDEO,
494 .amux = EM28XX_AMUX_LINE_IN,
495 .gpio = hauppauge_wintv_hvr_900_analog,
498 [EM2861_BOARD_KWORLD_PVRTV_300U] = {
499 .name = "KWorld PVRTV 300U",
500 .valid = EM28XX_BOARD_NOT_VALIDATED,
501 .tuner_type = TUNER_XC2028,
502 .tuner_gpio = default_tuner_gpio,
503 .decoder = EM28XX_TVP5150,
505 .type = EM28XX_VMUX_TELEVISION,
506 .vmux = TVP5150_COMPOSITE0,
507 .amux = EM28XX_AMUX_VIDEO,
509 .type = EM28XX_VMUX_COMPOSITE1,
510 .vmux = TVP5150_COMPOSITE1,
511 .amux = EM28XX_AMUX_LINE_IN,
513 .type = EM28XX_VMUX_SVIDEO,
514 .vmux = TVP5150_SVIDEO,
515 .amux = EM28XX_AMUX_LINE_IN,
518 [EM2861_BOARD_YAKUMO_MOVIE_MIXER] = {
519 .name = "Yakumo MovieMixer",
520 .tuner_type = TUNER_ABSENT, /* Capture only device */
521 .decoder = EM28XX_TVP5150,
523 .type = EM28XX_VMUX_TELEVISION,
524 .vmux = TVP5150_COMPOSITE0,
525 .amux = EM28XX_AMUX_VIDEO,
527 .type = EM28XX_VMUX_COMPOSITE1,
528 .vmux = TVP5150_COMPOSITE1,
529 .amux = EM28XX_AMUX_LINE_IN,
531 .type = EM28XX_VMUX_SVIDEO,
532 .vmux = TVP5150_SVIDEO,
533 .amux = EM28XX_AMUX_LINE_IN,
536 [EM2861_BOARD_PLEXTOR_PX_TV100U] = {
537 .name = "Plextor ConvertX PX-TV100U",
538 .valid = EM28XX_BOARD_NOT_VALIDATED,
539 .tuner_type = TUNER_TNF_5335MF,
540 .tda9887_conf = TDA9887_PRESENT,
541 .decoder = EM28XX_TVP5150,
543 .type = EM28XX_VMUX_TELEVISION,
544 .vmux = TVP5150_COMPOSITE0,
545 .amux = EM28XX_AMUX_LINE_IN,
547 .type = EM28XX_VMUX_COMPOSITE1,
548 .vmux = TVP5150_COMPOSITE1,
549 .amux = EM28XX_AMUX_LINE_IN,
551 .type = EM28XX_VMUX_SVIDEO,
552 .vmux = TVP5150_SVIDEO,
553 .amux = EM28XX_AMUX_LINE_IN,
557 /* Those boards with em2870 are DVB Only*/
559 [EM2870_BOARD_TERRATEC_XS] = {
560 .name = "Terratec Cinergy T XS",
561 .valid = EM28XX_BOARD_NOT_VALIDATED,
562 .tuner_type = TUNER_XC2028,
563 .tuner_gpio = default_tuner_gpio,
565 [EM2870_BOARD_TERRATEC_XS_MT2060] = {
566 .name = "Terratec Cinergy T XS (MT2060)",
567 .valid = EM28XX_BOARD_NOT_VALIDATED,
568 .tuner_type = TUNER_ABSENT, /* MT2060 */
570 [EM2870_BOARD_KWORLD_350U] = {
571 .name = "Kworld 350 U DVB-T",
572 .valid = EM28XX_BOARD_NOT_VALIDATED,
573 .tuner_type = TUNER_XC2028,
574 .tuner_gpio = default_tuner_gpio,
576 [EM2870_BOARD_KWORLD_355U] = {
577 .name = "Kworld 355 U DVB-T",
578 .valid = EM28XX_BOARD_NOT_VALIDATED,
580 [EM2870_BOARD_PINNACLE_PCTV_DVB] = {
581 .name = "Pinnacle PCTV DVB-T",
582 .valid = EM28XX_BOARD_NOT_VALIDATED,
583 .tuner_type = TUNER_ABSENT, /* MT2060 */
584 /* djh - I have serious doubts this is right... */
585 .xclk = EM28XX_XCLK_IR_RC5_MODE |
586 EM28XX_XCLK_FREQUENCY_10MHZ,
588 [EM2870_BOARD_COMPRO_VIDEOMATE] = {
589 .name = "Compro, VideoMate U3",
590 .valid = EM28XX_BOARD_NOT_VALIDATED,
591 .tuner_type = TUNER_ABSENT, /* MT2060 */
594 [EM2880_BOARD_TERRATEC_HYBRID_XS_FR] = {
595 .name = "Terratec Hybrid XS Secam",
596 .valid = EM28XX_BOARD_NOT_VALIDATED,
598 .tuner_type = TUNER_XC2028,
599 .tuner_gpio = default_tuner_gpio,
600 .decoder = EM28XX_TVP5150,
602 .type = EM28XX_VMUX_TELEVISION,
603 .vmux = TVP5150_COMPOSITE0,
604 .amux = EM28XX_AMUX_VIDEO,
605 .gpio = default_analog,
607 .type = EM28XX_VMUX_COMPOSITE1,
608 .vmux = TVP5150_COMPOSITE1,
609 .amux = EM28XX_AMUX_LINE_IN,
610 .gpio = default_analog,
612 .type = EM28XX_VMUX_SVIDEO,
613 .vmux = TVP5150_SVIDEO,
614 .amux = EM28XX_AMUX_LINE_IN,
615 .gpio = default_analog,
618 [EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900] = {
619 .name = "Hauppauge WinTV HVR 900",
620 .tda9887_conf = TDA9887_PRESENT,
621 .tuner_type = TUNER_XC2028,
622 .tuner_gpio = default_tuner_gpio,
625 .dvb_gpio = hauppauge_wintv_hvr_900_digital,
626 .decoder = EM28XX_TVP5150,
628 .type = EM28XX_VMUX_TELEVISION,
629 .vmux = TVP5150_COMPOSITE0,
630 .amux = EM28XX_AMUX_VIDEO,
631 .gpio = hauppauge_wintv_hvr_900_analog,
633 .type = EM28XX_VMUX_COMPOSITE1,
634 .vmux = TVP5150_COMPOSITE1,
635 .amux = EM28XX_AMUX_LINE_IN,
636 .gpio = hauppauge_wintv_hvr_900_analog,
638 .type = EM28XX_VMUX_SVIDEO,
639 .vmux = TVP5150_SVIDEO,
640 .amux = EM28XX_AMUX_LINE_IN,
641 .gpio = hauppauge_wintv_hvr_900_analog,
644 [EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900_R2] = {
645 .name = "Hauppauge WinTV HVR 900 (R2)",
646 .tda9887_conf = TDA9887_PRESENT,
647 .tuner_type = TUNER_XC2028,
648 .tuner_gpio = default_tuner_gpio,
650 .decoder = EM28XX_TVP5150,
652 .type = EM28XX_VMUX_TELEVISION,
653 .vmux = TVP5150_COMPOSITE0,
654 .amux = EM28XX_AMUX_VIDEO,
655 .gpio = hauppauge_wintv_hvr_900_analog,
657 .type = EM28XX_VMUX_COMPOSITE1,
658 .vmux = TVP5150_COMPOSITE1,
659 .amux = EM28XX_AMUX_LINE_IN,
660 .gpio = hauppauge_wintv_hvr_900_analog,
662 .type = EM28XX_VMUX_SVIDEO,
663 .vmux = TVP5150_SVIDEO,
664 .amux = EM28XX_AMUX_LINE_IN,
665 .gpio = hauppauge_wintv_hvr_900_analog,
668 [EM2883_BOARD_HAUPPAUGE_WINTV_HVR_850] = {
669 .name = "Hauppauge WinTV HVR 850",
670 .tuner_type = TUNER_XC2028,
671 .tuner_gpio = default_tuner_gpio,
674 .dvb_gpio = hauppauge_wintv_hvr_900_digital,
675 .ir_codes = ir_codes_hauppauge_new,
676 .decoder = EM28XX_TVP5150,
678 .type = EM28XX_VMUX_TELEVISION,
679 .vmux = TVP5150_COMPOSITE0,
680 .amux = EM28XX_AMUX_VIDEO,
681 .gpio = hauppauge_wintv_hvr_900_analog,
683 .type = EM28XX_VMUX_COMPOSITE1,
684 .vmux = TVP5150_COMPOSITE1,
685 .amux = EM28XX_AMUX_LINE_IN,
686 .gpio = hauppauge_wintv_hvr_900_analog,
688 .type = EM28XX_VMUX_SVIDEO,
689 .vmux = TVP5150_SVIDEO,
690 .amux = EM28XX_AMUX_LINE_IN,
691 .gpio = hauppauge_wintv_hvr_900_analog,
694 [EM2883_BOARD_HAUPPAUGE_WINTV_HVR_950] = {
695 .name = "Hauppauge WinTV HVR 950",
696 .tuner_type = TUNER_XC2028,
697 .tuner_gpio = default_tuner_gpio,
700 .dvb_gpio = hauppauge_wintv_hvr_900_digital,
701 .ir_codes = ir_codes_hauppauge_new,
702 .decoder = EM28XX_TVP5150,
704 .type = EM28XX_VMUX_TELEVISION,
705 .vmux = TVP5150_COMPOSITE0,
706 .amux = EM28XX_AMUX_VIDEO,
707 .gpio = hauppauge_wintv_hvr_900_analog,
709 .type = EM28XX_VMUX_COMPOSITE1,
710 .vmux = TVP5150_COMPOSITE1,
711 .amux = EM28XX_AMUX_LINE_IN,
712 .gpio = hauppauge_wintv_hvr_900_analog,
714 .type = EM28XX_VMUX_SVIDEO,
715 .vmux = TVP5150_SVIDEO,
716 .amux = EM28XX_AMUX_LINE_IN,
717 .gpio = hauppauge_wintv_hvr_900_analog,
720 [EM2880_BOARD_PINNACLE_PCTV_HD_PRO] = {
721 .name = "Pinnacle PCTV HD Pro Stick",
722 .tuner_type = TUNER_XC2028,
723 .tuner_gpio = default_tuner_gpio,
726 .dvb_gpio = hauppauge_wintv_hvr_900_digital,
727 .ir_codes = ir_codes_pinnacle_pctv_hd,
728 .decoder = EM28XX_TVP5150,
730 .type = EM28XX_VMUX_TELEVISION,
731 .vmux = TVP5150_COMPOSITE0,
732 .amux = EM28XX_AMUX_VIDEO,
733 .gpio = hauppauge_wintv_hvr_900_analog,
735 .type = EM28XX_VMUX_COMPOSITE1,
736 .vmux = TVP5150_COMPOSITE1,
737 .amux = EM28XX_AMUX_LINE_IN,
738 .gpio = hauppauge_wintv_hvr_900_analog,
740 .type = EM28XX_VMUX_SVIDEO,
741 .vmux = TVP5150_SVIDEO,
742 .amux = EM28XX_AMUX_LINE_IN,
743 .gpio = hauppauge_wintv_hvr_900_analog,
746 [EM2880_BOARD_AMD_ATI_TV_WONDER_HD_600] = {
747 .name = "AMD ATI TV Wonder HD 600",
748 .tuner_type = TUNER_XC2028,
749 .tuner_gpio = default_tuner_gpio,
752 .dvb_gpio = hauppauge_wintv_hvr_900_digital,
753 .ir_codes = ir_codes_ati_tv_wonder_hd_600,
754 .decoder = EM28XX_TVP5150,
756 .type = EM28XX_VMUX_TELEVISION,
757 .vmux = TVP5150_COMPOSITE0,
758 .amux = EM28XX_AMUX_VIDEO,
759 .gpio = hauppauge_wintv_hvr_900_analog,
761 .type = EM28XX_VMUX_COMPOSITE1,
762 .vmux = TVP5150_COMPOSITE1,
763 .amux = EM28XX_AMUX_LINE_IN,
764 .gpio = hauppauge_wintv_hvr_900_analog,
766 .type = EM28XX_VMUX_SVIDEO,
767 .vmux = TVP5150_SVIDEO,
768 .amux = EM28XX_AMUX_LINE_IN,
769 .gpio = hauppauge_wintv_hvr_900_analog,
772 [EM2880_BOARD_TERRATEC_HYBRID_XS] = {
773 .name = "Terratec Hybrid XS",
774 .tuner_type = TUNER_XC2028,
775 .tuner_gpio = default_tuner_gpio,
776 .decoder = EM28XX_TVP5150,
778 .dvb_gpio = default_analog,
780 .type = EM28XX_VMUX_TELEVISION,
781 .vmux = TVP5150_COMPOSITE0,
782 .amux = EM28XX_AMUX_VIDEO,
783 .gpio = default_analog,
785 .type = EM28XX_VMUX_COMPOSITE1,
786 .vmux = TVP5150_COMPOSITE1,
787 .amux = EM28XX_AMUX_LINE_IN,
788 .gpio = default_analog,
790 .type = EM28XX_VMUX_SVIDEO,
791 .vmux = TVP5150_SVIDEO,
792 .amux = EM28XX_AMUX_LINE_IN,
793 .gpio = default_analog,
796 /* maybe there's a reason behind it why Terratec sells the Hybrid XS
797 as Prodigy XS with a different PID, let's keep it separated for now
798 maybe we'll need it lateron */
799 [EM2880_BOARD_TERRATEC_PRODIGY_XS] = {
800 .name = "Terratec Prodigy XS",
801 .tuner_type = TUNER_XC2028,
802 .tuner_gpio = default_tuner_gpio,
803 .decoder = EM28XX_TVP5150,
805 .type = EM28XX_VMUX_TELEVISION,
806 .vmux = TVP5150_COMPOSITE0,
807 .amux = EM28XX_AMUX_VIDEO,
808 .gpio = hauppauge_wintv_hvr_900_analog,
810 .type = EM28XX_VMUX_COMPOSITE1,
811 .vmux = TVP5150_COMPOSITE1,
812 .amux = EM28XX_AMUX_LINE_IN,
813 .gpio = hauppauge_wintv_hvr_900_analog,
815 .type = EM28XX_VMUX_SVIDEO,
816 .vmux = TVP5150_SVIDEO,
817 .amux = EM28XX_AMUX_LINE_IN,
818 .gpio = hauppauge_wintv_hvr_900_analog,
821 [EM2820_BOARD_MSI_VOX_USB_2] = {
822 .name = "MSI VOX USB 2.0",
823 .tuner_type = TUNER_LG_PAL_NEW_TAPC,
824 .tda9887_conf = TDA9887_PRESENT |
825 TDA9887_PORT1_ACTIVE |
826 TDA9887_PORT2_ACTIVE,
827 .max_range_640_480 = 1,
828 .decoder = EM28XX_SAA711X,
830 .type = EM28XX_VMUX_TELEVISION,
831 .vmux = SAA7115_COMPOSITE4,
832 .amux = EM28XX_AMUX_VIDEO,
834 .type = EM28XX_VMUX_COMPOSITE1,
835 .vmux = SAA7115_COMPOSITE0,
836 .amux = EM28XX_AMUX_LINE_IN,
838 .type = EM28XX_VMUX_SVIDEO,
839 .vmux = SAA7115_SVIDEO3,
840 .amux = EM28XX_AMUX_LINE_IN,
843 [EM2800_BOARD_TERRATEC_CINERGY_200] = {
844 .name = "Terratec Cinergy 200 USB",
846 .tuner_type = TUNER_LG_PAL_NEW_TAPC,
847 .tda9887_conf = TDA9887_PRESENT,
848 .decoder = EM28XX_SAA711X,
850 .type = EM28XX_VMUX_TELEVISION,
851 .vmux = SAA7115_COMPOSITE2,
852 .amux = EM28XX_AMUX_VIDEO,
854 .type = EM28XX_VMUX_COMPOSITE1,
855 .vmux = SAA7115_COMPOSITE0,
856 .amux = EM28XX_AMUX_LINE_IN,
858 .type = EM28XX_VMUX_SVIDEO,
859 .vmux = SAA7115_SVIDEO3,
860 .amux = EM28XX_AMUX_LINE_IN,
863 [EM2800_BOARD_GRABBEEX_USB2800] = {
864 .name = "eMPIA Technology, Inc. GrabBeeX+ Video Encoder",
866 .decoder = EM28XX_SAA711X,
867 .tuner_type = TUNER_ABSENT, /* capture only board */
869 .type = EM28XX_VMUX_COMPOSITE1,
870 .vmux = SAA7115_COMPOSITE0,
871 .amux = EM28XX_AMUX_LINE_IN,
873 .type = EM28XX_VMUX_SVIDEO,
874 .vmux = SAA7115_SVIDEO3,
875 .amux = EM28XX_AMUX_LINE_IN,
878 [EM2800_BOARD_LEADTEK_WINFAST_USBII] = {
879 .name = "Leadtek Winfast USB II",
881 .tuner_type = TUNER_LG_PAL_NEW_TAPC,
882 .tda9887_conf = TDA9887_PRESENT,
883 .decoder = EM28XX_SAA711X,
885 .type = EM28XX_VMUX_TELEVISION,
886 .vmux = SAA7115_COMPOSITE2,
887 .amux = EM28XX_AMUX_VIDEO,
889 .type = EM28XX_VMUX_COMPOSITE1,
890 .vmux = SAA7115_COMPOSITE0,
891 .amux = EM28XX_AMUX_LINE_IN,
893 .type = EM28XX_VMUX_SVIDEO,
894 .vmux = SAA7115_SVIDEO3,
895 .amux = EM28XX_AMUX_LINE_IN,
898 [EM2800_BOARD_KWORLD_USB2800] = {
899 .name = "Kworld USB2800",
901 .tuner_type = TUNER_PHILIPS_FCV1236D,
902 .tda9887_conf = TDA9887_PRESENT,
903 .decoder = EM28XX_SAA711X,
905 .type = EM28XX_VMUX_TELEVISION,
906 .vmux = SAA7115_COMPOSITE2,
907 .amux = EM28XX_AMUX_VIDEO,
909 .type = EM28XX_VMUX_COMPOSITE1,
910 .vmux = SAA7115_COMPOSITE0,
911 .amux = EM28XX_AMUX_LINE_IN,
913 .type = EM28XX_VMUX_SVIDEO,
914 .vmux = SAA7115_SVIDEO3,
915 .amux = EM28XX_AMUX_LINE_IN,
918 [EM2820_BOARD_PINNACLE_DVC_90] = {
919 .name = "Pinnacle Dazzle DVC 90/DVC 100/DVC 101/DVC 107",
920 .tuner_type = TUNER_ABSENT, /* capture only board */
921 .decoder = EM28XX_SAA711X,
923 .type = EM28XX_VMUX_COMPOSITE1,
924 .vmux = SAA7115_COMPOSITE0,
925 .amux = EM28XX_AMUX_LINE_IN,
927 .type = EM28XX_VMUX_SVIDEO,
928 .vmux = SAA7115_SVIDEO3,
929 .amux = EM28XX_AMUX_LINE_IN,
932 [EM2800_BOARD_VGEAR_POCKETTV] = {
933 .name = "V-Gear PocketTV",
935 .tuner_type = TUNER_LG_PAL_NEW_TAPC,
936 .tda9887_conf = TDA9887_PRESENT,
937 .decoder = EM28XX_SAA711X,
939 .type = EM28XX_VMUX_TELEVISION,
940 .vmux = SAA7115_COMPOSITE2,
941 .amux = EM28XX_AMUX_VIDEO,
943 .type = EM28XX_VMUX_COMPOSITE1,
944 .vmux = SAA7115_COMPOSITE0,
945 .amux = EM28XX_AMUX_LINE_IN,
947 .type = EM28XX_VMUX_SVIDEO,
948 .vmux = SAA7115_SVIDEO3,
949 .amux = EM28XX_AMUX_LINE_IN,
952 [EM2820_BOARD_PROLINK_PLAYTV_BOX4_USB2] = {
953 .name = "Pixelview PlayTV Box 4 USB 2.0",
954 .tda9887_conf = TDA9887_PRESENT,
955 .tuner_type = TUNER_YMEC_TVF_5533MF,
956 .decoder = EM28XX_SAA711X,
958 .type = EM28XX_VMUX_TELEVISION,
959 .vmux = SAA7115_COMPOSITE2,
960 .amux = EM28XX_AMUX_VIDEO,
961 .aout = EM28XX_AOUT_MONO | /* I2S */
962 EM28XX_AOUT_MASTER, /* Line out pin */
964 .type = EM28XX_VMUX_COMPOSITE1,
965 .vmux = SAA7115_COMPOSITE0,
966 .amux = EM28XX_AMUX_LINE_IN,
968 .type = EM28XX_VMUX_SVIDEO,
969 .vmux = SAA7115_SVIDEO3,
970 .amux = EM28XX_AMUX_LINE_IN,
973 [EM2820_BOARD_PROLINK_PLAYTV_USB2] = {
974 .name = "Pixelview Prolink PlayTV USB 2.0",
975 .has_snapshot_button = 1,
976 .tda9887_conf = TDA9887_PRESENT,
977 .tuner_type = TUNER_YMEC_TVF_5533MF,
978 .decoder = EM28XX_SAA711X,
980 .type = EM28XX_VMUX_TELEVISION,
981 .vmux = SAA7115_COMPOSITE2,
982 .amux = EM28XX_AMUX_VIDEO,
983 .aout = EM28XX_AOUT_MONO | /* I2S */
984 EM28XX_AOUT_MASTER, /* Line out pin */
986 .type = EM28XX_VMUX_COMPOSITE1,
987 .vmux = SAA7115_COMPOSITE0,
988 .amux = EM28XX_AMUX_LINE_IN,
990 .type = EM28XX_VMUX_SVIDEO,
991 .vmux = SAA7115_SVIDEO3,
992 .amux = EM28XX_AMUX_LINE_IN,
995 [EM2860_BOARD_POINTNIX_INTRAORAL_CAMERA] = {
996 .name = "PointNix Intra-Oral Camera",
997 .has_snapshot_button = 1,
998 .tda9887_conf = TDA9887_PRESENT,
999 .tuner_type = TUNER_ABSENT,
1000 .decoder = EM28XX_SAA711X,
1002 .type = EM28XX_VMUX_SVIDEO,
1003 .vmux = SAA7115_SVIDEO3,
1004 .amux = EM28XX_AMUX_VIDEO,
1007 [EM2880_BOARD_MSI_DIGIVOX_AD] = {
1008 .name = "MSI DigiVox A/D",
1009 .valid = EM28XX_BOARD_NOT_VALIDATED,
1010 .tuner_type = TUNER_XC2028,
1011 .tuner_gpio = default_tuner_gpio,
1012 .decoder = EM28XX_TVP5150,
1014 .type = EM28XX_VMUX_TELEVISION,
1015 .vmux = TVP5150_COMPOSITE0,
1016 .amux = EM28XX_AMUX_VIDEO,
1017 .gpio = em2880_msi_digivox_ad_analog,
1019 .type = EM28XX_VMUX_COMPOSITE1,
1020 .vmux = TVP5150_COMPOSITE1,
1021 .amux = EM28XX_AMUX_LINE_IN,
1022 .gpio = em2880_msi_digivox_ad_analog,
1024 .type = EM28XX_VMUX_SVIDEO,
1025 .vmux = TVP5150_SVIDEO,
1026 .amux = EM28XX_AMUX_LINE_IN,
1027 .gpio = em2880_msi_digivox_ad_analog,
1030 [EM2880_BOARD_MSI_DIGIVOX_AD_II] = {
1031 .name = "MSI DigiVox A/D II",
1032 .valid = EM28XX_BOARD_NOT_VALIDATED,
1033 .tuner_type = TUNER_XC2028,
1034 .tuner_gpio = default_tuner_gpio,
1035 .decoder = EM28XX_TVP5150,
1037 .type = EM28XX_VMUX_TELEVISION,
1038 .vmux = TVP5150_COMPOSITE0,
1039 .amux = EM28XX_AMUX_VIDEO,
1040 .gpio = em2880_msi_digivox_ad_analog,
1042 .type = EM28XX_VMUX_COMPOSITE1,
1043 .vmux = TVP5150_COMPOSITE1,
1044 .amux = EM28XX_AMUX_LINE_IN,
1045 .gpio = em2880_msi_digivox_ad_analog,
1047 .type = EM28XX_VMUX_SVIDEO,
1048 .vmux = TVP5150_SVIDEO,
1049 .amux = EM28XX_AMUX_LINE_IN,
1050 .gpio = em2880_msi_digivox_ad_analog,
1053 [EM2880_BOARD_KWORLD_DVB_305U] = {
1054 .name = "KWorld DVB-T 305U",
1055 .valid = EM28XX_BOARD_NOT_VALIDATED,
1056 .tuner_type = TUNER_XC2028,
1057 .tuner_gpio = default_tuner_gpio,
1058 .decoder = EM28XX_TVP5150,
1060 .type = EM28XX_VMUX_TELEVISION,
1061 .vmux = TVP5150_COMPOSITE0,
1062 .amux = EM28XX_AMUX_VIDEO,
1064 .type = EM28XX_VMUX_COMPOSITE1,
1065 .vmux = TVP5150_COMPOSITE1,
1066 .amux = EM28XX_AMUX_LINE_IN,
1068 .type = EM28XX_VMUX_SVIDEO,
1069 .vmux = TVP5150_SVIDEO,
1070 .amux = EM28XX_AMUX_LINE_IN,
1073 [EM2880_BOARD_KWORLD_DVB_310U] = {
1074 .name = "KWorld DVB-T 310U",
1075 .tuner_type = TUNER_XC2028,
1076 .tuner_gpio = default_tuner_gpio,
1078 .dvb_gpio = default_digital,
1080 .decoder = EM28XX_TVP5150,
1082 .type = EM28XX_VMUX_TELEVISION,
1083 .vmux = TVP5150_COMPOSITE0,
1084 .amux = EM28XX_AMUX_VIDEO,
1085 .gpio = default_analog,
1087 .type = EM28XX_VMUX_COMPOSITE1,
1088 .vmux = TVP5150_COMPOSITE1,
1089 .amux = EM28XX_AMUX_LINE_IN,
1090 .gpio = default_analog,
1091 }, { /* S-video has not been tested yet */
1092 .type = EM28XX_VMUX_SVIDEO,
1093 .vmux = TVP5150_SVIDEO,
1094 .amux = EM28XX_AMUX_LINE_IN,
1095 .gpio = default_analog,
1098 [EM2881_BOARD_DNT_DA2_HYBRID] = {
1099 .name = "DNT DA2 Hybrid",
1100 .valid = EM28XX_BOARD_NOT_VALIDATED,
1101 .tuner_type = TUNER_XC2028,
1102 .tuner_gpio = default_tuner_gpio,
1103 .decoder = EM28XX_TVP5150,
1105 .type = EM28XX_VMUX_TELEVISION,
1106 .vmux = TVP5150_COMPOSITE0,
1107 .amux = EM28XX_AMUX_VIDEO,
1108 .gpio = default_analog,
1110 .type = EM28XX_VMUX_COMPOSITE1,
1111 .vmux = TVP5150_COMPOSITE1,
1112 .amux = EM28XX_AMUX_LINE_IN,
1113 .gpio = default_analog,
1115 .type = EM28XX_VMUX_SVIDEO,
1116 .vmux = TVP5150_SVIDEO,
1117 .amux = EM28XX_AMUX_LINE_IN,
1118 .gpio = default_analog,
1121 [EM2881_BOARD_PINNACLE_HYBRID_PRO] = {
1122 .name = "Pinnacle Hybrid Pro",
1123 .valid = EM28XX_BOARD_NOT_VALIDATED,
1124 .tuner_type = TUNER_XC2028,
1125 .tuner_gpio = default_tuner_gpio,
1126 .decoder = EM28XX_TVP5150,
1128 .type = EM28XX_VMUX_TELEVISION,
1129 .vmux = TVP5150_COMPOSITE0,
1130 .amux = EM28XX_AMUX_VIDEO,
1131 .gpio = default_analog,
1133 .type = EM28XX_VMUX_COMPOSITE1,
1134 .vmux = TVP5150_COMPOSITE1,
1135 .amux = EM28XX_AMUX_LINE_IN,
1136 .gpio = default_analog,
1138 .type = EM28XX_VMUX_SVIDEO,
1139 .vmux = TVP5150_SVIDEO,
1140 .amux = EM28XX_AMUX_LINE_IN,
1141 .gpio = default_analog,
1144 [EM2882_BOARD_PINNACLE_HYBRID_PRO] = {
1145 .name = "Pinnacle Hybrid Pro (2)",
1146 .valid = EM28XX_BOARD_NOT_VALIDATED,
1147 .tuner_type = TUNER_XC2028,
1148 .tuner_gpio = default_tuner_gpio,
1150 .decoder = EM28XX_TVP5150,
1152 .type = EM28XX_VMUX_TELEVISION,
1153 .vmux = TVP5150_COMPOSITE0,
1154 .amux = EM28XX_AMUX_VIDEO,
1155 .gpio = hauppauge_wintv_hvr_900_analog,
1157 .type = EM28XX_VMUX_COMPOSITE1,
1158 .vmux = TVP5150_COMPOSITE1,
1159 .amux = EM28XX_AMUX_LINE_IN,
1160 .gpio = hauppauge_wintv_hvr_900_analog,
1162 .type = EM28XX_VMUX_SVIDEO,
1163 .vmux = TVP5150_SVIDEO,
1164 .amux = EM28XX_AMUX_LINE_IN,
1165 .gpio = hauppauge_wintv_hvr_900_analog,
1168 [EM2882_BOARD_KWORLD_VS_DVBT] = {
1169 .name = "Kworld VS-DVB-T 323UR",
1170 .valid = EM28XX_BOARD_NOT_VALIDATED,
1171 .tuner_type = TUNER_XC2028,
1172 .tuner_gpio = default_tuner_gpio,
1173 .decoder = EM28XX_TVP5150,
1175 .type = EM28XX_VMUX_TELEVISION,
1176 .vmux = TVP5150_COMPOSITE0,
1177 .amux = EM28XX_AMUX_VIDEO,
1179 .type = EM28XX_VMUX_COMPOSITE1,
1180 .vmux = TVP5150_COMPOSITE1,
1181 .amux = EM28XX_AMUX_LINE_IN,
1183 .type = EM28XX_VMUX_SVIDEO,
1184 .vmux = TVP5150_SVIDEO,
1185 .amux = EM28XX_AMUX_LINE_IN,
1188 [EM2882_BOARD_TERRATEC_HYBRID_XS] = {
1189 .name = "Terratec Hybrid XS (em2882)",
1190 .valid = EM28XX_BOARD_NOT_VALIDATED,
1191 .tuner_type = TUNER_XC2028,
1192 .tuner_gpio = default_tuner_gpio,
1193 .decoder = EM28XX_TVP5150,
1195 .type = EM28XX_VMUX_TELEVISION,
1196 .vmux = TVP5150_COMPOSITE0,
1197 .amux = EM28XX_AMUX_VIDEO,
1198 .gpio = hauppauge_wintv_hvr_900_analog,
1200 .type = EM28XX_VMUX_COMPOSITE1,
1201 .vmux = TVP5150_COMPOSITE1,
1202 .amux = EM28XX_AMUX_LINE_IN,
1203 .gpio = hauppauge_wintv_hvr_900_analog,
1205 .type = EM28XX_VMUX_SVIDEO,
1206 .vmux = TVP5150_SVIDEO,
1207 .amux = EM28XX_AMUX_LINE_IN,
1208 .gpio = hauppauge_wintv_hvr_900_analog,
1211 [EM2883_BOARD_KWORLD_HYBRID_330U] = {
1212 .name = "Kworld PlusTV HD Hybrid 330",
1213 .tuner_type = TUNER_XC2028,
1214 .tuner_gpio = default_tuner_gpio,
1215 .decoder = EM28XX_TVP5150,
1218 .dvb_gpio = kworld_330u_digital,
1219 .xclk = EM28XX_XCLK_FREQUENCY_12MHZ,
1220 .i2c_speed = EM28XX_I2C_CLK_WAIT_ENABLE |
1221 EM28XX_I2C_EEPROM_ON_BOARD |
1222 EM28XX_I2C_EEPROM_KEY_VALID,
1224 .type = EM28XX_VMUX_TELEVISION,
1225 .vmux = TVP5150_COMPOSITE0,
1226 .amux = EM28XX_AMUX_VIDEO,
1227 .gpio = kworld_330u_analog,
1228 .aout = EM28XX_AOUT_PCM_IN | EM28XX_AOUT_PCM_STEREO,
1230 .type = EM28XX_VMUX_COMPOSITE1,
1231 .vmux = TVP5150_COMPOSITE1,
1232 .amux = EM28XX_AMUX_LINE_IN,
1233 .gpio = kworld_330u_analog,
1234 .aout = EM28XX_AOUT_PCM_IN | EM28XX_AOUT_PCM_STEREO,
1236 .type = EM28XX_VMUX_SVIDEO,
1237 .vmux = TVP5150_SVIDEO,
1238 .amux = EM28XX_AMUX_LINE_IN,
1239 .gpio = kworld_330u_analog,
1242 [EM2820_BOARD_COMPRO_VIDEOMATE_FORYOU] = {
1243 .name = "Compro VideoMate ForYou/Stereo",
1244 .tuner_type = TUNER_LG_PAL_NEW_TAPC,
1245 .tda9887_conf = TDA9887_PRESENT,
1246 .decoder = EM28XX_TVP5150,
1247 .adecoder = EM28XX_TVAUDIO,
1249 .type = EM28XX_VMUX_TELEVISION,
1250 .vmux = TVP5150_COMPOSITE0,
1251 .amux = EM28XX_AMUX_LINE_IN,
1253 .type = EM28XX_VMUX_SVIDEO,
1254 .vmux = TVP5150_SVIDEO,
1255 .amux = EM28XX_AMUX_LINE_IN,
1258 [EM2860_BOARD_KAIOMY_TVNPC_U2] = {
1259 .name = "Kaiomy TVnPC U2",
1261 .tuner_type = TUNER_XC2028,
1264 .decoder = EM28XX_TVP5150,
1265 .tuner_gpio = default_tuner_gpio,
1266 .ir_codes = ir_codes_kaiomy,
1268 .type = EM28XX_VMUX_TELEVISION,
1269 .vmux = TVP5150_COMPOSITE0,
1270 .amux = EM28XX_AMUX_VIDEO,
1273 .type = EM28XX_VMUX_COMPOSITE1,
1274 .vmux = TVP5150_COMPOSITE1,
1275 .amux = EM28XX_AMUX_LINE_IN,
1277 .type = EM28XX_VMUX_SVIDEO,
1278 .vmux = TVP5150_SVIDEO,
1279 .amux = EM28XX_AMUX_LINE_IN,
1282 .type = EM28XX_RADIO,
1283 .amux = EM28XX_AMUX_LINE_IN,
1286 [EM2860_BOARD_EASYCAP] = {
1287 .name = "Easy Cap Capture DC-60",
1289 .tuner_type = TUNER_ABSENT,
1290 .decoder = EM28XX_SAA711X,
1292 .type = EM28XX_VMUX_COMPOSITE1,
1293 .vmux = SAA7115_COMPOSITE0,
1294 .amux = EM28XX_AMUX_LINE_IN,
1296 .type = EM28XX_VMUX_SVIDEO,
1297 .vmux = SAA7115_SVIDEO3,
1298 .amux = EM28XX_AMUX_LINE_IN,
1301 [EM2820_BOARD_IODATA_GVMVP_SZ] = {
1302 .name = "IO-DATA GV-MVP/SZ",
1303 .tuner_type = TUNER_PHILIPS_FM1236_MK3,
1304 .tuner_gpio = default_tuner_gpio,
1305 .tda9887_conf = TDA9887_PRESENT,
1306 .decoder = EM28XX_TVP5150,
1308 .type = EM28XX_VMUX_TELEVISION,
1309 .vmux = TVP5150_COMPOSITE0,
1310 .amux = EM28XX_AMUX_VIDEO,
1311 }, { /* Composite has not been tested yet */
1312 .type = EM28XX_VMUX_COMPOSITE1,
1313 .vmux = TVP5150_COMPOSITE1,
1314 .amux = EM28XX_AMUX_VIDEO,
1315 }, { /* S-video has not been tested yet */
1316 .type = EM28XX_VMUX_SVIDEO,
1317 .vmux = TVP5150_SVIDEO,
1318 .amux = EM28XX_AMUX_VIDEO,
1322 const unsigned int em28xx_bcount = ARRAY_SIZE(em28xx_boards);
1324 /* table of devices that work with this driver */
1325 struct usb_device_id em28xx_id_table[] = {
1326 { USB_DEVICE(0xeb1a, 0x2750),
1327 .driver_info = EM2750_BOARD_UNKNOWN },
1328 { USB_DEVICE(0xeb1a, 0x2751),
1329 .driver_info = EM2750_BOARD_UNKNOWN },
1330 { USB_DEVICE(0xeb1a, 0x2800),
1331 .driver_info = EM2800_BOARD_UNKNOWN },
1332 { USB_DEVICE(0xeb1a, 0x2820),
1333 .driver_info = EM2820_BOARD_UNKNOWN },
1334 { USB_DEVICE(0xeb1a, 0x2821),
1335 .driver_info = EM2820_BOARD_UNKNOWN },
1336 { USB_DEVICE(0xeb1a, 0x2860),
1337 .driver_info = EM2820_BOARD_UNKNOWN },
1338 { USB_DEVICE(0xeb1a, 0x2861),
1339 .driver_info = EM2820_BOARD_UNKNOWN },
1340 { USB_DEVICE(0xeb1a, 0x2870),
1341 .driver_info = EM2820_BOARD_UNKNOWN },
1342 { USB_DEVICE(0xeb1a, 0x2881),
1343 .driver_info = EM2820_BOARD_UNKNOWN },
1344 { USB_DEVICE(0xeb1a, 0x2883),
1345 .driver_info = EM2820_BOARD_UNKNOWN },
1346 { USB_DEVICE(0xeb1a, 0xe300),
1347 .driver_info = EM2861_BOARD_KWORLD_PVRTV_300U },
1348 { USB_DEVICE(0xeb1a, 0xe303),
1349 .driver_info = EM2860_BOARD_KAIOMY_TVNPC_U2 },
1350 { USB_DEVICE(0xeb1a, 0xe305),
1351 .driver_info = EM2880_BOARD_KWORLD_DVB_305U },
1352 { USB_DEVICE(0xeb1a, 0xe310),
1353 .driver_info = EM2880_BOARD_MSI_DIGIVOX_AD },
1354 { USB_DEVICE(0xeb1a, 0xa316),
1355 .driver_info = EM2883_BOARD_KWORLD_HYBRID_330U },
1356 { USB_DEVICE(0xeb1a, 0xe320),
1357 .driver_info = EM2880_BOARD_MSI_DIGIVOX_AD_II },
1358 { USB_DEVICE(0xeb1a, 0xe323),
1359 .driver_info = EM2882_BOARD_KWORLD_VS_DVBT },
1360 { USB_DEVICE(0xeb1a, 0xe350),
1361 .driver_info = EM2870_BOARD_KWORLD_350U },
1362 { USB_DEVICE(0xeb1a, 0xe355),
1363 .driver_info = EM2870_BOARD_KWORLD_355U },
1364 { USB_DEVICE(0xeb1a, 0x2801),
1365 .driver_info = EM2800_BOARD_GRABBEEX_USB2800 },
1366 { USB_DEVICE(0xeb1a, 0xe357),
1367 .driver_info = EM2870_BOARD_KWORLD_355U },
1368 { USB_DEVICE(0x0ccd, 0x0036),
1369 .driver_info = EM2820_BOARD_TERRATEC_CINERGY_250 },
1370 { USB_DEVICE(0x0ccd, 0x004c),
1371 .driver_info = EM2880_BOARD_TERRATEC_HYBRID_XS_FR },
1372 { USB_DEVICE(0x0ccd, 0x004f),
1373 .driver_info = EM2860_BOARD_TERRATEC_HYBRID_XS },
1374 { USB_DEVICE(0x0ccd, 0x005e),
1375 .driver_info = EM2882_BOARD_TERRATEC_HYBRID_XS },
1376 { USB_DEVICE(0x0ccd, 0x0042),
1377 .driver_info = EM2880_BOARD_TERRATEC_HYBRID_XS },
1378 { USB_DEVICE(0x0ccd, 0x0043),
1379 .driver_info = EM2870_BOARD_TERRATEC_XS },
1380 { USB_DEVICE(0x0ccd, 0x0047),
1381 .driver_info = EM2880_BOARD_TERRATEC_PRODIGY_XS },
1382 { USB_DEVICE(0x185b, 0x2870),
1383 .driver_info = EM2870_BOARD_COMPRO_VIDEOMATE },
1384 { USB_DEVICE(0x185b, 0x2041),
1385 .driver_info = EM2820_BOARD_COMPRO_VIDEOMATE_FORYOU },
1386 { USB_DEVICE(0x2040, 0x4200),
1387 .driver_info = EM2820_BOARD_HAUPPAUGE_WINTV_USB_2 },
1388 { USB_DEVICE(0x2040, 0x4201),
1389 .driver_info = EM2820_BOARD_HAUPPAUGE_WINTV_USB_2 },
1390 { USB_DEVICE(0x2040, 0x6500),
1391 .driver_info = EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900 },
1392 { USB_DEVICE(0x2040, 0x6502),
1393 .driver_info = EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900_R2 },
1394 { USB_DEVICE(0x2040, 0x6513), /* HCW HVR-980 */
1395 .driver_info = EM2883_BOARD_HAUPPAUGE_WINTV_HVR_950 },
1396 { USB_DEVICE(0x2040, 0x6517), /* HP HVR-950 */
1397 .driver_info = EM2883_BOARD_HAUPPAUGE_WINTV_HVR_950 },
1398 { USB_DEVICE(0x2040, 0x651b), /* RP HVR-950 */
1399 .driver_info = EM2883_BOARD_HAUPPAUGE_WINTV_HVR_950 },
1400 { USB_DEVICE(0x2040, 0x651f),
1401 .driver_info = EM2883_BOARD_HAUPPAUGE_WINTV_HVR_850 },
1402 { USB_DEVICE(0x0438, 0xb002),
1403 .driver_info = EM2880_BOARD_AMD_ATI_TV_WONDER_HD_600 },
1404 { USB_DEVICE(0x2001, 0xf112),
1405 .driver_info = EM2820_BOARD_DLINK_USB_TV },
1406 { USB_DEVICE(0x2304, 0x0207),
1407 .driver_info = EM2820_BOARD_PINNACLE_DVC_90 },
1408 { USB_DEVICE(0x2304, 0x0208),
1409 .driver_info = EM2820_BOARD_PINNACLE_USB_2 },
1410 { USB_DEVICE(0x2304, 0x021a),
1411 .driver_info = EM2820_BOARD_PINNACLE_DVC_90 },
1412 { USB_DEVICE(0x2304, 0x0226),
1413 .driver_info = EM2882_BOARD_PINNACLE_HYBRID_PRO },
1414 { USB_DEVICE(0x2304, 0x0227),
1415 .driver_info = EM2880_BOARD_PINNACLE_PCTV_HD_PRO },
1416 { USB_DEVICE(0x0413, 0x6023),
1417 .driver_info = EM2800_BOARD_LEADTEK_WINFAST_USBII },
1418 { USB_DEVICE(0x093b, 0xa005),
1419 .driver_info = EM2861_BOARD_PLEXTOR_PX_TV100U },
1420 { USB_DEVICE(0x04bb, 0x0515),
1421 .driver_info = EM2820_BOARD_IODATA_GVMVP_SZ },
1424 MODULE_DEVICE_TABLE(usb, em28xx_id_table);
1427 * EEPROM hash table for devices with generic USB IDs
1429 static struct em28xx_hash_table em28xx_eeprom_hash[] = {
1430 /* P/N: SA 60002070465 Tuner: TVF7533-MF */
1431 {0x6ce05a8f, EM2820_BOARD_PROLINK_PLAYTV_USB2, TUNER_YMEC_TVF_5533MF},
1432 {0x72cc5a8b, EM2820_BOARD_PROLINK_PLAYTV_BOX4_USB2, TUNER_YMEC_TVF_5533MF},
1433 {0x966a0441, EM2880_BOARD_KWORLD_DVB_310U, TUNER_XC2028},
1436 /* I2C devicelist hash table for devices with generic USB IDs */
1437 static struct em28xx_hash_table em28xx_i2c_hash[] = {
1438 {0xb06a32c3, EM2800_BOARD_TERRATEC_CINERGY_200, TUNER_LG_PAL_NEW_TAPC},
1439 {0xf51200e3, EM2800_BOARD_VGEAR_POCKETTV, TUNER_LG_PAL_NEW_TAPC},
1440 {0x1ba50080, EM2860_BOARD_POINTNIX_INTRAORAL_CAMERA, TUNER_ABSENT},
1441 {0xc51200e3, EM2820_BOARD_GADMEI_TVR200, TUNER_LG_PAL_NEW_TAPC},
1444 int em28xx_tuner_callback(void *ptr, int component, int command, int arg)
1447 struct em28xx *dev = ptr;
1449 if (dev->tuner_type != TUNER_XC2028)
1452 if (command != XC2028_TUNER_RESET)
1455 rc = em28xx_gpio_set(dev, dev->board.tuner_gpio);
1459 EXPORT_SYMBOL_GPL(em28xx_tuner_callback);
1461 static inline void em28xx_set_model(struct em28xx *dev)
1463 memcpy(&dev->board, &em28xx_boards[dev->model], sizeof(dev->board));
1465 /* Those are the default values for the majority of boards
1466 Use those values if not specified otherwise at boards entry
1468 if (!dev->board.xclk)
1469 dev->board.xclk = EM28XX_XCLK_IR_RC5_MODE |
1470 EM28XX_XCLK_FREQUENCY_12MHZ;
1472 if (!dev->board.i2c_speed)
1473 dev->board.i2c_speed = EM28XX_I2C_CLK_WAIT_ENABLE |
1474 EM28XX_I2C_FREQ_100_KHZ;
1477 /* Since em28xx_pre_card_setup() requires a proper dev->model,
1478 * this won't work for boards with generic PCI IDs
1480 void em28xx_pre_card_setup(struct em28xx *dev)
1484 em28xx_set_model(dev);
1486 em28xx_info("Identified as %s (card=%d)\n",
1487 dev->board.name, dev->model);
1489 /* Set the default GPO/GPIO for legacy devices */
1490 dev->reg_gpo_num = EM2880_R04_GPO;
1491 dev->reg_gpio_num = EM28XX_R08_GPIO;
1493 dev->wait_after_write = 5;
1495 /* Based on the Chip ID, set the device configuration */
1496 rc = em28xx_read_reg(dev, EM28XX_R0A_CHIPID);
1500 switch (dev->chip_id) {
1501 case CHIP_ID_EM2750:
1502 em28xx_info("chip ID is em2750\n");
1504 case CHIP_ID_EM2820:
1505 em28xx_info("chip ID is em2820\n");
1507 case CHIP_ID_EM2840:
1508 em28xx_info("chip ID is em2840\n");
1510 case CHIP_ID_EM2860:
1511 em28xx_info("chip ID is em2860\n");
1513 case CHIP_ID_EM2870:
1514 em28xx_info("chip ID is em2870\n");
1515 dev->wait_after_write = 0;
1517 case CHIP_ID_EM2874:
1518 em28xx_info("chip ID is em2874\n");
1519 dev->reg_gpio_num = EM2874_R80_GPIO;
1520 dev->wait_after_write = 0;
1522 case CHIP_ID_EM2883:
1523 em28xx_info("chip ID is em2882/em2883\n");
1524 dev->wait_after_write = 0;
1527 em28xx_info("em28xx chip ID = %d\n", dev->chip_id);
1531 /* Prepopulate cached GPO register content */
1532 rc = em28xx_read_reg(dev, dev->reg_gpo_num);
1536 /* Set the initial XCLK and I2C clock values based on the board
1538 em28xx_write_reg(dev, EM28XX_R0F_XCLK, dev->board.xclk & 0x7f);
1539 em28xx_write_reg(dev, EM28XX_R06_I2C_CLK, dev->board.i2c_speed);
1542 /* request some modules */
1543 switch (dev->model) {
1544 case EM2861_BOARD_PLEXTOR_PX_TV100U:
1546 /* Turn on analog audio output */
1547 em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xfd);
1549 case EM2861_BOARD_KWORLD_PVRTV_300U:
1550 case EM2880_BOARD_KWORLD_DVB_305U:
1551 em28xx_write_reg(dev, EM28XX_R08_GPIO, 0x6d);
1553 em28xx_write_reg(dev, EM28XX_R08_GPIO, 0x7d);
1556 case EM2870_BOARD_COMPRO_VIDEOMATE:
1557 /* TODO: someone can do some cleanup here...
1558 not everything's needed */
1559 em28xx_write_reg(dev, EM2880_R04_GPO, 0x00);
1561 em28xx_write_reg(dev, EM2880_R04_GPO, 0x01);
1563 em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xfd);
1565 em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xfc);
1567 em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xdc);
1569 em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xfc);
1572 case EM2870_BOARD_TERRATEC_XS_MT2060:
1573 /* this device needs some gpio writes to get the DVB-T
1575 em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xfe);
1577 em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xde);
1579 em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xfe);
1582 case EM2870_BOARD_PINNACLE_PCTV_DVB:
1583 /* this device needs some gpio writes to get the
1585 em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xfe);
1587 em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xde);
1589 em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xfe);
1592 case EM2820_BOARD_GADMEI_UTV310:
1593 case EM2820_BOARD_MSI_VOX_USB_2:
1594 /* enables audio for that devices */
1595 em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xfd);
1598 case EM2860_BOARD_KAIOMY_TVNPC_U2:
1599 em28xx_write_regs(dev, EM28XX_R0F_XCLK, "\x07", 1);
1600 em28xx_write_regs(dev, EM28XX_R06_I2C_CLK, "\x40", 1);
1601 em28xx_write_regs(dev, 0x0d, "\x42", 1);
1602 em28xx_write_regs(dev, 0x08, "\xfd", 1);
1604 em28xx_write_regs(dev, 0x08, "\xff", 1);
1606 em28xx_write_regs(dev, 0x08, "\x7f", 1);
1608 em28xx_write_regs(dev, 0x08, "\x6b", 1);
1611 case EM2860_BOARD_EASYCAP:
1612 em28xx_write_regs(dev, 0x08, "\xf8", 1);
1615 case EM2820_BOARD_IODATA_GVMVP_SZ:
1616 em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xff);
1618 em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xf7);
1620 em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xfe);
1622 em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xfd);
1627 em28xx_gpio_set(dev, dev->board.tuner_gpio);
1628 em28xx_set_mode(dev, EM28XX_ANALOG_MODE);
1631 em28xx_set_mode(dev, EM28XX_SUSPEND);
1634 static void em28xx_setup_xc3028(struct em28xx *dev, struct xc2028_ctrl *ctl)
1636 memset(ctl, 0, sizeof(*ctl));
1638 ctl->fname = XC2028_DEFAULT_FIRMWARE;
1640 ctl->mts = em28xx_boards[dev->model].mts_firmware;
1642 switch (dev->model) {
1643 case EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900:
1644 ctl->demod = XC3028_FE_ZARLINK456;
1646 case EM2880_BOARD_TERRATEC_HYBRID_XS:
1647 ctl->demod = XC3028_FE_ZARLINK456;
1649 case EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900_R2:
1650 /* djh - Not sure which demod we need here */
1651 ctl->demod = XC3028_FE_DEFAULT;
1653 case EM2880_BOARD_AMD_ATI_TV_WONDER_HD_600:
1654 ctl->demod = XC3028_FE_DEFAULT;
1655 ctl->fname = XC3028L_DEFAULT_FIRMWARE;
1657 case EM2883_BOARD_HAUPPAUGE_WINTV_HVR_850:
1658 case EM2883_BOARD_HAUPPAUGE_WINTV_HVR_950:
1659 case EM2880_BOARD_PINNACLE_PCTV_HD_PRO:
1660 /* FIXME: Better to specify the needed IF */
1661 ctl->demod = XC3028_FE_DEFAULT;
1663 case EM2883_BOARD_KWORLD_HYBRID_330U:
1664 ctl->demod = XC3028_FE_CHINA;
1665 ctl->fname = XC2028_DEFAULT_FIRMWARE;
1668 ctl->demod = XC3028_FE_OREN538;
1672 static void em28xx_config_tuner(struct em28xx *dev)
1674 struct v4l2_priv_tun_config xc2028_cfg;
1675 struct tuner_setup tun_setup;
1676 struct v4l2_frequency f;
1678 if (dev->tuner_type == TUNER_ABSENT)
1681 tun_setup.mode_mask = T_ANALOG_TV | T_RADIO;
1682 tun_setup.type = dev->tuner_type;
1683 tun_setup.addr = dev->tuner_addr;
1684 tun_setup.tuner_callback = em28xx_tuner_callback;
1686 em28xx_i2c_call_clients(dev, TUNER_SET_TYPE_ADDR, &tun_setup);
1688 if (dev->tuner_type == TUNER_XC2028) {
1689 struct xc2028_ctrl ctl;
1691 em28xx_setup_xc3028(dev, &ctl);
1693 xc2028_cfg.tuner = TUNER_XC2028;
1694 xc2028_cfg.priv = &ctl;
1696 em28xx_i2c_call_clients(dev, TUNER_SET_CONFIG, &xc2028_cfg);
1699 /* configure tuner */
1701 f.type = V4L2_TUNER_ANALOG_TV;
1702 f.frequency = 9076; /* just a magic number */
1703 dev->ctl_freq = f.frequency;
1704 em28xx_i2c_call_clients(dev, VIDIOC_S_FREQUENCY, &f);
1707 static int em28xx_hint_board(struct em28xx *dev)
1711 /* HINT method: EEPROM
1713 * This method works only for boards with eeprom.
1714 * Uses a hash of all eeprom bytes. The hash should be
1715 * unique for a vendor/tuner pair.
1716 * There are a high chance that tuners for different
1717 * video standards produce different hashes.
1719 for (i = 0; i < ARRAY_SIZE(em28xx_eeprom_hash); i++) {
1720 if (dev->hash == em28xx_eeprom_hash[i].hash) {
1721 dev->model = em28xx_eeprom_hash[i].model;
1722 dev->tuner_type = em28xx_eeprom_hash[i].tuner;
1724 em28xx_errdev("Your board has no unique USB ID.\n");
1725 em28xx_errdev("A hint were successfully done, "
1726 "based on eeprom hash.\n");
1727 em28xx_errdev("This method is not 100%% failproof.\n");
1728 em28xx_errdev("If the board were missdetected, "
1729 "please email this log to:\n");
1730 em28xx_errdev("\tV4L Mailing List "
1731 " <linux-media@vger.kernel.org>\n");
1732 em28xx_errdev("Board detected as %s\n",
1733 em28xx_boards[dev->model].name);
1739 /* HINT method: I2C attached devices
1741 * This method works for all boards.
1742 * Uses a hash of i2c scanned devices.
1743 * Devices with the same i2c attached chips will
1744 * be considered equal.
1745 * This method is less precise than the eeprom one.
1748 /* user did not request i2c scanning => do it now */
1750 em28xx_do_i2c_scan(dev);
1752 for (i = 0; i < ARRAY_SIZE(em28xx_i2c_hash); i++) {
1753 if (dev->i2c_hash == em28xx_i2c_hash[i].hash) {
1754 dev->model = em28xx_i2c_hash[i].model;
1755 dev->tuner_type = em28xx_i2c_hash[i].tuner;
1756 em28xx_errdev("Your board has no unique USB ID.\n");
1757 em28xx_errdev("A hint were successfully done, "
1758 "based on i2c devicelist hash.\n");
1759 em28xx_errdev("This method is not 100%% failproof.\n");
1760 em28xx_errdev("If the board were missdetected, "
1761 "please email this log to:\n");
1762 em28xx_errdev("\tV4L Mailing List "
1763 " <linux-media@vger.kernel.org>\n");
1764 em28xx_errdev("Board detected as %s\n",
1765 em28xx_boards[dev->model].name);
1771 em28xx_errdev("Your board has no unique USB ID and thus need a "
1772 "hint to be detected.\n");
1773 em28xx_errdev("You may try to use card=<n> insmod option to "
1774 "workaround that.\n");
1775 em28xx_errdev("Please send an email with this log to:\n");
1776 em28xx_errdev("\tV4L Mailing List <linux-media@vger.kernel.org>\n");
1777 em28xx_errdev("Board eeprom hash is 0x%08lx\n", dev->hash);
1778 em28xx_errdev("Board i2c devicelist hash is 0x%08lx\n", dev->i2c_hash);
1780 em28xx_errdev("Here is a list of valid choices for the card=<n>"
1781 " insmod option:\n");
1782 for (i = 0; i < em28xx_bcount; i++) {
1783 em28xx_errdev(" card=%d -> %s\n",
1784 i, em28xx_boards[i].name);
1789 /* ----------------------------------------------------------------------- */
1790 void em28xx_set_ir(struct em28xx *dev, struct IR_i2c *ir)
1797 /* detect & configure */
1798 switch (dev->model) {
1799 case (EM2800_BOARD_UNKNOWN):
1801 case (EM2820_BOARD_UNKNOWN):
1803 case (EM2800_BOARD_TERRATEC_CINERGY_200):
1804 case (EM2820_BOARD_TERRATEC_CINERGY_250):
1805 ir->ir_codes = ir_codes_em_terratec;
1806 ir->get_key = em28xx_get_key_terratec;
1807 snprintf(ir->c.name, sizeof(ir->c.name),
1808 "i2c IR (EM28XX Terratec)");
1810 case (EM2820_BOARD_PINNACLE_USB_2):
1811 ir->ir_codes = ir_codes_pinnacle_grey;
1812 ir->get_key = em28xx_get_key_pinnacle_usb_grey;
1813 snprintf(ir->c.name, sizeof(ir->c.name),
1814 "i2c IR (EM28XX Pinnacle PCTV)");
1816 case (EM2820_BOARD_HAUPPAUGE_WINTV_USB_2):
1817 ir->ir_codes = ir_codes_hauppauge_new;
1818 ir->get_key = em28xx_get_key_em_haup;
1819 snprintf(ir->c.name, sizeof(ir->c.name),
1820 "i2c IR (EM2840 Hauppauge)");
1822 case (EM2820_BOARD_MSI_VOX_USB_2):
1824 case (EM2800_BOARD_LEADTEK_WINFAST_USBII):
1826 case (EM2800_BOARD_KWORLD_USB2800):
1828 case (EM2800_BOARD_GRABBEEX_USB2800):
1833 void em28xx_card_setup(struct em28xx *dev)
1835 em28xx_set_model(dev);
1837 dev->tuner_type = em28xx_boards[dev->model].tuner_type;
1838 if (em28xx_boards[dev->model].tuner_addr)
1839 dev->tuner_addr = em28xx_boards[dev->model].tuner_addr;
1841 /* request some modules */
1842 switch (dev->model) {
1843 case EM2820_BOARD_HAUPPAUGE_WINTV_USB_2:
1844 case EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900:
1845 case EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900_R2:
1846 case EM2883_BOARD_HAUPPAUGE_WINTV_HVR_850:
1847 case EM2883_BOARD_HAUPPAUGE_WINTV_HVR_950:
1850 #ifdef CONFIG_MODULES
1851 request_module("tveeprom");
1853 /* Call first TVeeprom */
1855 dev->i2c_client.addr = 0xa0 >> 1;
1856 tveeprom_hauppauge_analog(&dev->i2c_client, &tv, dev->eedata);
1858 dev->tuner_type = tv.tuner_type;
1860 if (tv.audio_processor == V4L2_IDENT_MSPX4XX) {
1861 dev->i2s_speed = 2048000;
1862 dev->board.has_msp34xx = 1;
1864 #ifdef CONFIG_MODULES
1866 request_module("ir-kbd-i2c");
1870 case EM2820_BOARD_KWORLD_PVRTV2800RF:
1871 /* GPIO enables sound on KWORLD PVR TV 2800RF */
1872 em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xf9);
1874 case EM2820_BOARD_UNKNOWN:
1875 case EM2800_BOARD_UNKNOWN:
1877 * The K-WORLD DVB-T 310U is detected as an MSI Digivox AD.
1879 * This occurs because they share identical USB vendor and
1882 * What we do here is look up the EEPROM hash of the K-WORLD
1883 * and if it is found then we decide that we do not have
1884 * a DIGIVOX and reset the device to the K-WORLD instead.
1886 * This solution is only valid if they do not share eeprom
1887 * hash identities which has not been determined as yet.
1889 case EM2880_BOARD_MSI_DIGIVOX_AD:
1890 if (!em28xx_hint_board(dev))
1891 em28xx_set_model(dev);
1895 if (dev->board.has_snapshot_button)
1896 em28xx_register_snapshot_button(dev);
1898 if (dev->board.valid == EM28XX_BOARD_NOT_VALIDATED) {
1899 em28xx_errdev("\n\n");
1900 em28xx_errdev("The support for this board weren't "
1902 em28xx_errdev("Please send a report of having this working\n");
1903 em28xx_errdev("not to V4L mailing list (and/or to other "
1907 /* Allow override tuner type by a module parameter */
1909 dev->tuner_type = tuner;
1911 #ifdef CONFIG_MODULES
1912 /* request some modules */
1913 if (dev->board.has_msp34xx)
1914 request_module("msp3400");
1915 if (dev->board.decoder == EM28XX_SAA711X)
1916 request_module("saa7115");
1917 if (dev->board.decoder == EM28XX_TVP5150)
1918 request_module("tvp5150");
1919 if (dev->board.tuner_type != TUNER_ABSENT)
1920 request_module("tuner");
1921 if (dev->board.adecoder == EM28XX_TVAUDIO)
1922 request_module("tvaudio");
1925 em28xx_config_tuner(dev);
1927 em28xx_ir_init(dev);
1931 #if defined(CONFIG_MODULES) && defined(MODULE)
1932 static void request_module_async(struct work_struct *work)
1934 struct em28xx *dev = container_of(work,
1935 struct em28xx, request_module_wk);
1937 if (dev->has_audio_class)
1938 request_module("snd-usb-audio");
1939 else if (dev->has_alsa_audio)
1940 request_module("em28xx-alsa");
1942 if (dev->board.has_dvb)
1943 request_module("em28xx-dvb");
1946 static void request_modules(struct em28xx *dev)
1948 INIT_WORK(&dev->request_module_wk, request_module_async);
1949 schedule_work(&dev->request_module_wk);
1952 #define request_modules(dev)
1953 #endif /* CONFIG_MODULES */
1956 * em28xx_realease_resources()
1957 * unregisters the v4l2,i2c and usb devices
1958 * called when the device gets disconected or at module unload
1960 void em28xx_release_resources(struct em28xx *dev)
1962 if (dev->sbutton_input_dev)
1963 em28xx_deregister_snapshot_button(dev);
1966 em28xx_ir_fini(dev);
1968 /*FIXME: I2C IR should be disconnected */
1970 em28xx_release_analog_resources(dev);
1972 em28xx_remove_from_devlist(dev);
1974 em28xx_i2c_unregister(dev);
1975 usb_put_dev(dev->udev);
1977 /* Mark device as unused */
1978 em28xx_devused &= ~(1 << dev->devno);
1983 * allocates and inits the device structs, registers i2c bus and v4l device
1985 static int em28xx_init_dev(struct em28xx **devhandle, struct usb_device *udev,
1988 struct em28xx *dev = *devhandle;
1989 int retval = -ENOMEM;
1993 mutex_init(&dev->ctrl_urb_lock);
1994 spin_lock_init(&dev->slock);
1995 init_waitqueue_head(&dev->open);
1996 init_waitqueue_head(&dev->wait_frame);
1997 init_waitqueue_head(&dev->wait_stream);
1999 dev->em28xx_write_regs = em28xx_write_regs;
2000 dev->em28xx_read_reg = em28xx_read_reg;
2001 dev->em28xx_read_reg_req_len = em28xx_read_reg_req_len;
2002 dev->em28xx_write_regs_req = em28xx_write_regs_req;
2003 dev->em28xx_read_reg_req = em28xx_read_reg_req;
2004 dev->board.is_em2800 = em28xx_boards[dev->model].is_em2800;
2006 em28xx_pre_card_setup(dev);
2008 if (!dev->board.is_em2800) {
2009 /* Sets I2C speed to 100 KHz */
2010 retval = em28xx_write_reg(dev, EM28XX_R06_I2C_CLK, 0x40);
2012 em28xx_errdev("%s: em28xx_write_regs_req failed!"
2019 /* register i2c bus */
2020 errCode = em28xx_i2c_register(dev);
2022 em28xx_errdev("%s: em28xx_i2c_register - errCode [%d]!\n",
2027 /* Do board specific init and eeprom reading */
2028 em28xx_card_setup(dev);
2030 /* Configure audio */
2031 errCode = em28xx_audio_setup(dev);
2033 em28xx_errdev("%s: Error while setting audio - errCode [%d]!\n",
2037 /* wake i2c devices */
2038 em28xx_wake_i2c(dev);
2040 /* init video dma queues */
2041 INIT_LIST_HEAD(&dev->vidq.active);
2042 INIT_LIST_HEAD(&dev->vidq.queued);
2045 if (dev->board.has_msp34xx) {
2046 /* Send a reset to other chips via gpio */
2047 errCode = em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xf7);
2049 em28xx_errdev("%s: em28xx_write_regs_req - "
2050 "msp34xx(1) failed! errCode [%d]\n",
2056 errCode = em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xff);
2058 em28xx_errdev("%s: em28xx_write_regs_req - "
2059 "msp34xx(2) failed! errCode [%d]\n",
2066 em28xx_add_into_devlist(dev);
2068 retval = em28xx_register_analog_devices(dev);
2070 em28xx_release_resources(dev);
2071 goto fail_reg_devices;
2074 em28xx_init_extension(dev);
2076 /* Save some power by putting tuner to sleep */
2077 em28xx_i2c_call_clients(dev, TUNER_SET_STANDBY, NULL);
2086 * em28xx_usb_probe()
2087 * checks for supported devices
2089 static int em28xx_usb_probe(struct usb_interface *interface,
2090 const struct usb_device_id *id)
2092 const struct usb_endpoint_descriptor *endpoint;
2093 struct usb_device *udev;
2094 struct usb_interface *uif;
2095 struct em28xx *dev = NULL;
2096 int retval = -ENODEV;
2097 int i, nr, ifnum, isoc_pipe;
2099 char descr[255] = "";
2101 udev = usb_get_dev(interface_to_usbdev(interface));
2102 ifnum = interface->altsetting[0].desc.bInterfaceNumber;
2104 /* Check to see next free device and mark as used */
2105 nr = find_first_zero_bit(&em28xx_devused, EM28XX_MAXBOARDS);
2106 em28xx_devused |= 1<<nr;
2108 /* Don't register audio interfaces */
2109 if (interface->altsetting[0].desc.bInterfaceClass == USB_CLASS_AUDIO) {
2110 em28xx_err(DRIVER_NAME " audio device (%04x:%04x): "
2111 "interface %i, class %i\n",
2112 le16_to_cpu(udev->descriptor.idVendor),
2113 le16_to_cpu(udev->descriptor.idProduct),
2115 interface->altsetting[0].desc.bInterfaceClass);
2117 em28xx_devused &= ~(1<<nr);
2121 endpoint = &interface->cur_altsetting->endpoint[0].desc;
2123 /* check if the device has the iso in endpoint at the correct place */
2124 if (usb_endpoint_xfer_isoc(endpoint)
2126 (interface->altsetting[1].endpoint[0].desc.wMaxPacketSize == 940)) {
2127 /* It's a newer em2874/em2875 device */
2130 int check_interface = 1;
2132 endpoint = &interface->cur_altsetting->endpoint[1].desc;
2133 if (!usb_endpoint_xfer_isoc(endpoint))
2134 check_interface = 0;
2136 if (usb_endpoint_dir_out(endpoint))
2137 check_interface = 0;
2139 if (!check_interface) {
2140 em28xx_err(DRIVER_NAME " video device (%04x:%04x): "
2141 "interface %i, class %i found.\n",
2142 le16_to_cpu(udev->descriptor.idVendor),
2143 le16_to_cpu(udev->descriptor.idProduct),
2145 interface->altsetting[0].desc.bInterfaceClass);
2147 em28xx_err(DRIVER_NAME " This is an anciliary "
2148 "interface not used by the driver\n");
2150 em28xx_devused &= ~(1<<nr);
2155 switch (udev->speed) {
2159 case USB_SPEED_UNKNOWN:
2160 case USB_SPEED_FULL:
2163 case USB_SPEED_HIGH:
2170 if (udev->manufacturer)
2171 strlcpy(descr, udev->manufacturer, sizeof(descr));
2173 if (udev->product) {
2175 strlcat(descr, " ", sizeof(descr));
2176 strlcat(descr, udev->product, sizeof(descr));
2179 strlcat(descr, " ", sizeof(descr));
2181 printk(DRIVER_NAME ": New device %s@ %s Mbps "
2182 "(%04x:%04x, interface %d, class %d)\n",
2185 le16_to_cpu(udev->descriptor.idVendor),
2186 le16_to_cpu(udev->descriptor.idProduct),
2188 interface->altsetting->desc.bInterfaceNumber);
2190 if (nr >= EM28XX_MAXBOARDS) {
2191 printk(DRIVER_NAME ": Supports only %i em28xx boards.\n",
2193 em28xx_devused &= ~(1<<nr);
2197 /* allocate memory for our device state and initialize it */
2198 dev = kzalloc(sizeof(*dev), GFP_KERNEL);
2200 em28xx_err(DRIVER_NAME ": out of memory!\n");
2201 em28xx_devused &= ~(1<<nr);
2205 snprintf(dev->name, 29, "em28xx #%d", nr);
2207 dev->model = id->driver_info;
2210 /* Checks if audio is provided by some interface */
2211 for (i = 0; i < udev->config->desc.bNumInterfaces; i++) {
2212 uif = udev->config->interface[i];
2213 if (uif->altsetting[0].desc.bInterfaceClass == USB_CLASS_AUDIO) {
2214 dev->has_audio_class = 1;
2219 /* compute alternate max packet sizes */
2220 uif = udev->actconfig->interface[0];
2222 dev->num_alt = uif->num_altsetting;
2223 dev->alt_max_pkt_size = kmalloc(32 * dev->num_alt, GFP_KERNEL);
2225 if (dev->alt_max_pkt_size == NULL) {
2226 em28xx_errdev("out of memory!\n");
2227 em28xx_devused &= ~(1<<nr);
2232 for (i = 0; i < dev->num_alt ; i++) {
2233 u16 tmp = le16_to_cpu(uif->altsetting[i].endpoint[isoc_pipe].desc.wMaxPacketSize);
2234 dev->alt_max_pkt_size[i] =
2235 (tmp & 0x07ff) * (((tmp & 0x1800) >> 11) + 1);
2238 if ((card[nr] >= 0) && (card[nr] < em28xx_bcount))
2239 dev->model = card[nr];
2241 /* allocate device struct */
2242 mutex_init(&dev->lock);
2243 mutex_lock(&dev->lock);
2244 retval = em28xx_init_dev(&dev, udev, nr);
2246 em28xx_devused &= ~(1<<dev->devno);
2252 /* save our data pointer in this interface device */
2253 usb_set_intfdata(interface, dev);
2255 request_modules(dev);
2257 /* Should be the last thing to do, to avoid newer udev's to
2258 open the device before fully initializing it
2260 mutex_unlock(&dev->lock);
2266 * em28xx_usb_disconnect()
2267 * called when the device gets diconencted
2268 * video device will be unregistered on v4l2_close in case it is still open
2270 static void em28xx_usb_disconnect(struct usb_interface *interface)
2274 dev = usb_get_intfdata(interface);
2275 usb_set_intfdata(interface, NULL);
2280 em28xx_info("disconnecting %s\n", dev->vdev->name);
2282 /* wait until all current v4l2 io is finished then deallocate
2284 mutex_lock(&dev->lock);
2286 wake_up_interruptible_all(&dev->open);
2290 ("device /dev/video%d is open! Deregistration and memory "
2291 "deallocation are deferred on close.\n",
2294 dev->state |= DEV_MISCONFIGURED;
2295 em28xx_uninit_isoc(dev);
2296 dev->state |= DEV_DISCONNECTED;
2297 wake_up_interruptible(&dev->wait_frame);
2298 wake_up_interruptible(&dev->wait_stream);
2300 dev->state |= DEV_DISCONNECTED;
2301 em28xx_release_resources(dev);
2304 em28xx_close_extension(dev);
2306 mutex_unlock(&dev->lock);
2309 kfree(dev->alt_max_pkt_size);
2314 static struct usb_driver em28xx_usb_driver = {
2316 .probe = em28xx_usb_probe,
2317 .disconnect = em28xx_usb_disconnect,
2318 .id_table = em28xx_id_table,
2321 static int __init em28xx_module_init(void)
2325 /* register this driver with the USB subsystem */
2326 result = usb_register(&em28xx_usb_driver);
2328 em28xx_err(DRIVER_NAME
2329 " usb_register failed. Error number %d.\n", result);
2331 printk(KERN_INFO DRIVER_NAME " driver loaded\n");
2336 static void __exit em28xx_module_exit(void)
2338 /* deregister this driver with the USB subsystem */
2339 usb_deregister(&em28xx_usb_driver);
2342 module_init(em28xx_module_init);
2343 module_exit(em28xx_module_exit);