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