Linux 2.6.34-rc3
[pohmelfs.git] / drivers / media / video / em28xx / em28xx-cards.c
blobecbcefb08739db90ea57f60db7ebff0b237579e3
1 /*
2 em28xx-cards.c - driver for Empia EM2800/EM2820/2840 USB
3 video capture devices
5 Copyright (C) 2005 Ludovico Cavedon <cavedon@sssup.it>
6 Markus Rechberger <mrechberger@gmail.com>
7 Mauro Carvalho Chehab <mchehab@infradead.org>
8 Sascha Sommer <saschasommer@freenet.de>
10 This program is free software; you can redistribute it and/or modify
11 it under the terms of the GNU General Public License as published by
12 the Free Software Foundation; either version 2 of the License, or
13 (at your option) any later version.
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details.
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25 #include <linux/init.h>
26 #include <linux/module.h>
27 #include <linux/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/tvaudio.h>
35 #include <media/i2c-addr.h>
36 #include <media/tveeprom.h>
37 #include <media/v4l2-common.h>
38 #include <media/v4l2-chip-ident.h>
40 #include "em28xx.h"
42 #define DRIVER_NAME "em28xx"
44 static int tuner = -1;
45 module_param(tuner, int, 0444);
46 MODULE_PARM_DESC(tuner, "tuner type");
48 static unsigned int disable_ir;
49 module_param(disable_ir, int, 0444);
50 MODULE_PARM_DESC(disable_ir, "disable infrared remote support");
52 static unsigned int disable_usb_speed_check;
53 module_param(disable_usb_speed_check, int, 0444);
54 MODULE_PARM_DESC(disable_usb_speed_check,
55 "override min bandwidth requirement of 480M bps");
57 static unsigned int card[] = {[0 ... (EM28XX_MAXBOARDS - 1)] = UNSET };
58 module_param_array(card, int, NULL, 0444);
59 MODULE_PARM_DESC(card, "card type");
61 /* Bitmask marking allocated devices from 0 to EM28XX_MAXBOARDS */
62 static unsigned long em28xx_devused;
64 struct em28xx_hash_table {
65 unsigned long hash;
66 unsigned int model;
67 unsigned int tuner;
71 * Reset sequences for analog/digital modes
74 /* Reset for the most [analog] boards */
75 static struct em28xx_reg_seq default_analog[] = {
76 {EM28XX_R08_GPIO, 0x6d, ~EM_GPIO_4, 10},
77 { -1, -1, -1, -1},
80 /* Reset for the most [digital] boards */
81 static struct em28xx_reg_seq default_digital[] = {
82 {EM28XX_R08_GPIO, 0x6e, ~EM_GPIO_4, 10},
83 { -1, -1, -1, -1},
86 /* Board Hauppauge WinTV HVR 900 analog */
87 static struct em28xx_reg_seq hauppauge_wintv_hvr_900_analog[] = {
88 {EM28XX_R08_GPIO, 0x2d, ~EM_GPIO_4, 10},
89 {0x05, 0xff, 0x10, 10},
90 { -1, -1, -1, -1},
93 /* Board Hauppauge WinTV HVR 900 digital */
94 static struct em28xx_reg_seq hauppauge_wintv_hvr_900_digital[] = {
95 {EM28XX_R08_GPIO, 0x2e, ~EM_GPIO_4, 10},
96 {EM2880_R04_GPO, 0x04, 0x0f, 10},
97 {EM2880_R04_GPO, 0x0c, 0x0f, 10},
98 { -1, -1, -1, -1},
101 /* Boards - EM2880 MSI DIGIVOX AD and EM2880_BOARD_MSI_DIGIVOX_AD_II */
102 static struct em28xx_reg_seq em2880_msi_digivox_ad_analog[] = {
103 {EM28XX_R08_GPIO, 0x69, ~EM_GPIO_4, 10},
104 { -1, -1, -1, -1},
107 /* Boards - EM2880 MSI DIGIVOX AD and EM2880_BOARD_MSI_DIGIVOX_AD_II */
109 /* Board - EM2870 Kworld 355u
110 Analog - No input analog */
112 /* Board - EM2882 Kworld 315U digital */
113 static struct em28xx_reg_seq em2882_kworld_315u_digital[] = {
114 {EM28XX_R08_GPIO, 0xff, 0xff, 10},
115 {EM28XX_R08_GPIO, 0xfe, 0xff, 10},
116 {EM2880_R04_GPO, 0x04, 0xff, 10},
117 {EM2880_R04_GPO, 0x0c, 0xff, 10},
118 {EM28XX_R08_GPIO, 0x7e, 0xff, 10},
119 { -1, -1, -1, -1},
122 static struct em28xx_reg_seq em2882_kworld_315u_tuner_gpio[] = {
123 {EM2880_R04_GPO, 0x08, 0xff, 10},
124 {EM2880_R04_GPO, 0x0c, 0xff, 10},
125 {EM2880_R04_GPO, 0x08, 0xff, 10},
126 {EM2880_R04_GPO, 0x0c, 0xff, 10},
127 { -1, -1, -1, -1},
130 static struct em28xx_reg_seq kworld_330u_analog[] = {
131 {EM28XX_R08_GPIO, 0x6d, ~EM_GPIO_4, 10},
132 {EM2880_R04_GPO, 0x00, 0xff, 10},
133 { -1, -1, -1, -1},
136 static struct em28xx_reg_seq kworld_330u_digital[] = {
137 {EM28XX_R08_GPIO, 0x6e, ~EM_GPIO_4, 10},
138 {EM2880_R04_GPO, 0x08, 0xff, 10},
139 { -1, -1, -1, -1},
142 /* Evga inDtube
143 GPIO0 - Enable digital power (s5h1409) - low to enable
144 GPIO1 - Enable analog power (tvp5150/emp202) - low to enable
145 GPIO4 - xc3028 reset
146 GOP3 - s5h1409 reset
148 static struct em28xx_reg_seq evga_indtube_analog[] = {
149 {EM28XX_R08_GPIO, 0x79, 0xff, 60},
150 { -1, -1, -1, -1},
153 static struct em28xx_reg_seq evga_indtube_digital[] = {
154 {EM28XX_R08_GPIO, 0x7a, 0xff, 1},
155 {EM2880_R04_GPO, 0x04, 0xff, 10},
156 {EM2880_R04_GPO, 0x0c, 0xff, 1},
157 { -1, -1, -1, -1},
160 /* Pinnacle Hybrid Pro eb1a:2881 */
161 static struct em28xx_reg_seq pinnacle_hybrid_pro_analog[] = {
162 {EM28XX_R08_GPIO, 0xfd, ~EM_GPIO_4, 10},
163 { -1, -1, -1, -1},
166 static struct em28xx_reg_seq pinnacle_hybrid_pro_digital[] = {
167 {EM28XX_R08_GPIO, 0x6e, ~EM_GPIO_4, 10},
168 {EM2880_R04_GPO, 0x04, 0xff, 100},/* zl10353 reset */
169 {EM2880_R04_GPO, 0x0c, 0xff, 1},
170 { -1, -1, -1, -1},
173 /* eb1a:2868 Reddo DVB-C USB TV Box
174 GPIO4 - CU1216L NIM
175 Other GPIOs seems to be don't care. */
176 static struct em28xx_reg_seq reddo_dvb_c_usb_box[] = {
177 {EM28XX_R08_GPIO, 0xfe, 0xff, 10},
178 {EM28XX_R08_GPIO, 0xde, 0xff, 10},
179 {EM28XX_R08_GPIO, 0xfe, 0xff, 10},
180 {EM28XX_R08_GPIO, 0xff, 0xff, 10},
181 {EM28XX_R08_GPIO, 0x7f, 0xff, 10},
182 {EM28XX_R08_GPIO, 0x6f, 0xff, 10},
183 {EM28XX_R08_GPIO, 0xff, 0xff, 10},
184 {-1, -1, -1, -1},
187 /* Callback for the most boards */
188 static struct em28xx_reg_seq default_tuner_gpio[] = {
189 {EM28XX_R08_GPIO, EM_GPIO_4, EM_GPIO_4, 10},
190 {EM28XX_R08_GPIO, 0, EM_GPIO_4, 10},
191 {EM28XX_R08_GPIO, EM_GPIO_4, EM_GPIO_4, 10},
192 { -1, -1, -1, -1},
195 /* Mute/unmute */
196 static struct em28xx_reg_seq compro_unmute_tv_gpio[] = {
197 {EM28XX_R08_GPIO, 5, 7, 10},
198 { -1, -1, -1, -1},
201 static struct em28xx_reg_seq compro_unmute_svid_gpio[] = {
202 {EM28XX_R08_GPIO, 4, 7, 10},
203 { -1, -1, -1, -1},
206 static struct em28xx_reg_seq compro_mute_gpio[] = {
207 {EM28XX_R08_GPIO, 6, 7, 10},
208 { -1, -1, -1, -1},
211 /* Terratec AV350 */
212 static struct em28xx_reg_seq terratec_av350_mute_gpio[] = {
213 {EM28XX_R08_GPIO, 0xff, 0x7f, 10},
214 { -1, -1, -1, -1},
217 static struct em28xx_reg_seq terratec_av350_unmute_gpio[] = {
218 {EM28XX_R08_GPIO, 0xff, 0xff, 10},
219 { -1, -1, -1, -1},
222 static struct em28xx_reg_seq silvercrest_reg_seq[] = {
223 {EM28XX_R08_GPIO, 0xff, 0xff, 10},
224 {EM28XX_R08_GPIO, 0x01, 0xf7, 10},
225 { -1, -1, -1, -1},
228 static struct em28xx_reg_seq vc211a_enable[] = {
229 {EM28XX_R08_GPIO, 0xff, 0x07, 10},
230 {EM28XX_R08_GPIO, 0xff, 0x0f, 10},
231 {EM28XX_R08_GPIO, 0xff, 0x0b, 10},
232 { -1, -1, -1, -1},
235 static struct em28xx_reg_seq dikom_dk300_digital[] = {
236 {EM28XX_R08_GPIO, 0x6e, ~EM_GPIO_4, 10},
237 {EM2880_R04_GPO, 0x08, 0xff, 10},
238 { -1, -1, -1, -1},
243 * Board definitions
245 struct em28xx_board em28xx_boards[] = {
246 [EM2750_BOARD_UNKNOWN] = {
247 .name = "EM2710/EM2750/EM2751 webcam grabber",
248 .xclk = EM28XX_XCLK_FREQUENCY_20MHZ,
249 .tuner_type = TUNER_ABSENT,
250 .is_webcam = 1,
251 .input = { {
252 .type = EM28XX_VMUX_COMPOSITE1,
253 .vmux = 0,
254 .amux = EM28XX_AMUX_VIDEO,
255 .gpio = silvercrest_reg_seq,
256 } },
258 [EM2800_BOARD_UNKNOWN] = {
259 .name = "Unknown EM2800 video grabber",
260 .is_em2800 = 1,
261 .tda9887_conf = TDA9887_PRESENT,
262 .decoder = EM28XX_SAA711X,
263 .tuner_type = TUNER_ABSENT,
264 .input = { {
265 .type = EM28XX_VMUX_COMPOSITE1,
266 .vmux = SAA7115_COMPOSITE0,
267 .amux = EM28XX_AMUX_LINE_IN,
268 }, {
269 .type = EM28XX_VMUX_SVIDEO,
270 .vmux = SAA7115_SVIDEO3,
271 .amux = EM28XX_AMUX_LINE_IN,
272 } },
274 [EM2820_BOARD_UNKNOWN] = {
275 .name = "Unknown EM2750/28xx video grabber",
276 .tuner_type = TUNER_ABSENT,
277 .is_webcam = 1, /* To enable sensor probe */
279 [EM2750_BOARD_DLCW_130] = {
280 /* Beijing Huaqi Information Digital Technology Co., Ltd */
281 .name = "Huaqi DLCW-130",
282 .valid = EM28XX_BOARD_NOT_VALIDATED,
283 .xclk = EM28XX_XCLK_FREQUENCY_48MHZ,
284 .tuner_type = TUNER_ABSENT,
285 .is_webcam = 1,
286 .input = { {
287 .type = EM28XX_VMUX_COMPOSITE1,
288 .vmux = 0,
289 .amux = EM28XX_AMUX_VIDEO,
290 } },
292 [EM2820_BOARD_KWORLD_PVRTV2800RF] = {
293 .name = "Kworld PVR TV 2800 RF",
294 .tuner_type = TUNER_TEMIC_PAL,
295 .tda9887_conf = TDA9887_PRESENT,
296 .decoder = EM28XX_SAA711X,
297 .input = { {
298 .type = EM28XX_VMUX_COMPOSITE1,
299 .vmux = SAA7115_COMPOSITE0,
300 .amux = EM28XX_AMUX_LINE_IN,
301 }, {
302 .type = EM28XX_VMUX_SVIDEO,
303 .vmux = SAA7115_SVIDEO3,
304 .amux = EM28XX_AMUX_LINE_IN,
305 } },
307 [EM2820_BOARD_GADMEI_TVR200] = {
308 .name = "Gadmei TVR200",
309 .tuner_type = TUNER_LG_PAL_NEW_TAPC,
310 .tda9887_conf = TDA9887_PRESENT,
311 .decoder = EM28XX_SAA711X,
312 .input = { {
313 .type = EM28XX_VMUX_TELEVISION,
314 .vmux = SAA7115_COMPOSITE2,
315 .amux = EM28XX_AMUX_LINE_IN,
316 }, {
317 .type = EM28XX_VMUX_COMPOSITE1,
318 .vmux = SAA7115_COMPOSITE0,
319 .amux = EM28XX_AMUX_LINE_IN,
320 }, {
321 .type = EM28XX_VMUX_SVIDEO,
322 .vmux = SAA7115_SVIDEO3,
323 .amux = EM28XX_AMUX_LINE_IN,
324 } },
326 [EM2820_BOARD_TERRATEC_CINERGY_250] = {
327 .name = "Terratec Cinergy 250 USB",
328 .tuner_type = TUNER_LG_PAL_NEW_TAPC,
329 .has_ir_i2c = 1,
330 .tda9887_conf = TDA9887_PRESENT,
331 .decoder = EM28XX_SAA711X,
332 .input = { {
333 .type = EM28XX_VMUX_TELEVISION,
334 .vmux = SAA7115_COMPOSITE2,
335 .amux = EM28XX_AMUX_LINE_IN,
336 }, {
337 .type = EM28XX_VMUX_COMPOSITE1,
338 .vmux = SAA7115_COMPOSITE0,
339 .amux = EM28XX_AMUX_LINE_IN,
340 }, {
341 .type = EM28XX_VMUX_SVIDEO,
342 .vmux = SAA7115_SVIDEO3,
343 .amux = EM28XX_AMUX_LINE_IN,
344 } },
346 [EM2820_BOARD_PINNACLE_USB_2] = {
347 .name = "Pinnacle PCTV USB 2",
348 .tuner_type = TUNER_LG_PAL_NEW_TAPC,
349 .has_ir_i2c = 1,
350 .tda9887_conf = TDA9887_PRESENT,
351 .decoder = EM28XX_SAA711X,
352 .input = { {
353 .type = EM28XX_VMUX_TELEVISION,
354 .vmux = SAA7115_COMPOSITE2,
355 .amux = EM28XX_AMUX_VIDEO,
356 }, {
357 .type = EM28XX_VMUX_COMPOSITE1,
358 .vmux = SAA7115_COMPOSITE0,
359 .amux = EM28XX_AMUX_LINE_IN,
360 }, {
361 .type = EM28XX_VMUX_SVIDEO,
362 .vmux = SAA7115_SVIDEO3,
363 .amux = EM28XX_AMUX_LINE_IN,
364 } },
366 [EM2820_BOARD_HAUPPAUGE_WINTV_USB_2] = {
367 .name = "Hauppauge WinTV USB 2",
368 .tuner_type = TUNER_PHILIPS_FM1236_MK3,
369 .tda9887_conf = TDA9887_PRESENT |
370 TDA9887_PORT1_ACTIVE |
371 TDA9887_PORT2_ACTIVE,
372 .decoder = EM28XX_TVP5150,
373 .has_msp34xx = 1,
374 .has_ir_i2c = 1,
375 .input = { {
376 .type = EM28XX_VMUX_TELEVISION,
377 .vmux = TVP5150_COMPOSITE0,
378 .amux = MSP_INPUT_DEFAULT,
379 }, {
380 .type = EM28XX_VMUX_SVIDEO,
381 .vmux = TVP5150_SVIDEO,
382 .amux = MSP_INPUT(MSP_IN_SCART1, MSP_IN_TUNER1,
383 MSP_DSP_IN_SCART, MSP_DSP_IN_SCART),
384 } },
386 [EM2820_BOARD_DLINK_USB_TV] = {
387 .name = "D-Link DUB-T210 TV Tuner",
388 .valid = EM28XX_BOARD_NOT_VALIDATED,
389 .tuner_type = TUNER_LG_PAL_NEW_TAPC,
390 .tda9887_conf = TDA9887_PRESENT,
391 .decoder = EM28XX_SAA711X,
392 .input = { {
393 .type = EM28XX_VMUX_TELEVISION,
394 .vmux = SAA7115_COMPOSITE2,
395 .amux = EM28XX_AMUX_LINE_IN,
396 }, {
397 .type = EM28XX_VMUX_COMPOSITE1,
398 .vmux = SAA7115_COMPOSITE0,
399 .amux = EM28XX_AMUX_LINE_IN,
400 }, {
401 .type = EM28XX_VMUX_SVIDEO,
402 .vmux = SAA7115_SVIDEO3,
403 .amux = EM28XX_AMUX_LINE_IN,
404 } },
406 [EM2820_BOARD_HERCULES_SMART_TV_USB2] = {
407 .name = "Hercules Smart TV USB 2.0",
408 .valid = EM28XX_BOARD_NOT_VALIDATED,
409 .tuner_type = TUNER_LG_PAL_NEW_TAPC,
410 .tda9887_conf = TDA9887_PRESENT,
411 .decoder = EM28XX_SAA711X,
412 .input = { {
413 .type = EM28XX_VMUX_TELEVISION,
414 .vmux = SAA7115_COMPOSITE2,
415 .amux = EM28XX_AMUX_LINE_IN,
416 }, {
417 .type = EM28XX_VMUX_COMPOSITE1,
418 .vmux = SAA7115_COMPOSITE0,
419 .amux = EM28XX_AMUX_LINE_IN,
420 }, {
421 .type = EM28XX_VMUX_SVIDEO,
422 .vmux = SAA7115_SVIDEO3,
423 .amux = EM28XX_AMUX_LINE_IN,
424 } },
426 [EM2820_BOARD_PINNACLE_USB_2_FM1216ME] = {
427 .name = "Pinnacle PCTV USB 2 (Philips FM1216ME)",
428 .valid = EM28XX_BOARD_NOT_VALIDATED,
429 .tuner_type = TUNER_PHILIPS_FM1216ME_MK3,
430 .tda9887_conf = TDA9887_PRESENT,
431 .decoder = EM28XX_SAA711X,
432 .input = { {
433 .type = EM28XX_VMUX_TELEVISION,
434 .vmux = SAA7115_COMPOSITE2,
435 .amux = EM28XX_AMUX_VIDEO,
436 }, {
437 .type = EM28XX_VMUX_COMPOSITE1,
438 .vmux = SAA7115_COMPOSITE0,
439 .amux = EM28XX_AMUX_LINE_IN,
440 }, {
441 .type = EM28XX_VMUX_SVIDEO,
442 .vmux = SAA7115_SVIDEO3,
443 .amux = EM28XX_AMUX_LINE_IN,
444 } },
446 [EM2820_BOARD_GADMEI_UTV310] = {
447 .name = "Gadmei UTV310",
448 .valid = EM28XX_BOARD_NOT_VALIDATED,
449 .tuner_type = TUNER_TNF_5335MF,
450 .tda9887_conf = TDA9887_PRESENT,
451 .decoder = EM28XX_SAA711X,
452 .input = { {
453 .type = EM28XX_VMUX_TELEVISION,
454 .vmux = SAA7115_COMPOSITE1,
455 .amux = EM28XX_AMUX_LINE_IN,
456 }, {
457 .type = EM28XX_VMUX_COMPOSITE1,
458 .vmux = SAA7115_COMPOSITE0,
459 .amux = EM28XX_AMUX_LINE_IN,
460 }, {
461 .type = EM28XX_VMUX_SVIDEO,
462 .vmux = SAA7115_SVIDEO3,
463 .amux = EM28XX_AMUX_LINE_IN,
464 } },
466 [EM2820_BOARD_LEADTEK_WINFAST_USBII_DELUXE] = {
467 .name = "Leadtek Winfast USB II Deluxe",
468 .valid = EM28XX_BOARD_NOT_VALIDATED,
469 .tuner_type = TUNER_PHILIPS_FM1216ME_MK3,
470 .has_ir_i2c = 1,
471 .tvaudio_addr = 0x58,
472 .tda9887_conf = TDA9887_PRESENT |
473 TDA9887_PORT2_ACTIVE |
474 TDA9887_QSS,
475 .decoder = EM28XX_SAA711X,
476 .adecoder = EM28XX_TVAUDIO,
477 .input = { {
478 .type = EM28XX_VMUX_TELEVISION,
479 .vmux = SAA7115_COMPOSITE4,
480 .amux = EM28XX_AMUX_AUX,
481 }, {
482 .type = EM28XX_VMUX_COMPOSITE1,
483 .vmux = SAA7115_COMPOSITE5,
484 .amux = EM28XX_AMUX_LINE_IN,
485 }, {
486 .type = EM28XX_VMUX_SVIDEO,
487 .vmux = SAA7115_SVIDEO3,
488 .amux = EM28XX_AMUX_LINE_IN,
489 } },
490 .radio = {
491 .type = EM28XX_RADIO,
492 .amux = EM28XX_AMUX_AUX,
495 [EM2820_BOARD_VIDEOLOGY_20K14XUSB] = {
496 .name = "Videology 20K14XUSB USB2.0",
497 .valid = EM28XX_BOARD_NOT_VALIDATED,
498 .tuner_type = TUNER_ABSENT,
499 .is_webcam = 1,
500 .input = { {
501 .type = EM28XX_VMUX_COMPOSITE1,
502 .vmux = 0,
503 .amux = EM28XX_AMUX_VIDEO,
504 } },
506 [EM2820_BOARD_SILVERCREST_WEBCAM] = {
507 .name = "Silvercrest Webcam 1.3mpix",
508 .tuner_type = TUNER_ABSENT,
509 .is_webcam = 1,
510 .input = { {
511 .type = EM28XX_VMUX_COMPOSITE1,
512 .vmux = 0,
513 .amux = EM28XX_AMUX_VIDEO,
514 .gpio = silvercrest_reg_seq,
515 } },
517 [EM2821_BOARD_SUPERCOMP_USB_2] = {
518 .name = "Supercomp USB 2.0 TV",
519 .valid = EM28XX_BOARD_NOT_VALIDATED,
520 .tuner_type = TUNER_PHILIPS_FM1236_MK3,
521 .tda9887_conf = TDA9887_PRESENT |
522 TDA9887_PORT1_ACTIVE |
523 TDA9887_PORT2_ACTIVE,
524 .decoder = EM28XX_SAA711X,
525 .input = { {
526 .type = EM28XX_VMUX_TELEVISION,
527 .vmux = SAA7115_COMPOSITE2,
528 .amux = EM28XX_AMUX_LINE_IN,
529 }, {
530 .type = EM28XX_VMUX_COMPOSITE1,
531 .vmux = SAA7115_COMPOSITE0,
532 .amux = EM28XX_AMUX_VIDEO,
533 }, {
534 .type = EM28XX_VMUX_SVIDEO,
535 .vmux = SAA7115_SVIDEO3,
536 .amux = EM28XX_AMUX_LINE_IN,
537 } },
539 [EM2821_BOARD_USBGEAR_VD204] = {
540 .name = "Usbgear VD204v9",
541 .valid = EM28XX_BOARD_NOT_VALIDATED,
542 .tuner_type = TUNER_ABSENT, /* Capture only device */
543 .decoder = EM28XX_SAA711X,
544 .input = { {
545 .type = EM28XX_VMUX_COMPOSITE1,
546 .vmux = SAA7115_COMPOSITE0,
547 .amux = EM28XX_AMUX_LINE_IN,
548 }, {
549 .type = EM28XX_VMUX_SVIDEO,
550 .vmux = SAA7115_SVIDEO3,
551 .amux = EM28XX_AMUX_LINE_IN,
552 } },
554 [EM2860_BOARD_NETGMBH_CAM] = {
555 /* Beijing Huaqi Information Digital Technology Co., Ltd */
556 .name = "NetGMBH Cam",
557 .valid = EM28XX_BOARD_NOT_VALIDATED,
558 .tuner_type = TUNER_ABSENT,
559 .is_webcam = 1,
560 .input = { {
561 .type = EM28XX_VMUX_COMPOSITE1,
562 .vmux = 0,
563 .amux = EM28XX_AMUX_VIDEO,
564 } },
566 [EM2860_BOARD_TYPHOON_DVD_MAKER] = {
567 .name = "Typhoon DVD Maker",
568 .decoder = EM28XX_SAA711X,
569 .tuner_type = TUNER_ABSENT, /* Capture only device */
570 .input = { {
571 .type = EM28XX_VMUX_COMPOSITE1,
572 .vmux = SAA7115_COMPOSITE0,
573 .amux = EM28XX_AMUX_LINE_IN,
574 }, {
575 .type = EM28XX_VMUX_SVIDEO,
576 .vmux = SAA7115_SVIDEO3,
577 .amux = EM28XX_AMUX_LINE_IN,
578 } },
580 [EM2860_BOARD_GADMEI_UTV330] = {
581 .name = "Gadmei UTV330",
582 .valid = EM28XX_BOARD_NOT_VALIDATED,
583 .tuner_type = TUNER_TNF_5335MF,
584 .tda9887_conf = TDA9887_PRESENT,
585 .decoder = EM28XX_SAA711X,
586 .input = { {
587 .type = EM28XX_VMUX_TELEVISION,
588 .vmux = SAA7115_COMPOSITE2,
589 .amux = EM28XX_AMUX_VIDEO,
590 }, {
591 .type = EM28XX_VMUX_COMPOSITE1,
592 .vmux = SAA7115_COMPOSITE0,
593 .amux = EM28XX_AMUX_LINE_IN,
594 }, {
595 .type = EM28XX_VMUX_SVIDEO,
596 .vmux = SAA7115_SVIDEO3,
597 .amux = EM28XX_AMUX_LINE_IN,
598 } },
600 [EM2861_BOARD_GADMEI_UTV330PLUS] = {
601 .name = "Gadmei UTV330+",
602 .tuner_type = TUNER_TNF_5335MF,
603 .tda9887_conf = TDA9887_PRESENT,
604 .ir_codes = &ir_codes_gadmei_rm008z_table,
605 .decoder = EM28XX_SAA711X,
606 .xclk = EM28XX_XCLK_FREQUENCY_12MHZ,
607 .input = { {
608 .type = EM28XX_VMUX_TELEVISION,
609 .vmux = SAA7115_COMPOSITE2,
610 .amux = EM28XX_AMUX_VIDEO,
611 }, {
612 .type = EM28XX_VMUX_COMPOSITE1,
613 .vmux = SAA7115_COMPOSITE0,
614 .amux = EM28XX_AMUX_LINE_IN,
615 }, {
616 .type = EM28XX_VMUX_SVIDEO,
617 .vmux = SAA7115_SVIDEO3,
618 .amux = EM28XX_AMUX_LINE_IN,
619 } },
621 [EM2860_BOARD_TERRATEC_HYBRID_XS] = {
622 .name = "Terratec Cinergy A Hybrid XS",
623 .valid = EM28XX_BOARD_NOT_VALIDATED,
624 .tuner_type = TUNER_XC2028,
625 .tuner_gpio = default_tuner_gpio,
626 .decoder = EM28XX_TVP5150,
628 .input = { {
629 .type = EM28XX_VMUX_TELEVISION,
630 .vmux = TVP5150_COMPOSITE0,
631 .amux = EM28XX_AMUX_VIDEO,
632 .gpio = hauppauge_wintv_hvr_900_analog,
633 }, {
634 .type = EM28XX_VMUX_COMPOSITE1,
635 .vmux = TVP5150_COMPOSITE1,
636 .amux = EM28XX_AMUX_LINE_IN,
637 .gpio = hauppauge_wintv_hvr_900_analog,
638 }, {
639 .type = EM28XX_VMUX_SVIDEO,
640 .vmux = TVP5150_SVIDEO,
641 .amux = EM28XX_AMUX_LINE_IN,
642 .gpio = hauppauge_wintv_hvr_900_analog,
643 } },
645 [EM2861_BOARD_KWORLD_PVRTV_300U] = {
646 .name = "KWorld PVRTV 300U",
647 .valid = EM28XX_BOARD_NOT_VALIDATED,
648 .tuner_type = TUNER_XC2028,
649 .tuner_gpio = default_tuner_gpio,
650 .decoder = EM28XX_TVP5150,
651 .input = { {
652 .type = EM28XX_VMUX_TELEVISION,
653 .vmux = TVP5150_COMPOSITE0,
654 .amux = EM28XX_AMUX_VIDEO,
655 }, {
656 .type = EM28XX_VMUX_COMPOSITE1,
657 .vmux = TVP5150_COMPOSITE1,
658 .amux = EM28XX_AMUX_LINE_IN,
659 }, {
660 .type = EM28XX_VMUX_SVIDEO,
661 .vmux = TVP5150_SVIDEO,
662 .amux = EM28XX_AMUX_LINE_IN,
663 } },
665 [EM2861_BOARD_YAKUMO_MOVIE_MIXER] = {
666 .name = "Yakumo MovieMixer",
667 .tuner_type = TUNER_ABSENT, /* Capture only device */
668 .decoder = EM28XX_TVP5150,
669 .input = { {
670 .type = EM28XX_VMUX_TELEVISION,
671 .vmux = TVP5150_COMPOSITE0,
672 .amux = EM28XX_AMUX_VIDEO,
673 }, {
674 .type = EM28XX_VMUX_COMPOSITE1,
675 .vmux = TVP5150_COMPOSITE1,
676 .amux = EM28XX_AMUX_LINE_IN,
677 }, {
678 .type = EM28XX_VMUX_SVIDEO,
679 .vmux = TVP5150_SVIDEO,
680 .amux = EM28XX_AMUX_LINE_IN,
681 } },
683 [EM2861_BOARD_PLEXTOR_PX_TV100U] = {
684 .name = "Plextor ConvertX PX-TV100U",
685 .tuner_type = TUNER_TNF_5335MF,
686 .xclk = EM28XX_XCLK_I2S_MSB_TIMING |
687 EM28XX_XCLK_FREQUENCY_12MHZ,
688 .tda9887_conf = TDA9887_PRESENT,
689 .decoder = EM28XX_TVP5150,
690 .has_msp34xx = 1,
691 .input = { {
692 .type = EM28XX_VMUX_TELEVISION,
693 .vmux = TVP5150_COMPOSITE0,
694 .amux = EM28XX_AMUX_LINE_IN,
695 .gpio = pinnacle_hybrid_pro_analog,
696 }, {
697 .type = EM28XX_VMUX_COMPOSITE1,
698 .vmux = TVP5150_COMPOSITE1,
699 .amux = EM28XX_AMUX_LINE_IN,
700 .gpio = pinnacle_hybrid_pro_analog,
701 }, {
702 .type = EM28XX_VMUX_SVIDEO,
703 .vmux = TVP5150_SVIDEO,
704 .amux = EM28XX_AMUX_LINE_IN,
705 .gpio = pinnacle_hybrid_pro_analog,
706 } },
709 /* Those boards with em2870 are DVB Only*/
711 [EM2870_BOARD_TERRATEC_XS] = {
712 .name = "Terratec Cinergy T XS",
713 .valid = EM28XX_BOARD_NOT_VALIDATED,
714 .tuner_type = TUNER_XC2028,
715 .tuner_gpio = default_tuner_gpio,
717 [EM2870_BOARD_TERRATEC_XS_MT2060] = {
718 .name = "Terratec Cinergy T XS (MT2060)",
719 .valid = EM28XX_BOARD_NOT_VALIDATED,
720 .tuner_type = TUNER_ABSENT, /* MT2060 */
722 [EM2870_BOARD_KWORLD_350U] = {
723 .name = "Kworld 350 U DVB-T",
724 .valid = EM28XX_BOARD_NOT_VALIDATED,
725 .tuner_type = TUNER_XC2028,
726 .tuner_gpio = default_tuner_gpio,
728 [EM2870_BOARD_KWORLD_355U] = {
729 .name = "Kworld 355 U DVB-T",
730 .valid = EM28XX_BOARD_NOT_VALIDATED,
732 [EM2870_BOARD_PINNACLE_PCTV_DVB] = {
733 .name = "Pinnacle PCTV DVB-T",
734 .valid = EM28XX_BOARD_NOT_VALIDATED,
735 .tuner_type = TUNER_ABSENT, /* MT2060 */
736 /* djh - I have serious doubts this is right... */
737 .xclk = EM28XX_XCLK_IR_RC5_MODE |
738 EM28XX_XCLK_FREQUENCY_10MHZ,
740 [EM2870_BOARD_COMPRO_VIDEOMATE] = {
741 .name = "Compro, VideoMate U3",
742 .valid = EM28XX_BOARD_NOT_VALIDATED,
743 .tuner_type = TUNER_ABSENT, /* MT2060 */
746 [EM2880_BOARD_TERRATEC_HYBRID_XS_FR] = {
747 .name = "Terratec Hybrid XS Secam",
748 .has_msp34xx = 1,
749 .tuner_type = TUNER_XC2028,
750 .tuner_gpio = default_tuner_gpio,
751 .decoder = EM28XX_TVP5150,
752 .has_dvb = 1,
753 .dvb_gpio = default_digital,
754 .input = { {
755 .type = EM28XX_VMUX_TELEVISION,
756 .vmux = TVP5150_COMPOSITE0,
757 .amux = EM28XX_AMUX_VIDEO,
758 .gpio = default_analog,
759 }, {
760 .type = EM28XX_VMUX_COMPOSITE1,
761 .vmux = TVP5150_COMPOSITE1,
762 .amux = EM28XX_AMUX_LINE_IN,
763 .gpio = default_analog,
764 }, {
765 .type = EM28XX_VMUX_SVIDEO,
766 .vmux = TVP5150_SVIDEO,
767 .amux = EM28XX_AMUX_LINE_IN,
768 .gpio = default_analog,
769 } },
771 [EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900] = {
772 .name = "Hauppauge WinTV HVR 900",
773 .tda9887_conf = TDA9887_PRESENT,
774 .tuner_type = TUNER_XC2028,
775 .tuner_gpio = default_tuner_gpio,
776 .mts_firmware = 1,
777 .has_dvb = 1,
778 .dvb_gpio = hauppauge_wintv_hvr_900_digital,
779 .ir_codes = &ir_codes_hauppauge_new_table,
780 .decoder = EM28XX_TVP5150,
781 .input = { {
782 .type = EM28XX_VMUX_TELEVISION,
783 .vmux = TVP5150_COMPOSITE0,
784 .amux = EM28XX_AMUX_VIDEO,
785 .gpio = hauppauge_wintv_hvr_900_analog,
786 }, {
787 .type = EM28XX_VMUX_COMPOSITE1,
788 .vmux = TVP5150_COMPOSITE1,
789 .amux = EM28XX_AMUX_LINE_IN,
790 .gpio = hauppauge_wintv_hvr_900_analog,
791 }, {
792 .type = EM28XX_VMUX_SVIDEO,
793 .vmux = TVP5150_SVIDEO,
794 .amux = EM28XX_AMUX_LINE_IN,
795 .gpio = hauppauge_wintv_hvr_900_analog,
796 } },
798 [EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900_R2] = {
799 .name = "Hauppauge WinTV HVR 900 (R2)",
800 .tda9887_conf = TDA9887_PRESENT,
801 .tuner_type = TUNER_XC2028,
802 .tuner_gpio = default_tuner_gpio,
803 .mts_firmware = 1,
804 .ir_codes = &ir_codes_hauppauge_new_table,
805 .decoder = EM28XX_TVP5150,
806 .input = { {
807 .type = EM28XX_VMUX_TELEVISION,
808 .vmux = TVP5150_COMPOSITE0,
809 .amux = EM28XX_AMUX_VIDEO,
810 .gpio = hauppauge_wintv_hvr_900_analog,
811 }, {
812 .type = EM28XX_VMUX_COMPOSITE1,
813 .vmux = TVP5150_COMPOSITE1,
814 .amux = EM28XX_AMUX_LINE_IN,
815 .gpio = hauppauge_wintv_hvr_900_analog,
816 }, {
817 .type = EM28XX_VMUX_SVIDEO,
818 .vmux = TVP5150_SVIDEO,
819 .amux = EM28XX_AMUX_LINE_IN,
820 .gpio = hauppauge_wintv_hvr_900_analog,
821 } },
823 [EM2883_BOARD_HAUPPAUGE_WINTV_HVR_850] = {
824 .name = "Hauppauge WinTV HVR 850",
825 .tuner_type = TUNER_XC2028,
826 .tuner_gpio = default_tuner_gpio,
827 .mts_firmware = 1,
828 .has_dvb = 1,
829 .dvb_gpio = hauppauge_wintv_hvr_900_digital,
830 .ir_codes = &ir_codes_hauppauge_new_table,
831 .decoder = EM28XX_TVP5150,
832 .input = { {
833 .type = EM28XX_VMUX_TELEVISION,
834 .vmux = TVP5150_COMPOSITE0,
835 .amux = EM28XX_AMUX_VIDEO,
836 .gpio = hauppauge_wintv_hvr_900_analog,
837 }, {
838 .type = EM28XX_VMUX_COMPOSITE1,
839 .vmux = TVP5150_COMPOSITE1,
840 .amux = EM28XX_AMUX_LINE_IN,
841 .gpio = hauppauge_wintv_hvr_900_analog,
842 }, {
843 .type = EM28XX_VMUX_SVIDEO,
844 .vmux = TVP5150_SVIDEO,
845 .amux = EM28XX_AMUX_LINE_IN,
846 .gpio = hauppauge_wintv_hvr_900_analog,
847 } },
849 [EM2883_BOARD_HAUPPAUGE_WINTV_HVR_950] = {
850 .name = "Hauppauge WinTV HVR 950",
851 .tuner_type = TUNER_XC2028,
852 .tuner_gpio = default_tuner_gpio,
853 .mts_firmware = 1,
854 .has_dvb = 1,
855 .dvb_gpio = hauppauge_wintv_hvr_900_digital,
856 .ir_codes = &ir_codes_rc5_hauppauge_new_table,
857 .decoder = EM28XX_TVP5150,
858 .input = { {
859 .type = EM28XX_VMUX_TELEVISION,
860 .vmux = TVP5150_COMPOSITE0,
861 .amux = EM28XX_AMUX_VIDEO,
862 .gpio = hauppauge_wintv_hvr_900_analog,
863 }, {
864 .type = EM28XX_VMUX_COMPOSITE1,
865 .vmux = TVP5150_COMPOSITE1,
866 .amux = EM28XX_AMUX_LINE_IN,
867 .gpio = hauppauge_wintv_hvr_900_analog,
868 }, {
869 .type = EM28XX_VMUX_SVIDEO,
870 .vmux = TVP5150_SVIDEO,
871 .amux = EM28XX_AMUX_LINE_IN,
872 .gpio = hauppauge_wintv_hvr_900_analog,
873 } },
875 [EM2880_BOARD_PINNACLE_PCTV_HD_PRO] = {
876 .name = "Pinnacle PCTV HD Pro Stick",
877 .tuner_type = TUNER_XC2028,
878 .tuner_gpio = default_tuner_gpio,
879 .mts_firmware = 1,
880 .has_dvb = 1,
881 .dvb_gpio = hauppauge_wintv_hvr_900_digital,
882 .ir_codes = &ir_codes_pinnacle_pctv_hd_table,
883 .decoder = EM28XX_TVP5150,
884 .input = { {
885 .type = EM28XX_VMUX_TELEVISION,
886 .vmux = TVP5150_COMPOSITE0,
887 .amux = EM28XX_AMUX_VIDEO,
888 .gpio = hauppauge_wintv_hvr_900_analog,
889 }, {
890 .type = EM28XX_VMUX_COMPOSITE1,
891 .vmux = TVP5150_COMPOSITE1,
892 .amux = EM28XX_AMUX_LINE_IN,
893 .gpio = hauppauge_wintv_hvr_900_analog,
894 }, {
895 .type = EM28XX_VMUX_SVIDEO,
896 .vmux = TVP5150_SVIDEO,
897 .amux = EM28XX_AMUX_LINE_IN,
898 .gpio = hauppauge_wintv_hvr_900_analog,
899 } },
901 [EM2880_BOARD_AMD_ATI_TV_WONDER_HD_600] = {
902 .name = "AMD ATI TV Wonder HD 600",
903 .tuner_type = TUNER_XC2028,
904 .tuner_gpio = default_tuner_gpio,
905 .mts_firmware = 1,
906 .has_dvb = 1,
907 .dvb_gpio = hauppauge_wintv_hvr_900_digital,
908 .ir_codes = &ir_codes_ati_tv_wonder_hd_600_table,
909 .decoder = EM28XX_TVP5150,
910 .input = { {
911 .type = EM28XX_VMUX_TELEVISION,
912 .vmux = TVP5150_COMPOSITE0,
913 .amux = EM28XX_AMUX_VIDEO,
914 .gpio = hauppauge_wintv_hvr_900_analog,
915 }, {
916 .type = EM28XX_VMUX_COMPOSITE1,
917 .vmux = TVP5150_COMPOSITE1,
918 .amux = EM28XX_AMUX_LINE_IN,
919 .gpio = hauppauge_wintv_hvr_900_analog,
920 }, {
921 .type = EM28XX_VMUX_SVIDEO,
922 .vmux = TVP5150_SVIDEO,
923 .amux = EM28XX_AMUX_LINE_IN,
924 .gpio = hauppauge_wintv_hvr_900_analog,
925 } },
927 [EM2880_BOARD_TERRATEC_HYBRID_XS] = {
928 .name = "Terratec Hybrid XS",
929 .tuner_type = TUNER_XC2028,
930 .tuner_gpio = default_tuner_gpio,
931 .decoder = EM28XX_TVP5150,
932 .has_dvb = 1,
933 .dvb_gpio = default_digital,
934 .ir_codes = &ir_codes_terratec_cinergy_xs_table,
935 .xclk = EM28XX_XCLK_FREQUENCY_12MHZ, /* NEC IR */
936 .input = { {
937 .type = EM28XX_VMUX_TELEVISION,
938 .vmux = TVP5150_COMPOSITE0,
939 .amux = EM28XX_AMUX_VIDEO,
940 .gpio = default_analog,
941 }, {
942 .type = EM28XX_VMUX_COMPOSITE1,
943 .vmux = TVP5150_COMPOSITE1,
944 .amux = EM28XX_AMUX_LINE_IN,
945 .gpio = default_analog,
946 }, {
947 .type = EM28XX_VMUX_SVIDEO,
948 .vmux = TVP5150_SVIDEO,
949 .amux = EM28XX_AMUX_LINE_IN,
950 .gpio = default_analog,
951 } },
953 /* maybe there's a reason behind it why Terratec sells the Hybrid XS
954 as Prodigy XS with a different PID, let's keep it separated for now
955 maybe we'll need it lateron */
956 [EM2880_BOARD_TERRATEC_PRODIGY_XS] = {
957 .name = "Terratec Prodigy XS",
958 .tuner_type = TUNER_XC2028,
959 .tuner_gpio = default_tuner_gpio,
960 .decoder = EM28XX_TVP5150,
961 .input = { {
962 .type = EM28XX_VMUX_TELEVISION,
963 .vmux = TVP5150_COMPOSITE0,
964 .amux = EM28XX_AMUX_VIDEO,
965 .gpio = hauppauge_wintv_hvr_900_analog,
966 }, {
967 .type = EM28XX_VMUX_COMPOSITE1,
968 .vmux = TVP5150_COMPOSITE1,
969 .amux = EM28XX_AMUX_LINE_IN,
970 .gpio = hauppauge_wintv_hvr_900_analog,
971 }, {
972 .type = EM28XX_VMUX_SVIDEO,
973 .vmux = TVP5150_SVIDEO,
974 .amux = EM28XX_AMUX_LINE_IN,
975 .gpio = hauppauge_wintv_hvr_900_analog,
976 } },
978 [EM2820_BOARD_MSI_VOX_USB_2] = {
979 .name = "MSI VOX USB 2.0",
980 .tuner_type = TUNER_LG_PAL_NEW_TAPC,
981 .tda9887_conf = TDA9887_PRESENT |
982 TDA9887_PORT1_ACTIVE |
983 TDA9887_PORT2_ACTIVE,
984 .max_range_640_480 = 1,
985 .decoder = EM28XX_SAA711X,
986 .input = { {
987 .type = EM28XX_VMUX_TELEVISION,
988 .vmux = SAA7115_COMPOSITE4,
989 .amux = EM28XX_AMUX_VIDEO,
990 }, {
991 .type = EM28XX_VMUX_COMPOSITE1,
992 .vmux = SAA7115_COMPOSITE0,
993 .amux = EM28XX_AMUX_LINE_IN,
994 }, {
995 .type = EM28XX_VMUX_SVIDEO,
996 .vmux = SAA7115_SVIDEO3,
997 .amux = EM28XX_AMUX_LINE_IN,
998 } },
1000 [EM2800_BOARD_TERRATEC_CINERGY_200] = {
1001 .name = "Terratec Cinergy 200 USB",
1002 .is_em2800 = 1,
1003 .has_ir_i2c = 1,
1004 .tuner_type = TUNER_LG_PAL_NEW_TAPC,
1005 .tda9887_conf = TDA9887_PRESENT,
1006 .decoder = EM28XX_SAA711X,
1007 .input = { {
1008 .type = EM28XX_VMUX_TELEVISION,
1009 .vmux = SAA7115_COMPOSITE2,
1010 .amux = EM28XX_AMUX_VIDEO,
1011 }, {
1012 .type = EM28XX_VMUX_COMPOSITE1,
1013 .vmux = SAA7115_COMPOSITE0,
1014 .amux = EM28XX_AMUX_LINE_IN,
1015 }, {
1016 .type = EM28XX_VMUX_SVIDEO,
1017 .vmux = SAA7115_SVIDEO3,
1018 .amux = EM28XX_AMUX_LINE_IN,
1019 } },
1021 [EM2800_BOARD_GRABBEEX_USB2800] = {
1022 .name = "eMPIA Technology, Inc. GrabBeeX+ Video Encoder",
1023 .is_em2800 = 1,
1024 .decoder = EM28XX_SAA711X,
1025 .tuner_type = TUNER_ABSENT, /* capture only board */
1026 .input = { {
1027 .type = EM28XX_VMUX_COMPOSITE1,
1028 .vmux = SAA7115_COMPOSITE0,
1029 .amux = EM28XX_AMUX_LINE_IN,
1030 }, {
1031 .type = EM28XX_VMUX_SVIDEO,
1032 .vmux = SAA7115_SVIDEO3,
1033 .amux = EM28XX_AMUX_LINE_IN,
1034 } },
1036 [EM2800_BOARD_VC211A] = {
1037 .name = "Actionmaster/LinXcel/Digitus VC211A",
1038 .is_em2800 = 1,
1039 .tuner_type = TUNER_ABSENT, /* Capture-only board */
1040 .decoder = EM28XX_SAA711X,
1041 .input = { {
1042 .type = EM28XX_VMUX_COMPOSITE1,
1043 .vmux = SAA7115_COMPOSITE0,
1044 .amux = EM28XX_AMUX_LINE_IN,
1045 .gpio = vc211a_enable,
1046 }, {
1047 .type = EM28XX_VMUX_SVIDEO,
1048 .vmux = SAA7115_SVIDEO3,
1049 .amux = EM28XX_AMUX_LINE_IN,
1050 .gpio = vc211a_enable,
1051 } },
1053 [EM2800_BOARD_LEADTEK_WINFAST_USBII] = {
1054 .name = "Leadtek Winfast USB II",
1055 .is_em2800 = 1,
1056 .tuner_type = TUNER_LG_PAL_NEW_TAPC,
1057 .tda9887_conf = TDA9887_PRESENT,
1058 .decoder = EM28XX_SAA711X,
1059 .input = { {
1060 .type = EM28XX_VMUX_TELEVISION,
1061 .vmux = SAA7115_COMPOSITE2,
1062 .amux = EM28XX_AMUX_VIDEO,
1063 }, {
1064 .type = EM28XX_VMUX_COMPOSITE1,
1065 .vmux = SAA7115_COMPOSITE0,
1066 .amux = EM28XX_AMUX_LINE_IN,
1067 }, {
1068 .type = EM28XX_VMUX_SVIDEO,
1069 .vmux = SAA7115_SVIDEO3,
1070 .amux = EM28XX_AMUX_LINE_IN,
1071 } },
1073 [EM2800_BOARD_KWORLD_USB2800] = {
1074 .name = "Kworld USB2800",
1075 .is_em2800 = 1,
1076 .tuner_type = TUNER_PHILIPS_FCV1236D,
1077 .tda9887_conf = TDA9887_PRESENT,
1078 .decoder = EM28XX_SAA711X,
1079 .input = { {
1080 .type = EM28XX_VMUX_TELEVISION,
1081 .vmux = SAA7115_COMPOSITE2,
1082 .amux = EM28XX_AMUX_VIDEO,
1083 }, {
1084 .type = EM28XX_VMUX_COMPOSITE1,
1085 .vmux = SAA7115_COMPOSITE0,
1086 .amux = EM28XX_AMUX_LINE_IN,
1087 }, {
1088 .type = EM28XX_VMUX_SVIDEO,
1089 .vmux = SAA7115_SVIDEO3,
1090 .amux = EM28XX_AMUX_LINE_IN,
1091 } },
1093 [EM2820_BOARD_PINNACLE_DVC_90] = {
1094 .name = "Pinnacle Dazzle DVC 90/100/101/107 / Kaiser Baas Video to DVD maker "
1095 "/ Kworld DVD Maker 2",
1096 .tuner_type = TUNER_ABSENT, /* capture only board */
1097 .decoder = EM28XX_SAA711X,
1098 .input = { {
1099 .type = EM28XX_VMUX_COMPOSITE1,
1100 .vmux = SAA7115_COMPOSITE0,
1101 .amux = EM28XX_AMUX_LINE_IN,
1102 }, {
1103 .type = EM28XX_VMUX_SVIDEO,
1104 .vmux = SAA7115_SVIDEO3,
1105 .amux = EM28XX_AMUX_LINE_IN,
1106 } },
1108 [EM2800_BOARD_VGEAR_POCKETTV] = {
1109 .name = "V-Gear PocketTV",
1110 .is_em2800 = 1,
1111 .tuner_type = TUNER_LG_PAL_NEW_TAPC,
1112 .tda9887_conf = TDA9887_PRESENT,
1113 .decoder = EM28XX_SAA711X,
1114 .input = { {
1115 .type = EM28XX_VMUX_TELEVISION,
1116 .vmux = SAA7115_COMPOSITE2,
1117 .amux = EM28XX_AMUX_VIDEO,
1118 }, {
1119 .type = EM28XX_VMUX_COMPOSITE1,
1120 .vmux = SAA7115_COMPOSITE0,
1121 .amux = EM28XX_AMUX_LINE_IN,
1122 }, {
1123 .type = EM28XX_VMUX_SVIDEO,
1124 .vmux = SAA7115_SVIDEO3,
1125 .amux = EM28XX_AMUX_LINE_IN,
1126 } },
1128 [EM2820_BOARD_PROLINK_PLAYTV_BOX4_USB2] = {
1129 .name = "Pixelview PlayTV Box 4 USB 2.0",
1130 .tda9887_conf = TDA9887_PRESENT,
1131 .tuner_type = TUNER_YMEC_TVF_5533MF,
1132 .decoder = EM28XX_SAA711X,
1133 .input = { {
1134 .type = EM28XX_VMUX_TELEVISION,
1135 .vmux = SAA7115_COMPOSITE2,
1136 .amux = EM28XX_AMUX_VIDEO,
1137 .aout = EM28XX_AOUT_MONO | /* I2S */
1138 EM28XX_AOUT_MASTER, /* Line out pin */
1139 }, {
1140 .type = EM28XX_VMUX_COMPOSITE1,
1141 .vmux = SAA7115_COMPOSITE0,
1142 .amux = EM28XX_AMUX_LINE_IN,
1143 }, {
1144 .type = EM28XX_VMUX_SVIDEO,
1145 .vmux = SAA7115_SVIDEO3,
1146 .amux = EM28XX_AMUX_LINE_IN,
1147 } },
1149 [EM2820_BOARD_PROLINK_PLAYTV_USB2] = {
1150 .name = "SIIG AVTuner-PVR / Pixelview Prolink PlayTV USB 2.0",
1151 .has_snapshot_button = 1,
1152 .tda9887_conf = TDA9887_PRESENT,
1153 .tuner_type = TUNER_YMEC_TVF_5533MF,
1154 .decoder = EM28XX_SAA711X,
1155 .input = { {
1156 .type = EM28XX_VMUX_TELEVISION,
1157 .vmux = SAA7115_COMPOSITE2,
1158 .amux = EM28XX_AMUX_VIDEO,
1159 .aout = EM28XX_AOUT_MONO | /* I2S */
1160 EM28XX_AOUT_MASTER, /* Line out pin */
1161 }, {
1162 .type = EM28XX_VMUX_COMPOSITE1,
1163 .vmux = SAA7115_COMPOSITE0,
1164 .amux = EM28XX_AMUX_LINE_IN,
1165 }, {
1166 .type = EM28XX_VMUX_SVIDEO,
1167 .vmux = SAA7115_SVIDEO3,
1168 .amux = EM28XX_AMUX_LINE_IN,
1169 } },
1171 [EM2860_BOARD_SAA711X_REFERENCE_DESIGN] = {
1172 .name = "EM2860/SAA711X Reference Design",
1173 .has_snapshot_button = 1,
1174 .tuner_type = TUNER_ABSENT,
1175 .decoder = EM28XX_SAA711X,
1176 .input = { {
1177 .type = EM28XX_VMUX_SVIDEO,
1178 .vmux = SAA7115_SVIDEO3,
1179 }, {
1180 .type = EM28XX_VMUX_COMPOSITE1,
1181 .vmux = SAA7115_COMPOSITE0,
1182 } },
1184 [EM2880_BOARD_MSI_DIGIVOX_AD] = {
1185 .name = "MSI DigiVox A/D",
1186 .valid = EM28XX_BOARD_NOT_VALIDATED,
1187 .tuner_type = TUNER_XC2028,
1188 .tuner_gpio = default_tuner_gpio,
1189 .decoder = EM28XX_TVP5150,
1190 .input = { {
1191 .type = EM28XX_VMUX_TELEVISION,
1192 .vmux = TVP5150_COMPOSITE0,
1193 .amux = EM28XX_AMUX_VIDEO,
1194 .gpio = em2880_msi_digivox_ad_analog,
1195 }, {
1196 .type = EM28XX_VMUX_COMPOSITE1,
1197 .vmux = TVP5150_COMPOSITE1,
1198 .amux = EM28XX_AMUX_LINE_IN,
1199 .gpio = em2880_msi_digivox_ad_analog,
1200 }, {
1201 .type = EM28XX_VMUX_SVIDEO,
1202 .vmux = TVP5150_SVIDEO,
1203 .amux = EM28XX_AMUX_LINE_IN,
1204 .gpio = em2880_msi_digivox_ad_analog,
1205 } },
1207 [EM2880_BOARD_MSI_DIGIVOX_AD_II] = {
1208 .name = "MSI DigiVox A/D II",
1209 .valid = EM28XX_BOARD_NOT_VALIDATED,
1210 .tuner_type = TUNER_XC2028,
1211 .tuner_gpio = default_tuner_gpio,
1212 .decoder = EM28XX_TVP5150,
1213 .input = { {
1214 .type = EM28XX_VMUX_TELEVISION,
1215 .vmux = TVP5150_COMPOSITE0,
1216 .amux = EM28XX_AMUX_VIDEO,
1217 .gpio = em2880_msi_digivox_ad_analog,
1218 }, {
1219 .type = EM28XX_VMUX_COMPOSITE1,
1220 .vmux = TVP5150_COMPOSITE1,
1221 .amux = EM28XX_AMUX_LINE_IN,
1222 .gpio = em2880_msi_digivox_ad_analog,
1223 }, {
1224 .type = EM28XX_VMUX_SVIDEO,
1225 .vmux = TVP5150_SVIDEO,
1226 .amux = EM28XX_AMUX_LINE_IN,
1227 .gpio = em2880_msi_digivox_ad_analog,
1228 } },
1230 [EM2880_BOARD_KWORLD_DVB_305U] = {
1231 .name = "KWorld DVB-T 305U",
1232 .valid = EM28XX_BOARD_NOT_VALIDATED,
1233 .tuner_type = TUNER_XC2028,
1234 .tuner_gpio = default_tuner_gpio,
1235 .decoder = EM28XX_TVP5150,
1236 .input = { {
1237 .type = EM28XX_VMUX_TELEVISION,
1238 .vmux = TVP5150_COMPOSITE0,
1239 .amux = EM28XX_AMUX_VIDEO,
1240 }, {
1241 .type = EM28XX_VMUX_COMPOSITE1,
1242 .vmux = TVP5150_COMPOSITE1,
1243 .amux = EM28XX_AMUX_LINE_IN,
1244 }, {
1245 .type = EM28XX_VMUX_SVIDEO,
1246 .vmux = TVP5150_SVIDEO,
1247 .amux = EM28XX_AMUX_LINE_IN,
1248 } },
1250 [EM2880_BOARD_KWORLD_DVB_310U] = {
1251 .name = "KWorld DVB-T 310U",
1252 .tuner_type = TUNER_XC2028,
1253 .tuner_gpio = default_tuner_gpio,
1254 .has_dvb = 1,
1255 .dvb_gpio = default_digital,
1256 .mts_firmware = 1,
1257 .decoder = EM28XX_TVP5150,
1258 .input = { {
1259 .type = EM28XX_VMUX_TELEVISION,
1260 .vmux = TVP5150_COMPOSITE0,
1261 .amux = EM28XX_AMUX_VIDEO,
1262 .gpio = default_analog,
1263 }, {
1264 .type = EM28XX_VMUX_COMPOSITE1,
1265 .vmux = TVP5150_COMPOSITE1,
1266 .amux = EM28XX_AMUX_LINE_IN,
1267 .gpio = default_analog,
1268 }, { /* S-video has not been tested yet */
1269 .type = EM28XX_VMUX_SVIDEO,
1270 .vmux = TVP5150_SVIDEO,
1271 .amux = EM28XX_AMUX_LINE_IN,
1272 .gpio = default_analog,
1273 } },
1275 [EM2882_BOARD_KWORLD_ATSC_315U] = {
1276 .name = "KWorld ATSC 315U HDTV TV Box",
1277 .valid = EM28XX_BOARD_NOT_VALIDATED,
1278 .tuner_type = TUNER_THOMSON_DTT761X,
1279 .tuner_gpio = em2882_kworld_315u_tuner_gpio,
1280 .tda9887_conf = TDA9887_PRESENT,
1281 .decoder = EM28XX_SAA711X,
1282 .has_dvb = 1,
1283 .dvb_gpio = em2882_kworld_315u_digital,
1284 .ir_codes = &ir_codes_kworld_315u_table,
1285 .xclk = EM28XX_XCLK_FREQUENCY_12MHZ,
1286 .i2c_speed = EM28XX_I2C_CLK_WAIT_ENABLE,
1287 /* Analog mode - still not ready */
1288 /*.input = { {
1289 .type = EM28XX_VMUX_TELEVISION,
1290 .vmux = SAA7115_COMPOSITE2,
1291 .amux = EM28XX_AMUX_VIDEO,
1292 .gpio = em2882_kworld_315u_analog,
1293 .aout = EM28XX_AOUT_PCM_IN | EM28XX_AOUT_PCM_STEREO,
1294 }, {
1295 .type = EM28XX_VMUX_COMPOSITE1,
1296 .vmux = SAA7115_COMPOSITE0,
1297 .amux = EM28XX_AMUX_LINE_IN,
1298 .gpio = em2882_kworld_315u_analog1,
1299 .aout = EM28XX_AOUT_PCM_IN | EM28XX_AOUT_PCM_STEREO,
1300 }, {
1301 .type = EM28XX_VMUX_SVIDEO,
1302 .vmux = SAA7115_SVIDEO3,
1303 .amux = EM28XX_AMUX_LINE_IN,
1304 .gpio = em2882_kworld_315u_analog1,
1305 .aout = EM28XX_AOUT_PCM_IN | EM28XX_AOUT_PCM_STEREO,
1306 } }, */
1308 [EM2880_BOARD_EMPIRE_DUAL_TV] = {
1309 .name = "Empire dual TV",
1310 .tuner_type = TUNER_XC2028,
1311 .tuner_gpio = default_tuner_gpio,
1312 .has_dvb = 1,
1313 .dvb_gpio = default_digital,
1314 .mts_firmware = 1,
1315 .decoder = EM28XX_TVP5150,
1316 .input = { {
1317 .type = EM28XX_VMUX_TELEVISION,
1318 .vmux = TVP5150_COMPOSITE0,
1319 .amux = EM28XX_AMUX_VIDEO,
1320 .gpio = default_analog,
1321 }, {
1322 .type = EM28XX_VMUX_COMPOSITE1,
1323 .vmux = TVP5150_COMPOSITE1,
1324 .amux = EM28XX_AMUX_LINE_IN,
1325 .gpio = default_analog,
1326 }, {
1327 .type = EM28XX_VMUX_SVIDEO,
1328 .vmux = TVP5150_SVIDEO,
1329 .amux = EM28XX_AMUX_LINE_IN,
1330 .gpio = default_analog,
1331 } },
1333 [EM2881_BOARD_DNT_DA2_HYBRID] = {
1334 .name = "DNT DA2 Hybrid",
1335 .valid = EM28XX_BOARD_NOT_VALIDATED,
1336 .tuner_type = TUNER_XC2028,
1337 .tuner_gpio = default_tuner_gpio,
1338 .decoder = EM28XX_TVP5150,
1339 .input = { {
1340 .type = EM28XX_VMUX_TELEVISION,
1341 .vmux = TVP5150_COMPOSITE0,
1342 .amux = EM28XX_AMUX_VIDEO,
1343 .gpio = default_analog,
1344 }, {
1345 .type = EM28XX_VMUX_COMPOSITE1,
1346 .vmux = TVP5150_COMPOSITE1,
1347 .amux = EM28XX_AMUX_LINE_IN,
1348 .gpio = default_analog,
1349 }, {
1350 .type = EM28XX_VMUX_SVIDEO,
1351 .vmux = TVP5150_SVIDEO,
1352 .amux = EM28XX_AMUX_LINE_IN,
1353 .gpio = default_analog,
1354 } },
1356 [EM2881_BOARD_PINNACLE_HYBRID_PRO] = {
1357 .name = "Pinnacle Hybrid Pro",
1358 .tuner_type = TUNER_XC2028,
1359 .tuner_gpio = default_tuner_gpio,
1360 .decoder = EM28XX_TVP5150,
1361 .has_dvb = 1,
1362 .dvb_gpio = pinnacle_hybrid_pro_digital,
1363 .input = { {
1364 .type = EM28XX_VMUX_TELEVISION,
1365 .vmux = TVP5150_COMPOSITE0,
1366 .amux = EM28XX_AMUX_VIDEO,
1367 .gpio = pinnacle_hybrid_pro_analog,
1368 }, {
1369 .type = EM28XX_VMUX_COMPOSITE1,
1370 .vmux = TVP5150_COMPOSITE1,
1371 .amux = EM28XX_AMUX_LINE_IN,
1372 .gpio = pinnacle_hybrid_pro_analog,
1373 }, {
1374 .type = EM28XX_VMUX_SVIDEO,
1375 .vmux = TVP5150_SVIDEO,
1376 .amux = EM28XX_AMUX_LINE_IN,
1377 .gpio = pinnacle_hybrid_pro_analog,
1378 } },
1380 [EM2882_BOARD_PINNACLE_HYBRID_PRO] = {
1381 .name = "Pinnacle Hybrid Pro (2)",
1382 .valid = EM28XX_BOARD_NOT_VALIDATED,
1383 .tuner_type = TUNER_XC2028,
1384 .tuner_gpio = default_tuner_gpio,
1385 .mts_firmware = 1,
1386 .decoder = EM28XX_TVP5150,
1387 .input = { {
1388 .type = EM28XX_VMUX_TELEVISION,
1389 .vmux = TVP5150_COMPOSITE0,
1390 .amux = EM28XX_AMUX_VIDEO,
1391 .gpio = hauppauge_wintv_hvr_900_analog,
1392 }, {
1393 .type = EM28XX_VMUX_COMPOSITE1,
1394 .vmux = TVP5150_COMPOSITE1,
1395 .amux = EM28XX_AMUX_LINE_IN,
1396 .gpio = hauppauge_wintv_hvr_900_analog,
1397 }, {
1398 .type = EM28XX_VMUX_SVIDEO,
1399 .vmux = TVP5150_SVIDEO,
1400 .amux = EM28XX_AMUX_LINE_IN,
1401 .gpio = hauppauge_wintv_hvr_900_analog,
1402 } },
1404 [EM2882_BOARD_KWORLD_VS_DVBT] = {
1405 .name = "Kworld VS-DVB-T 323UR",
1406 .valid = EM28XX_BOARD_NOT_VALIDATED,
1407 .tuner_type = TUNER_XC2028,
1408 .tuner_gpio = default_tuner_gpio,
1409 .decoder = EM28XX_TVP5150,
1410 .input = { {
1411 .type = EM28XX_VMUX_TELEVISION,
1412 .vmux = TVP5150_COMPOSITE0,
1413 .amux = EM28XX_AMUX_VIDEO,
1414 }, {
1415 .type = EM28XX_VMUX_COMPOSITE1,
1416 .vmux = TVP5150_COMPOSITE1,
1417 .amux = EM28XX_AMUX_LINE_IN,
1418 }, {
1419 .type = EM28XX_VMUX_SVIDEO,
1420 .vmux = TVP5150_SVIDEO,
1421 .amux = EM28XX_AMUX_LINE_IN,
1422 } },
1424 [EM2882_BOARD_TERRATEC_HYBRID_XS] = {
1425 .name = "Terratec Hybrid XS (em2882)",
1426 .tuner_type = TUNER_XC2028,
1427 .tuner_gpio = default_tuner_gpio,
1428 .mts_firmware = 1,
1429 .decoder = EM28XX_TVP5150,
1430 .has_dvb = 1,
1431 .dvb_gpio = hauppauge_wintv_hvr_900_digital,
1432 .ir_codes = &ir_codes_terratec_cinergy_xs_table,
1433 .xclk = EM28XX_XCLK_FREQUENCY_12MHZ,
1434 .input = { {
1435 .type = EM28XX_VMUX_TELEVISION,
1436 .vmux = TVP5150_COMPOSITE0,
1437 .amux = EM28XX_AMUX_VIDEO,
1438 .gpio = hauppauge_wintv_hvr_900_analog,
1439 }, {
1440 .type = EM28XX_VMUX_COMPOSITE1,
1441 .vmux = TVP5150_COMPOSITE1,
1442 .amux = EM28XX_AMUX_LINE_IN,
1443 .gpio = hauppauge_wintv_hvr_900_analog,
1444 }, {
1445 .type = EM28XX_VMUX_SVIDEO,
1446 .vmux = TVP5150_SVIDEO,
1447 .amux = EM28XX_AMUX_LINE_IN,
1448 .gpio = hauppauge_wintv_hvr_900_analog,
1449 } },
1451 [EM2882_BOARD_DIKOM_DK300] = {
1452 .name = "Dikom DK300",
1453 .tuner_type = TUNER_XC2028,
1454 .tuner_gpio = default_tuner_gpio,
1455 .decoder = EM28XX_TVP5150,
1456 .mts_firmware = 1,
1457 .has_dvb = 1,
1458 .dvb_gpio = dikom_dk300_digital,
1459 .input = { {
1460 .type = EM28XX_VMUX_TELEVISION,
1461 .vmux = TVP5150_COMPOSITE0,
1462 .amux = EM28XX_AMUX_VIDEO,
1463 .gpio = default_analog,
1464 } },
1466 [EM2883_BOARD_KWORLD_HYBRID_330U] = {
1467 .name = "Kworld PlusTV HD Hybrid 330",
1468 .tuner_type = TUNER_XC2028,
1469 .tuner_gpio = default_tuner_gpio,
1470 .decoder = EM28XX_TVP5150,
1471 .mts_firmware = 1,
1472 .has_dvb = 1,
1473 .dvb_gpio = kworld_330u_digital,
1474 .xclk = EM28XX_XCLK_FREQUENCY_12MHZ,
1475 .i2c_speed = EM28XX_I2C_CLK_WAIT_ENABLE |
1476 EM28XX_I2C_EEPROM_ON_BOARD |
1477 EM28XX_I2C_EEPROM_KEY_VALID,
1478 .input = { {
1479 .type = EM28XX_VMUX_TELEVISION,
1480 .vmux = TVP5150_COMPOSITE0,
1481 .amux = EM28XX_AMUX_VIDEO,
1482 .gpio = kworld_330u_analog,
1483 .aout = EM28XX_AOUT_PCM_IN | EM28XX_AOUT_PCM_STEREO,
1484 }, {
1485 .type = EM28XX_VMUX_COMPOSITE1,
1486 .vmux = TVP5150_COMPOSITE1,
1487 .amux = EM28XX_AMUX_LINE_IN,
1488 .gpio = kworld_330u_analog,
1489 .aout = EM28XX_AOUT_PCM_IN | EM28XX_AOUT_PCM_STEREO,
1490 }, {
1491 .type = EM28XX_VMUX_SVIDEO,
1492 .vmux = TVP5150_SVIDEO,
1493 .amux = EM28XX_AMUX_LINE_IN,
1494 .gpio = kworld_330u_analog,
1495 } },
1497 [EM2820_BOARD_COMPRO_VIDEOMATE_FORYOU] = {
1498 .name = "Compro VideoMate ForYou/Stereo",
1499 .tuner_type = TUNER_LG_PAL_NEW_TAPC,
1500 .tvaudio_addr = 0xb0,
1501 .tda9887_conf = TDA9887_PRESENT,
1502 .decoder = EM28XX_TVP5150,
1503 .adecoder = EM28XX_TVAUDIO,
1504 .mute_gpio = compro_mute_gpio,
1505 .input = { {
1506 .type = EM28XX_VMUX_TELEVISION,
1507 .vmux = TVP5150_COMPOSITE0,
1508 .amux = EM28XX_AMUX_VIDEO,
1509 .gpio = compro_unmute_tv_gpio,
1510 }, {
1511 .type = EM28XX_VMUX_SVIDEO,
1512 .vmux = TVP5150_SVIDEO,
1513 .amux = EM28XX_AMUX_LINE_IN,
1514 .gpio = compro_unmute_svid_gpio,
1515 } },
1517 [EM2860_BOARD_KAIOMY_TVNPC_U2] = {
1518 .name = "Kaiomy TVnPC U2",
1519 .vchannels = 3,
1520 .tuner_type = TUNER_XC2028,
1521 .tuner_addr = 0x61,
1522 .mts_firmware = 1,
1523 .decoder = EM28XX_TVP5150,
1524 .tuner_gpio = default_tuner_gpio,
1525 .ir_codes = &ir_codes_kaiomy_table,
1526 .input = { {
1527 .type = EM28XX_VMUX_TELEVISION,
1528 .vmux = TVP5150_COMPOSITE0,
1529 .amux = EM28XX_AMUX_VIDEO,
1531 }, {
1532 .type = EM28XX_VMUX_COMPOSITE1,
1533 .vmux = TVP5150_COMPOSITE1,
1534 .amux = EM28XX_AMUX_LINE_IN,
1535 }, {
1536 .type = EM28XX_VMUX_SVIDEO,
1537 .vmux = TVP5150_SVIDEO,
1538 .amux = EM28XX_AMUX_LINE_IN,
1539 } },
1540 .radio = {
1541 .type = EM28XX_RADIO,
1542 .amux = EM28XX_AMUX_LINE_IN,
1545 [EM2860_BOARD_EASYCAP] = {
1546 .name = "Easy Cap Capture DC-60",
1547 .vchannels = 2,
1548 .tuner_type = TUNER_ABSENT,
1549 .decoder = EM28XX_SAA711X,
1550 .input = { {
1551 .type = EM28XX_VMUX_COMPOSITE1,
1552 .vmux = SAA7115_COMPOSITE0,
1553 .amux = EM28XX_AMUX_LINE_IN,
1554 }, {
1555 .type = EM28XX_VMUX_SVIDEO,
1556 .vmux = SAA7115_SVIDEO3,
1557 .amux = EM28XX_AMUX_LINE_IN,
1558 } },
1560 [EM2820_BOARD_IODATA_GVMVP_SZ] = {
1561 .name = "IO-DATA GV-MVP/SZ",
1562 .tuner_type = TUNER_PHILIPS_FM1236_MK3,
1563 .tuner_gpio = default_tuner_gpio,
1564 .tda9887_conf = TDA9887_PRESENT,
1565 .decoder = EM28XX_TVP5150,
1566 .input = { {
1567 .type = EM28XX_VMUX_TELEVISION,
1568 .vmux = TVP5150_COMPOSITE0,
1569 .amux = EM28XX_AMUX_VIDEO,
1570 }, { /* Composite has not been tested yet */
1571 .type = EM28XX_VMUX_COMPOSITE1,
1572 .vmux = TVP5150_COMPOSITE1,
1573 .amux = EM28XX_AMUX_VIDEO,
1574 }, { /* S-video has not been tested yet */
1575 .type = EM28XX_VMUX_SVIDEO,
1576 .vmux = TVP5150_SVIDEO,
1577 .amux = EM28XX_AMUX_VIDEO,
1578 } },
1580 [EM2860_BOARD_TERRATEC_GRABBY] = {
1581 .name = "Terratec Grabby",
1582 .vchannels = 2,
1583 .tuner_type = TUNER_ABSENT,
1584 .decoder = EM28XX_SAA711X,
1585 .xclk = EM28XX_XCLK_FREQUENCY_12MHZ,
1586 .input = { {
1587 .type = EM28XX_VMUX_COMPOSITE1,
1588 .vmux = SAA7115_COMPOSITE0,
1589 .amux = EM28XX_AMUX_VIDEO2,
1590 }, {
1591 .type = EM28XX_VMUX_SVIDEO,
1592 .vmux = SAA7115_SVIDEO3,
1593 .amux = EM28XX_AMUX_VIDEO2,
1594 } },
1596 [EM2860_BOARD_TERRATEC_AV350] = {
1597 .name = "Terratec AV350",
1598 .vchannels = 2,
1599 .tuner_type = TUNER_ABSENT,
1600 .decoder = EM28XX_TVP5150,
1601 .xclk = EM28XX_XCLK_FREQUENCY_12MHZ,
1602 .mute_gpio = terratec_av350_mute_gpio,
1603 .input = { {
1604 .type = EM28XX_VMUX_COMPOSITE1,
1605 .vmux = TVP5150_COMPOSITE1,
1606 .amux = EM28XX_AUDIO_SRC_LINE,
1607 .gpio = terratec_av350_unmute_gpio,
1609 }, {
1610 .type = EM28XX_VMUX_SVIDEO,
1611 .vmux = TVP5150_SVIDEO,
1612 .amux = EM28XX_AUDIO_SRC_LINE,
1613 .gpio = terratec_av350_unmute_gpio,
1614 } },
1616 [EM2882_BOARD_EVGA_INDTUBE] = {
1617 .name = "Evga inDtube",
1618 .tuner_type = TUNER_XC2028,
1619 .tuner_gpio = default_tuner_gpio,
1620 .decoder = EM28XX_TVP5150,
1621 .xclk = EM28XX_XCLK_FREQUENCY_12MHZ, /* NEC IR */
1622 .mts_firmware = 1,
1623 .has_dvb = 1,
1624 .dvb_gpio = evga_indtube_digital,
1625 .ir_codes = &ir_codes_evga_indtube_table,
1626 .input = { {
1627 .type = EM28XX_VMUX_TELEVISION,
1628 .vmux = TVP5150_COMPOSITE0,
1629 .amux = EM28XX_AMUX_VIDEO,
1630 .gpio = evga_indtube_analog,
1631 }, {
1632 .type = EM28XX_VMUX_COMPOSITE1,
1633 .vmux = TVP5150_COMPOSITE1,
1634 .amux = EM28XX_AMUX_LINE_IN,
1635 .gpio = evga_indtube_analog,
1636 }, {
1637 .type = EM28XX_VMUX_SVIDEO,
1638 .vmux = TVP5150_SVIDEO,
1639 .amux = EM28XX_AMUX_LINE_IN,
1640 .gpio = evga_indtube_analog,
1641 } },
1643 /* eb1a:2868 Empia EM2870 + Philips CU1216L NIM (Philips TDA10023 +
1644 Infineon TUA6034) */
1645 [EM2870_BOARD_REDDO_DVB_C_USB_BOX] = {
1646 .name = "Reddo DVB-C USB TV Box",
1647 .tuner_type = TUNER_ABSENT,
1648 .tuner_gpio = reddo_dvb_c_usb_box,
1649 .has_dvb = 1,
1652 const unsigned int em28xx_bcount = ARRAY_SIZE(em28xx_boards);
1654 /* table of devices that work with this driver */
1655 struct usb_device_id em28xx_id_table[] = {
1656 { USB_DEVICE(0xeb1a, 0x2750),
1657 .driver_info = EM2750_BOARD_UNKNOWN },
1658 { USB_DEVICE(0xeb1a, 0x2751),
1659 .driver_info = EM2750_BOARD_UNKNOWN },
1660 { USB_DEVICE(0xeb1a, 0x2800),
1661 .driver_info = EM2800_BOARD_UNKNOWN },
1662 { USB_DEVICE(0xeb1a, 0x2710),
1663 .driver_info = EM2820_BOARD_UNKNOWN },
1664 { USB_DEVICE(0xeb1a, 0x2820),
1665 .driver_info = EM2820_BOARD_UNKNOWN },
1666 { USB_DEVICE(0xeb1a, 0x2821),
1667 .driver_info = EM2820_BOARD_UNKNOWN },
1668 { USB_DEVICE(0xeb1a, 0x2860),
1669 .driver_info = EM2820_BOARD_UNKNOWN },
1670 { USB_DEVICE(0xeb1a, 0x2861),
1671 .driver_info = EM2820_BOARD_UNKNOWN },
1672 { USB_DEVICE(0xeb1a, 0x2862),
1673 .driver_info = EM2820_BOARD_UNKNOWN },
1674 { USB_DEVICE(0xeb1a, 0x2870),
1675 .driver_info = EM2820_BOARD_UNKNOWN },
1676 { USB_DEVICE(0xeb1a, 0x2881),
1677 .driver_info = EM2820_BOARD_UNKNOWN },
1678 { USB_DEVICE(0xeb1a, 0x2883),
1679 .driver_info = EM2820_BOARD_UNKNOWN },
1680 { USB_DEVICE(0xeb1a, 0x2868),
1681 .driver_info = EM2820_BOARD_UNKNOWN },
1682 { USB_DEVICE(0xeb1a, 0xe300),
1683 .driver_info = EM2861_BOARD_KWORLD_PVRTV_300U },
1684 { USB_DEVICE(0xeb1a, 0xe303),
1685 .driver_info = EM2860_BOARD_KAIOMY_TVNPC_U2 },
1686 { USB_DEVICE(0xeb1a, 0xe305),
1687 .driver_info = EM2880_BOARD_KWORLD_DVB_305U },
1688 { USB_DEVICE(0xeb1a, 0xe310),
1689 .driver_info = EM2880_BOARD_MSI_DIGIVOX_AD },
1690 { USB_DEVICE(0xeb1a, 0xa313),
1691 .driver_info = EM2882_BOARD_KWORLD_ATSC_315U },
1692 { USB_DEVICE(0xeb1a, 0xa316),
1693 .driver_info = EM2883_BOARD_KWORLD_HYBRID_330U },
1694 { USB_DEVICE(0xeb1a, 0xe320),
1695 .driver_info = EM2880_BOARD_MSI_DIGIVOX_AD_II },
1696 { USB_DEVICE(0xeb1a, 0xe323),
1697 .driver_info = EM2882_BOARD_KWORLD_VS_DVBT },
1698 { USB_DEVICE(0xeb1a, 0xe350),
1699 .driver_info = EM2870_BOARD_KWORLD_350U },
1700 { USB_DEVICE(0xeb1a, 0xe355),
1701 .driver_info = EM2870_BOARD_KWORLD_355U },
1702 { USB_DEVICE(0xeb1a, 0x2801),
1703 .driver_info = EM2800_BOARD_GRABBEEX_USB2800 },
1704 { USB_DEVICE(0xeb1a, 0xe357),
1705 .driver_info = EM2870_BOARD_KWORLD_355U },
1706 { USB_DEVICE(0x1b80, 0xe302),
1707 .driver_info = EM2820_BOARD_PINNACLE_DVC_90 }, /* Kaiser Baas Video to DVD maker */
1708 { USB_DEVICE(0x1b80, 0xe304),
1709 .driver_info = EM2820_BOARD_PINNACLE_DVC_90 }, /* Kworld DVD Maker 2 */
1710 { USB_DEVICE(0x0ccd, 0x0036),
1711 .driver_info = EM2820_BOARD_TERRATEC_CINERGY_250 },
1712 { USB_DEVICE(0x0ccd, 0x004c),
1713 .driver_info = EM2880_BOARD_TERRATEC_HYBRID_XS_FR },
1714 { USB_DEVICE(0x0ccd, 0x004f),
1715 .driver_info = EM2860_BOARD_TERRATEC_HYBRID_XS },
1716 { USB_DEVICE(0x0ccd, 0x005e),
1717 .driver_info = EM2882_BOARD_TERRATEC_HYBRID_XS },
1718 { USB_DEVICE(0x0ccd, 0x0042),
1719 .driver_info = EM2880_BOARD_TERRATEC_HYBRID_XS },
1720 { USB_DEVICE(0x0ccd, 0x0043),
1721 .driver_info = EM2870_BOARD_TERRATEC_XS },
1722 { USB_DEVICE(0x0ccd, 0x0047),
1723 .driver_info = EM2880_BOARD_TERRATEC_PRODIGY_XS },
1724 { USB_DEVICE(0x0ccd, 0x0084),
1725 .driver_info = EM2860_BOARD_TERRATEC_AV350 },
1726 { USB_DEVICE(0x0ccd, 0x0096),
1727 .driver_info = EM2860_BOARD_TERRATEC_GRABBY },
1728 { USB_DEVICE(0x185b, 0x2870),
1729 .driver_info = EM2870_BOARD_COMPRO_VIDEOMATE },
1730 { USB_DEVICE(0x185b, 0x2041),
1731 .driver_info = EM2820_BOARD_COMPRO_VIDEOMATE_FORYOU },
1732 { USB_DEVICE(0x2040, 0x4200),
1733 .driver_info = EM2820_BOARD_HAUPPAUGE_WINTV_USB_2 },
1734 { USB_DEVICE(0x2040, 0x4201),
1735 .driver_info = EM2820_BOARD_HAUPPAUGE_WINTV_USB_2 },
1736 { USB_DEVICE(0x2040, 0x6500),
1737 .driver_info = EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900 },
1738 { USB_DEVICE(0x2040, 0x6502),
1739 .driver_info = EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900_R2 },
1740 { USB_DEVICE(0x2040, 0x6513), /* HCW HVR-980 */
1741 .driver_info = EM2883_BOARD_HAUPPAUGE_WINTV_HVR_950 },
1742 { USB_DEVICE(0x2040, 0x6517), /* HP HVR-950 */
1743 .driver_info = EM2883_BOARD_HAUPPAUGE_WINTV_HVR_950 },
1744 { USB_DEVICE(0x2040, 0x651b), /* RP HVR-950 */
1745 .driver_info = EM2883_BOARD_HAUPPAUGE_WINTV_HVR_950 },
1746 { USB_DEVICE(0x2040, 0x651f),
1747 .driver_info = EM2883_BOARD_HAUPPAUGE_WINTV_HVR_850 },
1748 { USB_DEVICE(0x0438, 0xb002),
1749 .driver_info = EM2880_BOARD_AMD_ATI_TV_WONDER_HD_600 },
1750 { USB_DEVICE(0x2001, 0xf112),
1751 .driver_info = EM2820_BOARD_DLINK_USB_TV },
1752 { USB_DEVICE(0x2304, 0x0207),
1753 .driver_info = EM2820_BOARD_PINNACLE_DVC_90 },
1754 { USB_DEVICE(0x2304, 0x0208),
1755 .driver_info = EM2820_BOARD_PINNACLE_USB_2 },
1756 { USB_DEVICE(0x2304, 0x021a),
1757 .driver_info = EM2820_BOARD_PINNACLE_DVC_90 },
1758 { USB_DEVICE(0x2304, 0x0226),
1759 .driver_info = EM2882_BOARD_PINNACLE_HYBRID_PRO },
1760 { USB_DEVICE(0x2304, 0x0227),
1761 .driver_info = EM2880_BOARD_PINNACLE_PCTV_HD_PRO },
1762 { USB_DEVICE(0x0413, 0x6023),
1763 .driver_info = EM2800_BOARD_LEADTEK_WINFAST_USBII },
1764 { USB_DEVICE(0x093b, 0xa005),
1765 .driver_info = EM2861_BOARD_PLEXTOR_PX_TV100U },
1766 { USB_DEVICE(0x04bb, 0x0515),
1767 .driver_info = EM2820_BOARD_IODATA_GVMVP_SZ },
1768 { USB_DEVICE(0xeb1a, 0x50a6),
1769 .driver_info = EM2860_BOARD_GADMEI_UTV330 },
1770 { },
1772 MODULE_DEVICE_TABLE(usb, em28xx_id_table);
1775 * EEPROM hash table for devices with generic USB IDs
1777 static struct em28xx_hash_table em28xx_eeprom_hash[] = {
1778 /* P/N: SA 60002070465 Tuner: TVF7533-MF */
1779 {0x6ce05a8f, EM2820_BOARD_PROLINK_PLAYTV_USB2, TUNER_YMEC_TVF_5533MF},
1780 {0x72cc5a8b, EM2820_BOARD_PROLINK_PLAYTV_BOX4_USB2, TUNER_YMEC_TVF_5533MF},
1781 {0x966a0441, EM2880_BOARD_KWORLD_DVB_310U, TUNER_XC2028},
1782 {0x166a0441, EM2880_BOARD_EMPIRE_DUAL_TV, TUNER_XC2028},
1783 {0xcee44a99, EM2882_BOARD_EVGA_INDTUBE, TUNER_XC2028},
1784 {0xb8846b20, EM2881_BOARD_PINNACLE_HYBRID_PRO, TUNER_XC2028},
1785 {0x63f653bd, EM2870_BOARD_REDDO_DVB_C_USB_BOX, TUNER_ABSENT},
1786 {0x4e913442, EM2882_BOARD_DIKOM_DK300, TUNER_XC2028},
1789 /* I2C devicelist hash table for devices with generic USB IDs */
1790 static struct em28xx_hash_table em28xx_i2c_hash[] = {
1791 {0xb06a32c3, EM2800_BOARD_TERRATEC_CINERGY_200, TUNER_LG_PAL_NEW_TAPC},
1792 {0xf51200e3, EM2800_BOARD_VGEAR_POCKETTV, TUNER_LG_PAL_NEW_TAPC},
1793 {0x1ba50080, EM2860_BOARD_SAA711X_REFERENCE_DESIGN, TUNER_ABSENT},
1794 {0xc51200e3, EM2820_BOARD_GADMEI_TVR200, TUNER_LG_PAL_NEW_TAPC},
1795 {0x4ba50080, EM2861_BOARD_GADMEI_UTV330PLUS, TUNER_TNF_5335MF},
1798 /* I2C possible address to saa7115, tvp5150, msp3400, tvaudio */
1799 static unsigned short saa711x_addrs[] = {
1800 0x4a >> 1, 0x48 >> 1, /* SAA7111, SAA7111A and SAA7113 */
1801 0x42 >> 1, 0x40 >> 1, /* SAA7114, SAA7115 and SAA7118 */
1802 I2C_CLIENT_END };
1804 static unsigned short tvp5150_addrs[] = {
1805 0xb8 >> 1,
1806 0xba >> 1,
1807 I2C_CLIENT_END
1810 static unsigned short mt9v011_addrs[] = {
1811 0xba >> 1,
1812 I2C_CLIENT_END
1815 static unsigned short msp3400_addrs[] = {
1816 0x80 >> 1,
1817 0x88 >> 1,
1818 I2C_CLIENT_END
1821 int em28xx_tuner_callback(void *ptr, int component, int command, int arg)
1823 int rc = 0;
1824 struct em28xx *dev = ptr;
1826 if (dev->tuner_type != TUNER_XC2028)
1827 return 0;
1829 if (command != XC2028_TUNER_RESET)
1830 return 0;
1832 rc = em28xx_gpio_set(dev, dev->board.tuner_gpio);
1834 return rc;
1836 EXPORT_SYMBOL_GPL(em28xx_tuner_callback);
1838 static inline void em28xx_set_model(struct em28xx *dev)
1840 memcpy(&dev->board, &em28xx_boards[dev->model], sizeof(dev->board));
1842 /* Those are the default values for the majority of boards
1843 Use those values if not specified otherwise at boards entry
1845 if (!dev->board.xclk)
1846 dev->board.xclk = EM28XX_XCLK_IR_RC5_MODE |
1847 EM28XX_XCLK_FREQUENCY_12MHZ;
1849 if (!dev->board.i2c_speed)
1850 dev->board.i2c_speed = EM28XX_I2C_CLK_WAIT_ENABLE |
1851 EM28XX_I2C_FREQ_100_KHZ;
1855 /* FIXME: Should be replaced by a proper mt9m111 driver */
1856 static int em28xx_initialize_mt9m111(struct em28xx *dev)
1858 int i;
1859 unsigned char regs[][3] = {
1860 { 0x0d, 0x00, 0x01, }, /* reset and use defaults */
1861 { 0x0d, 0x00, 0x00, },
1862 { 0x0a, 0x00, 0x21, },
1863 { 0x21, 0x04, 0x00, }, /* full readout speed, no row/col skipping */
1866 for (i = 0; i < ARRAY_SIZE(regs); i++)
1867 i2c_master_send(&dev->i2c_client, &regs[i][0], 3);
1869 return 0;
1873 /* FIXME: Should be replaced by a proper mt9m001 driver */
1874 static int em28xx_initialize_mt9m001(struct em28xx *dev)
1876 int i;
1877 unsigned char regs[][3] = {
1878 { 0x0d, 0x00, 0x01, },
1879 { 0x0d, 0x00, 0x00, },
1880 { 0x04, 0x05, 0x00, }, /* hres = 1280 */
1881 { 0x03, 0x04, 0x00, }, /* vres = 1024 */
1882 { 0x20, 0x11, 0x00, },
1883 { 0x06, 0x00, 0x10, },
1884 { 0x2b, 0x00, 0x24, },
1885 { 0x2e, 0x00, 0x24, },
1886 { 0x35, 0x00, 0x24, },
1887 { 0x2d, 0x00, 0x20, },
1888 { 0x2c, 0x00, 0x20, },
1889 { 0x09, 0x0a, 0xd4, },
1890 { 0x35, 0x00, 0x57, },
1893 for (i = 0; i < ARRAY_SIZE(regs); i++)
1894 i2c_master_send(&dev->i2c_client, &regs[i][0], 3);
1896 return 0;
1899 /* HINT method: webcam I2C chips
1901 * This method works for webcams with Micron sensors
1903 static int em28xx_hint_sensor(struct em28xx *dev)
1905 int rc;
1906 char *sensor_name;
1907 unsigned char cmd;
1908 __be16 version_be;
1909 u16 version;
1911 /* Micron sensor detection */
1912 dev->i2c_client.addr = 0xba >> 1;
1913 cmd = 0;
1914 i2c_master_send(&dev->i2c_client, &cmd, 1);
1915 rc = i2c_master_recv(&dev->i2c_client, (char *)&version_be, 2);
1916 if (rc != 2)
1917 return -EINVAL;
1919 version = be16_to_cpu(version_be);
1920 switch (version) {
1921 case 0x8232: /* mt9v011 640x480 1.3 Mpix sensor */
1922 case 0x8243: /* mt9v011 rev B 640x480 1.3 Mpix sensor */
1923 dev->model = EM2820_BOARD_SILVERCREST_WEBCAM;
1924 em28xx_set_model(dev);
1926 sensor_name = "mt9v011";
1927 dev->em28xx_sensor = EM28XX_MT9V011;
1928 dev->sensor_xres = 640;
1929 dev->sensor_yres = 480;
1931 * FIXME: mt9v011 uses I2S speed as xtal clk - at least with
1932 * the Silvercrest cam I have here for testing - for higher
1933 * resolutions, a high clock cause horizontal artifacts, so we
1934 * need to use a lower xclk frequency.
1935 * Yet, it would be possible to adjust xclk depending on the
1936 * desired resolution, since this affects directly the
1937 * frame rate.
1939 dev->board.xclk = EM28XX_XCLK_FREQUENCY_4_3MHZ;
1940 dev->sensor_xtal = 4300000;
1942 /* probably means GRGB 16 bit bayer */
1943 dev->vinmode = 0x0d;
1944 dev->vinctl = 0x00;
1946 break;
1948 case 0x143a: /* MT9M111 as found in the ECS G200 */
1949 dev->model = EM2750_BOARD_UNKNOWN;
1950 em28xx_set_model(dev);
1952 sensor_name = "mt9m111";
1953 dev->board.xclk = EM28XX_XCLK_FREQUENCY_48MHZ;
1954 dev->em28xx_sensor = EM28XX_MT9M111;
1955 em28xx_initialize_mt9m111(dev);
1956 dev->sensor_xres = 640;
1957 dev->sensor_yres = 512;
1959 dev->vinmode = 0x0a;
1960 dev->vinctl = 0x00;
1962 break;
1964 case 0x8431:
1965 dev->model = EM2750_BOARD_UNKNOWN;
1966 em28xx_set_model(dev);
1968 sensor_name = "mt9m001";
1969 dev->em28xx_sensor = EM28XX_MT9M001;
1970 em28xx_initialize_mt9m001(dev);
1971 dev->sensor_xres = 1280;
1972 dev->sensor_yres = 1024;
1974 /* probably means BGGR 16 bit bayer */
1975 dev->vinmode = 0x0c;
1976 dev->vinctl = 0x00;
1978 break;
1979 default:
1980 printk("Unknown Micron Sensor 0x%04x\n", version);
1981 return -EINVAL;
1984 /* Setup webcam defaults */
1985 em28xx_pre_card_setup(dev);
1987 em28xx_errdev("Sensor is %s, using model %s entry.\n",
1988 sensor_name, em28xx_boards[dev->model].name);
1990 return 0;
1993 /* Since em28xx_pre_card_setup() requires a proper dev->model,
1994 * this won't work for boards with generic PCI IDs
1996 void em28xx_pre_card_setup(struct em28xx *dev)
1998 /* Set the initial XCLK and I2C clock values based on the board
1999 definition */
2000 em28xx_write_reg(dev, EM28XX_R0F_XCLK, dev->board.xclk & 0x7f);
2001 em28xx_write_reg(dev, EM28XX_R06_I2C_CLK, dev->board.i2c_speed);
2002 msleep(50);
2004 /* request some modules */
2005 switch (dev->model) {
2006 case EM2861_BOARD_PLEXTOR_PX_TV100U:
2007 /* Sets the msp34xx I2S speed */
2008 dev->i2s_speed = 2048000;
2009 break;
2010 case EM2861_BOARD_KWORLD_PVRTV_300U:
2011 case EM2880_BOARD_KWORLD_DVB_305U:
2012 em28xx_write_reg(dev, EM28XX_R08_GPIO, 0x6d);
2013 msleep(10);
2014 em28xx_write_reg(dev, EM28XX_R08_GPIO, 0x7d);
2015 msleep(10);
2016 break;
2017 case EM2870_BOARD_COMPRO_VIDEOMATE:
2018 /* TODO: someone can do some cleanup here...
2019 not everything's needed */
2020 em28xx_write_reg(dev, EM2880_R04_GPO, 0x00);
2021 msleep(10);
2022 em28xx_write_reg(dev, EM2880_R04_GPO, 0x01);
2023 msleep(10);
2024 em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xfd);
2025 mdelay(70);
2026 em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xfc);
2027 mdelay(70);
2028 em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xdc);
2029 mdelay(70);
2030 em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xfc);
2031 mdelay(70);
2032 break;
2033 case EM2870_BOARD_TERRATEC_XS_MT2060:
2034 /* this device needs some gpio writes to get the DVB-T
2035 demod work */
2036 em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xfe);
2037 mdelay(70);
2038 em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xde);
2039 mdelay(70);
2040 em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xfe);
2041 mdelay(70);
2042 break;
2043 case EM2870_BOARD_PINNACLE_PCTV_DVB:
2044 /* this device needs some gpio writes to get the
2045 DVB-T demod work */
2046 em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xfe);
2047 mdelay(70);
2048 em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xde);
2049 mdelay(70);
2050 em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xfe);
2051 mdelay(70);
2052 break;
2053 case EM2820_BOARD_GADMEI_UTV310:
2054 case EM2820_BOARD_MSI_VOX_USB_2:
2055 /* enables audio for that devices */
2056 em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xfd);
2057 break;
2059 case EM2882_BOARD_KWORLD_ATSC_315U:
2060 em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xff);
2061 msleep(10);
2062 em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xfe);
2063 msleep(10);
2064 em28xx_write_reg(dev, EM2880_R04_GPO, 0x00);
2065 msleep(10);
2066 em28xx_write_reg(dev, EM2880_R04_GPO, 0x08);
2067 msleep(10);
2068 break;
2070 case EM2860_BOARD_KAIOMY_TVNPC_U2:
2071 em28xx_write_regs(dev, EM28XX_R0F_XCLK, "\x07", 1);
2072 em28xx_write_regs(dev, EM28XX_R06_I2C_CLK, "\x40", 1);
2073 em28xx_write_regs(dev, 0x0d, "\x42", 1);
2074 em28xx_write_regs(dev, 0x08, "\xfd", 1);
2075 msleep(10);
2076 em28xx_write_regs(dev, 0x08, "\xff", 1);
2077 msleep(10);
2078 em28xx_write_regs(dev, 0x08, "\x7f", 1);
2079 msleep(10);
2080 em28xx_write_regs(dev, 0x08, "\x6b", 1);
2082 break;
2083 case EM2860_BOARD_EASYCAP:
2084 em28xx_write_regs(dev, 0x08, "\xf8", 1);
2085 break;
2087 case EM2820_BOARD_IODATA_GVMVP_SZ:
2088 em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xff);
2089 msleep(70);
2090 em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xf7);
2091 msleep(10);
2092 em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xfe);
2093 msleep(70);
2094 em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xfd);
2095 msleep(70);
2096 break;
2099 em28xx_gpio_set(dev, dev->board.tuner_gpio);
2100 em28xx_set_mode(dev, EM28XX_ANALOG_MODE);
2102 /* Unlock device */
2103 em28xx_set_mode(dev, EM28XX_SUSPEND);
2106 static void em28xx_setup_xc3028(struct em28xx *dev, struct xc2028_ctrl *ctl)
2108 memset(ctl, 0, sizeof(*ctl));
2110 ctl->fname = XC2028_DEFAULT_FIRMWARE;
2111 ctl->max_len = 64;
2112 ctl->mts = em28xx_boards[dev->model].mts_firmware;
2114 switch (dev->model) {
2115 case EM2880_BOARD_EMPIRE_DUAL_TV:
2116 case EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900:
2117 case EM2882_BOARD_TERRATEC_HYBRID_XS:
2118 ctl->demod = XC3028_FE_ZARLINK456;
2119 break;
2120 case EM2880_BOARD_TERRATEC_HYBRID_XS:
2121 case EM2881_BOARD_PINNACLE_HYBRID_PRO:
2122 ctl->demod = XC3028_FE_ZARLINK456;
2123 break;
2124 case EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900_R2:
2125 /* djh - Not sure which demod we need here */
2126 ctl->demod = XC3028_FE_DEFAULT;
2127 break;
2128 case EM2880_BOARD_AMD_ATI_TV_WONDER_HD_600:
2129 ctl->demod = XC3028_FE_DEFAULT;
2130 ctl->fname = XC3028L_DEFAULT_FIRMWARE;
2131 break;
2132 case EM2883_BOARD_HAUPPAUGE_WINTV_HVR_850:
2133 case EM2883_BOARD_HAUPPAUGE_WINTV_HVR_950:
2134 case EM2880_BOARD_PINNACLE_PCTV_HD_PRO:
2135 /* FIXME: Better to specify the needed IF */
2136 ctl->demod = XC3028_FE_DEFAULT;
2137 break;
2138 case EM2883_BOARD_KWORLD_HYBRID_330U:
2139 case EM2882_BOARD_DIKOM_DK300:
2140 ctl->demod = XC3028_FE_CHINA;
2141 ctl->fname = XC2028_DEFAULT_FIRMWARE;
2142 break;
2143 case EM2882_BOARD_EVGA_INDTUBE:
2144 ctl->demod = XC3028_FE_CHINA;
2145 ctl->fname = XC3028L_DEFAULT_FIRMWARE;
2146 break;
2147 default:
2148 ctl->demod = XC3028_FE_OREN538;
2152 static void em28xx_tuner_setup(struct em28xx *dev)
2154 struct tuner_setup tun_setup;
2155 struct v4l2_frequency f;
2157 if (dev->tuner_type == TUNER_ABSENT)
2158 return;
2160 memset(&tun_setup, 0, sizeof(tun_setup));
2162 tun_setup.mode_mask = T_ANALOG_TV | T_RADIO;
2163 tun_setup.tuner_callback = em28xx_tuner_callback;
2165 if (dev->board.radio.type) {
2166 tun_setup.type = dev->board.radio.type;
2167 tun_setup.addr = dev->board.radio_addr;
2169 v4l2_device_call_all(&dev->v4l2_dev, 0, tuner, s_type_addr, &tun_setup);
2172 if ((dev->tuner_type != TUNER_ABSENT) && (dev->tuner_type)) {
2173 tun_setup.type = dev->tuner_type;
2174 tun_setup.addr = dev->tuner_addr;
2176 v4l2_device_call_all(&dev->v4l2_dev, 0, tuner, s_type_addr, &tun_setup);
2179 if (dev->tda9887_conf) {
2180 struct v4l2_priv_tun_config tda9887_cfg;
2182 tda9887_cfg.tuner = TUNER_TDA9887;
2183 tda9887_cfg.priv = &dev->tda9887_conf;
2185 v4l2_device_call_all(&dev->v4l2_dev, 0, tuner, s_config, &tda9887_cfg);
2188 if (dev->tuner_type == TUNER_XC2028) {
2189 struct v4l2_priv_tun_config xc2028_cfg;
2190 struct xc2028_ctrl ctl;
2192 memset(&xc2028_cfg, 0, sizeof(xc2028_cfg));
2193 memset(&ctl, 0, sizeof(ctl));
2195 em28xx_setup_xc3028(dev, &ctl);
2197 xc2028_cfg.tuner = TUNER_XC2028;
2198 xc2028_cfg.priv = &ctl;
2200 v4l2_device_call_all(&dev->v4l2_dev, 0, tuner, s_config, &xc2028_cfg);
2203 /* configure tuner */
2204 f.tuner = 0;
2205 f.type = V4L2_TUNER_ANALOG_TV;
2206 f.frequency = 9076; /* just a magic number */
2207 dev->ctl_freq = f.frequency;
2208 v4l2_device_call_all(&dev->v4l2_dev, 0, tuner, s_frequency, &f);
2211 static int em28xx_hint_board(struct em28xx *dev)
2213 int i;
2215 /* HINT method: EEPROM
2217 * This method works only for boards with eeprom.
2218 * Uses a hash of all eeprom bytes. The hash should be
2219 * unique for a vendor/tuner pair.
2220 * There are a high chance that tuners for different
2221 * video standards produce different hashes.
2223 for (i = 0; i < ARRAY_SIZE(em28xx_eeprom_hash); i++) {
2224 if (dev->hash == em28xx_eeprom_hash[i].hash) {
2225 dev->model = em28xx_eeprom_hash[i].model;
2226 dev->tuner_type = em28xx_eeprom_hash[i].tuner;
2228 em28xx_errdev("Your board has no unique USB ID.\n");
2229 em28xx_errdev("A hint were successfully done, "
2230 "based on eeprom hash.\n");
2231 em28xx_errdev("This method is not 100%% failproof.\n");
2232 em28xx_errdev("If the board were missdetected, "
2233 "please email this log to:\n");
2234 em28xx_errdev("\tV4L Mailing List "
2235 " <linux-media@vger.kernel.org>\n");
2236 em28xx_errdev("Board detected as %s\n",
2237 em28xx_boards[dev->model].name);
2239 return 0;
2243 /* HINT method: I2C attached devices
2245 * This method works for all boards.
2246 * Uses a hash of i2c scanned devices.
2247 * Devices with the same i2c attached chips will
2248 * be considered equal.
2249 * This method is less precise than the eeprom one.
2252 /* user did not request i2c scanning => do it now */
2253 if (!dev->i2c_hash)
2254 em28xx_do_i2c_scan(dev);
2256 for (i = 0; i < ARRAY_SIZE(em28xx_i2c_hash); i++) {
2257 if (dev->i2c_hash == em28xx_i2c_hash[i].hash) {
2258 dev->model = em28xx_i2c_hash[i].model;
2259 dev->tuner_type = em28xx_i2c_hash[i].tuner;
2260 em28xx_errdev("Your board has no unique USB ID.\n");
2261 em28xx_errdev("A hint were successfully done, "
2262 "based on i2c devicelist hash.\n");
2263 em28xx_errdev("This method is not 100%% failproof.\n");
2264 em28xx_errdev("If the board were missdetected, "
2265 "please email this log to:\n");
2266 em28xx_errdev("\tV4L Mailing List "
2267 " <linux-media@vger.kernel.org>\n");
2268 em28xx_errdev("Board detected as %s\n",
2269 em28xx_boards[dev->model].name);
2271 return 0;
2275 em28xx_errdev("Your board has no unique USB ID and thus need a "
2276 "hint to be detected.\n");
2277 em28xx_errdev("You may try to use card=<n> insmod option to "
2278 "workaround that.\n");
2279 em28xx_errdev("Please send an email with this log to:\n");
2280 em28xx_errdev("\tV4L Mailing List <linux-media@vger.kernel.org>\n");
2281 em28xx_errdev("Board eeprom hash is 0x%08lx\n", dev->hash);
2282 em28xx_errdev("Board i2c devicelist hash is 0x%08lx\n", dev->i2c_hash);
2284 em28xx_errdev("Here is a list of valid choices for the card=<n>"
2285 " insmod option:\n");
2286 for (i = 0; i < em28xx_bcount; i++) {
2287 em28xx_errdev(" card=%d -> %s\n",
2288 i, em28xx_boards[i].name);
2290 return -1;
2293 /* ----------------------------------------------------------------------- */
2294 void em28xx_register_i2c_ir(struct em28xx *dev)
2296 /* Leadtek winfast tv USBII deluxe can find a non working IR-device */
2297 /* at address 0x18, so if that address is needed for another board in */
2298 /* the future, please put it after 0x1f. */
2299 struct i2c_board_info info;
2300 const unsigned short addr_list[] = {
2301 0x1f, 0x30, 0x47, I2C_CLIENT_END
2304 if (disable_ir)
2305 return;
2307 memset(&info, 0, sizeof(struct i2c_board_info));
2308 memset(&dev->init_data, 0, sizeof(dev->init_data));
2309 strlcpy(info.type, "ir_video", I2C_NAME_SIZE);
2311 /* detect & configure */
2312 switch (dev->model) {
2313 case EM2800_BOARD_TERRATEC_CINERGY_200:
2314 case EM2820_BOARD_TERRATEC_CINERGY_250:
2315 dev->init_data.ir_codes = &ir_codes_em_terratec_table;
2316 dev->init_data.get_key = em28xx_get_key_terratec;
2317 dev->init_data.name = "i2c IR (EM28XX Terratec)";
2318 break;
2319 case EM2820_BOARD_PINNACLE_USB_2:
2320 dev->init_data.ir_codes = &ir_codes_pinnacle_grey_table;
2321 dev->init_data.get_key = em28xx_get_key_pinnacle_usb_grey;
2322 dev->init_data.name = "i2c IR (EM28XX Pinnacle PCTV)";
2323 break;
2324 case EM2820_BOARD_HAUPPAUGE_WINTV_USB_2:
2325 dev->init_data.ir_codes = &ir_codes_rc5_hauppauge_new_table;
2326 dev->init_data.get_key = em28xx_get_key_em_haup;
2327 dev->init_data.name = "i2c IR (EM2840 Hauppauge)";
2328 case EM2820_BOARD_LEADTEK_WINFAST_USBII_DELUXE:
2329 dev->init_data.ir_codes = &ir_codes_winfast_usbii_deluxe_table;;
2330 dev->init_data.get_key = em28xx_get_key_winfast_usbii_deluxe;
2331 dev->init_data.name = "i2c IR (EM2820 Winfast TV USBII Deluxe)";
2332 break;
2335 if (dev->init_data.name)
2336 info.platform_data = &dev->init_data;
2337 i2c_new_probed_device(&dev->i2c_adap, &info, addr_list);
2340 void em28xx_card_setup(struct em28xx *dev)
2343 * If the device can be a webcam, seek for a sensor.
2344 * If sensor is not found, then it isn't a webcam.
2346 if (dev->board.is_webcam) {
2347 if (em28xx_hint_sensor(dev) < 0)
2348 dev->board.is_webcam = 0;
2349 else
2350 dev->progressive = 1;
2351 } else
2352 em28xx_set_model(dev);
2354 em28xx_info("Identified as %s (card=%d)\n",
2355 dev->board.name, dev->model);
2357 dev->tuner_type = em28xx_boards[dev->model].tuner_type;
2358 if (em28xx_boards[dev->model].tuner_addr)
2359 dev->tuner_addr = em28xx_boards[dev->model].tuner_addr;
2361 if (em28xx_boards[dev->model].tda9887_conf)
2362 dev->tda9887_conf = em28xx_boards[dev->model].tda9887_conf;
2364 /* request some modules */
2365 switch (dev->model) {
2366 case EM2820_BOARD_HAUPPAUGE_WINTV_USB_2:
2367 case EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900:
2368 case EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900_R2:
2369 case EM2883_BOARD_HAUPPAUGE_WINTV_HVR_850:
2370 case EM2883_BOARD_HAUPPAUGE_WINTV_HVR_950:
2372 struct tveeprom tv;
2373 #if defined(CONFIG_MODULES) && defined(MODULE)
2374 request_module("tveeprom");
2375 #endif
2376 /* Call first TVeeprom */
2378 dev->i2c_client.addr = 0xa0 >> 1;
2379 tveeprom_hauppauge_analog(&dev->i2c_client, &tv, dev->eedata);
2381 dev->tuner_type = tv.tuner_type;
2383 if (tv.audio_processor == V4L2_IDENT_MSPX4XX) {
2384 dev->i2s_speed = 2048000;
2385 dev->board.has_msp34xx = 1;
2387 break;
2389 case EM2882_BOARD_KWORLD_ATSC_315U:
2390 em28xx_write_reg(dev, 0x0d, 0x42);
2391 msleep(10);
2392 em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xfd);
2393 msleep(10);
2394 break;
2395 case EM2820_BOARD_KWORLD_PVRTV2800RF:
2396 /* GPIO enables sound on KWORLD PVR TV 2800RF */
2397 em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xf9);
2398 break;
2399 case EM2820_BOARD_UNKNOWN:
2400 case EM2800_BOARD_UNKNOWN:
2402 * The K-WORLD DVB-T 310U is detected as an MSI Digivox AD.
2404 * This occurs because they share identical USB vendor and
2405 * product IDs.
2407 * What we do here is look up the EEPROM hash of the K-WORLD
2408 * and if it is found then we decide that we do not have
2409 * a DIGIVOX and reset the device to the K-WORLD instead.
2411 * This solution is only valid if they do not share eeprom
2412 * hash identities which has not been determined as yet.
2414 case EM2880_BOARD_MSI_DIGIVOX_AD:
2415 if (!em28xx_hint_board(dev))
2416 em28xx_set_model(dev);
2418 /* In cases where we had to use a board hint, the call to
2419 em28xx_set_mode() in em28xx_pre_card_setup() was a no-op,
2420 so make the call now so the analog GPIOs are set properly
2421 before probing the i2c bus. */
2422 em28xx_gpio_set(dev, dev->board.tuner_gpio);
2423 em28xx_set_mode(dev, EM28XX_ANALOG_MODE);
2424 break;
2427 * The Dikom DK300 is detected as an Kworld VS-DVB-T 323UR.
2429 * This occurs because they share identical USB vendor and
2430 * product IDs.
2432 * What we do here is look up the EEPROM hash of the Dikom
2433 * and if it is found then we decide that we do not have
2434 * a Kworld and reset the device to the Dikom instead.
2436 * This solution is only valid if they do not share eeprom
2437 * hash identities which has not been determined as yet.
2439 case EM2882_BOARD_KWORLD_VS_DVBT:
2440 if (!em28xx_hint_board(dev))
2441 em28xx_set_model(dev);
2443 /* In cases where we had to use a board hint, the call to
2444 em28xx_set_mode() in em28xx_pre_card_setup() was a no-op,
2445 so make the call now so the analog GPIOs are set properly
2446 before probing the i2c bus. */
2447 em28xx_gpio_set(dev, dev->board.tuner_gpio);
2448 em28xx_set_mode(dev, EM28XX_ANALOG_MODE);
2449 break;
2452 #if defined(CONFIG_MODULES) && defined(MODULE)
2453 if (dev->board.has_ir_i2c && !disable_ir)
2454 request_module("ir-kbd-i2c");
2455 #endif
2456 if (dev->board.has_snapshot_button)
2457 em28xx_register_snapshot_button(dev);
2459 if (dev->board.valid == EM28XX_BOARD_NOT_VALIDATED) {
2460 em28xx_errdev("\n\n");
2461 em28xx_errdev("The support for this board weren't "
2462 "valid yet.\n");
2463 em28xx_errdev("Please send a report of having this working\n");
2464 em28xx_errdev("not to V4L mailing list (and/or to other "
2465 "addresses)\n\n");
2468 /* Allow override tuner type by a module parameter */
2469 if (tuner >= 0)
2470 dev->tuner_type = tuner;
2472 /* request some modules */
2473 if (dev->board.has_msp34xx)
2474 v4l2_i2c_new_subdev(&dev->v4l2_dev, &dev->i2c_adap,
2475 "msp3400", "msp3400", 0, msp3400_addrs);
2477 if (dev->board.decoder == EM28XX_SAA711X)
2478 v4l2_i2c_new_subdev(&dev->v4l2_dev, &dev->i2c_adap,
2479 "saa7115", "saa7115_auto", 0, saa711x_addrs);
2481 if (dev->board.decoder == EM28XX_TVP5150)
2482 v4l2_i2c_new_subdev(&dev->v4l2_dev, &dev->i2c_adap,
2483 "tvp5150", "tvp5150", 0, tvp5150_addrs);
2485 if (dev->em28xx_sensor == EM28XX_MT9V011) {
2486 struct v4l2_subdev *sd;
2488 sd = v4l2_i2c_new_subdev(&dev->v4l2_dev,
2489 &dev->i2c_adap, "mt9v011", "mt9v011", 0, mt9v011_addrs);
2490 v4l2_subdev_call(sd, core, s_config, 0, &dev->sensor_xtal);
2494 if (dev->board.adecoder == EM28XX_TVAUDIO)
2495 v4l2_i2c_new_subdev(&dev->v4l2_dev, &dev->i2c_adap,
2496 "tvaudio", "tvaudio", dev->board.tvaudio_addr, NULL);
2498 if (dev->board.tuner_type != TUNER_ABSENT) {
2499 int has_demod = (dev->tda9887_conf & TDA9887_PRESENT);
2501 if (dev->board.radio.type)
2502 v4l2_i2c_new_subdev(&dev->v4l2_dev, &dev->i2c_adap,
2503 "tuner", "tuner", dev->board.radio_addr, NULL);
2505 if (has_demod)
2506 v4l2_i2c_new_subdev(&dev->v4l2_dev,
2507 &dev->i2c_adap, "tuner", "tuner",
2508 0, v4l2_i2c_tuner_addrs(ADDRS_DEMOD));
2509 if (dev->tuner_addr == 0) {
2510 enum v4l2_i2c_tuner_type type =
2511 has_demod ? ADDRS_TV_WITH_DEMOD : ADDRS_TV;
2512 struct v4l2_subdev *sd;
2514 sd = v4l2_i2c_new_subdev(&dev->v4l2_dev,
2515 &dev->i2c_adap, "tuner", "tuner",
2516 0, v4l2_i2c_tuner_addrs(type));
2518 if (sd)
2519 dev->tuner_addr = v4l2_i2c_subdev_addr(sd);
2520 } else {
2521 v4l2_i2c_new_subdev(&dev->v4l2_dev, &dev->i2c_adap,
2522 "tuner", "tuner", dev->tuner_addr, NULL);
2526 em28xx_tuner_setup(dev);
2528 if(!disable_ir)
2529 em28xx_ir_init(dev);
2533 #if defined(CONFIG_MODULES) && defined(MODULE)
2534 static void request_module_async(struct work_struct *work)
2536 struct em28xx *dev = container_of(work,
2537 struct em28xx, request_module_wk);
2539 if (dev->has_audio_class)
2540 request_module("snd-usb-audio");
2541 else if (dev->has_alsa_audio)
2542 request_module("em28xx-alsa");
2544 if (dev->board.has_dvb)
2545 request_module("em28xx-dvb");
2548 static void request_modules(struct em28xx *dev)
2550 INIT_WORK(&dev->request_module_wk, request_module_async);
2551 schedule_work(&dev->request_module_wk);
2553 #else
2554 #define request_modules(dev)
2555 #endif /* CONFIG_MODULES */
2558 * em28xx_realease_resources()
2559 * unregisters the v4l2,i2c and usb devices
2560 * called when the device gets disconected or at module unload
2562 void em28xx_release_resources(struct em28xx *dev)
2564 if (dev->sbutton_input_dev)
2565 em28xx_deregister_snapshot_button(dev);
2567 if (dev->ir)
2568 em28xx_ir_fini(dev);
2570 /*FIXME: I2C IR should be disconnected */
2572 em28xx_release_analog_resources(dev);
2574 em28xx_remove_from_devlist(dev);
2576 em28xx_i2c_unregister(dev);
2578 v4l2_device_unregister(&dev->v4l2_dev);
2580 usb_put_dev(dev->udev);
2582 /* Mark device as unused */
2583 em28xx_devused &= ~(1 << dev->devno);
2587 * em28xx_init_dev()
2588 * allocates and inits the device structs, registers i2c bus and v4l device
2590 static int em28xx_init_dev(struct em28xx **devhandle, struct usb_device *udev,
2591 struct usb_interface *interface,
2592 int minor)
2594 struct em28xx *dev = *devhandle;
2595 int retval;
2596 int errCode;
2598 dev->udev = udev;
2599 mutex_init(&dev->ctrl_urb_lock);
2600 spin_lock_init(&dev->slock);
2601 init_waitqueue_head(&dev->open);
2602 init_waitqueue_head(&dev->wait_frame);
2603 init_waitqueue_head(&dev->wait_stream);
2605 dev->em28xx_write_regs = em28xx_write_regs;
2606 dev->em28xx_read_reg = em28xx_read_reg;
2607 dev->em28xx_read_reg_req_len = em28xx_read_reg_req_len;
2608 dev->em28xx_write_regs_req = em28xx_write_regs_req;
2609 dev->em28xx_read_reg_req = em28xx_read_reg_req;
2610 dev->board.is_em2800 = em28xx_boards[dev->model].is_em2800;
2612 em28xx_set_model(dev);
2614 /* Set the default GPO/GPIO for legacy devices */
2615 dev->reg_gpo_num = EM2880_R04_GPO;
2616 dev->reg_gpio_num = EM28XX_R08_GPIO;
2618 dev->wait_after_write = 5;
2620 /* Based on the Chip ID, set the device configuration */
2621 retval = em28xx_read_reg(dev, EM28XX_R0A_CHIPID);
2622 if (retval > 0) {
2623 dev->chip_id = retval;
2625 switch (dev->chip_id) {
2626 case CHIP_ID_EM2800:
2627 em28xx_info("chip ID is em2800\n");
2628 break;
2629 case CHIP_ID_EM2710:
2630 em28xx_info("chip ID is em2710\n");
2631 break;
2632 case CHIP_ID_EM2750:
2633 em28xx_info("chip ID is em2750\n");
2634 break;
2635 case CHIP_ID_EM2820:
2636 em28xx_info("chip ID is em2820 (or em2710)\n");
2637 break;
2638 case CHIP_ID_EM2840:
2639 em28xx_info("chip ID is em2840\n");
2640 break;
2641 case CHIP_ID_EM2860:
2642 em28xx_info("chip ID is em2860\n");
2643 break;
2644 case CHIP_ID_EM2870:
2645 em28xx_info("chip ID is em2870\n");
2646 dev->wait_after_write = 0;
2647 break;
2648 case CHIP_ID_EM2874:
2649 em28xx_info("chip ID is em2874\n");
2650 dev->reg_gpio_num = EM2874_R80_GPIO;
2651 dev->wait_after_write = 0;
2652 break;
2653 case CHIP_ID_EM2883:
2654 em28xx_info("chip ID is em2882/em2883\n");
2655 dev->wait_after_write = 0;
2656 break;
2657 default:
2658 em28xx_info("em28xx chip ID = %d\n", dev->chip_id);
2662 /* Prepopulate cached GPO register content */
2663 retval = em28xx_read_reg(dev, dev->reg_gpo_num);
2664 if (retval >= 0)
2665 dev->reg_gpo = retval;
2667 em28xx_pre_card_setup(dev);
2669 if (!dev->board.is_em2800) {
2670 /* Sets I2C speed to 100 KHz */
2671 retval = em28xx_write_reg(dev, EM28XX_R06_I2C_CLK, 0x40);
2672 if (retval < 0) {
2673 em28xx_errdev("%s: em28xx_write_regs_req failed!"
2674 " retval [%d]\n",
2675 __func__, retval);
2676 return retval;
2680 retval = v4l2_device_register(&interface->dev, &dev->v4l2_dev);
2681 if (retval < 0) {
2682 em28xx_errdev("Call to v4l2_device_register() failed!\n");
2683 return retval;
2686 /* register i2c bus */
2687 errCode = em28xx_i2c_register(dev);
2688 if (errCode < 0) {
2689 v4l2_device_unregister(&dev->v4l2_dev);
2690 em28xx_errdev("%s: em28xx_i2c_register - errCode [%d]!\n",
2691 __func__, errCode);
2692 return errCode;
2696 * Default format, used for tvp5150 or saa711x output formats
2698 dev->vinmode = 0x10;
2699 dev->vinctl = EM28XX_VINCTRL_INTERLACED |
2700 EM28XX_VINCTRL_CCIR656_ENABLE;
2702 /* Do board specific init and eeprom reading */
2703 em28xx_card_setup(dev);
2705 /* Configure audio */
2706 errCode = em28xx_audio_setup(dev);
2707 if (errCode < 0) {
2708 v4l2_device_unregister(&dev->v4l2_dev);
2709 em28xx_errdev("%s: Error while setting audio - errCode [%d]!\n",
2710 __func__, errCode);
2713 /* wake i2c devices */
2714 em28xx_wake_i2c(dev);
2716 /* init video dma queues */
2717 INIT_LIST_HEAD(&dev->vidq.active);
2718 INIT_LIST_HEAD(&dev->vidq.queued);
2719 INIT_LIST_HEAD(&dev->vbiq.active);
2720 INIT_LIST_HEAD(&dev->vbiq.queued);
2722 if (dev->board.has_msp34xx) {
2723 /* Send a reset to other chips via gpio */
2724 errCode = em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xf7);
2725 if (errCode < 0) {
2726 em28xx_errdev("%s: em28xx_write_regs_req - "
2727 "msp34xx(1) failed! errCode [%d]\n",
2728 __func__, errCode);
2729 return errCode;
2731 msleep(3);
2733 errCode = em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xff);
2734 if (errCode < 0) {
2735 em28xx_errdev("%s: em28xx_write_regs_req - "
2736 "msp34xx(2) failed! errCode [%d]\n",
2737 __func__, errCode);
2738 return errCode;
2740 msleep(3);
2743 em28xx_add_into_devlist(dev);
2745 retval = em28xx_register_analog_devices(dev);
2746 if (retval < 0) {
2747 em28xx_release_resources(dev);
2748 goto fail_reg_devices;
2751 em28xx_init_extension(dev);
2753 /* Save some power by putting tuner to sleep */
2754 v4l2_device_call_all(&dev->v4l2_dev, 0, core, s_power, 0);
2756 return 0;
2758 fail_reg_devices:
2759 return retval;
2763 * em28xx_usb_probe()
2764 * checks for supported devices
2766 static int em28xx_usb_probe(struct usb_interface *interface,
2767 const struct usb_device_id *id)
2769 const struct usb_endpoint_descriptor *endpoint;
2770 struct usb_device *udev;
2771 struct usb_interface *uif;
2772 struct em28xx *dev = NULL;
2773 int retval;
2774 int i, nr, ifnum, isoc_pipe;
2775 char *speed;
2776 char descr[255] = "";
2778 udev = usb_get_dev(interface_to_usbdev(interface));
2779 ifnum = interface->altsetting[0].desc.bInterfaceNumber;
2781 /* Check to see next free device and mark as used */
2782 nr = find_first_zero_bit(&em28xx_devused, EM28XX_MAXBOARDS);
2783 em28xx_devused |= 1<<nr;
2785 /* Don't register audio interfaces */
2786 if (interface->altsetting[0].desc.bInterfaceClass == USB_CLASS_AUDIO) {
2787 em28xx_err(DRIVER_NAME " audio device (%04x:%04x): "
2788 "interface %i, class %i\n",
2789 le16_to_cpu(udev->descriptor.idVendor),
2790 le16_to_cpu(udev->descriptor.idProduct),
2791 ifnum,
2792 interface->altsetting[0].desc.bInterfaceClass);
2794 em28xx_devused &= ~(1<<nr);
2795 retval = -ENODEV;
2796 goto err;
2799 endpoint = &interface->cur_altsetting->endpoint[0].desc;
2801 /* check if the device has the iso in endpoint at the correct place */
2802 if (usb_endpoint_xfer_isoc(endpoint)
2804 (interface->altsetting[1].endpoint[0].desc.wMaxPacketSize == 940)) {
2805 /* It's a newer em2874/em2875 device */
2806 isoc_pipe = 0;
2807 } else {
2808 int check_interface = 1;
2809 isoc_pipe = 1;
2810 endpoint = &interface->cur_altsetting->endpoint[1].desc;
2811 if (!usb_endpoint_xfer_isoc(endpoint))
2812 check_interface = 0;
2814 if (usb_endpoint_dir_out(endpoint))
2815 check_interface = 0;
2817 if (!check_interface) {
2818 em28xx_err(DRIVER_NAME " video device (%04x:%04x): "
2819 "interface %i, class %i found.\n",
2820 le16_to_cpu(udev->descriptor.idVendor),
2821 le16_to_cpu(udev->descriptor.idProduct),
2822 ifnum,
2823 interface->altsetting[0].desc.bInterfaceClass);
2825 em28xx_err(DRIVER_NAME " This is an anciliary "
2826 "interface not used by the driver\n");
2828 em28xx_devused &= ~(1<<nr);
2829 retval = -ENODEV;
2830 goto err;
2834 switch (udev->speed) {
2835 case USB_SPEED_LOW:
2836 speed = "1.5";
2837 break;
2838 case USB_SPEED_UNKNOWN:
2839 case USB_SPEED_FULL:
2840 speed = "12";
2841 break;
2842 case USB_SPEED_HIGH:
2843 speed = "480";
2844 break;
2845 default:
2846 speed = "unknown";
2849 if (udev->manufacturer)
2850 strlcpy(descr, udev->manufacturer, sizeof(descr));
2852 if (udev->product) {
2853 if (*descr)
2854 strlcat(descr, " ", sizeof(descr));
2855 strlcat(descr, udev->product, sizeof(descr));
2857 if (*descr)
2858 strlcat(descr, " ", sizeof(descr));
2860 printk(DRIVER_NAME ": New device %s@ %s Mbps "
2861 "(%04x:%04x, interface %d, class %d)\n",
2862 descr,
2863 speed,
2864 le16_to_cpu(udev->descriptor.idVendor),
2865 le16_to_cpu(udev->descriptor.idProduct),
2866 ifnum,
2867 interface->altsetting->desc.bInterfaceNumber);
2870 * Make sure we have 480 Mbps of bandwidth, otherwise things like
2871 * video stream wouldn't likely work, since 12 Mbps is generally
2872 * not enough even for most Digital TV streams.
2874 if (udev->speed != USB_SPEED_HIGH && disable_usb_speed_check == 0) {
2875 printk(DRIVER_NAME ": Device initialization failed.\n");
2876 printk(DRIVER_NAME ": Device must be connected to a high-speed"
2877 " USB 2.0 port.\n");
2878 em28xx_devused &= ~(1<<nr);
2879 retval = -ENODEV;
2880 goto err;
2883 if (nr >= EM28XX_MAXBOARDS) {
2884 printk(DRIVER_NAME ": Supports only %i em28xx boards.\n",
2885 EM28XX_MAXBOARDS);
2886 em28xx_devused &= ~(1<<nr);
2887 retval = -ENOMEM;
2888 goto err;
2891 /* allocate memory for our device state and initialize it */
2892 dev = kzalloc(sizeof(*dev), GFP_KERNEL);
2893 if (dev == NULL) {
2894 em28xx_err(DRIVER_NAME ": out of memory!\n");
2895 em28xx_devused &= ~(1<<nr);
2896 retval = -ENOMEM;
2897 goto err;
2900 snprintf(dev->name, 29, "em28xx #%d", nr);
2901 dev->devno = nr;
2902 dev->model = id->driver_info;
2903 dev->alt = -1;
2905 /* Checks if audio is provided by some interface */
2906 for (i = 0; i < udev->config->desc.bNumInterfaces; i++) {
2907 uif = udev->config->interface[i];
2908 if (uif->altsetting[0].desc.bInterfaceClass == USB_CLASS_AUDIO) {
2909 dev->has_audio_class = 1;
2910 break;
2914 /* compute alternate max packet sizes */
2915 uif = udev->actconfig->interface[0];
2917 dev->num_alt = uif->num_altsetting;
2918 dev->alt_max_pkt_size = kmalloc(32 * dev->num_alt, GFP_KERNEL);
2920 if (dev->alt_max_pkt_size == NULL) {
2921 em28xx_errdev("out of memory!\n");
2922 em28xx_devused &= ~(1<<nr);
2923 kfree(dev);
2924 retval = -ENOMEM;
2925 goto err;
2928 for (i = 0; i < dev->num_alt ; i++) {
2929 u16 tmp = le16_to_cpu(uif->altsetting[i].endpoint[isoc_pipe].desc.wMaxPacketSize);
2930 dev->alt_max_pkt_size[i] =
2931 (tmp & 0x07ff) * (((tmp & 0x1800) >> 11) + 1);
2934 if ((card[nr] >= 0) && (card[nr] < em28xx_bcount))
2935 dev->model = card[nr];
2937 /* allocate device struct */
2938 mutex_init(&dev->lock);
2939 mutex_lock(&dev->lock);
2940 retval = em28xx_init_dev(&dev, udev, interface, nr);
2941 if (retval) {
2942 em28xx_devused &= ~(1<<dev->devno);
2943 mutex_unlock(&dev->lock);
2944 kfree(dev);
2945 goto err;
2948 /* save our data pointer in this interface device */
2949 usb_set_intfdata(interface, dev);
2951 request_modules(dev);
2953 /* Should be the last thing to do, to avoid newer udev's to
2954 open the device before fully initializing it
2956 mutex_unlock(&dev->lock);
2958 return 0;
2960 err:
2961 return retval;
2965 * em28xx_usb_disconnect()
2966 * called when the device gets diconencted
2967 * video device will be unregistered on v4l2_close in case it is still open
2969 static void em28xx_usb_disconnect(struct usb_interface *interface)
2971 struct em28xx *dev;
2973 dev = usb_get_intfdata(interface);
2974 usb_set_intfdata(interface, NULL);
2976 if (!dev)
2977 return;
2979 em28xx_info("disconnecting %s\n", dev->vdev->name);
2981 /* wait until all current v4l2 io is finished then deallocate
2982 resources */
2983 mutex_lock(&dev->lock);
2985 wake_up_interruptible_all(&dev->open);
2987 v4l2_device_disconnect(&dev->v4l2_dev);
2989 if (dev->users) {
2990 em28xx_warn
2991 ("device %s is open! Deregistration and memory "
2992 "deallocation are deferred on close.\n",
2993 video_device_node_name(dev->vdev));
2995 dev->state |= DEV_MISCONFIGURED;
2996 em28xx_uninit_isoc(dev);
2997 dev->state |= DEV_DISCONNECTED;
2998 wake_up_interruptible(&dev->wait_frame);
2999 wake_up_interruptible(&dev->wait_stream);
3000 } else {
3001 dev->state |= DEV_DISCONNECTED;
3002 em28xx_release_resources(dev);
3005 em28xx_close_extension(dev);
3007 mutex_unlock(&dev->lock);
3009 if (!dev->users) {
3010 kfree(dev->alt_max_pkt_size);
3011 kfree(dev);
3015 static struct usb_driver em28xx_usb_driver = {
3016 .name = "em28xx",
3017 .probe = em28xx_usb_probe,
3018 .disconnect = em28xx_usb_disconnect,
3019 .id_table = em28xx_id_table,
3022 static int __init em28xx_module_init(void)
3024 int result;
3026 /* register this driver with the USB subsystem */
3027 result = usb_register(&em28xx_usb_driver);
3028 if (result)
3029 em28xx_err(DRIVER_NAME
3030 " usb_register failed. Error number %d.\n", result);
3032 printk(KERN_INFO DRIVER_NAME " driver loaded\n");
3034 return result;
3037 static void __exit em28xx_module_exit(void)
3039 /* deregister this driver with the USB subsystem */
3040 usb_deregister(&em28xx_usb_driver);
3043 module_init(em28xx_module_init);
3044 module_exit(em28xx_module_exit);