Merge branch 'v6v7' into devel
[linux/fpc-iii.git] / drivers / media / video / em28xx / em28xx-cards.c
blob87f77a34eeabd092a678208dcac815caf0c230cc
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/slab.h>
28 #include <linux/delay.h>
29 #include <linux/i2c.h>
30 #include <linux/usb.h>
31 #include <media/tuner.h>
32 #include <media/msp3400.h>
33 #include <media/saa7115.h>
34 #include <media/tvp5150.h>
35 #include <media/tvaudio.h>
36 #include <media/mt9v011.h>
37 #include <media/i2c-addr.h>
38 #include <media/tveeprom.h>
39 #include <media/v4l2-common.h>
40 #include <media/v4l2-chip-ident.h>
42 #include "em28xx.h"
44 #define DRIVER_NAME "em28xx"
46 static int tuner = -1;
47 module_param(tuner, int, 0444);
48 MODULE_PARM_DESC(tuner, "tuner type");
50 static unsigned int disable_ir;
51 module_param(disable_ir, int, 0444);
52 MODULE_PARM_DESC(disable_ir, "disable infrared remote support");
54 static unsigned int disable_usb_speed_check;
55 module_param(disable_usb_speed_check, int, 0444);
56 MODULE_PARM_DESC(disable_usb_speed_check,
57 "override min bandwidth requirement of 480M bps");
59 static unsigned int card[] = {[0 ... (EM28XX_MAXBOARDS - 1)] = UNSET };
60 module_param_array(card, int, NULL, 0444);
61 MODULE_PARM_DESC(card, "card type");
63 /* Bitmask marking allocated devices from 0 to EM28XX_MAXBOARDS */
64 static unsigned long em28xx_devused;
66 struct em28xx_hash_table {
67 unsigned long hash;
68 unsigned int model;
69 unsigned int tuner;
73 * Reset sequences for analog/digital modes
76 /* Reset for the most [analog] boards */
77 static struct em28xx_reg_seq default_analog[] = {
78 {EM28XX_R08_GPIO, 0x6d, ~EM_GPIO_4, 10},
79 { -1, -1, -1, -1},
82 /* Reset for the most [digital] boards */
83 static struct em28xx_reg_seq default_digital[] = {
84 {EM28XX_R08_GPIO, 0x6e, ~EM_GPIO_4, 10},
85 { -1, -1, -1, -1},
88 /* Board Hauppauge WinTV HVR 900 analog */
89 static struct em28xx_reg_seq hauppauge_wintv_hvr_900_analog[] = {
90 {EM28XX_R08_GPIO, 0x2d, ~EM_GPIO_4, 10},
91 {0x05, 0xff, 0x10, 10},
92 { -1, -1, -1, -1},
95 /* Board Hauppauge WinTV HVR 900 digital */
96 static struct em28xx_reg_seq hauppauge_wintv_hvr_900_digital[] = {
97 {EM28XX_R08_GPIO, 0x2e, ~EM_GPIO_4, 10},
98 {EM2880_R04_GPO, 0x04, 0x0f, 10},
99 {EM2880_R04_GPO, 0x0c, 0x0f, 10},
100 { -1, -1, -1, -1},
103 /* Boards - EM2880 MSI DIGIVOX AD and EM2880_BOARD_MSI_DIGIVOX_AD_II */
104 static struct em28xx_reg_seq em2880_msi_digivox_ad_analog[] = {
105 {EM28XX_R08_GPIO, 0x69, ~EM_GPIO_4, 10},
106 { -1, -1, -1, -1},
109 /* Boards - EM2880 MSI DIGIVOX AD and EM2880_BOARD_MSI_DIGIVOX_AD_II */
111 /* Board - EM2870 Kworld 355u
112 Analog - No input analog */
114 /* Board - EM2882 Kworld 315U digital */
115 static struct em28xx_reg_seq em2882_kworld_315u_digital[] = {
116 {EM28XX_R08_GPIO, 0xff, 0xff, 10},
117 {EM28XX_R08_GPIO, 0xfe, 0xff, 10},
118 {EM2880_R04_GPO, 0x04, 0xff, 10},
119 {EM2880_R04_GPO, 0x0c, 0xff, 10},
120 {EM28XX_R08_GPIO, 0x7e, 0xff, 10},
121 { -1, -1, -1, -1},
124 static struct em28xx_reg_seq em2882_kworld_315u_tuner_gpio[] = {
125 {EM2880_R04_GPO, 0x08, 0xff, 10},
126 {EM2880_R04_GPO, 0x0c, 0xff, 10},
127 {EM2880_R04_GPO, 0x08, 0xff, 10},
128 {EM2880_R04_GPO, 0x0c, 0xff, 10},
129 { -1, -1, -1, -1},
132 static struct em28xx_reg_seq kworld_330u_analog[] = {
133 {EM28XX_R08_GPIO, 0x6d, ~EM_GPIO_4, 10},
134 {EM2880_R04_GPO, 0x00, 0xff, 10},
135 { -1, -1, -1, -1},
138 static struct em28xx_reg_seq kworld_330u_digital[] = {
139 {EM28XX_R08_GPIO, 0x6e, ~EM_GPIO_4, 10},
140 {EM2880_R04_GPO, 0x08, 0xff, 10},
141 { -1, -1, -1, -1},
144 /* Evga inDtube
145 GPIO0 - Enable digital power (s5h1409) - low to enable
146 GPIO1 - Enable analog power (tvp5150/emp202) - low to enable
147 GPIO4 - xc3028 reset
148 GOP3 - s5h1409 reset
150 static struct em28xx_reg_seq evga_indtube_analog[] = {
151 {EM28XX_R08_GPIO, 0x79, 0xff, 60},
152 { -1, -1, -1, -1},
155 static struct em28xx_reg_seq evga_indtube_digital[] = {
156 {EM28XX_R08_GPIO, 0x7a, 0xff, 1},
157 {EM2880_R04_GPO, 0x04, 0xff, 10},
158 {EM2880_R04_GPO, 0x0c, 0xff, 1},
159 { -1, -1, -1, -1},
163 * KWorld PlusTV 340U and UB435-Q (ATSC) GPIOs map:
164 * EM_GPIO_0 - currently unknown
165 * EM_GPIO_1 - LED disable/enable (1 = off, 0 = on)
166 * EM_GPIO_2 - currently unknown
167 * EM_GPIO_3 - currently unknown
168 * EM_GPIO_4 - TDA18271HD/C1 tuner (1 = active, 0 = in reset)
169 * EM_GPIO_5 - LGDT3304 ATSC/QAM demod (1 = active, 0 = in reset)
170 * EM_GPIO_6 - currently unknown
171 * EM_GPIO_7 - currently unknown
173 static struct em28xx_reg_seq kworld_a340_digital[] = {
174 {EM28XX_R08_GPIO, 0x6d, ~EM_GPIO_4, 10},
175 { -1, -1, -1, -1},
178 /* Pinnacle Hybrid Pro eb1a:2881 */
179 static struct em28xx_reg_seq pinnacle_hybrid_pro_analog[] = {
180 {EM28XX_R08_GPIO, 0xfd, ~EM_GPIO_4, 10},
181 { -1, -1, -1, -1},
184 static struct em28xx_reg_seq pinnacle_hybrid_pro_digital[] = {
185 {EM28XX_R08_GPIO, 0x6e, ~EM_GPIO_4, 10},
186 {EM2880_R04_GPO, 0x04, 0xff, 100},/* zl10353 reset */
187 {EM2880_R04_GPO, 0x0c, 0xff, 1},
188 { -1, -1, -1, -1},
191 static struct em28xx_reg_seq terratec_cinergy_USB_XS_FR_analog[] = {
192 {EM28XX_R08_GPIO, 0x6d, ~EM_GPIO_4, 10},
193 {EM2880_R04_GPO, 0x00, 0xff, 10},
194 { -1, -1, -1, -1},
197 static struct em28xx_reg_seq terratec_cinergy_USB_XS_FR_digital[] = {
198 {EM28XX_R08_GPIO, 0x6e, ~EM_GPIO_4, 10},
199 {EM2880_R04_GPO, 0x08, 0xff, 10},
200 { -1, -1, -1, -1},
203 /* eb1a:2868 Reddo DVB-C USB TV Box
204 GPIO4 - CU1216L NIM
205 Other GPIOs seems to be don't care. */
206 static struct em28xx_reg_seq reddo_dvb_c_usb_box[] = {
207 {EM28XX_R08_GPIO, 0xfe, 0xff, 10},
208 {EM28XX_R08_GPIO, 0xde, 0xff, 10},
209 {EM28XX_R08_GPIO, 0xfe, 0xff, 10},
210 {EM28XX_R08_GPIO, 0xff, 0xff, 10},
211 {EM28XX_R08_GPIO, 0x7f, 0xff, 10},
212 {EM28XX_R08_GPIO, 0x6f, 0xff, 10},
213 {EM28XX_R08_GPIO, 0xff, 0xff, 10},
214 {-1, -1, -1, -1},
217 /* Callback for the most boards */
218 static struct em28xx_reg_seq default_tuner_gpio[] = {
219 {EM28XX_R08_GPIO, EM_GPIO_4, EM_GPIO_4, 10},
220 {EM28XX_R08_GPIO, 0, EM_GPIO_4, 10},
221 {EM28XX_R08_GPIO, EM_GPIO_4, EM_GPIO_4, 10},
222 { -1, -1, -1, -1},
225 /* Mute/unmute */
226 static struct em28xx_reg_seq compro_unmute_tv_gpio[] = {
227 {EM28XX_R08_GPIO, 5, 7, 10},
228 { -1, -1, -1, -1},
231 static struct em28xx_reg_seq compro_unmute_svid_gpio[] = {
232 {EM28XX_R08_GPIO, 4, 7, 10},
233 { -1, -1, -1, -1},
236 static struct em28xx_reg_seq compro_mute_gpio[] = {
237 {EM28XX_R08_GPIO, 6, 7, 10},
238 { -1, -1, -1, -1},
241 /* Terratec AV350 */
242 static struct em28xx_reg_seq terratec_av350_mute_gpio[] = {
243 {EM28XX_R08_GPIO, 0xff, 0x7f, 10},
244 { -1, -1, -1, -1},
247 static struct em28xx_reg_seq terratec_av350_unmute_gpio[] = {
248 {EM28XX_R08_GPIO, 0xff, 0xff, 10},
249 { -1, -1, -1, -1},
252 static struct em28xx_reg_seq silvercrest_reg_seq[] = {
253 {EM28XX_R08_GPIO, 0xff, 0xff, 10},
254 {EM28XX_R08_GPIO, 0x01, 0xf7, 10},
255 { -1, -1, -1, -1},
258 static struct em28xx_reg_seq vc211a_enable[] = {
259 {EM28XX_R08_GPIO, 0xff, 0x07, 10},
260 {EM28XX_R08_GPIO, 0xff, 0x0f, 10},
261 {EM28XX_R08_GPIO, 0xff, 0x0b, 10},
262 { -1, -1, -1, -1},
265 static struct em28xx_reg_seq dikom_dk300_digital[] = {
266 {EM28XX_R08_GPIO, 0x6e, ~EM_GPIO_4, 10},
267 {EM2880_R04_GPO, 0x08, 0xff, 10},
268 { -1, -1, -1, -1},
272 /* Reset for the most [digital] boards */
273 static struct em28xx_reg_seq leadership_digital[] = {
274 {EM2874_R80_GPIO, 0x70, 0xff, 10},
275 { -1, -1, -1, -1},
278 static struct em28xx_reg_seq leadership_reset[] = {
279 {EM2874_R80_GPIO, 0xf0, 0xff, 10},
280 {EM2874_R80_GPIO, 0xb0, 0xff, 10},
281 {EM2874_R80_GPIO, 0xf0, 0xff, 10},
282 { -1, -1, -1, -1},
287 * Board definitions
289 struct em28xx_board em28xx_boards[] = {
290 [EM2750_BOARD_UNKNOWN] = {
291 .name = "EM2710/EM2750/EM2751 webcam grabber",
292 .xclk = EM28XX_XCLK_FREQUENCY_20MHZ,
293 .tuner_type = TUNER_ABSENT,
294 .is_webcam = 1,
295 .input = { {
296 .type = EM28XX_VMUX_COMPOSITE1,
297 .vmux = 0,
298 .amux = EM28XX_AMUX_VIDEO,
299 .gpio = silvercrest_reg_seq,
300 } },
302 [EM2800_BOARD_UNKNOWN] = {
303 .name = "Unknown EM2800 video grabber",
304 .is_em2800 = 1,
305 .tda9887_conf = TDA9887_PRESENT,
306 .decoder = EM28XX_SAA711X,
307 .tuner_type = TUNER_ABSENT,
308 .input = { {
309 .type = EM28XX_VMUX_COMPOSITE1,
310 .vmux = SAA7115_COMPOSITE0,
311 .amux = EM28XX_AMUX_LINE_IN,
312 }, {
313 .type = EM28XX_VMUX_SVIDEO,
314 .vmux = SAA7115_SVIDEO3,
315 .amux = EM28XX_AMUX_LINE_IN,
316 } },
318 [EM2820_BOARD_UNKNOWN] = {
319 .name = "Unknown EM2750/28xx video grabber",
320 .tuner_type = TUNER_ABSENT,
321 .is_webcam = 1, /* To enable sensor probe */
323 [EM2750_BOARD_DLCW_130] = {
324 /* Beijing Huaqi Information Digital Technology Co., Ltd */
325 .name = "Huaqi DLCW-130",
326 .valid = EM28XX_BOARD_NOT_VALIDATED,
327 .xclk = EM28XX_XCLK_FREQUENCY_48MHZ,
328 .tuner_type = TUNER_ABSENT,
329 .is_webcam = 1,
330 .input = { {
331 .type = EM28XX_VMUX_COMPOSITE1,
332 .vmux = 0,
333 .amux = EM28XX_AMUX_VIDEO,
334 } },
336 [EM2820_BOARD_KWORLD_PVRTV2800RF] = {
337 .name = "Kworld PVR TV 2800 RF",
338 .tuner_type = TUNER_TEMIC_PAL,
339 .tda9887_conf = TDA9887_PRESENT,
340 .decoder = EM28XX_SAA711X,
341 .input = { {
342 .type = EM28XX_VMUX_COMPOSITE1,
343 .vmux = SAA7115_COMPOSITE0,
344 .amux = EM28XX_AMUX_LINE_IN,
345 }, {
346 .type = EM28XX_VMUX_SVIDEO,
347 .vmux = SAA7115_SVIDEO3,
348 .amux = EM28XX_AMUX_LINE_IN,
349 } },
351 [EM2820_BOARD_GADMEI_TVR200] = {
352 .name = "Gadmei TVR200",
353 .tuner_type = TUNER_LG_PAL_NEW_TAPC,
354 .tda9887_conf = TDA9887_PRESENT,
355 .decoder = EM28XX_SAA711X,
356 .input = { {
357 .type = EM28XX_VMUX_TELEVISION,
358 .vmux = SAA7115_COMPOSITE2,
359 .amux = EM28XX_AMUX_LINE_IN,
360 }, {
361 .type = EM28XX_VMUX_COMPOSITE1,
362 .vmux = SAA7115_COMPOSITE0,
363 .amux = EM28XX_AMUX_LINE_IN,
364 }, {
365 .type = EM28XX_VMUX_SVIDEO,
366 .vmux = SAA7115_SVIDEO3,
367 .amux = EM28XX_AMUX_LINE_IN,
368 } },
370 [EM2820_BOARD_TERRATEC_CINERGY_250] = {
371 .name = "Terratec Cinergy 250 USB",
372 .tuner_type = TUNER_LG_PAL_NEW_TAPC,
373 .has_ir_i2c = 1,
374 .tda9887_conf = TDA9887_PRESENT,
375 .decoder = EM28XX_SAA711X,
376 .input = { {
377 .type = EM28XX_VMUX_TELEVISION,
378 .vmux = SAA7115_COMPOSITE2,
379 .amux = EM28XX_AMUX_LINE_IN,
380 }, {
381 .type = EM28XX_VMUX_COMPOSITE1,
382 .vmux = SAA7115_COMPOSITE0,
383 .amux = EM28XX_AMUX_LINE_IN,
384 }, {
385 .type = EM28XX_VMUX_SVIDEO,
386 .vmux = SAA7115_SVIDEO3,
387 .amux = EM28XX_AMUX_LINE_IN,
388 } },
390 [EM2820_BOARD_PINNACLE_USB_2] = {
391 .name = "Pinnacle PCTV USB 2",
392 .tuner_type = TUNER_LG_PAL_NEW_TAPC,
393 .has_ir_i2c = 1,
394 .tda9887_conf = TDA9887_PRESENT,
395 .decoder = EM28XX_SAA711X,
396 .input = { {
397 .type = EM28XX_VMUX_TELEVISION,
398 .vmux = SAA7115_COMPOSITE2,
399 .amux = EM28XX_AMUX_VIDEO,
400 }, {
401 .type = EM28XX_VMUX_COMPOSITE1,
402 .vmux = SAA7115_COMPOSITE0,
403 .amux = EM28XX_AMUX_LINE_IN,
404 }, {
405 .type = EM28XX_VMUX_SVIDEO,
406 .vmux = SAA7115_SVIDEO3,
407 .amux = EM28XX_AMUX_LINE_IN,
408 } },
410 [EM2820_BOARD_HAUPPAUGE_WINTV_USB_2] = {
411 .name = "Hauppauge WinTV USB 2",
412 .tuner_type = TUNER_PHILIPS_FM1236_MK3,
413 .tda9887_conf = TDA9887_PRESENT |
414 TDA9887_PORT1_ACTIVE |
415 TDA9887_PORT2_ACTIVE,
416 .decoder = EM28XX_TVP5150,
417 .has_msp34xx = 1,
418 .has_ir_i2c = 1,
419 .input = { {
420 .type = EM28XX_VMUX_TELEVISION,
421 .vmux = TVP5150_COMPOSITE0,
422 .amux = MSP_INPUT_DEFAULT,
423 }, {
424 .type = EM28XX_VMUX_SVIDEO,
425 .vmux = TVP5150_SVIDEO,
426 .amux = MSP_INPUT(MSP_IN_SCART1, MSP_IN_TUNER1,
427 MSP_DSP_IN_SCART, MSP_DSP_IN_SCART),
428 } },
430 [EM2820_BOARD_DLINK_USB_TV] = {
431 .name = "D-Link DUB-T210 TV Tuner",
432 .valid = EM28XX_BOARD_NOT_VALIDATED,
433 .tuner_type = TUNER_LG_PAL_NEW_TAPC,
434 .tda9887_conf = TDA9887_PRESENT,
435 .decoder = EM28XX_SAA711X,
436 .input = { {
437 .type = EM28XX_VMUX_TELEVISION,
438 .vmux = SAA7115_COMPOSITE2,
439 .amux = EM28XX_AMUX_LINE_IN,
440 }, {
441 .type = EM28XX_VMUX_COMPOSITE1,
442 .vmux = SAA7115_COMPOSITE0,
443 .amux = EM28XX_AMUX_LINE_IN,
444 }, {
445 .type = EM28XX_VMUX_SVIDEO,
446 .vmux = SAA7115_SVIDEO3,
447 .amux = EM28XX_AMUX_LINE_IN,
448 } },
450 [EM2820_BOARD_HERCULES_SMART_TV_USB2] = {
451 .name = "Hercules Smart TV USB 2.0",
452 .valid = EM28XX_BOARD_NOT_VALIDATED,
453 .tuner_type = TUNER_LG_PAL_NEW_TAPC,
454 .tda9887_conf = TDA9887_PRESENT,
455 .decoder = EM28XX_SAA711X,
456 .input = { {
457 .type = EM28XX_VMUX_TELEVISION,
458 .vmux = SAA7115_COMPOSITE2,
459 .amux = EM28XX_AMUX_LINE_IN,
460 }, {
461 .type = EM28XX_VMUX_COMPOSITE1,
462 .vmux = SAA7115_COMPOSITE0,
463 .amux = EM28XX_AMUX_LINE_IN,
464 }, {
465 .type = EM28XX_VMUX_SVIDEO,
466 .vmux = SAA7115_SVIDEO3,
467 .amux = EM28XX_AMUX_LINE_IN,
468 } },
470 [EM2820_BOARD_PINNACLE_USB_2_FM1216ME] = {
471 .name = "Pinnacle PCTV USB 2 (Philips FM1216ME)",
472 .valid = EM28XX_BOARD_NOT_VALIDATED,
473 .tuner_type = TUNER_PHILIPS_FM1216ME_MK3,
474 .tda9887_conf = TDA9887_PRESENT,
475 .decoder = EM28XX_SAA711X,
476 .input = { {
477 .type = EM28XX_VMUX_TELEVISION,
478 .vmux = SAA7115_COMPOSITE2,
479 .amux = EM28XX_AMUX_VIDEO,
480 }, {
481 .type = EM28XX_VMUX_COMPOSITE1,
482 .vmux = SAA7115_COMPOSITE0,
483 .amux = EM28XX_AMUX_LINE_IN,
484 }, {
485 .type = EM28XX_VMUX_SVIDEO,
486 .vmux = SAA7115_SVIDEO3,
487 .amux = EM28XX_AMUX_LINE_IN,
488 } },
490 [EM2820_BOARD_GADMEI_UTV310] = {
491 .name = "Gadmei UTV310",
492 .valid = EM28XX_BOARD_NOT_VALIDATED,
493 .tuner_type = TUNER_TNF_5335MF,
494 .tda9887_conf = TDA9887_PRESENT,
495 .decoder = EM28XX_SAA711X,
496 .input = { {
497 .type = EM28XX_VMUX_TELEVISION,
498 .vmux = SAA7115_COMPOSITE1,
499 .amux = EM28XX_AMUX_LINE_IN,
500 }, {
501 .type = EM28XX_VMUX_COMPOSITE1,
502 .vmux = SAA7115_COMPOSITE0,
503 .amux = EM28XX_AMUX_LINE_IN,
504 }, {
505 .type = EM28XX_VMUX_SVIDEO,
506 .vmux = SAA7115_SVIDEO3,
507 .amux = EM28XX_AMUX_LINE_IN,
508 } },
510 [EM2820_BOARD_LEADTEK_WINFAST_USBII_DELUXE] = {
511 .name = "Leadtek Winfast USB II Deluxe",
512 .valid = EM28XX_BOARD_NOT_VALIDATED,
513 .tuner_type = TUNER_PHILIPS_FM1216ME_MK3,
514 .has_ir_i2c = 1,
515 .tvaudio_addr = 0x58,
516 .tda9887_conf = TDA9887_PRESENT |
517 TDA9887_PORT2_ACTIVE |
518 TDA9887_QSS,
519 .decoder = EM28XX_SAA711X,
520 .adecoder = EM28XX_TVAUDIO,
521 .input = { {
522 .type = EM28XX_VMUX_TELEVISION,
523 .vmux = SAA7115_COMPOSITE4,
524 .amux = EM28XX_AMUX_AUX,
525 }, {
526 .type = EM28XX_VMUX_COMPOSITE1,
527 .vmux = SAA7115_COMPOSITE5,
528 .amux = EM28XX_AMUX_LINE_IN,
529 }, {
530 .type = EM28XX_VMUX_SVIDEO,
531 .vmux = SAA7115_SVIDEO3,
532 .amux = EM28XX_AMUX_LINE_IN,
533 } },
534 .radio = {
535 .type = EM28XX_RADIO,
536 .amux = EM28XX_AMUX_AUX,
539 [EM2820_BOARD_VIDEOLOGY_20K14XUSB] = {
540 .name = "Videology 20K14XUSB USB2.0",
541 .valid = EM28XX_BOARD_NOT_VALIDATED,
542 .tuner_type = TUNER_ABSENT,
543 .is_webcam = 1,
544 .input = { {
545 .type = EM28XX_VMUX_COMPOSITE1,
546 .vmux = 0,
547 .amux = EM28XX_AMUX_VIDEO,
548 } },
550 [EM2820_BOARD_SILVERCREST_WEBCAM] = {
551 .name = "Silvercrest Webcam 1.3mpix",
552 .tuner_type = TUNER_ABSENT,
553 .is_webcam = 1,
554 .input = { {
555 .type = EM28XX_VMUX_COMPOSITE1,
556 .vmux = 0,
557 .amux = EM28XX_AMUX_VIDEO,
558 .gpio = silvercrest_reg_seq,
559 } },
561 [EM2821_BOARD_SUPERCOMP_USB_2] = {
562 .name = "Supercomp USB 2.0 TV",
563 .valid = EM28XX_BOARD_NOT_VALIDATED,
564 .tuner_type = TUNER_PHILIPS_FM1236_MK3,
565 .tda9887_conf = TDA9887_PRESENT |
566 TDA9887_PORT1_ACTIVE |
567 TDA9887_PORT2_ACTIVE,
568 .decoder = EM28XX_SAA711X,
569 .input = { {
570 .type = EM28XX_VMUX_TELEVISION,
571 .vmux = SAA7115_COMPOSITE2,
572 .amux = EM28XX_AMUX_LINE_IN,
573 }, {
574 .type = EM28XX_VMUX_COMPOSITE1,
575 .vmux = SAA7115_COMPOSITE0,
576 .amux = EM28XX_AMUX_VIDEO,
577 }, {
578 .type = EM28XX_VMUX_SVIDEO,
579 .vmux = SAA7115_SVIDEO3,
580 .amux = EM28XX_AMUX_LINE_IN,
581 } },
583 [EM2821_BOARD_USBGEAR_VD204] = {
584 .name = "Usbgear VD204v9",
585 .valid = EM28XX_BOARD_NOT_VALIDATED,
586 .tuner_type = TUNER_ABSENT, /* Capture only device */
587 .decoder = EM28XX_SAA711X,
588 .input = { {
589 .type = EM28XX_VMUX_COMPOSITE1,
590 .vmux = SAA7115_COMPOSITE0,
591 .amux = EM28XX_AMUX_LINE_IN,
592 }, {
593 .type = EM28XX_VMUX_SVIDEO,
594 .vmux = SAA7115_SVIDEO3,
595 .amux = EM28XX_AMUX_LINE_IN,
596 } },
598 [EM2860_BOARD_NETGMBH_CAM] = {
599 /* Beijing Huaqi Information Digital Technology Co., Ltd */
600 .name = "NetGMBH Cam",
601 .valid = EM28XX_BOARD_NOT_VALIDATED,
602 .tuner_type = TUNER_ABSENT,
603 .is_webcam = 1,
604 .input = { {
605 .type = EM28XX_VMUX_COMPOSITE1,
606 .vmux = 0,
607 .amux = EM28XX_AMUX_VIDEO,
608 } },
610 [EM2860_BOARD_TYPHOON_DVD_MAKER] = {
611 .name = "Typhoon DVD Maker",
612 .decoder = EM28XX_SAA711X,
613 .tuner_type = TUNER_ABSENT, /* Capture only device */
614 .input = { {
615 .type = EM28XX_VMUX_COMPOSITE1,
616 .vmux = SAA7115_COMPOSITE0,
617 .amux = EM28XX_AMUX_LINE_IN,
618 }, {
619 .type = EM28XX_VMUX_SVIDEO,
620 .vmux = SAA7115_SVIDEO3,
621 .amux = EM28XX_AMUX_LINE_IN,
622 } },
624 [EM2860_BOARD_GADMEI_UTV330] = {
625 .name = "Gadmei UTV330",
626 .valid = EM28XX_BOARD_NOT_VALIDATED,
627 .tuner_type = TUNER_TNF_5335MF,
628 .tda9887_conf = TDA9887_PRESENT,
629 .decoder = EM28XX_SAA711X,
630 .input = { {
631 .type = EM28XX_VMUX_TELEVISION,
632 .vmux = SAA7115_COMPOSITE2,
633 .amux = EM28XX_AMUX_VIDEO,
634 }, {
635 .type = EM28XX_VMUX_COMPOSITE1,
636 .vmux = SAA7115_COMPOSITE0,
637 .amux = EM28XX_AMUX_LINE_IN,
638 }, {
639 .type = EM28XX_VMUX_SVIDEO,
640 .vmux = SAA7115_SVIDEO3,
641 .amux = EM28XX_AMUX_LINE_IN,
642 } },
644 [EM2861_BOARD_GADMEI_UTV330PLUS] = {
645 .name = "Gadmei UTV330+",
646 .tuner_type = TUNER_TNF_5335MF,
647 .tda9887_conf = TDA9887_PRESENT,
648 .ir_codes = RC_MAP_GADMEI_RM008Z,
649 .decoder = EM28XX_SAA711X,
650 .xclk = EM28XX_XCLK_FREQUENCY_12MHZ,
651 .input = { {
652 .type = EM28XX_VMUX_TELEVISION,
653 .vmux = SAA7115_COMPOSITE2,
654 .amux = EM28XX_AMUX_VIDEO,
655 }, {
656 .type = EM28XX_VMUX_COMPOSITE1,
657 .vmux = SAA7115_COMPOSITE0,
658 .amux = EM28XX_AMUX_LINE_IN,
659 }, {
660 .type = EM28XX_VMUX_SVIDEO,
661 .vmux = SAA7115_SVIDEO3,
662 .amux = EM28XX_AMUX_LINE_IN,
663 } },
665 [EM2860_BOARD_TERRATEC_HYBRID_XS] = {
666 .name = "Terratec Cinergy A Hybrid XS",
667 .valid = EM28XX_BOARD_NOT_VALIDATED,
668 .tuner_type = TUNER_XC2028,
669 .tuner_gpio = default_tuner_gpio,
670 .decoder = EM28XX_TVP5150,
672 .input = { {
673 .type = EM28XX_VMUX_TELEVISION,
674 .vmux = TVP5150_COMPOSITE0,
675 .amux = EM28XX_AMUX_VIDEO,
676 .gpio = hauppauge_wintv_hvr_900_analog,
677 }, {
678 .type = EM28XX_VMUX_COMPOSITE1,
679 .vmux = TVP5150_COMPOSITE1,
680 .amux = EM28XX_AMUX_LINE_IN,
681 .gpio = hauppauge_wintv_hvr_900_analog,
682 }, {
683 .type = EM28XX_VMUX_SVIDEO,
684 .vmux = TVP5150_SVIDEO,
685 .amux = EM28XX_AMUX_LINE_IN,
686 .gpio = hauppauge_wintv_hvr_900_analog,
687 } },
689 [EM2861_BOARD_KWORLD_PVRTV_300U] = {
690 .name = "KWorld PVRTV 300U",
691 .valid = EM28XX_BOARD_NOT_VALIDATED,
692 .tuner_type = TUNER_XC2028,
693 .tuner_gpio = default_tuner_gpio,
694 .decoder = EM28XX_TVP5150,
695 .input = { {
696 .type = EM28XX_VMUX_TELEVISION,
697 .vmux = TVP5150_COMPOSITE0,
698 .amux = EM28XX_AMUX_VIDEO,
699 }, {
700 .type = EM28XX_VMUX_COMPOSITE1,
701 .vmux = TVP5150_COMPOSITE1,
702 .amux = EM28XX_AMUX_LINE_IN,
703 }, {
704 .type = EM28XX_VMUX_SVIDEO,
705 .vmux = TVP5150_SVIDEO,
706 .amux = EM28XX_AMUX_LINE_IN,
707 } },
709 [EM2861_BOARD_YAKUMO_MOVIE_MIXER] = {
710 .name = "Yakumo MovieMixer",
711 .tuner_type = TUNER_ABSENT, /* Capture only device */
712 .decoder = EM28XX_TVP5150,
713 .input = { {
714 .type = EM28XX_VMUX_TELEVISION,
715 .vmux = TVP5150_COMPOSITE0,
716 .amux = EM28XX_AMUX_VIDEO,
717 }, {
718 .type = EM28XX_VMUX_COMPOSITE1,
719 .vmux = TVP5150_COMPOSITE1,
720 .amux = EM28XX_AMUX_LINE_IN,
721 }, {
722 .type = EM28XX_VMUX_SVIDEO,
723 .vmux = TVP5150_SVIDEO,
724 .amux = EM28XX_AMUX_LINE_IN,
725 } },
727 [EM2860_BOARD_TVP5150_REFERENCE_DESIGN] = {
728 .name = "EM2860/TVP5150 Reference Design",
729 .tuner_type = TUNER_ABSENT, /* Capture only device */
730 .decoder = EM28XX_TVP5150,
731 .input = { {
732 .type = EM28XX_VMUX_COMPOSITE1,
733 .vmux = TVP5150_COMPOSITE1,
734 .amux = EM28XX_AMUX_LINE_IN,
735 }, {
736 .type = EM28XX_VMUX_SVIDEO,
737 .vmux = TVP5150_SVIDEO,
738 .amux = EM28XX_AMUX_LINE_IN,
739 } },
741 [EM2861_BOARD_PLEXTOR_PX_TV100U] = {
742 .name = "Plextor ConvertX PX-TV100U",
743 .tuner_type = TUNER_TNF_5335MF,
744 .xclk = EM28XX_XCLK_I2S_MSB_TIMING |
745 EM28XX_XCLK_FREQUENCY_12MHZ,
746 .tda9887_conf = TDA9887_PRESENT,
747 .decoder = EM28XX_TVP5150,
748 .has_msp34xx = 1,
749 .input = { {
750 .type = EM28XX_VMUX_TELEVISION,
751 .vmux = TVP5150_COMPOSITE0,
752 .amux = EM28XX_AMUX_LINE_IN,
753 .gpio = pinnacle_hybrid_pro_analog,
754 }, {
755 .type = EM28XX_VMUX_COMPOSITE1,
756 .vmux = TVP5150_COMPOSITE1,
757 .amux = EM28XX_AMUX_LINE_IN,
758 .gpio = pinnacle_hybrid_pro_analog,
759 }, {
760 .type = EM28XX_VMUX_SVIDEO,
761 .vmux = TVP5150_SVIDEO,
762 .amux = EM28XX_AMUX_LINE_IN,
763 .gpio = pinnacle_hybrid_pro_analog,
764 } },
767 /* Those boards with em2870 are DVB Only*/
769 [EM2870_BOARD_TERRATEC_XS] = {
770 .name = "Terratec Cinergy T XS",
771 .valid = EM28XX_BOARD_NOT_VALIDATED,
772 .tuner_type = TUNER_XC2028,
773 .tuner_gpio = default_tuner_gpio,
775 [EM2870_BOARD_TERRATEC_XS_MT2060] = {
776 .name = "Terratec Cinergy T XS (MT2060)",
777 .valid = EM28XX_BOARD_NOT_VALIDATED,
778 .tuner_type = TUNER_ABSENT, /* MT2060 */
780 [EM2870_BOARD_KWORLD_350U] = {
781 .name = "Kworld 350 U DVB-T",
782 .valid = EM28XX_BOARD_NOT_VALIDATED,
783 .tuner_type = TUNER_XC2028,
784 .tuner_gpio = default_tuner_gpio,
786 [EM2870_BOARD_KWORLD_355U] = {
787 .name = "Kworld 355 U DVB-T",
788 .valid = EM28XX_BOARD_NOT_VALIDATED,
790 [EM2870_BOARD_PINNACLE_PCTV_DVB] = {
791 .name = "Pinnacle PCTV DVB-T",
792 .valid = EM28XX_BOARD_NOT_VALIDATED,
793 .tuner_type = TUNER_ABSENT, /* MT2060 */
794 /* djh - I have serious doubts this is right... */
795 .xclk = EM28XX_XCLK_IR_RC5_MODE |
796 EM28XX_XCLK_FREQUENCY_10MHZ,
798 [EM2870_BOARD_COMPRO_VIDEOMATE] = {
799 .name = "Compro, VideoMate U3",
800 .valid = EM28XX_BOARD_NOT_VALIDATED,
801 .tuner_type = TUNER_ABSENT, /* MT2060 */
804 [EM2880_BOARD_TERRATEC_HYBRID_XS_FR] = {
805 .name = "Terratec Hybrid XS Secam",
806 .has_msp34xx = 1,
807 .tuner_type = TUNER_XC2028,
808 .tuner_gpio = default_tuner_gpio,
809 .decoder = EM28XX_TVP5150,
810 .has_dvb = 1,
811 .dvb_gpio = terratec_cinergy_USB_XS_FR_digital,
812 .input = { {
813 .type = EM28XX_VMUX_TELEVISION,
814 .vmux = TVP5150_COMPOSITE0,
815 .amux = EM28XX_AMUX_VIDEO,
816 .gpio = terratec_cinergy_USB_XS_FR_analog,
817 }, {
818 .type = EM28XX_VMUX_COMPOSITE1,
819 .vmux = TVP5150_COMPOSITE1,
820 .amux = EM28XX_AMUX_LINE_IN,
821 .gpio = terratec_cinergy_USB_XS_FR_analog,
822 }, {
823 .type = EM28XX_VMUX_SVIDEO,
824 .vmux = TVP5150_SVIDEO,
825 .amux = EM28XX_AMUX_LINE_IN,
826 .gpio = terratec_cinergy_USB_XS_FR_analog,
827 } },
829 [EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900] = {
830 .name = "Hauppauge WinTV HVR 900",
831 .tda9887_conf = TDA9887_PRESENT,
832 .tuner_type = TUNER_XC2028,
833 .tuner_gpio = default_tuner_gpio,
834 .mts_firmware = 1,
835 .has_dvb = 1,
836 .dvb_gpio = hauppauge_wintv_hvr_900_digital,
837 .ir_codes = RC_MAP_HAUPPAUGE_NEW,
838 .decoder = EM28XX_TVP5150,
839 .input = { {
840 .type = EM28XX_VMUX_TELEVISION,
841 .vmux = TVP5150_COMPOSITE0,
842 .amux = EM28XX_AMUX_VIDEO,
843 .gpio = hauppauge_wintv_hvr_900_analog,
844 }, {
845 .type = EM28XX_VMUX_COMPOSITE1,
846 .vmux = TVP5150_COMPOSITE1,
847 .amux = EM28XX_AMUX_LINE_IN,
848 .gpio = hauppauge_wintv_hvr_900_analog,
849 }, {
850 .type = EM28XX_VMUX_SVIDEO,
851 .vmux = TVP5150_SVIDEO,
852 .amux = EM28XX_AMUX_LINE_IN,
853 .gpio = hauppauge_wintv_hvr_900_analog,
854 } },
856 [EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900_R2] = {
857 .name = "Hauppauge WinTV HVR 900 (R2)",
858 .tda9887_conf = TDA9887_PRESENT,
859 .tuner_type = TUNER_XC2028,
860 .tuner_gpio = default_tuner_gpio,
861 .mts_firmware = 1,
862 .ir_codes = RC_MAP_HAUPPAUGE_NEW,
863 .decoder = EM28XX_TVP5150,
864 .input = { {
865 .type = EM28XX_VMUX_TELEVISION,
866 .vmux = TVP5150_COMPOSITE0,
867 .amux = EM28XX_AMUX_VIDEO,
868 .gpio = hauppauge_wintv_hvr_900_analog,
869 }, {
870 .type = EM28XX_VMUX_COMPOSITE1,
871 .vmux = TVP5150_COMPOSITE1,
872 .amux = EM28XX_AMUX_LINE_IN,
873 .gpio = hauppauge_wintv_hvr_900_analog,
874 }, {
875 .type = EM28XX_VMUX_SVIDEO,
876 .vmux = TVP5150_SVIDEO,
877 .amux = EM28XX_AMUX_LINE_IN,
878 .gpio = hauppauge_wintv_hvr_900_analog,
879 } },
881 [EM2883_BOARD_HAUPPAUGE_WINTV_HVR_850] = {
882 .name = "Hauppauge WinTV HVR 850",
883 .tuner_type = TUNER_XC2028,
884 .tuner_gpio = default_tuner_gpio,
885 .mts_firmware = 1,
886 .has_dvb = 1,
887 .dvb_gpio = hauppauge_wintv_hvr_900_digital,
888 .ir_codes = RC_MAP_HAUPPAUGE_NEW,
889 .decoder = EM28XX_TVP5150,
890 .input = { {
891 .type = EM28XX_VMUX_TELEVISION,
892 .vmux = TVP5150_COMPOSITE0,
893 .amux = EM28XX_AMUX_VIDEO,
894 .gpio = hauppauge_wintv_hvr_900_analog,
895 }, {
896 .type = EM28XX_VMUX_COMPOSITE1,
897 .vmux = TVP5150_COMPOSITE1,
898 .amux = EM28XX_AMUX_LINE_IN,
899 .gpio = hauppauge_wintv_hvr_900_analog,
900 }, {
901 .type = EM28XX_VMUX_SVIDEO,
902 .vmux = TVP5150_SVIDEO,
903 .amux = EM28XX_AMUX_LINE_IN,
904 .gpio = hauppauge_wintv_hvr_900_analog,
905 } },
907 [EM2883_BOARD_HAUPPAUGE_WINTV_HVR_950] = {
908 .name = "Hauppauge WinTV HVR 950",
909 .tuner_type = TUNER_XC2028,
910 .tuner_gpio = default_tuner_gpio,
911 .mts_firmware = 1,
912 .has_dvb = 1,
913 .dvb_gpio = hauppauge_wintv_hvr_900_digital,
914 .ir_codes = RC_MAP_RC5_HAUPPAUGE_NEW,
915 .decoder = EM28XX_TVP5150,
916 .input = { {
917 .type = EM28XX_VMUX_TELEVISION,
918 .vmux = TVP5150_COMPOSITE0,
919 .amux = EM28XX_AMUX_VIDEO,
920 .gpio = hauppauge_wintv_hvr_900_analog,
921 }, {
922 .type = EM28XX_VMUX_COMPOSITE1,
923 .vmux = TVP5150_COMPOSITE1,
924 .amux = EM28XX_AMUX_LINE_IN,
925 .gpio = hauppauge_wintv_hvr_900_analog,
926 }, {
927 .type = EM28XX_VMUX_SVIDEO,
928 .vmux = TVP5150_SVIDEO,
929 .amux = EM28XX_AMUX_LINE_IN,
930 .gpio = hauppauge_wintv_hvr_900_analog,
931 } },
933 [EM2880_BOARD_PINNACLE_PCTV_HD_PRO] = {
934 .name = "Pinnacle PCTV HD Pro Stick",
935 .tuner_type = TUNER_XC2028,
936 .tuner_gpio = default_tuner_gpio,
937 .mts_firmware = 1,
938 .has_dvb = 1,
939 .dvb_gpio = hauppauge_wintv_hvr_900_digital,
940 .ir_codes = RC_MAP_PINNACLE_PCTV_HD,
941 .decoder = EM28XX_TVP5150,
942 .input = { {
943 .type = EM28XX_VMUX_TELEVISION,
944 .vmux = TVP5150_COMPOSITE0,
945 .amux = EM28XX_AMUX_VIDEO,
946 .gpio = hauppauge_wintv_hvr_900_analog,
947 }, {
948 .type = EM28XX_VMUX_COMPOSITE1,
949 .vmux = TVP5150_COMPOSITE1,
950 .amux = EM28XX_AMUX_LINE_IN,
951 .gpio = hauppauge_wintv_hvr_900_analog,
952 }, {
953 .type = EM28XX_VMUX_SVIDEO,
954 .vmux = TVP5150_SVIDEO,
955 .amux = EM28XX_AMUX_LINE_IN,
956 .gpio = hauppauge_wintv_hvr_900_analog,
957 } },
959 [EM2880_BOARD_AMD_ATI_TV_WONDER_HD_600] = {
960 .name = "AMD ATI TV Wonder HD 600",
961 .tuner_type = TUNER_XC2028,
962 .tuner_gpio = default_tuner_gpio,
963 .mts_firmware = 1,
964 .has_dvb = 1,
965 .dvb_gpio = hauppauge_wintv_hvr_900_digital,
966 .ir_codes = RC_MAP_ATI_TV_WONDER_HD_600,
967 .decoder = EM28XX_TVP5150,
968 .input = { {
969 .type = EM28XX_VMUX_TELEVISION,
970 .vmux = TVP5150_COMPOSITE0,
971 .amux = EM28XX_AMUX_VIDEO,
972 .gpio = hauppauge_wintv_hvr_900_analog,
973 }, {
974 .type = EM28XX_VMUX_COMPOSITE1,
975 .vmux = TVP5150_COMPOSITE1,
976 .amux = EM28XX_AMUX_LINE_IN,
977 .gpio = hauppauge_wintv_hvr_900_analog,
978 }, {
979 .type = EM28XX_VMUX_SVIDEO,
980 .vmux = TVP5150_SVIDEO,
981 .amux = EM28XX_AMUX_LINE_IN,
982 .gpio = hauppauge_wintv_hvr_900_analog,
983 } },
985 [EM2880_BOARD_TERRATEC_HYBRID_XS] = {
986 .name = "Terratec Hybrid XS",
987 .tuner_type = TUNER_XC2028,
988 .tuner_gpio = default_tuner_gpio,
989 .decoder = EM28XX_TVP5150,
990 .has_dvb = 1,
991 .dvb_gpio = default_digital,
992 .ir_codes = RC_MAP_TERRATEC_CINERGY_XS,
993 .xclk = EM28XX_XCLK_FREQUENCY_12MHZ, /* NEC IR */
994 .input = { {
995 .type = EM28XX_VMUX_TELEVISION,
996 .vmux = TVP5150_COMPOSITE0,
997 .amux = EM28XX_AMUX_VIDEO,
998 .gpio = default_analog,
999 }, {
1000 .type = EM28XX_VMUX_COMPOSITE1,
1001 .vmux = TVP5150_COMPOSITE1,
1002 .amux = EM28XX_AMUX_LINE_IN,
1003 .gpio = default_analog,
1004 }, {
1005 .type = EM28XX_VMUX_SVIDEO,
1006 .vmux = TVP5150_SVIDEO,
1007 .amux = EM28XX_AMUX_LINE_IN,
1008 .gpio = default_analog,
1009 } },
1011 /* maybe there's a reason behind it why Terratec sells the Hybrid XS
1012 as Prodigy XS with a different PID, let's keep it separated for now
1013 maybe we'll need it lateron */
1014 [EM2880_BOARD_TERRATEC_PRODIGY_XS] = {
1015 .name = "Terratec Prodigy XS",
1016 .tuner_type = TUNER_XC2028,
1017 .tuner_gpio = default_tuner_gpio,
1018 .decoder = EM28XX_TVP5150,
1019 .input = { {
1020 .type = EM28XX_VMUX_TELEVISION,
1021 .vmux = TVP5150_COMPOSITE0,
1022 .amux = EM28XX_AMUX_VIDEO,
1023 .gpio = hauppauge_wintv_hvr_900_analog,
1024 }, {
1025 .type = EM28XX_VMUX_COMPOSITE1,
1026 .vmux = TVP5150_COMPOSITE1,
1027 .amux = EM28XX_AMUX_LINE_IN,
1028 .gpio = hauppauge_wintv_hvr_900_analog,
1029 }, {
1030 .type = EM28XX_VMUX_SVIDEO,
1031 .vmux = TVP5150_SVIDEO,
1032 .amux = EM28XX_AMUX_LINE_IN,
1033 .gpio = hauppauge_wintv_hvr_900_analog,
1034 } },
1036 [EM2820_BOARD_MSI_VOX_USB_2] = {
1037 .name = "MSI VOX USB 2.0",
1038 .tuner_type = TUNER_LG_PAL_NEW_TAPC,
1039 .tda9887_conf = TDA9887_PRESENT |
1040 TDA9887_PORT1_ACTIVE |
1041 TDA9887_PORT2_ACTIVE,
1042 .max_range_640_480 = 1,
1043 .decoder = EM28XX_SAA711X,
1044 .input = { {
1045 .type = EM28XX_VMUX_TELEVISION,
1046 .vmux = SAA7115_COMPOSITE4,
1047 .amux = EM28XX_AMUX_VIDEO,
1048 }, {
1049 .type = EM28XX_VMUX_COMPOSITE1,
1050 .vmux = SAA7115_COMPOSITE0,
1051 .amux = EM28XX_AMUX_LINE_IN,
1052 }, {
1053 .type = EM28XX_VMUX_SVIDEO,
1054 .vmux = SAA7115_SVIDEO3,
1055 .amux = EM28XX_AMUX_LINE_IN,
1056 } },
1058 [EM2800_BOARD_TERRATEC_CINERGY_200] = {
1059 .name = "Terratec Cinergy 200 USB",
1060 .is_em2800 = 1,
1061 .has_ir_i2c = 1,
1062 .tuner_type = TUNER_LG_PAL_NEW_TAPC,
1063 .tda9887_conf = TDA9887_PRESENT,
1064 .decoder = EM28XX_SAA711X,
1065 .input = { {
1066 .type = EM28XX_VMUX_TELEVISION,
1067 .vmux = SAA7115_COMPOSITE2,
1068 .amux = EM28XX_AMUX_VIDEO,
1069 }, {
1070 .type = EM28XX_VMUX_COMPOSITE1,
1071 .vmux = SAA7115_COMPOSITE0,
1072 .amux = EM28XX_AMUX_LINE_IN,
1073 }, {
1074 .type = EM28XX_VMUX_SVIDEO,
1075 .vmux = SAA7115_SVIDEO3,
1076 .amux = EM28XX_AMUX_LINE_IN,
1077 } },
1079 [EM2800_BOARD_GRABBEEX_USB2800] = {
1080 .name = "eMPIA Technology, Inc. GrabBeeX+ Video Encoder",
1081 .is_em2800 = 1,
1082 .decoder = EM28XX_SAA711X,
1083 .tuner_type = TUNER_ABSENT, /* capture only board */
1084 .input = { {
1085 .type = EM28XX_VMUX_COMPOSITE1,
1086 .vmux = SAA7115_COMPOSITE0,
1087 .amux = EM28XX_AMUX_LINE_IN,
1088 }, {
1089 .type = EM28XX_VMUX_SVIDEO,
1090 .vmux = SAA7115_SVIDEO3,
1091 .amux = EM28XX_AMUX_LINE_IN,
1092 } },
1094 [EM2800_BOARD_VC211A] = {
1095 .name = "Actionmaster/LinXcel/Digitus VC211A",
1096 .is_em2800 = 1,
1097 .tuner_type = TUNER_ABSENT, /* Capture-only board */
1098 .decoder = EM28XX_SAA711X,
1099 .input = { {
1100 .type = EM28XX_VMUX_COMPOSITE1,
1101 .vmux = SAA7115_COMPOSITE0,
1102 .amux = EM28XX_AMUX_LINE_IN,
1103 .gpio = vc211a_enable,
1104 }, {
1105 .type = EM28XX_VMUX_SVIDEO,
1106 .vmux = SAA7115_SVIDEO3,
1107 .amux = EM28XX_AMUX_LINE_IN,
1108 .gpio = vc211a_enable,
1109 } },
1111 [EM2800_BOARD_LEADTEK_WINFAST_USBII] = {
1112 .name = "Leadtek Winfast USB II",
1113 .is_em2800 = 1,
1114 .tuner_type = TUNER_LG_PAL_NEW_TAPC,
1115 .tda9887_conf = TDA9887_PRESENT,
1116 .decoder = EM28XX_SAA711X,
1117 .input = { {
1118 .type = EM28XX_VMUX_TELEVISION,
1119 .vmux = SAA7115_COMPOSITE2,
1120 .amux = EM28XX_AMUX_VIDEO,
1121 }, {
1122 .type = EM28XX_VMUX_COMPOSITE1,
1123 .vmux = SAA7115_COMPOSITE0,
1124 .amux = EM28XX_AMUX_LINE_IN,
1125 }, {
1126 .type = EM28XX_VMUX_SVIDEO,
1127 .vmux = SAA7115_SVIDEO3,
1128 .amux = EM28XX_AMUX_LINE_IN,
1129 } },
1131 [EM2800_BOARD_KWORLD_USB2800] = {
1132 .name = "Kworld USB2800",
1133 .is_em2800 = 1,
1134 .tuner_type = TUNER_PHILIPS_FCV1236D,
1135 .tda9887_conf = TDA9887_PRESENT,
1136 .decoder = EM28XX_SAA711X,
1137 .input = { {
1138 .type = EM28XX_VMUX_TELEVISION,
1139 .vmux = SAA7115_COMPOSITE2,
1140 .amux = EM28XX_AMUX_VIDEO,
1141 }, {
1142 .type = EM28XX_VMUX_COMPOSITE1,
1143 .vmux = SAA7115_COMPOSITE0,
1144 .amux = EM28XX_AMUX_LINE_IN,
1145 }, {
1146 .type = EM28XX_VMUX_SVIDEO,
1147 .vmux = SAA7115_SVIDEO3,
1148 .amux = EM28XX_AMUX_LINE_IN,
1149 } },
1151 [EM2820_BOARD_PINNACLE_DVC_90] = {
1152 .name = "Pinnacle Dazzle DVC 90/100/101/107 / Kaiser Baas Video to DVD maker "
1153 "/ Kworld DVD Maker 2",
1154 .tuner_type = TUNER_ABSENT, /* capture only board */
1155 .decoder = EM28XX_SAA711X,
1156 .input = { {
1157 .type = EM28XX_VMUX_COMPOSITE1,
1158 .vmux = SAA7115_COMPOSITE0,
1159 .amux = EM28XX_AMUX_LINE_IN,
1160 }, {
1161 .type = EM28XX_VMUX_SVIDEO,
1162 .vmux = SAA7115_SVIDEO3,
1163 .amux = EM28XX_AMUX_LINE_IN,
1164 } },
1166 [EM2800_BOARD_VGEAR_POCKETTV] = {
1167 .name = "V-Gear PocketTV",
1168 .is_em2800 = 1,
1169 .tuner_type = TUNER_LG_PAL_NEW_TAPC,
1170 .tda9887_conf = TDA9887_PRESENT,
1171 .decoder = EM28XX_SAA711X,
1172 .input = { {
1173 .type = EM28XX_VMUX_TELEVISION,
1174 .vmux = SAA7115_COMPOSITE2,
1175 .amux = EM28XX_AMUX_VIDEO,
1176 }, {
1177 .type = EM28XX_VMUX_COMPOSITE1,
1178 .vmux = SAA7115_COMPOSITE0,
1179 .amux = EM28XX_AMUX_LINE_IN,
1180 }, {
1181 .type = EM28XX_VMUX_SVIDEO,
1182 .vmux = SAA7115_SVIDEO3,
1183 .amux = EM28XX_AMUX_LINE_IN,
1184 } },
1186 [EM2820_BOARD_PROLINK_PLAYTV_BOX4_USB2] = {
1187 .name = "Pixelview PlayTV Box 4 USB 2.0",
1188 .tda9887_conf = TDA9887_PRESENT,
1189 .tuner_type = TUNER_YMEC_TVF_5533MF,
1190 .decoder = EM28XX_SAA711X,
1191 .input = { {
1192 .type = EM28XX_VMUX_TELEVISION,
1193 .vmux = SAA7115_COMPOSITE2,
1194 .amux = EM28XX_AMUX_VIDEO,
1195 .aout = EM28XX_AOUT_MONO | /* I2S */
1196 EM28XX_AOUT_MASTER, /* Line out pin */
1197 }, {
1198 .type = EM28XX_VMUX_COMPOSITE1,
1199 .vmux = SAA7115_COMPOSITE0,
1200 .amux = EM28XX_AMUX_LINE_IN,
1201 }, {
1202 .type = EM28XX_VMUX_SVIDEO,
1203 .vmux = SAA7115_SVIDEO3,
1204 .amux = EM28XX_AMUX_LINE_IN,
1205 } },
1207 [EM2820_BOARD_PROLINK_PLAYTV_USB2] = {
1208 .name = "SIIG AVTuner-PVR / Pixelview Prolink PlayTV USB 2.0",
1209 .has_snapshot_button = 1,
1210 .tda9887_conf = TDA9887_PRESENT,
1211 .tuner_type = TUNER_YMEC_TVF_5533MF,
1212 .decoder = EM28XX_SAA711X,
1213 .input = { {
1214 .type = EM28XX_VMUX_TELEVISION,
1215 .vmux = SAA7115_COMPOSITE2,
1216 .amux = EM28XX_AMUX_VIDEO,
1217 .aout = EM28XX_AOUT_MONO | /* I2S */
1218 EM28XX_AOUT_MASTER, /* Line out pin */
1219 }, {
1220 .type = EM28XX_VMUX_COMPOSITE1,
1221 .vmux = SAA7115_COMPOSITE0,
1222 .amux = EM28XX_AMUX_LINE_IN,
1223 }, {
1224 .type = EM28XX_VMUX_SVIDEO,
1225 .vmux = SAA7115_SVIDEO3,
1226 .amux = EM28XX_AMUX_LINE_IN,
1227 } },
1229 [EM2860_BOARD_SAA711X_REFERENCE_DESIGN] = {
1230 .name = "EM2860/SAA711X Reference Design",
1231 .has_snapshot_button = 1,
1232 .tuner_type = TUNER_ABSENT,
1233 .decoder = EM28XX_SAA711X,
1234 .input = { {
1235 .type = EM28XX_VMUX_SVIDEO,
1236 .vmux = SAA7115_SVIDEO3,
1237 }, {
1238 .type = EM28XX_VMUX_COMPOSITE1,
1239 .vmux = SAA7115_COMPOSITE0,
1240 } },
1243 [EM2874_LEADERSHIP_ISDBT] = {
1244 .i2c_speed = EM2874_I2C_SECONDARY_BUS_SELECT |
1245 EM28XX_I2C_CLK_WAIT_ENABLE |
1246 EM28XX_I2C_FREQ_100_KHZ,
1247 .xclk = EM28XX_XCLK_FREQUENCY_10MHZ,
1248 .name = "EM2874 Leadership ISDBT",
1249 .tuner_type = TUNER_ABSENT,
1250 .tuner_gpio = leadership_reset,
1251 .dvb_gpio = leadership_digital,
1252 .has_dvb = 1,
1255 [EM2880_BOARD_MSI_DIGIVOX_AD] = {
1256 .name = "MSI DigiVox A/D",
1257 .valid = EM28XX_BOARD_NOT_VALIDATED,
1258 .tuner_type = TUNER_XC2028,
1259 .tuner_gpio = default_tuner_gpio,
1260 .decoder = EM28XX_TVP5150,
1261 .input = { {
1262 .type = EM28XX_VMUX_TELEVISION,
1263 .vmux = TVP5150_COMPOSITE0,
1264 .amux = EM28XX_AMUX_VIDEO,
1265 .gpio = em2880_msi_digivox_ad_analog,
1266 }, {
1267 .type = EM28XX_VMUX_COMPOSITE1,
1268 .vmux = TVP5150_COMPOSITE1,
1269 .amux = EM28XX_AMUX_LINE_IN,
1270 .gpio = em2880_msi_digivox_ad_analog,
1271 }, {
1272 .type = EM28XX_VMUX_SVIDEO,
1273 .vmux = TVP5150_SVIDEO,
1274 .amux = EM28XX_AMUX_LINE_IN,
1275 .gpio = em2880_msi_digivox_ad_analog,
1276 } },
1278 [EM2880_BOARD_MSI_DIGIVOX_AD_II] = {
1279 .name = "MSI DigiVox A/D II",
1280 .valid = EM28XX_BOARD_NOT_VALIDATED,
1281 .tuner_type = TUNER_XC2028,
1282 .tuner_gpio = default_tuner_gpio,
1283 .decoder = EM28XX_TVP5150,
1284 .input = { {
1285 .type = EM28XX_VMUX_TELEVISION,
1286 .vmux = TVP5150_COMPOSITE0,
1287 .amux = EM28XX_AMUX_VIDEO,
1288 .gpio = em2880_msi_digivox_ad_analog,
1289 }, {
1290 .type = EM28XX_VMUX_COMPOSITE1,
1291 .vmux = TVP5150_COMPOSITE1,
1292 .amux = EM28XX_AMUX_LINE_IN,
1293 .gpio = em2880_msi_digivox_ad_analog,
1294 }, {
1295 .type = EM28XX_VMUX_SVIDEO,
1296 .vmux = TVP5150_SVIDEO,
1297 .amux = EM28XX_AMUX_LINE_IN,
1298 .gpio = em2880_msi_digivox_ad_analog,
1299 } },
1301 [EM2880_BOARD_KWORLD_DVB_305U] = {
1302 .name = "KWorld DVB-T 305U",
1303 .valid = EM28XX_BOARD_NOT_VALIDATED,
1304 .tuner_type = TUNER_XC2028,
1305 .tuner_gpio = default_tuner_gpio,
1306 .decoder = EM28XX_TVP5150,
1307 .input = { {
1308 .type = EM28XX_VMUX_TELEVISION,
1309 .vmux = TVP5150_COMPOSITE0,
1310 .amux = EM28XX_AMUX_VIDEO,
1311 }, {
1312 .type = EM28XX_VMUX_COMPOSITE1,
1313 .vmux = TVP5150_COMPOSITE1,
1314 .amux = EM28XX_AMUX_LINE_IN,
1315 }, {
1316 .type = EM28XX_VMUX_SVIDEO,
1317 .vmux = TVP5150_SVIDEO,
1318 .amux = EM28XX_AMUX_LINE_IN,
1319 } },
1321 [EM2880_BOARD_KWORLD_DVB_310U] = {
1322 .name = "KWorld DVB-T 310U",
1323 .tuner_type = TUNER_XC2028,
1324 .tuner_gpio = default_tuner_gpio,
1325 .has_dvb = 1,
1326 .dvb_gpio = default_digital,
1327 .mts_firmware = 1,
1328 .decoder = EM28XX_TVP5150,
1329 .input = { {
1330 .type = EM28XX_VMUX_TELEVISION,
1331 .vmux = TVP5150_COMPOSITE0,
1332 .amux = EM28XX_AMUX_VIDEO,
1333 .gpio = default_analog,
1334 }, {
1335 .type = EM28XX_VMUX_COMPOSITE1,
1336 .vmux = TVP5150_COMPOSITE1,
1337 .amux = EM28XX_AMUX_LINE_IN,
1338 .gpio = default_analog,
1339 }, { /* S-video has not been tested yet */
1340 .type = EM28XX_VMUX_SVIDEO,
1341 .vmux = TVP5150_SVIDEO,
1342 .amux = EM28XX_AMUX_LINE_IN,
1343 .gpio = default_analog,
1344 } },
1346 [EM2882_BOARD_KWORLD_ATSC_315U] = {
1347 .name = "KWorld ATSC 315U HDTV TV Box",
1348 .valid = EM28XX_BOARD_NOT_VALIDATED,
1349 .tuner_type = TUNER_THOMSON_DTT761X,
1350 .tuner_gpio = em2882_kworld_315u_tuner_gpio,
1351 .tda9887_conf = TDA9887_PRESENT,
1352 .decoder = EM28XX_SAA711X,
1353 .has_dvb = 1,
1354 .dvb_gpio = em2882_kworld_315u_digital,
1355 .ir_codes = RC_MAP_KWORLD_315U,
1356 .xclk = EM28XX_XCLK_FREQUENCY_12MHZ,
1357 .i2c_speed = EM28XX_I2C_CLK_WAIT_ENABLE,
1358 /* Analog mode - still not ready */
1359 /*.input = { {
1360 .type = EM28XX_VMUX_TELEVISION,
1361 .vmux = SAA7115_COMPOSITE2,
1362 .amux = EM28XX_AMUX_VIDEO,
1363 .gpio = em2882_kworld_315u_analog,
1364 .aout = EM28XX_AOUT_PCM_IN | EM28XX_AOUT_PCM_STEREO,
1365 }, {
1366 .type = EM28XX_VMUX_COMPOSITE1,
1367 .vmux = SAA7115_COMPOSITE0,
1368 .amux = EM28XX_AMUX_LINE_IN,
1369 .gpio = em2882_kworld_315u_analog1,
1370 .aout = EM28XX_AOUT_PCM_IN | EM28XX_AOUT_PCM_STEREO,
1371 }, {
1372 .type = EM28XX_VMUX_SVIDEO,
1373 .vmux = SAA7115_SVIDEO3,
1374 .amux = EM28XX_AMUX_LINE_IN,
1375 .gpio = em2882_kworld_315u_analog1,
1376 .aout = EM28XX_AOUT_PCM_IN | EM28XX_AOUT_PCM_STEREO,
1377 } }, */
1379 [EM2880_BOARD_EMPIRE_DUAL_TV] = {
1380 .name = "Empire dual TV",
1381 .tuner_type = TUNER_XC2028,
1382 .tuner_gpio = default_tuner_gpio,
1383 .has_dvb = 1,
1384 .dvb_gpio = default_digital,
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 = default_analog,
1392 }, {
1393 .type = EM28XX_VMUX_COMPOSITE1,
1394 .vmux = TVP5150_COMPOSITE1,
1395 .amux = EM28XX_AMUX_LINE_IN,
1396 .gpio = default_analog,
1397 }, {
1398 .type = EM28XX_VMUX_SVIDEO,
1399 .vmux = TVP5150_SVIDEO,
1400 .amux = EM28XX_AMUX_LINE_IN,
1401 .gpio = default_analog,
1402 } },
1404 [EM2881_BOARD_DNT_DA2_HYBRID] = {
1405 .name = "DNT DA2 Hybrid",
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 .gpio = default_analog,
1415 }, {
1416 .type = EM28XX_VMUX_COMPOSITE1,
1417 .vmux = TVP5150_COMPOSITE1,
1418 .amux = EM28XX_AMUX_LINE_IN,
1419 .gpio = default_analog,
1420 }, {
1421 .type = EM28XX_VMUX_SVIDEO,
1422 .vmux = TVP5150_SVIDEO,
1423 .amux = EM28XX_AMUX_LINE_IN,
1424 .gpio = default_analog,
1425 } },
1427 [EM2881_BOARD_PINNACLE_HYBRID_PRO] = {
1428 .name = "Pinnacle Hybrid Pro",
1429 .tuner_type = TUNER_XC2028,
1430 .tuner_gpio = default_tuner_gpio,
1431 .decoder = EM28XX_TVP5150,
1432 .has_dvb = 1,
1433 .dvb_gpio = pinnacle_hybrid_pro_digital,
1434 .input = { {
1435 .type = EM28XX_VMUX_TELEVISION,
1436 .vmux = TVP5150_COMPOSITE0,
1437 .amux = EM28XX_AMUX_VIDEO,
1438 .gpio = pinnacle_hybrid_pro_analog,
1439 }, {
1440 .type = EM28XX_VMUX_COMPOSITE1,
1441 .vmux = TVP5150_COMPOSITE1,
1442 .amux = EM28XX_AMUX_LINE_IN,
1443 .gpio = pinnacle_hybrid_pro_analog,
1444 }, {
1445 .type = EM28XX_VMUX_SVIDEO,
1446 .vmux = TVP5150_SVIDEO,
1447 .amux = EM28XX_AMUX_LINE_IN,
1448 .gpio = pinnacle_hybrid_pro_analog,
1449 } },
1451 [EM2882_BOARD_PINNACLE_HYBRID_PRO] = {
1452 .name = "Pinnacle Hybrid Pro (2)",
1453 .valid = EM28XX_BOARD_NOT_VALIDATED,
1454 .tuner_type = TUNER_XC2028,
1455 .tuner_gpio = default_tuner_gpio,
1456 .mts_firmware = 1,
1457 .decoder = EM28XX_TVP5150,
1458 .input = { {
1459 .type = EM28XX_VMUX_TELEVISION,
1460 .vmux = TVP5150_COMPOSITE0,
1461 .amux = EM28XX_AMUX_VIDEO,
1462 .gpio = hauppauge_wintv_hvr_900_analog,
1463 }, {
1464 .type = EM28XX_VMUX_COMPOSITE1,
1465 .vmux = TVP5150_COMPOSITE1,
1466 .amux = EM28XX_AMUX_LINE_IN,
1467 .gpio = hauppauge_wintv_hvr_900_analog,
1468 }, {
1469 .type = EM28XX_VMUX_SVIDEO,
1470 .vmux = TVP5150_SVIDEO,
1471 .amux = EM28XX_AMUX_LINE_IN,
1472 .gpio = hauppauge_wintv_hvr_900_analog,
1473 } },
1475 [EM2882_BOARD_KWORLD_VS_DVBT] = {
1476 .name = "Kworld VS-DVB-T 323UR",
1477 .tuner_type = TUNER_XC2028,
1478 .tuner_gpio = default_tuner_gpio,
1479 .decoder = EM28XX_TVP5150,
1480 .mts_firmware = 1,
1481 .has_dvb = 1,
1482 .dvb_gpio = kworld_330u_digital,
1483 .xclk = EM28XX_XCLK_FREQUENCY_12MHZ, /* NEC IR */
1484 .ir_codes = RC_MAP_KWORLD_315U,
1485 .input = { {
1486 .type = EM28XX_VMUX_TELEVISION,
1487 .vmux = TVP5150_COMPOSITE0,
1488 .amux = EM28XX_AMUX_VIDEO,
1489 }, {
1490 .type = EM28XX_VMUX_COMPOSITE1,
1491 .vmux = TVP5150_COMPOSITE1,
1492 .amux = EM28XX_AMUX_LINE_IN,
1493 }, {
1494 .type = EM28XX_VMUX_SVIDEO,
1495 .vmux = TVP5150_SVIDEO,
1496 .amux = EM28XX_AMUX_LINE_IN,
1497 } },
1499 [EM2882_BOARD_TERRATEC_HYBRID_XS] = {
1500 .name = "Terratec Cinnergy Hybrid T USB XS (em2882)",
1501 .tuner_type = TUNER_XC2028,
1502 .tuner_gpio = default_tuner_gpio,
1503 .mts_firmware = 1,
1504 .decoder = EM28XX_TVP5150,
1505 .has_dvb = 1,
1506 .dvb_gpio = hauppauge_wintv_hvr_900_digital,
1507 .ir_codes = RC_MAP_TERRATEC_CINERGY_XS,
1508 .xclk = EM28XX_XCLK_FREQUENCY_12MHZ,
1509 .input = { {
1510 .type = EM28XX_VMUX_TELEVISION,
1511 .vmux = TVP5150_COMPOSITE0,
1512 .amux = EM28XX_AMUX_VIDEO,
1513 .gpio = hauppauge_wintv_hvr_900_analog,
1514 }, {
1515 .type = EM28XX_VMUX_COMPOSITE1,
1516 .vmux = TVP5150_COMPOSITE1,
1517 .amux = EM28XX_AMUX_LINE_IN,
1518 .gpio = hauppauge_wintv_hvr_900_analog,
1519 }, {
1520 .type = EM28XX_VMUX_SVIDEO,
1521 .vmux = TVP5150_SVIDEO,
1522 .amux = EM28XX_AMUX_LINE_IN,
1523 .gpio = hauppauge_wintv_hvr_900_analog,
1524 } },
1526 [EM2882_BOARD_DIKOM_DK300] = {
1527 .name = "Dikom DK300",
1528 .tuner_type = TUNER_XC2028,
1529 .tuner_gpio = default_tuner_gpio,
1530 .decoder = EM28XX_TVP5150,
1531 .mts_firmware = 1,
1532 .has_dvb = 1,
1533 .dvb_gpio = dikom_dk300_digital,
1534 .input = { {
1535 .type = EM28XX_VMUX_TELEVISION,
1536 .vmux = TVP5150_COMPOSITE0,
1537 .amux = EM28XX_AMUX_VIDEO,
1538 .gpio = default_analog,
1539 } },
1541 [EM2883_BOARD_KWORLD_HYBRID_330U] = {
1542 .name = "Kworld PlusTV HD Hybrid 330",
1543 .tuner_type = TUNER_XC2028,
1544 .tuner_gpio = default_tuner_gpio,
1545 .decoder = EM28XX_TVP5150,
1546 .mts_firmware = 1,
1547 .has_dvb = 1,
1548 .dvb_gpio = kworld_330u_digital,
1549 .xclk = EM28XX_XCLK_FREQUENCY_12MHZ,
1550 .i2c_speed = EM28XX_I2C_CLK_WAIT_ENABLE |
1551 EM28XX_I2C_EEPROM_ON_BOARD |
1552 EM28XX_I2C_EEPROM_KEY_VALID,
1553 .input = { {
1554 .type = EM28XX_VMUX_TELEVISION,
1555 .vmux = TVP5150_COMPOSITE0,
1556 .amux = EM28XX_AMUX_VIDEO,
1557 .gpio = kworld_330u_analog,
1558 .aout = EM28XX_AOUT_PCM_IN | EM28XX_AOUT_PCM_STEREO,
1559 }, {
1560 .type = EM28XX_VMUX_COMPOSITE1,
1561 .vmux = TVP5150_COMPOSITE1,
1562 .amux = EM28XX_AMUX_LINE_IN,
1563 .gpio = kworld_330u_analog,
1564 .aout = EM28XX_AOUT_PCM_IN | EM28XX_AOUT_PCM_STEREO,
1565 }, {
1566 .type = EM28XX_VMUX_SVIDEO,
1567 .vmux = TVP5150_SVIDEO,
1568 .amux = EM28XX_AMUX_LINE_IN,
1569 .gpio = kworld_330u_analog,
1570 } },
1572 [EM2820_BOARD_COMPRO_VIDEOMATE_FORYOU] = {
1573 .name = "Compro VideoMate ForYou/Stereo",
1574 .tuner_type = TUNER_LG_PAL_NEW_TAPC,
1575 .tvaudio_addr = 0xb0,
1576 .tda9887_conf = TDA9887_PRESENT,
1577 .decoder = EM28XX_TVP5150,
1578 .adecoder = EM28XX_TVAUDIO,
1579 .mute_gpio = compro_mute_gpio,
1580 .input = { {
1581 .type = EM28XX_VMUX_TELEVISION,
1582 .vmux = TVP5150_COMPOSITE0,
1583 .amux = EM28XX_AMUX_VIDEO,
1584 .gpio = compro_unmute_tv_gpio,
1585 }, {
1586 .type = EM28XX_VMUX_SVIDEO,
1587 .vmux = TVP5150_SVIDEO,
1588 .amux = EM28XX_AMUX_LINE_IN,
1589 .gpio = compro_unmute_svid_gpio,
1590 } },
1592 [EM2860_BOARD_KAIOMY_TVNPC_U2] = {
1593 .name = "Kaiomy TVnPC U2",
1594 .vchannels = 3,
1595 .tuner_type = TUNER_XC2028,
1596 .tuner_addr = 0x61,
1597 .mts_firmware = 1,
1598 .decoder = EM28XX_TVP5150,
1599 .tuner_gpio = default_tuner_gpio,
1600 .ir_codes = RC_MAP_KAIOMY,
1601 .input = { {
1602 .type = EM28XX_VMUX_TELEVISION,
1603 .vmux = TVP5150_COMPOSITE0,
1604 .amux = EM28XX_AMUX_VIDEO,
1606 }, {
1607 .type = EM28XX_VMUX_COMPOSITE1,
1608 .vmux = TVP5150_COMPOSITE1,
1609 .amux = EM28XX_AMUX_LINE_IN,
1610 }, {
1611 .type = EM28XX_VMUX_SVIDEO,
1612 .vmux = TVP5150_SVIDEO,
1613 .amux = EM28XX_AMUX_LINE_IN,
1614 } },
1615 .radio = {
1616 .type = EM28XX_RADIO,
1617 .amux = EM28XX_AMUX_LINE_IN,
1620 [EM2860_BOARD_EASYCAP] = {
1621 .name = "Easy Cap Capture DC-60",
1622 .vchannels = 2,
1623 .tuner_type = TUNER_ABSENT,
1624 .decoder = EM28XX_SAA711X,
1625 .input = { {
1626 .type = EM28XX_VMUX_COMPOSITE1,
1627 .vmux = SAA7115_COMPOSITE0,
1628 .amux = EM28XX_AMUX_LINE_IN,
1629 }, {
1630 .type = EM28XX_VMUX_SVIDEO,
1631 .vmux = SAA7115_SVIDEO3,
1632 .amux = EM28XX_AMUX_LINE_IN,
1633 } },
1635 [EM2820_BOARD_IODATA_GVMVP_SZ] = {
1636 .name = "IO-DATA GV-MVP/SZ",
1637 .tuner_type = TUNER_PHILIPS_FM1236_MK3,
1638 .tuner_gpio = default_tuner_gpio,
1639 .tda9887_conf = TDA9887_PRESENT,
1640 .decoder = EM28XX_TVP5150,
1641 .input = { {
1642 .type = EM28XX_VMUX_TELEVISION,
1643 .vmux = TVP5150_COMPOSITE0,
1644 .amux = EM28XX_AMUX_VIDEO,
1645 }, { /* Composite has not been tested yet */
1646 .type = EM28XX_VMUX_COMPOSITE1,
1647 .vmux = TVP5150_COMPOSITE1,
1648 .amux = EM28XX_AMUX_VIDEO,
1649 }, { /* S-video has not been tested yet */
1650 .type = EM28XX_VMUX_SVIDEO,
1651 .vmux = TVP5150_SVIDEO,
1652 .amux = EM28XX_AMUX_VIDEO,
1653 } },
1655 [EM2860_BOARD_TERRATEC_GRABBY] = {
1656 .name = "Terratec Grabby",
1657 .vchannels = 2,
1658 .tuner_type = TUNER_ABSENT,
1659 .decoder = EM28XX_SAA711X,
1660 .xclk = EM28XX_XCLK_FREQUENCY_12MHZ,
1661 .input = { {
1662 .type = EM28XX_VMUX_COMPOSITE1,
1663 .vmux = SAA7115_COMPOSITE0,
1664 .amux = EM28XX_AMUX_LINE_IN,
1665 }, {
1666 .type = EM28XX_VMUX_SVIDEO,
1667 .vmux = SAA7115_SVIDEO3,
1668 .amux = EM28XX_AMUX_LINE_IN,
1669 } },
1671 [EM2860_BOARD_TERRATEC_AV350] = {
1672 .name = "Terratec AV350",
1673 .vchannels = 2,
1674 .tuner_type = TUNER_ABSENT,
1675 .decoder = EM28XX_TVP5150,
1676 .xclk = EM28XX_XCLK_FREQUENCY_12MHZ,
1677 .mute_gpio = terratec_av350_mute_gpio,
1678 .input = { {
1679 .type = EM28XX_VMUX_COMPOSITE1,
1680 .vmux = TVP5150_COMPOSITE1,
1681 .amux = EM28XX_AUDIO_SRC_LINE,
1682 .gpio = terratec_av350_unmute_gpio,
1684 }, {
1685 .type = EM28XX_VMUX_SVIDEO,
1686 .vmux = TVP5150_SVIDEO,
1687 .amux = EM28XX_AUDIO_SRC_LINE,
1688 .gpio = terratec_av350_unmute_gpio,
1689 } },
1692 [EM2860_BOARD_ELGATO_VIDEO_CAPTURE] = {
1693 .name = "Elgato Video Capture",
1694 .decoder = EM28XX_SAA711X,
1695 .tuner_type = TUNER_ABSENT, /* Capture only device */
1696 .input = { {
1697 .type = EM28XX_VMUX_COMPOSITE1,
1698 .vmux = SAA7115_COMPOSITE0,
1699 .amux = EM28XX_AMUX_LINE_IN,
1700 }, {
1701 .type = EM28XX_VMUX_SVIDEO,
1702 .vmux = SAA7115_SVIDEO3,
1703 .amux = EM28XX_AMUX_LINE_IN,
1704 } },
1707 [EM2882_BOARD_EVGA_INDTUBE] = {
1708 .name = "Evga inDtube",
1709 .tuner_type = TUNER_XC2028,
1710 .tuner_gpio = default_tuner_gpio,
1711 .decoder = EM28XX_TVP5150,
1712 .xclk = EM28XX_XCLK_FREQUENCY_12MHZ, /* NEC IR */
1713 .mts_firmware = 1,
1714 .has_dvb = 1,
1715 .dvb_gpio = evga_indtube_digital,
1716 .ir_codes = RC_MAP_EVGA_INDTUBE,
1717 .input = { {
1718 .type = EM28XX_VMUX_TELEVISION,
1719 .vmux = TVP5150_COMPOSITE0,
1720 .amux = EM28XX_AMUX_VIDEO,
1721 .gpio = evga_indtube_analog,
1722 }, {
1723 .type = EM28XX_VMUX_COMPOSITE1,
1724 .vmux = TVP5150_COMPOSITE1,
1725 .amux = EM28XX_AMUX_LINE_IN,
1726 .gpio = evga_indtube_analog,
1727 }, {
1728 .type = EM28XX_VMUX_SVIDEO,
1729 .vmux = TVP5150_SVIDEO,
1730 .amux = EM28XX_AMUX_LINE_IN,
1731 .gpio = evga_indtube_analog,
1732 } },
1734 /* eb1a:2868 Empia EM2870 + Philips CU1216L NIM (Philips TDA10023 +
1735 Infineon TUA6034) */
1736 [EM2870_BOARD_REDDO_DVB_C_USB_BOX] = {
1737 .name = "Reddo DVB-C USB TV Box",
1738 .tuner_type = TUNER_ABSENT,
1739 .tuner_gpio = reddo_dvb_c_usb_box,
1740 .has_dvb = 1,
1742 /* 1b80:a340 - Empia EM2870, NXP TDA18271HD and LG DT3304, sold
1743 * initially as the KWorld PlusTV 340U, then as the UB435-Q.
1744 * Early variants have a TDA18271HD/C1, later ones a TDA18271HD/C2 */
1745 [EM2870_BOARD_KWORLD_A340] = {
1746 .name = "KWorld PlusTV 340U or UB435-Q (ATSC)",
1747 .tuner_type = TUNER_ABSENT, /* Digital-only TDA18271HD */
1748 .has_dvb = 1,
1749 .dvb_gpio = kworld_a340_digital,
1750 .tuner_gpio = default_tuner_gpio,
1753 const unsigned int em28xx_bcount = ARRAY_SIZE(em28xx_boards);
1755 /* table of devices that work with this driver */
1756 struct usb_device_id em28xx_id_table[] = {
1757 { USB_DEVICE(0xeb1a, 0x2750),
1758 .driver_info = EM2750_BOARD_UNKNOWN },
1759 { USB_DEVICE(0xeb1a, 0x2751),
1760 .driver_info = EM2750_BOARD_UNKNOWN },
1761 { USB_DEVICE(0xeb1a, 0x2800),
1762 .driver_info = EM2800_BOARD_UNKNOWN },
1763 { USB_DEVICE(0xeb1a, 0x2710),
1764 .driver_info = EM2820_BOARD_UNKNOWN },
1765 { USB_DEVICE(0xeb1a, 0x2820),
1766 .driver_info = EM2820_BOARD_UNKNOWN },
1767 { USB_DEVICE(0xeb1a, 0x2821),
1768 .driver_info = EM2820_BOARD_UNKNOWN },
1769 { USB_DEVICE(0xeb1a, 0x2860),
1770 .driver_info = EM2820_BOARD_UNKNOWN },
1771 { USB_DEVICE(0xeb1a, 0x2861),
1772 .driver_info = EM2820_BOARD_UNKNOWN },
1773 { USB_DEVICE(0xeb1a, 0x2862),
1774 .driver_info = EM2820_BOARD_UNKNOWN },
1775 { USB_DEVICE(0xeb1a, 0x2863),
1776 .driver_info = EM2820_BOARD_UNKNOWN },
1777 { USB_DEVICE(0xeb1a, 0x2870),
1778 .driver_info = EM2820_BOARD_UNKNOWN },
1779 { USB_DEVICE(0xeb1a, 0x2881),
1780 .driver_info = EM2820_BOARD_UNKNOWN },
1781 { USB_DEVICE(0xeb1a, 0x2883),
1782 .driver_info = EM2820_BOARD_UNKNOWN },
1783 { USB_DEVICE(0xeb1a, 0x2868),
1784 .driver_info = EM2820_BOARD_UNKNOWN },
1785 { USB_DEVICE(0xeb1a, 0x2875),
1786 .driver_info = EM2820_BOARD_UNKNOWN },
1787 { USB_DEVICE(0xeb1a, 0xe300),
1788 .driver_info = EM2861_BOARD_KWORLD_PVRTV_300U },
1789 { USB_DEVICE(0xeb1a, 0xe303),
1790 .driver_info = EM2860_BOARD_KAIOMY_TVNPC_U2 },
1791 { USB_DEVICE(0xeb1a, 0xe305),
1792 .driver_info = EM2880_BOARD_KWORLD_DVB_305U },
1793 { USB_DEVICE(0xeb1a, 0xe310),
1794 .driver_info = EM2880_BOARD_MSI_DIGIVOX_AD },
1795 { USB_DEVICE(0xeb1a, 0xa313),
1796 .driver_info = EM2882_BOARD_KWORLD_ATSC_315U },
1797 { USB_DEVICE(0xeb1a, 0xa316),
1798 .driver_info = EM2883_BOARD_KWORLD_HYBRID_330U },
1799 { USB_DEVICE(0xeb1a, 0xe320),
1800 .driver_info = EM2880_BOARD_MSI_DIGIVOX_AD_II },
1801 { USB_DEVICE(0xeb1a, 0xe323),
1802 .driver_info = EM2882_BOARD_KWORLD_VS_DVBT },
1803 { USB_DEVICE(0xeb1a, 0xe350),
1804 .driver_info = EM2870_BOARD_KWORLD_350U },
1805 { USB_DEVICE(0xeb1a, 0xe355),
1806 .driver_info = EM2870_BOARD_KWORLD_355U },
1807 { USB_DEVICE(0xeb1a, 0x2801),
1808 .driver_info = EM2800_BOARD_GRABBEEX_USB2800 },
1809 { USB_DEVICE(0xeb1a, 0xe357),
1810 .driver_info = EM2870_BOARD_KWORLD_355U },
1811 { USB_DEVICE(0x1b80, 0xe302),
1812 .driver_info = EM2820_BOARD_PINNACLE_DVC_90 }, /* Kaiser Baas Video to DVD maker */
1813 { USB_DEVICE(0x1b80, 0xe304),
1814 .driver_info = EM2820_BOARD_PINNACLE_DVC_90 }, /* Kworld DVD Maker 2 */
1815 { USB_DEVICE(0x0ccd, 0x0036),
1816 .driver_info = EM2820_BOARD_TERRATEC_CINERGY_250 },
1817 { USB_DEVICE(0x0ccd, 0x004c),
1818 .driver_info = EM2880_BOARD_TERRATEC_HYBRID_XS_FR },
1819 { USB_DEVICE(0x0ccd, 0x004f),
1820 .driver_info = EM2860_BOARD_TERRATEC_HYBRID_XS },
1821 { USB_DEVICE(0x0ccd, 0x005e),
1822 .driver_info = EM2882_BOARD_TERRATEC_HYBRID_XS },
1823 { USB_DEVICE(0x0ccd, 0x0042),
1824 .driver_info = EM2882_BOARD_TERRATEC_HYBRID_XS },
1825 { USB_DEVICE(0x0ccd, 0x0043),
1826 .driver_info = EM2870_BOARD_TERRATEC_XS },
1827 { USB_DEVICE(0x0ccd, 0x0047),
1828 .driver_info = EM2880_BOARD_TERRATEC_PRODIGY_XS },
1829 { USB_DEVICE(0x0ccd, 0x0084),
1830 .driver_info = EM2860_BOARD_TERRATEC_AV350 },
1831 { USB_DEVICE(0x0ccd, 0x0096),
1832 .driver_info = EM2860_BOARD_TERRATEC_GRABBY },
1833 { USB_DEVICE(0x0fd9, 0x0033),
1834 .driver_info = EM2860_BOARD_ELGATO_VIDEO_CAPTURE},
1835 { USB_DEVICE(0x185b, 0x2870),
1836 .driver_info = EM2870_BOARD_COMPRO_VIDEOMATE },
1837 { USB_DEVICE(0x185b, 0x2041),
1838 .driver_info = EM2820_BOARD_COMPRO_VIDEOMATE_FORYOU },
1839 { USB_DEVICE(0x2040, 0x4200),
1840 .driver_info = EM2820_BOARD_HAUPPAUGE_WINTV_USB_2 },
1841 { USB_DEVICE(0x2040, 0x4201),
1842 .driver_info = EM2820_BOARD_HAUPPAUGE_WINTV_USB_2 },
1843 { USB_DEVICE(0x2040, 0x6500),
1844 .driver_info = EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900 },
1845 { USB_DEVICE(0x2040, 0x6502),
1846 .driver_info = EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900_R2 },
1847 { USB_DEVICE(0x2040, 0x6513), /* HCW HVR-980 */
1848 .driver_info = EM2883_BOARD_HAUPPAUGE_WINTV_HVR_950 },
1849 { USB_DEVICE(0x2040, 0x6517), /* HP HVR-950 */
1850 .driver_info = EM2883_BOARD_HAUPPAUGE_WINTV_HVR_950 },
1851 { USB_DEVICE(0x2040, 0x651b), /* RP HVR-950 */
1852 .driver_info = EM2883_BOARD_HAUPPAUGE_WINTV_HVR_950 },
1853 { USB_DEVICE(0x2040, 0x651f),
1854 .driver_info = EM2883_BOARD_HAUPPAUGE_WINTV_HVR_850 },
1855 { USB_DEVICE(0x0438, 0xb002),
1856 .driver_info = EM2880_BOARD_AMD_ATI_TV_WONDER_HD_600 },
1857 { USB_DEVICE(0x2001, 0xf112),
1858 .driver_info = EM2820_BOARD_DLINK_USB_TV },
1859 { USB_DEVICE(0x2304, 0x0207),
1860 .driver_info = EM2820_BOARD_PINNACLE_DVC_90 },
1861 { USB_DEVICE(0x2304, 0x0208),
1862 .driver_info = EM2820_BOARD_PINNACLE_USB_2 },
1863 { USB_DEVICE(0x2304, 0x021a),
1864 .driver_info = EM2820_BOARD_PINNACLE_DVC_90 },
1865 { USB_DEVICE(0x2304, 0x0226),
1866 .driver_info = EM2882_BOARD_PINNACLE_HYBRID_PRO },
1867 { USB_DEVICE(0x2304, 0x0227),
1868 .driver_info = EM2880_BOARD_PINNACLE_PCTV_HD_PRO },
1869 { USB_DEVICE(0x0413, 0x6023),
1870 .driver_info = EM2800_BOARD_LEADTEK_WINFAST_USBII },
1871 { USB_DEVICE(0x093b, 0xa005),
1872 .driver_info = EM2861_BOARD_PLEXTOR_PX_TV100U },
1873 { USB_DEVICE(0x04bb, 0x0515),
1874 .driver_info = EM2820_BOARD_IODATA_GVMVP_SZ },
1875 { USB_DEVICE(0xeb1a, 0x50a6),
1876 .driver_info = EM2860_BOARD_GADMEI_UTV330 },
1877 { USB_DEVICE(0x1b80, 0xa340),
1878 .driver_info = EM2870_BOARD_KWORLD_A340 },
1879 { },
1881 MODULE_DEVICE_TABLE(usb, em28xx_id_table);
1884 * EEPROM hash table for devices with generic USB IDs
1886 static struct em28xx_hash_table em28xx_eeprom_hash[] = {
1887 /* P/N: SA 60002070465 Tuner: TVF7533-MF */
1888 {0x6ce05a8f, EM2820_BOARD_PROLINK_PLAYTV_USB2, TUNER_YMEC_TVF_5533MF},
1889 {0x72cc5a8b, EM2820_BOARD_PROLINK_PLAYTV_BOX4_USB2, TUNER_YMEC_TVF_5533MF},
1890 {0x966a0441, EM2880_BOARD_KWORLD_DVB_310U, TUNER_XC2028},
1891 {0x166a0441, EM2880_BOARD_EMPIRE_DUAL_TV, TUNER_XC2028},
1892 {0xcee44a99, EM2882_BOARD_EVGA_INDTUBE, TUNER_XC2028},
1893 {0xb8846b20, EM2881_BOARD_PINNACLE_HYBRID_PRO, TUNER_XC2028},
1894 {0x63f653bd, EM2870_BOARD_REDDO_DVB_C_USB_BOX, TUNER_ABSENT},
1895 {0x4e913442, EM2882_BOARD_DIKOM_DK300, TUNER_XC2028},
1898 /* I2C devicelist hash table for devices with generic USB IDs */
1899 static struct em28xx_hash_table em28xx_i2c_hash[] = {
1900 {0xb06a32c3, EM2800_BOARD_TERRATEC_CINERGY_200, TUNER_LG_PAL_NEW_TAPC},
1901 {0xf51200e3, EM2800_BOARD_VGEAR_POCKETTV, TUNER_LG_PAL_NEW_TAPC},
1902 {0x1ba50080, EM2860_BOARD_SAA711X_REFERENCE_DESIGN, TUNER_ABSENT},
1903 {0x77800080, EM2860_BOARD_TVP5150_REFERENCE_DESIGN, TUNER_ABSENT},
1904 {0xc51200e3, EM2820_BOARD_GADMEI_TVR200, TUNER_LG_PAL_NEW_TAPC},
1905 {0x4ba50080, EM2861_BOARD_GADMEI_UTV330PLUS, TUNER_TNF_5335MF},
1906 {0x6b800080, EM2874_LEADERSHIP_ISDBT, TUNER_ABSENT},
1909 /* I2C possible address to saa7115, tvp5150, msp3400, tvaudio */
1910 static unsigned short saa711x_addrs[] = {
1911 0x4a >> 1, 0x48 >> 1, /* SAA7111, SAA7111A and SAA7113 */
1912 0x42 >> 1, 0x40 >> 1, /* SAA7114, SAA7115 and SAA7118 */
1913 I2C_CLIENT_END };
1915 static unsigned short tvp5150_addrs[] = {
1916 0xb8 >> 1,
1917 0xba >> 1,
1918 I2C_CLIENT_END
1921 static unsigned short msp3400_addrs[] = {
1922 0x80 >> 1,
1923 0x88 >> 1,
1924 I2C_CLIENT_END
1927 int em28xx_tuner_callback(void *ptr, int component, int command, int arg)
1929 int rc = 0;
1930 struct em28xx *dev = ptr;
1932 if (dev->tuner_type != TUNER_XC2028)
1933 return 0;
1935 if (command != XC2028_TUNER_RESET)
1936 return 0;
1938 rc = em28xx_gpio_set(dev, dev->board.tuner_gpio);
1940 return rc;
1942 EXPORT_SYMBOL_GPL(em28xx_tuner_callback);
1944 static inline void em28xx_set_model(struct em28xx *dev)
1946 memcpy(&dev->board, &em28xx_boards[dev->model], sizeof(dev->board));
1948 /* Those are the default values for the majority of boards
1949 Use those values if not specified otherwise at boards entry
1951 if (!dev->board.xclk)
1952 dev->board.xclk = EM28XX_XCLK_IR_RC5_MODE |
1953 EM28XX_XCLK_FREQUENCY_12MHZ;
1955 if (!dev->board.i2c_speed)
1956 dev->board.i2c_speed = EM28XX_I2C_CLK_WAIT_ENABLE |
1957 EM28XX_I2C_FREQ_100_KHZ;
1961 /* FIXME: Should be replaced by a proper mt9m111 driver */
1962 static int em28xx_initialize_mt9m111(struct em28xx *dev)
1964 int i;
1965 unsigned char regs[][3] = {
1966 { 0x0d, 0x00, 0x01, }, /* reset and use defaults */
1967 { 0x0d, 0x00, 0x00, },
1968 { 0x0a, 0x00, 0x21, },
1969 { 0x21, 0x04, 0x00, }, /* full readout speed, no row/col skipping */
1972 for (i = 0; i < ARRAY_SIZE(regs); i++)
1973 i2c_master_send(&dev->i2c_client, &regs[i][0], 3);
1975 return 0;
1979 /* FIXME: Should be replaced by a proper mt9m001 driver */
1980 static int em28xx_initialize_mt9m001(struct em28xx *dev)
1982 int i;
1983 unsigned char regs[][3] = {
1984 { 0x0d, 0x00, 0x01, },
1985 { 0x0d, 0x00, 0x00, },
1986 { 0x04, 0x05, 0x00, }, /* hres = 1280 */
1987 { 0x03, 0x04, 0x00, }, /* vres = 1024 */
1988 { 0x20, 0x11, 0x00, },
1989 { 0x06, 0x00, 0x10, },
1990 { 0x2b, 0x00, 0x24, },
1991 { 0x2e, 0x00, 0x24, },
1992 { 0x35, 0x00, 0x24, },
1993 { 0x2d, 0x00, 0x20, },
1994 { 0x2c, 0x00, 0x20, },
1995 { 0x09, 0x0a, 0xd4, },
1996 { 0x35, 0x00, 0x57, },
1999 for (i = 0; i < ARRAY_SIZE(regs); i++)
2000 i2c_master_send(&dev->i2c_client, &regs[i][0], 3);
2002 return 0;
2005 /* HINT method: webcam I2C chips
2007 * This method works for webcams with Micron sensors
2009 static int em28xx_hint_sensor(struct em28xx *dev)
2011 int rc;
2012 char *sensor_name;
2013 unsigned char cmd;
2014 __be16 version_be;
2015 u16 version;
2017 /* Micron sensor detection */
2018 dev->i2c_client.addr = 0xba >> 1;
2019 cmd = 0;
2020 i2c_master_send(&dev->i2c_client, &cmd, 1);
2021 rc = i2c_master_recv(&dev->i2c_client, (char *)&version_be, 2);
2022 if (rc != 2)
2023 return -EINVAL;
2025 version = be16_to_cpu(version_be);
2026 switch (version) {
2027 case 0x8232: /* mt9v011 640x480 1.3 Mpix sensor */
2028 case 0x8243: /* mt9v011 rev B 640x480 1.3 Mpix sensor */
2029 dev->model = EM2820_BOARD_SILVERCREST_WEBCAM;
2030 em28xx_set_model(dev);
2032 sensor_name = "mt9v011";
2033 dev->em28xx_sensor = EM28XX_MT9V011;
2034 dev->sensor_xres = 640;
2035 dev->sensor_yres = 480;
2037 * FIXME: mt9v011 uses I2S speed as xtal clk - at least with
2038 * the Silvercrest cam I have here for testing - for higher
2039 * resolutions, a high clock cause horizontal artifacts, so we
2040 * need to use a lower xclk frequency.
2041 * Yet, it would be possible to adjust xclk depending on the
2042 * desired resolution, since this affects directly the
2043 * frame rate.
2045 dev->board.xclk = EM28XX_XCLK_FREQUENCY_4_3MHZ;
2046 dev->sensor_xtal = 4300000;
2048 /* probably means GRGB 16 bit bayer */
2049 dev->vinmode = 0x0d;
2050 dev->vinctl = 0x00;
2052 break;
2054 case 0x143a: /* MT9M111 as found in the ECS G200 */
2055 dev->model = EM2750_BOARD_UNKNOWN;
2056 em28xx_set_model(dev);
2058 sensor_name = "mt9m111";
2059 dev->board.xclk = EM28XX_XCLK_FREQUENCY_48MHZ;
2060 dev->em28xx_sensor = EM28XX_MT9M111;
2061 em28xx_initialize_mt9m111(dev);
2062 dev->sensor_xres = 640;
2063 dev->sensor_yres = 512;
2065 dev->vinmode = 0x0a;
2066 dev->vinctl = 0x00;
2068 break;
2070 case 0x8431:
2071 dev->model = EM2750_BOARD_UNKNOWN;
2072 em28xx_set_model(dev);
2074 sensor_name = "mt9m001";
2075 dev->em28xx_sensor = EM28XX_MT9M001;
2076 em28xx_initialize_mt9m001(dev);
2077 dev->sensor_xres = 1280;
2078 dev->sensor_yres = 1024;
2080 /* probably means BGGR 16 bit bayer */
2081 dev->vinmode = 0x0c;
2082 dev->vinctl = 0x00;
2084 break;
2085 default:
2086 printk("Unknown Micron Sensor 0x%04x\n", version);
2087 return -EINVAL;
2090 /* Setup webcam defaults */
2091 em28xx_pre_card_setup(dev);
2093 em28xx_errdev("Sensor is %s, using model %s entry.\n",
2094 sensor_name, em28xx_boards[dev->model].name);
2096 return 0;
2099 /* Since em28xx_pre_card_setup() requires a proper dev->model,
2100 * this won't work for boards with generic PCI IDs
2102 void em28xx_pre_card_setup(struct em28xx *dev)
2104 /* Set the initial XCLK and I2C clock values based on the board
2105 definition */
2106 em28xx_write_reg(dev, EM28XX_R0F_XCLK, dev->board.xclk & 0x7f);
2107 em28xx_write_reg(dev, EM28XX_R06_I2C_CLK, dev->board.i2c_speed);
2108 msleep(50);
2110 /* request some modules */
2111 switch (dev->model) {
2112 case EM2861_BOARD_PLEXTOR_PX_TV100U:
2113 /* Sets the msp34xx I2S speed */
2114 dev->i2s_speed = 2048000;
2115 break;
2116 case EM2861_BOARD_KWORLD_PVRTV_300U:
2117 case EM2880_BOARD_KWORLD_DVB_305U:
2118 em28xx_write_reg(dev, EM28XX_R08_GPIO, 0x6d);
2119 msleep(10);
2120 em28xx_write_reg(dev, EM28XX_R08_GPIO, 0x7d);
2121 msleep(10);
2122 break;
2123 case EM2870_BOARD_COMPRO_VIDEOMATE:
2124 /* TODO: someone can do some cleanup here...
2125 not everything's needed */
2126 em28xx_write_reg(dev, EM2880_R04_GPO, 0x00);
2127 msleep(10);
2128 em28xx_write_reg(dev, EM2880_R04_GPO, 0x01);
2129 msleep(10);
2130 em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xfd);
2131 mdelay(70);
2132 em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xfc);
2133 mdelay(70);
2134 em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xdc);
2135 mdelay(70);
2136 em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xfc);
2137 mdelay(70);
2138 break;
2139 case EM2870_BOARD_TERRATEC_XS_MT2060:
2140 /* this device needs some gpio writes to get the DVB-T
2141 demod work */
2142 em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xfe);
2143 mdelay(70);
2144 em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xde);
2145 mdelay(70);
2146 em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xfe);
2147 mdelay(70);
2148 break;
2149 case EM2870_BOARD_PINNACLE_PCTV_DVB:
2150 /* this device needs some gpio writes to get the
2151 DVB-T demod work */
2152 em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xfe);
2153 mdelay(70);
2154 em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xde);
2155 mdelay(70);
2156 em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xfe);
2157 mdelay(70);
2158 break;
2159 case EM2820_BOARD_GADMEI_UTV310:
2160 case EM2820_BOARD_MSI_VOX_USB_2:
2161 /* enables audio for that devices */
2162 em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xfd);
2163 break;
2165 case EM2882_BOARD_KWORLD_ATSC_315U:
2166 em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xff);
2167 msleep(10);
2168 em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xfe);
2169 msleep(10);
2170 em28xx_write_reg(dev, EM2880_R04_GPO, 0x00);
2171 msleep(10);
2172 em28xx_write_reg(dev, EM2880_R04_GPO, 0x08);
2173 msleep(10);
2174 break;
2176 case EM2860_BOARD_KAIOMY_TVNPC_U2:
2177 em28xx_write_regs(dev, EM28XX_R0F_XCLK, "\x07", 1);
2178 em28xx_write_regs(dev, EM28XX_R06_I2C_CLK, "\x40", 1);
2179 em28xx_write_regs(dev, 0x0d, "\x42", 1);
2180 em28xx_write_regs(dev, 0x08, "\xfd", 1);
2181 msleep(10);
2182 em28xx_write_regs(dev, 0x08, "\xff", 1);
2183 msleep(10);
2184 em28xx_write_regs(dev, 0x08, "\x7f", 1);
2185 msleep(10);
2186 em28xx_write_regs(dev, 0x08, "\x6b", 1);
2188 break;
2189 case EM2860_BOARD_EASYCAP:
2190 em28xx_write_regs(dev, 0x08, "\xf8", 1);
2191 break;
2193 case EM2820_BOARD_IODATA_GVMVP_SZ:
2194 em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xff);
2195 msleep(70);
2196 em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xf7);
2197 msleep(10);
2198 em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xfe);
2199 msleep(70);
2200 em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xfd);
2201 msleep(70);
2202 break;
2205 em28xx_gpio_set(dev, dev->board.tuner_gpio);
2206 em28xx_set_mode(dev, EM28XX_ANALOG_MODE);
2208 /* Unlock device */
2209 em28xx_set_mode(dev, EM28XX_SUSPEND);
2212 static void em28xx_setup_xc3028(struct em28xx *dev, struct xc2028_ctrl *ctl)
2214 memset(ctl, 0, sizeof(*ctl));
2216 ctl->fname = XC2028_DEFAULT_FIRMWARE;
2217 ctl->max_len = 64;
2218 ctl->mts = em28xx_boards[dev->model].mts_firmware;
2220 switch (dev->model) {
2221 case EM2880_BOARD_EMPIRE_DUAL_TV:
2222 case EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900:
2223 case EM2882_BOARD_TERRATEC_HYBRID_XS:
2224 ctl->demod = XC3028_FE_ZARLINK456;
2225 break;
2226 case EM2880_BOARD_TERRATEC_HYBRID_XS:
2227 case EM2880_BOARD_TERRATEC_HYBRID_XS_FR:
2228 case EM2881_BOARD_PINNACLE_HYBRID_PRO:
2229 ctl->demod = XC3028_FE_ZARLINK456;
2230 break;
2231 case EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900_R2:
2232 /* djh - Not sure which demod we need here */
2233 ctl->demod = XC3028_FE_DEFAULT;
2234 break;
2235 case EM2880_BOARD_AMD_ATI_TV_WONDER_HD_600:
2236 ctl->demod = XC3028_FE_DEFAULT;
2237 ctl->fname = XC3028L_DEFAULT_FIRMWARE;
2238 break;
2239 case EM2883_BOARD_HAUPPAUGE_WINTV_HVR_850:
2240 case EM2883_BOARD_HAUPPAUGE_WINTV_HVR_950:
2241 case EM2880_BOARD_PINNACLE_PCTV_HD_PRO:
2242 /* FIXME: Better to specify the needed IF */
2243 ctl->demod = XC3028_FE_DEFAULT;
2244 break;
2245 case EM2883_BOARD_KWORLD_HYBRID_330U:
2246 case EM2882_BOARD_DIKOM_DK300:
2247 case EM2882_BOARD_KWORLD_VS_DVBT:
2248 ctl->demod = XC3028_FE_CHINA;
2249 ctl->fname = XC2028_DEFAULT_FIRMWARE;
2250 break;
2251 case EM2882_BOARD_EVGA_INDTUBE:
2252 ctl->demod = XC3028_FE_CHINA;
2253 ctl->fname = XC3028L_DEFAULT_FIRMWARE;
2254 break;
2255 default:
2256 ctl->demod = XC3028_FE_OREN538;
2260 static void em28xx_tuner_setup(struct em28xx *dev)
2262 struct tuner_setup tun_setup;
2263 struct v4l2_frequency f;
2265 if (dev->tuner_type == TUNER_ABSENT)
2266 return;
2268 memset(&tun_setup, 0, sizeof(tun_setup));
2270 tun_setup.mode_mask = T_ANALOG_TV | T_RADIO;
2271 tun_setup.tuner_callback = em28xx_tuner_callback;
2273 if (dev->board.radio.type) {
2274 tun_setup.type = dev->board.radio.type;
2275 tun_setup.addr = dev->board.radio_addr;
2277 v4l2_device_call_all(&dev->v4l2_dev, 0, tuner, s_type_addr, &tun_setup);
2280 if ((dev->tuner_type != TUNER_ABSENT) && (dev->tuner_type)) {
2281 tun_setup.type = dev->tuner_type;
2282 tun_setup.addr = dev->tuner_addr;
2284 v4l2_device_call_all(&dev->v4l2_dev, 0, tuner, s_type_addr, &tun_setup);
2287 if (dev->tda9887_conf) {
2288 struct v4l2_priv_tun_config tda9887_cfg;
2290 tda9887_cfg.tuner = TUNER_TDA9887;
2291 tda9887_cfg.priv = &dev->tda9887_conf;
2293 v4l2_device_call_all(&dev->v4l2_dev, 0, tuner, s_config, &tda9887_cfg);
2296 if (dev->tuner_type == TUNER_XC2028) {
2297 struct v4l2_priv_tun_config xc2028_cfg;
2298 struct xc2028_ctrl ctl;
2300 memset(&xc2028_cfg, 0, sizeof(xc2028_cfg));
2301 memset(&ctl, 0, sizeof(ctl));
2303 em28xx_setup_xc3028(dev, &ctl);
2305 xc2028_cfg.tuner = TUNER_XC2028;
2306 xc2028_cfg.priv = &ctl;
2308 v4l2_device_call_all(&dev->v4l2_dev, 0, tuner, s_config, &xc2028_cfg);
2311 /* configure tuner */
2312 f.tuner = 0;
2313 f.type = V4L2_TUNER_ANALOG_TV;
2314 f.frequency = 9076; /* just a magic number */
2315 dev->ctl_freq = f.frequency;
2316 v4l2_device_call_all(&dev->v4l2_dev, 0, tuner, s_frequency, &f);
2319 static int em28xx_hint_board(struct em28xx *dev)
2321 int i;
2323 /* HINT method: EEPROM
2325 * This method works only for boards with eeprom.
2326 * Uses a hash of all eeprom bytes. The hash should be
2327 * unique for a vendor/tuner pair.
2328 * There are a high chance that tuners for different
2329 * video standards produce different hashes.
2331 for (i = 0; i < ARRAY_SIZE(em28xx_eeprom_hash); i++) {
2332 if (dev->hash == em28xx_eeprom_hash[i].hash) {
2333 dev->model = em28xx_eeprom_hash[i].model;
2334 dev->tuner_type = em28xx_eeprom_hash[i].tuner;
2336 em28xx_errdev("Your board has no unique USB ID.\n");
2337 em28xx_errdev("A hint were successfully done, "
2338 "based on eeprom hash.\n");
2339 em28xx_errdev("This method is not 100%% failproof.\n");
2340 em28xx_errdev("If the board were missdetected, "
2341 "please email this log to:\n");
2342 em28xx_errdev("\tV4L Mailing List "
2343 " <linux-media@vger.kernel.org>\n");
2344 em28xx_errdev("Board detected as %s\n",
2345 em28xx_boards[dev->model].name);
2347 return 0;
2351 /* HINT method: I2C attached devices
2353 * This method works for all boards.
2354 * Uses a hash of i2c scanned devices.
2355 * Devices with the same i2c attached chips will
2356 * be considered equal.
2357 * This method is less precise than the eeprom one.
2360 /* user did not request i2c scanning => do it now */
2361 if (!dev->i2c_hash)
2362 em28xx_do_i2c_scan(dev);
2364 for (i = 0; i < ARRAY_SIZE(em28xx_i2c_hash); i++) {
2365 if (dev->i2c_hash == em28xx_i2c_hash[i].hash) {
2366 dev->model = em28xx_i2c_hash[i].model;
2367 dev->tuner_type = em28xx_i2c_hash[i].tuner;
2368 em28xx_errdev("Your board has no unique USB ID.\n");
2369 em28xx_errdev("A hint were successfully done, "
2370 "based on i2c devicelist hash.\n");
2371 em28xx_errdev("This method is not 100%% failproof.\n");
2372 em28xx_errdev("If the board were missdetected, "
2373 "please email this log to:\n");
2374 em28xx_errdev("\tV4L Mailing List "
2375 " <linux-media@vger.kernel.org>\n");
2376 em28xx_errdev("Board detected as %s\n",
2377 em28xx_boards[dev->model].name);
2379 return 0;
2383 em28xx_errdev("Your board has no unique USB ID and thus need a "
2384 "hint to be detected.\n");
2385 em28xx_errdev("You may try to use card=<n> insmod option to "
2386 "workaround that.\n");
2387 em28xx_errdev("Please send an email with this log to:\n");
2388 em28xx_errdev("\tV4L Mailing List <linux-media@vger.kernel.org>\n");
2389 em28xx_errdev("Board eeprom hash is 0x%08lx\n", dev->hash);
2390 em28xx_errdev("Board i2c devicelist hash is 0x%08lx\n", dev->i2c_hash);
2392 em28xx_errdev("Here is a list of valid choices for the card=<n>"
2393 " insmod option:\n");
2394 for (i = 0; i < em28xx_bcount; i++) {
2395 em28xx_errdev(" card=%d -> %s\n",
2396 i, em28xx_boards[i].name);
2398 return -1;
2401 /* ----------------------------------------------------------------------- */
2402 void em28xx_register_i2c_ir(struct em28xx *dev)
2404 /* Leadtek winfast tv USBII deluxe can find a non working IR-device */
2405 /* at address 0x18, so if that address is needed for another board in */
2406 /* the future, please put it after 0x1f. */
2407 struct i2c_board_info info;
2408 const unsigned short addr_list[] = {
2409 0x1f, 0x30, 0x47, I2C_CLIENT_END
2412 if (disable_ir)
2413 return;
2415 memset(&info, 0, sizeof(struct i2c_board_info));
2416 memset(&dev->init_data, 0, sizeof(dev->init_data));
2417 strlcpy(info.type, "ir_video", I2C_NAME_SIZE);
2419 /* detect & configure */
2420 switch (dev->model) {
2421 case EM2800_BOARD_TERRATEC_CINERGY_200:
2422 case EM2820_BOARD_TERRATEC_CINERGY_250:
2423 dev->init_data.ir_codes = RC_MAP_EM_TERRATEC;
2424 dev->init_data.get_key = em28xx_get_key_terratec;
2425 dev->init_data.name = "i2c IR (EM28XX Terratec)";
2426 break;
2427 case EM2820_BOARD_PINNACLE_USB_2:
2428 dev->init_data.ir_codes = RC_MAP_PINNACLE_GREY;
2429 dev->init_data.get_key = em28xx_get_key_pinnacle_usb_grey;
2430 dev->init_data.name = "i2c IR (EM28XX Pinnacle PCTV)";
2431 break;
2432 case EM2820_BOARD_HAUPPAUGE_WINTV_USB_2:
2433 dev->init_data.ir_codes = RC_MAP_RC5_HAUPPAUGE_NEW;
2434 dev->init_data.get_key = em28xx_get_key_em_haup;
2435 dev->init_data.name = "i2c IR (EM2840 Hauppauge)";
2436 break;
2437 case EM2820_BOARD_LEADTEK_WINFAST_USBII_DELUXE:
2438 dev->init_data.ir_codes = RC_MAP_WINFAST_USBII_DELUXE;
2439 dev->init_data.get_key = em28xx_get_key_winfast_usbii_deluxe;
2440 dev->init_data.name = "i2c IR (EM2820 Winfast TV USBII Deluxe)";
2441 break;
2444 if (dev->init_data.name)
2445 info.platform_data = &dev->init_data;
2446 i2c_new_probed_device(&dev->i2c_adap, &info, addr_list, NULL);
2449 void em28xx_card_setup(struct em28xx *dev)
2452 * If the device can be a webcam, seek for a sensor.
2453 * If sensor is not found, then it isn't a webcam.
2455 if (dev->board.is_webcam) {
2456 if (em28xx_hint_sensor(dev) < 0)
2457 dev->board.is_webcam = 0;
2458 else
2459 dev->progressive = 1;
2462 if (!dev->board.is_webcam) {
2463 switch (dev->model) {
2464 case EM2820_BOARD_UNKNOWN:
2465 case EM2800_BOARD_UNKNOWN:
2467 * The K-WORLD DVB-T 310U is detected as an MSI Digivox AD.
2469 * This occurs because they share identical USB vendor and
2470 * product IDs.
2472 * What we do here is look up the EEPROM hash of the K-WORLD
2473 * and if it is found then we decide that we do not have
2474 * a DIGIVOX and reset the device to the K-WORLD instead.
2476 * This solution is only valid if they do not share eeprom
2477 * hash identities which has not been determined as yet.
2479 if (em28xx_hint_board(dev) < 0)
2480 em28xx_errdev("Board not discovered\n");
2481 else {
2482 em28xx_set_model(dev);
2483 em28xx_pre_card_setup(dev);
2485 break;
2486 default:
2487 em28xx_set_model(dev);
2491 em28xx_info("Identified as %s (card=%d)\n",
2492 dev->board.name, dev->model);
2494 dev->tuner_type = em28xx_boards[dev->model].tuner_type;
2495 if (em28xx_boards[dev->model].tuner_addr)
2496 dev->tuner_addr = em28xx_boards[dev->model].tuner_addr;
2498 if (em28xx_boards[dev->model].tda9887_conf)
2499 dev->tda9887_conf = em28xx_boards[dev->model].tda9887_conf;
2501 /* request some modules */
2502 switch (dev->model) {
2503 case EM2820_BOARD_HAUPPAUGE_WINTV_USB_2:
2504 case EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900:
2505 case EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900_R2:
2506 case EM2883_BOARD_HAUPPAUGE_WINTV_HVR_850:
2507 case EM2883_BOARD_HAUPPAUGE_WINTV_HVR_950:
2509 struct tveeprom tv;
2510 #if defined(CONFIG_MODULES) && defined(MODULE)
2511 request_module("tveeprom");
2512 #endif
2513 /* Call first TVeeprom */
2515 dev->i2c_client.addr = 0xa0 >> 1;
2516 tveeprom_hauppauge_analog(&dev->i2c_client, &tv, dev->eedata);
2518 dev->tuner_type = tv.tuner_type;
2520 if (tv.audio_processor == V4L2_IDENT_MSPX4XX) {
2521 dev->i2s_speed = 2048000;
2522 dev->board.has_msp34xx = 1;
2524 break;
2526 case EM2882_BOARD_KWORLD_ATSC_315U:
2527 em28xx_write_reg(dev, 0x0d, 0x42);
2528 msleep(10);
2529 em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xfd);
2530 msleep(10);
2531 break;
2532 case EM2820_BOARD_KWORLD_PVRTV2800RF:
2533 /* GPIO enables sound on KWORLD PVR TV 2800RF */
2534 em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xf9);
2535 break;
2536 case EM2820_BOARD_UNKNOWN:
2537 case EM2800_BOARD_UNKNOWN:
2539 * The K-WORLD DVB-T 310U is detected as an MSI Digivox AD.
2541 * This occurs because they share identical USB vendor and
2542 * product IDs.
2544 * What we do here is look up the EEPROM hash of the K-WORLD
2545 * and if it is found then we decide that we do not have
2546 * a DIGIVOX and reset the device to the K-WORLD instead.
2548 * This solution is only valid if they do not share eeprom
2549 * hash identities which has not been determined as yet.
2551 case EM2880_BOARD_MSI_DIGIVOX_AD:
2552 if (!em28xx_hint_board(dev))
2553 em28xx_set_model(dev);
2555 /* In cases where we had to use a board hint, the call to
2556 em28xx_set_mode() in em28xx_pre_card_setup() was a no-op,
2557 so make the call now so the analog GPIOs are set properly
2558 before probing the i2c bus. */
2559 em28xx_gpio_set(dev, dev->board.tuner_gpio);
2560 em28xx_set_mode(dev, EM28XX_ANALOG_MODE);
2561 break;
2564 * The Dikom DK300 is detected as an Kworld VS-DVB-T 323UR.
2566 * This occurs because they share identical USB vendor and
2567 * product IDs.
2569 * What we do here is look up the EEPROM hash of the Dikom
2570 * and if it is found then we decide that we do not have
2571 * a Kworld and reset the device to the Dikom instead.
2573 * This solution is only valid if they do not share eeprom
2574 * hash identities which has not been determined as yet.
2576 case EM2882_BOARD_KWORLD_VS_DVBT:
2577 if (!em28xx_hint_board(dev))
2578 em28xx_set_model(dev);
2580 /* In cases where we had to use a board hint, the call to
2581 em28xx_set_mode() in em28xx_pre_card_setup() was a no-op,
2582 so make the call now so the analog GPIOs are set properly
2583 before probing the i2c bus. */
2584 em28xx_gpio_set(dev, dev->board.tuner_gpio);
2585 em28xx_set_mode(dev, EM28XX_ANALOG_MODE);
2586 break;
2589 #if defined(CONFIG_MODULES) && defined(MODULE)
2590 if (dev->board.has_ir_i2c && !disable_ir)
2591 request_module("ir-kbd-i2c");
2592 #endif
2593 if (dev->board.has_snapshot_button)
2594 em28xx_register_snapshot_button(dev);
2596 if (dev->board.valid == EM28XX_BOARD_NOT_VALIDATED) {
2597 em28xx_errdev("\n\n");
2598 em28xx_errdev("The support for this board weren't "
2599 "valid yet.\n");
2600 em28xx_errdev("Please send a report of having this working\n");
2601 em28xx_errdev("not to V4L mailing list (and/or to other "
2602 "addresses)\n\n");
2605 /* Allow override tuner type by a module parameter */
2606 if (tuner >= 0)
2607 dev->tuner_type = tuner;
2609 /* request some modules */
2610 if (dev->board.has_msp34xx)
2611 v4l2_i2c_new_subdev(&dev->v4l2_dev, &dev->i2c_adap,
2612 "msp3400", 0, msp3400_addrs);
2614 if (dev->board.decoder == EM28XX_SAA711X)
2615 v4l2_i2c_new_subdev(&dev->v4l2_dev, &dev->i2c_adap,
2616 "saa7115_auto", 0, saa711x_addrs);
2618 if (dev->board.decoder == EM28XX_TVP5150)
2619 v4l2_i2c_new_subdev(&dev->v4l2_dev, &dev->i2c_adap,
2620 "tvp5150", 0, tvp5150_addrs);
2622 if (dev->em28xx_sensor == EM28XX_MT9V011) {
2623 struct mt9v011_platform_data pdata;
2624 struct i2c_board_info mt9v011_info = {
2625 .type = "mt9v011",
2626 .addr = 0xba >> 1,
2627 .platform_data = &pdata,
2629 struct v4l2_subdev *sd;
2631 pdata.xtal = dev->sensor_xtal;
2632 sd = v4l2_i2c_new_subdev_board(&dev->v4l2_dev, &dev->i2c_adap,
2633 &mt9v011_info, NULL);
2637 if (dev->board.adecoder == EM28XX_TVAUDIO)
2638 v4l2_i2c_new_subdev(&dev->v4l2_dev, &dev->i2c_adap,
2639 "tvaudio", dev->board.tvaudio_addr, NULL);
2641 if (dev->board.tuner_type != TUNER_ABSENT) {
2642 int has_demod = (dev->tda9887_conf & TDA9887_PRESENT);
2644 if (dev->board.radio.type)
2645 v4l2_i2c_new_subdev(&dev->v4l2_dev, &dev->i2c_adap,
2646 "tuner", dev->board.radio_addr, NULL);
2648 if (has_demod)
2649 v4l2_i2c_new_subdev(&dev->v4l2_dev,
2650 &dev->i2c_adap, "tuner",
2651 0, v4l2_i2c_tuner_addrs(ADDRS_DEMOD));
2652 if (dev->tuner_addr == 0) {
2653 enum v4l2_i2c_tuner_type type =
2654 has_demod ? ADDRS_TV_WITH_DEMOD : ADDRS_TV;
2655 struct v4l2_subdev *sd;
2657 sd = v4l2_i2c_new_subdev(&dev->v4l2_dev,
2658 &dev->i2c_adap, "tuner",
2659 0, v4l2_i2c_tuner_addrs(type));
2661 if (sd)
2662 dev->tuner_addr = v4l2_i2c_subdev_addr(sd);
2663 } else {
2664 v4l2_i2c_new_subdev(&dev->v4l2_dev, &dev->i2c_adap,
2665 "tuner", dev->tuner_addr, NULL);
2669 em28xx_tuner_setup(dev);
2671 if(!disable_ir)
2672 em28xx_ir_init(dev);
2676 #if defined(CONFIG_MODULES) && defined(MODULE)
2677 static void request_module_async(struct work_struct *work)
2679 struct em28xx *dev = container_of(work,
2680 struct em28xx, request_module_wk);
2682 if (dev->has_audio_class)
2683 request_module("snd-usb-audio");
2684 else if (dev->has_alsa_audio)
2685 request_module("em28xx-alsa");
2687 if (dev->board.has_dvb)
2688 request_module("em28xx-dvb");
2691 static void request_modules(struct em28xx *dev)
2693 INIT_WORK(&dev->request_module_wk, request_module_async);
2694 schedule_work(&dev->request_module_wk);
2697 static void flush_request_modules(struct em28xx *dev)
2699 flush_work_sync(&dev->request_module_wk);
2701 #else
2702 #define request_modules(dev)
2703 #define flush_request_modules(dev)
2704 #endif /* CONFIG_MODULES */
2707 * em28xx_realease_resources()
2708 * unregisters the v4l2,i2c and usb devices
2709 * called when the device gets disconected or at module unload
2711 void em28xx_release_resources(struct em28xx *dev)
2713 if (dev->sbutton_input_dev)
2714 em28xx_deregister_snapshot_button(dev);
2716 if (dev->ir)
2717 em28xx_ir_fini(dev);
2719 /*FIXME: I2C IR should be disconnected */
2721 em28xx_release_analog_resources(dev);
2723 em28xx_remove_from_devlist(dev);
2725 em28xx_i2c_unregister(dev);
2727 v4l2_device_unregister(&dev->v4l2_dev);
2729 usb_put_dev(dev->udev);
2731 /* Mark device as unused */
2732 em28xx_devused &= ~(1 << dev->devno);
2736 * em28xx_init_dev()
2737 * allocates and inits the device structs, registers i2c bus and v4l device
2739 static int em28xx_init_dev(struct em28xx **devhandle, struct usb_device *udev,
2740 struct usb_interface *interface,
2741 int minor)
2743 struct em28xx *dev = *devhandle;
2744 int retval;
2745 int errCode;
2747 dev->udev = udev;
2748 mutex_init(&dev->ctrl_urb_lock);
2749 spin_lock_init(&dev->slock);
2750 init_waitqueue_head(&dev->open);
2751 init_waitqueue_head(&dev->wait_frame);
2752 init_waitqueue_head(&dev->wait_stream);
2754 dev->em28xx_write_regs = em28xx_write_regs;
2755 dev->em28xx_read_reg = em28xx_read_reg;
2756 dev->em28xx_read_reg_req_len = em28xx_read_reg_req_len;
2757 dev->em28xx_write_regs_req = em28xx_write_regs_req;
2758 dev->em28xx_read_reg_req = em28xx_read_reg_req;
2759 dev->board.is_em2800 = em28xx_boards[dev->model].is_em2800;
2761 em28xx_set_model(dev);
2763 /* Set the default GPO/GPIO for legacy devices */
2764 dev->reg_gpo_num = EM2880_R04_GPO;
2765 dev->reg_gpio_num = EM28XX_R08_GPIO;
2767 dev->wait_after_write = 5;
2769 /* Based on the Chip ID, set the device configuration */
2770 retval = em28xx_read_reg(dev, EM28XX_R0A_CHIPID);
2771 if (retval > 0) {
2772 dev->chip_id = retval;
2774 switch (dev->chip_id) {
2775 case CHIP_ID_EM2800:
2776 em28xx_info("chip ID is em2800\n");
2777 break;
2778 case CHIP_ID_EM2710:
2779 em28xx_info("chip ID is em2710\n");
2780 break;
2781 case CHIP_ID_EM2750:
2782 em28xx_info("chip ID is em2750\n");
2783 break;
2784 case CHIP_ID_EM2820:
2785 em28xx_info("chip ID is em2820 (or em2710)\n");
2786 break;
2787 case CHIP_ID_EM2840:
2788 em28xx_info("chip ID is em2840\n");
2789 break;
2790 case CHIP_ID_EM2860:
2791 em28xx_info("chip ID is em2860\n");
2792 break;
2793 case CHIP_ID_EM2870:
2794 em28xx_info("chip ID is em2870\n");
2795 dev->wait_after_write = 0;
2796 break;
2797 case CHIP_ID_EM2874:
2798 em28xx_info("chip ID is em2874\n");
2799 dev->reg_gpio_num = EM2874_R80_GPIO;
2800 dev->wait_after_write = 0;
2801 break;
2802 case CHIP_ID_EM2883:
2803 em28xx_info("chip ID is em2882/em2883\n");
2804 dev->wait_after_write = 0;
2805 break;
2806 default:
2807 em28xx_info("em28xx chip ID = %d\n", dev->chip_id);
2811 /* Prepopulate cached GPO register content */
2812 retval = em28xx_read_reg(dev, dev->reg_gpo_num);
2813 if (retval >= 0)
2814 dev->reg_gpo = retval;
2816 em28xx_pre_card_setup(dev);
2818 if (!dev->board.is_em2800) {
2819 /* Resets I2C speed */
2820 em28xx_write_reg(dev, EM28XX_R06_I2C_CLK, dev->board.i2c_speed);
2821 if (retval < 0) {
2822 em28xx_errdev("%s: em28xx_write_regs_req failed!"
2823 " retval [%d]\n",
2824 __func__, retval);
2825 return retval;
2829 retval = v4l2_device_register(&interface->dev, &dev->v4l2_dev);
2830 if (retval < 0) {
2831 em28xx_errdev("Call to v4l2_device_register() failed!\n");
2832 return retval;
2835 /* register i2c bus */
2836 errCode = em28xx_i2c_register(dev);
2837 if (errCode < 0) {
2838 v4l2_device_unregister(&dev->v4l2_dev);
2839 em28xx_errdev("%s: em28xx_i2c_register - errCode [%d]!\n",
2840 __func__, errCode);
2841 return errCode;
2845 * Default format, used for tvp5150 or saa711x output formats
2847 dev->vinmode = 0x10;
2848 dev->vinctl = EM28XX_VINCTRL_INTERLACED |
2849 EM28XX_VINCTRL_CCIR656_ENABLE;
2851 /* Do board specific init and eeprom reading */
2852 em28xx_card_setup(dev);
2854 /* Configure audio */
2855 errCode = em28xx_audio_setup(dev);
2856 if (errCode < 0) {
2857 v4l2_device_unregister(&dev->v4l2_dev);
2858 em28xx_errdev("%s: Error while setting audio - errCode [%d]!\n",
2859 __func__, errCode);
2862 /* wake i2c devices */
2863 em28xx_wake_i2c(dev);
2865 /* init video dma queues */
2866 INIT_LIST_HEAD(&dev->vidq.active);
2867 INIT_LIST_HEAD(&dev->vidq.queued);
2868 INIT_LIST_HEAD(&dev->vbiq.active);
2869 INIT_LIST_HEAD(&dev->vbiq.queued);
2871 if (dev->board.has_msp34xx) {
2872 /* Send a reset to other chips via gpio */
2873 errCode = em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xf7);
2874 if (errCode < 0) {
2875 em28xx_errdev("%s: em28xx_write_regs_req - "
2876 "msp34xx(1) failed! errCode [%d]\n",
2877 __func__, errCode);
2878 return errCode;
2880 msleep(3);
2882 errCode = em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xff);
2883 if (errCode < 0) {
2884 em28xx_errdev("%s: em28xx_write_regs_req - "
2885 "msp34xx(2) failed! errCode [%d]\n",
2886 __func__, errCode);
2887 return errCode;
2889 msleep(3);
2892 em28xx_add_into_devlist(dev);
2894 retval = em28xx_register_analog_devices(dev);
2895 if (retval < 0) {
2896 em28xx_release_resources(dev);
2897 goto fail_reg_devices;
2900 em28xx_init_extension(dev);
2902 /* Save some power by putting tuner to sleep */
2903 v4l2_device_call_all(&dev->v4l2_dev, 0, core, s_power, 0);
2905 return 0;
2907 fail_reg_devices:
2908 return retval;
2912 * em28xx_usb_probe()
2913 * checks for supported devices
2915 static int em28xx_usb_probe(struct usb_interface *interface,
2916 const struct usb_device_id *id)
2918 const struct usb_endpoint_descriptor *endpoint;
2919 struct usb_device *udev;
2920 struct usb_interface *uif;
2921 struct em28xx *dev = NULL;
2922 int retval;
2923 int i, nr, ifnum, isoc_pipe;
2924 char *speed;
2925 char descr[255] = "";
2927 udev = usb_get_dev(interface_to_usbdev(interface));
2928 ifnum = interface->altsetting[0].desc.bInterfaceNumber;
2930 /* Check to see next free device and mark as used */
2931 nr = find_first_zero_bit(&em28xx_devused, EM28XX_MAXBOARDS);
2932 em28xx_devused |= 1<<nr;
2934 /* Don't register audio interfaces */
2935 if (interface->altsetting[0].desc.bInterfaceClass == USB_CLASS_AUDIO) {
2936 em28xx_err(DRIVER_NAME " audio device (%04x:%04x): "
2937 "interface %i, class %i\n",
2938 le16_to_cpu(udev->descriptor.idVendor),
2939 le16_to_cpu(udev->descriptor.idProduct),
2940 ifnum,
2941 interface->altsetting[0].desc.bInterfaceClass);
2943 em28xx_devused &= ~(1<<nr);
2944 retval = -ENODEV;
2945 goto err;
2948 endpoint = &interface->cur_altsetting->endpoint[0].desc;
2950 /* check if the device has the iso in endpoint at the correct place */
2951 if (usb_endpoint_xfer_isoc(endpoint)
2953 (interface->altsetting[1].endpoint[0].desc.wMaxPacketSize == 940)) {
2954 /* It's a newer em2874/em2875 device */
2955 isoc_pipe = 0;
2956 } else {
2957 int check_interface = 1;
2958 isoc_pipe = 1;
2959 endpoint = &interface->cur_altsetting->endpoint[1].desc;
2960 if (!usb_endpoint_xfer_isoc(endpoint))
2961 check_interface = 0;
2963 if (usb_endpoint_dir_out(endpoint))
2964 check_interface = 0;
2966 if (!check_interface) {
2967 em28xx_err(DRIVER_NAME " video device (%04x:%04x): "
2968 "interface %i, class %i found.\n",
2969 le16_to_cpu(udev->descriptor.idVendor),
2970 le16_to_cpu(udev->descriptor.idProduct),
2971 ifnum,
2972 interface->altsetting[0].desc.bInterfaceClass);
2974 em28xx_err(DRIVER_NAME " This is an anciliary "
2975 "interface not used by the driver\n");
2977 em28xx_devused &= ~(1<<nr);
2978 retval = -ENODEV;
2979 goto err;
2983 switch (udev->speed) {
2984 case USB_SPEED_LOW:
2985 speed = "1.5";
2986 break;
2987 case USB_SPEED_UNKNOWN:
2988 case USB_SPEED_FULL:
2989 speed = "12";
2990 break;
2991 case USB_SPEED_HIGH:
2992 speed = "480";
2993 break;
2994 default:
2995 speed = "unknown";
2998 if (udev->manufacturer)
2999 strlcpy(descr, udev->manufacturer, sizeof(descr));
3001 if (udev->product) {
3002 if (*descr)
3003 strlcat(descr, " ", sizeof(descr));
3004 strlcat(descr, udev->product, sizeof(descr));
3006 if (*descr)
3007 strlcat(descr, " ", sizeof(descr));
3009 printk(DRIVER_NAME ": New device %s@ %s Mbps "
3010 "(%04x:%04x, interface %d, class %d)\n",
3011 descr,
3012 speed,
3013 le16_to_cpu(udev->descriptor.idVendor),
3014 le16_to_cpu(udev->descriptor.idProduct),
3015 ifnum,
3016 interface->altsetting->desc.bInterfaceNumber);
3019 * Make sure we have 480 Mbps of bandwidth, otherwise things like
3020 * video stream wouldn't likely work, since 12 Mbps is generally
3021 * not enough even for most Digital TV streams.
3023 if (udev->speed != USB_SPEED_HIGH && disable_usb_speed_check == 0) {
3024 printk(DRIVER_NAME ": Device initialization failed.\n");
3025 printk(DRIVER_NAME ": Device must be connected to a high-speed"
3026 " USB 2.0 port.\n");
3027 em28xx_devused &= ~(1<<nr);
3028 retval = -ENODEV;
3029 goto err;
3032 if (nr >= EM28XX_MAXBOARDS) {
3033 printk(DRIVER_NAME ": Supports only %i em28xx boards.\n",
3034 EM28XX_MAXBOARDS);
3035 em28xx_devused &= ~(1<<nr);
3036 retval = -ENOMEM;
3037 goto err;
3040 /* allocate memory for our device state and initialize it */
3041 dev = kzalloc(sizeof(*dev), GFP_KERNEL);
3042 if (dev == NULL) {
3043 em28xx_err(DRIVER_NAME ": out of memory!\n");
3044 em28xx_devused &= ~(1<<nr);
3045 retval = -ENOMEM;
3046 goto err;
3049 snprintf(dev->name, 29, "em28xx #%d", nr);
3050 dev->devno = nr;
3051 dev->model = id->driver_info;
3052 dev->alt = -1;
3054 /* Checks if audio is provided by some interface */
3055 for (i = 0; i < udev->config->desc.bNumInterfaces; i++) {
3056 uif = udev->config->interface[i];
3057 if (uif->altsetting[0].desc.bInterfaceClass == USB_CLASS_AUDIO) {
3058 dev->has_audio_class = 1;
3059 break;
3063 /* compute alternate max packet sizes */
3064 uif = udev->actconfig->interface[0];
3066 dev->num_alt = uif->num_altsetting;
3067 dev->alt_max_pkt_size = kmalloc(32 * dev->num_alt, GFP_KERNEL);
3069 if (dev->alt_max_pkt_size == NULL) {
3070 em28xx_errdev("out of memory!\n");
3071 em28xx_devused &= ~(1<<nr);
3072 kfree(dev);
3073 retval = -ENOMEM;
3074 goto err;
3077 for (i = 0; i < dev->num_alt ; i++) {
3078 u16 tmp = le16_to_cpu(uif->altsetting[i].endpoint[isoc_pipe].desc.wMaxPacketSize);
3079 dev->alt_max_pkt_size[i] =
3080 (tmp & 0x07ff) * (((tmp & 0x1800) >> 11) + 1);
3083 if ((card[nr] >= 0) && (card[nr] < em28xx_bcount))
3084 dev->model = card[nr];
3086 /* allocate device struct */
3087 mutex_init(&dev->lock);
3088 mutex_lock(&dev->lock);
3089 retval = em28xx_init_dev(&dev, udev, interface, nr);
3090 if (retval) {
3091 em28xx_devused &= ~(1<<dev->devno);
3092 mutex_unlock(&dev->lock);
3093 kfree(dev);
3094 goto err;
3097 /* save our data pointer in this interface device */
3098 usb_set_intfdata(interface, dev);
3100 request_modules(dev);
3102 /* Should be the last thing to do, to avoid newer udev's to
3103 open the device before fully initializing it
3105 mutex_unlock(&dev->lock);
3107 return 0;
3109 err:
3110 return retval;
3114 * em28xx_usb_disconnect()
3115 * called when the device gets diconencted
3116 * video device will be unregistered on v4l2_close in case it is still open
3118 static void em28xx_usb_disconnect(struct usb_interface *interface)
3120 struct em28xx *dev;
3122 dev = usb_get_intfdata(interface);
3123 usb_set_intfdata(interface, NULL);
3125 if (!dev)
3126 return;
3128 em28xx_info("disconnecting %s\n", dev->vdev->name);
3130 flush_request_modules(dev);
3132 /* wait until all current v4l2 io is finished then deallocate
3133 resources */
3134 mutex_lock(&dev->lock);
3136 wake_up_interruptible_all(&dev->open);
3138 v4l2_device_disconnect(&dev->v4l2_dev);
3140 if (dev->users) {
3141 em28xx_warn
3142 ("device %s is open! Deregistration and memory "
3143 "deallocation are deferred on close.\n",
3144 video_device_node_name(dev->vdev));
3146 dev->state |= DEV_MISCONFIGURED;
3147 em28xx_uninit_isoc(dev);
3148 dev->state |= DEV_DISCONNECTED;
3149 wake_up_interruptible(&dev->wait_frame);
3150 wake_up_interruptible(&dev->wait_stream);
3151 } else {
3152 dev->state |= DEV_DISCONNECTED;
3153 em28xx_release_resources(dev);
3156 em28xx_close_extension(dev);
3158 mutex_unlock(&dev->lock);
3160 if (!dev->users) {
3161 kfree(dev->alt_max_pkt_size);
3162 kfree(dev);
3166 static struct usb_driver em28xx_usb_driver = {
3167 .name = "em28xx",
3168 .probe = em28xx_usb_probe,
3169 .disconnect = em28xx_usb_disconnect,
3170 .id_table = em28xx_id_table,
3173 static int __init em28xx_module_init(void)
3175 int result;
3177 /* register this driver with the USB subsystem */
3178 result = usb_register(&em28xx_usb_driver);
3179 if (result)
3180 em28xx_err(DRIVER_NAME
3181 " usb_register failed. Error number %d.\n", result);
3183 printk(KERN_INFO DRIVER_NAME " driver loaded\n");
3185 return result;
3188 static void __exit em28xx_module_exit(void)
3190 /* deregister this driver with the USB subsystem */
3191 usb_deregister(&em28xx_usb_driver);
3194 module_init(em28xx_module_init);
3195 module_exit(em28xx_module_exit);