[media] marvell-ccic: remove g_chip_ident
[deliverable/linux.git] / drivers / media / usb / em28xx / em28xx-cards.c
CommitLineData
a6c2ba28 1/*
c23f5949
MCC
2 em28xx-cards.c - driver for Empia EM2800/EM2820/2840 USB
3 video capture devices
a6c2ba28 4
f7abcd38
MCC
5 Copyright (C) 2005 Ludovico Cavedon <cavedon@sssup.it>
6 Markus Rechberger <mrechberger@gmail.com>
2e7c6dc3 7 Mauro Carvalho Chehab <mchehab@infradead.org>
f7abcd38 8 Sascha Sommer <saschasommer@freenet.de>
c647a91a 9 Copyright (C) 2012 Frank Schäfer <fschaefer.oss@googlemail.com>
a6c2ba28 10
11 This program is free software; you can redistribute it and/or modify
12 it under the terms of the GNU General Public License as published by
13 the Free Software Foundation; either version 2 of the License, or
14 (at your option) any later version.
15
16 This program is distributed in the hope that it will be useful,
17 but WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 GNU General Public License for more details.
20
21 You should have received a copy of the GNU General Public License
22 along with this program; if not, write to the Free Software
23 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24 */
25
26#include <linux/init.h>
27#include <linux/module.h>
5a0e3ad6 28#include <linux/slab.h>
a6c2ba28 29#include <linux/delay.h>
30#include <linux/i2c.h>
31#include <linux/usb.h>
32#include <media/tuner.h>
2474ed44 33#include <media/msp3400.h>
c7c0b34c
HV
34#include <media/saa7115.h>
35#include <media/tvp5150.h>
f2cf250a
DSL
36#include <media/tvaudio.h>
37#include <media/i2c-addr.h>
1f6173ed 38#include <media/tveeprom.h>
9bb13a6d 39#include <media/v4l2-common.h>
38f9d308 40#include <media/v4l2-chip-ident.h>
a6c2ba28 41
f7abcd38 42#include "em28xx.h"
a6c2ba28 43
1a23f81b
MCC
44#define DRIVER_NAME "em28xx"
45
03910cc3
MCC
46static int tuner = -1;
47module_param(tuner, int, 0444);
48MODULE_PARM_DESC(tuner, "tuner type");
49
c8793b03
MCC
50static unsigned int disable_ir;
51module_param(disable_ir, int, 0444);
52MODULE_PARM_DESC(disable_ir, "disable infrared remote support");
53
e2a1b79f
DH
54static unsigned int disable_usb_speed_check;
55module_param(disable_usb_speed_check, int, 0444);
56MODULE_PARM_DESC(disable_usb_speed_check,
57 "override min bandwidth requirement of 480M bps");
58
d3829fad 59static unsigned int card[] = {[0 ... (EM28XX_MAXBOARDS - 1)] = -1U };
1a23f81b
MCC
60module_param_array(card, int, NULL, 0444);
61MODULE_PARM_DESC(card, "card type");
62
7e5d74ee
FS
63static int usb_xfer_mode = -1;
64module_param(usb_xfer_mode, int, 0444);
65MODULE_PARM_DESC(usb_xfer_mode,
66 "USB transfer mode for frame data (-1 = auto, 0 = prefer isoc, 1 = prefer bulk)");
454fe92f
FS
67
68
38b61eb2 69/* Bitmask marking allocated devices from 0 to EM28XX_MAXBOARDS - 1 */
1a23f81b
MCC
70static unsigned long em28xx_devused;
71
03910cc3
MCC
72struct em28xx_hash_table {
73 unsigned long hash;
74 unsigned int model;
75 unsigned int tuner;
76};
77
60332f03
EG
78static void em28xx_pre_card_setup(struct em28xx *dev);
79
0ec202d1
MCC
80/*
81 * Reset sequences for analog/digital modes
82 */
83
84/* Reset for the most [analog] boards */
85static struct em28xx_reg_seq default_analog[] = {
86 {EM28XX_R08_GPIO, 0x6d, ~EM_GPIO_4, 10},
87 { -1, -1, -1, -1},
88};
89
90/* Reset for the most [digital] boards */
91static struct em28xx_reg_seq default_digital[] = {
92 {EM28XX_R08_GPIO, 0x6e, ~EM_GPIO_4, 10},
93 { -1, -1, -1, -1},
94};
95
96/* Board Hauppauge WinTV HVR 900 analog */
97static struct em28xx_reg_seq hauppauge_wintv_hvr_900_analog[] = {
98 {EM28XX_R08_GPIO, 0x2d, ~EM_GPIO_4, 10},
99 {0x05, 0xff, 0x10, 10},
100 { -1, -1, -1, -1},
101};
102
103/* Board Hauppauge WinTV HVR 900 digital */
104static struct em28xx_reg_seq hauppauge_wintv_hvr_900_digital[] = {
105 {EM28XX_R08_GPIO, 0x2e, ~EM_GPIO_4, 10},
106 {EM2880_R04_GPO, 0x04, 0x0f, 10},
107 {EM2880_R04_GPO, 0x0c, 0x0f, 10},
108 { -1, -1, -1, -1},
109};
110
7030f52b
DH
111/* Board Hauppauge WinTV HVR 900 (R2) digital */
112static struct em28xx_reg_seq hauppauge_wintv_hvr_900R2_digital[] = {
113 {EM28XX_R08_GPIO, 0x2e, ~EM_GPIO_4, 10},
114 {EM2880_R04_GPO, 0x0c, 0x0f, 10},
115 { -1, -1, -1, -1},
116};
117
0ec202d1
MCC
118/* Boards - EM2880 MSI DIGIVOX AD and EM2880_BOARD_MSI_DIGIVOX_AD_II */
119static struct em28xx_reg_seq em2880_msi_digivox_ad_analog[] = {
120 {EM28XX_R08_GPIO, 0x69, ~EM_GPIO_4, 10},
121 { -1, -1, -1, -1},
122};
123
124/* Boards - EM2880 MSI DIGIVOX AD and EM2880_BOARD_MSI_DIGIVOX_AD_II */
0ec202d1
MCC
125
126/* Board - EM2870 Kworld 355u
127 Analog - No input analog */
0ec202d1 128
d7de5d8f
FM
129/* Board - EM2882 Kworld 315U digital */
130static struct em28xx_reg_seq em2882_kworld_315u_digital[] = {
131 {EM28XX_R08_GPIO, 0xff, 0xff, 10},
132 {EM28XX_R08_GPIO, 0xfe, 0xff, 10},
133 {EM2880_R04_GPO, 0x04, 0xff, 10},
134 {EM2880_R04_GPO, 0x0c, 0xff, 10},
135 {EM28XX_R08_GPIO, 0x7e, 0xff, 10},
136 { -1, -1, -1, -1},
137};
138
139static struct em28xx_reg_seq em2882_kworld_315u_tuner_gpio[] = {
140 {EM2880_R04_GPO, 0x08, 0xff, 10},
141 {EM2880_R04_GPO, 0x0c, 0xff, 10},
142 {EM2880_R04_GPO, 0x08, 0xff, 10},
143 {EM2880_R04_GPO, 0x0c, 0xff, 10},
144 { -1, -1, -1, -1},
145};
146
6e7b9ea0
RK
147static struct em28xx_reg_seq kworld_330u_analog[] = {
148 {EM28XX_R08_GPIO, 0x6d, ~EM_GPIO_4, 10},
149 {EM2880_R04_GPO, 0x00, 0xff, 10},
150 { -1, -1, -1, -1},
151};
152
153static struct em28xx_reg_seq kworld_330u_digital[] = {
154 {EM28XX_R08_GPIO, 0x6e, ~EM_GPIO_4, 10},
155 {EM2880_R04_GPO, 0x08, 0xff, 10},
156 { -1, -1, -1, -1},
157};
158
19859229
DH
159/* Evga inDtube
160 GPIO0 - Enable digital power (s5h1409) - low to enable
161 GPIO1 - Enable analog power (tvp5150/emp202) - low to enable
162 GPIO4 - xc3028 reset
163 GOP3 - s5h1409 reset
164 */
165static struct em28xx_reg_seq evga_indtube_analog[] = {
166 {EM28XX_R08_GPIO, 0x79, 0xff, 60},
167 { -1, -1, -1, -1},
168};
169
170static struct em28xx_reg_seq evga_indtube_digital[] = {
171 {EM28XX_R08_GPIO, 0x7a, 0xff, 1},
172 {EM2880_R04_GPO, 0x04, 0xff, 10},
173 {EM2880_R04_GPO, 0x0c, 0xff, 1},
174 { -1, -1, -1, -1},
175};
176
7e48b30a
JW
177/*
178 * KWorld PlusTV 340U and UB435-Q (ATSC) GPIOs map:
179 * EM_GPIO_0 - currently unknown
180 * EM_GPIO_1 - LED disable/enable (1 = off, 0 = on)
181 * EM_GPIO_2 - currently unknown
182 * EM_GPIO_3 - currently unknown
183 * EM_GPIO_4 - TDA18271HD/C1 tuner (1 = active, 0 = in reset)
184 * EM_GPIO_5 - LGDT3304 ATSC/QAM demod (1 = active, 0 = in reset)
185 * EM_GPIO_6 - currently unknown
186 * EM_GPIO_7 - currently unknown
187 */
188static struct em28xx_reg_seq kworld_a340_digital[] = {
189 {EM28XX_R08_GPIO, 0x6d, ~EM_GPIO_4, 10},
190 { -1, -1, -1, -1},
191};
192
d5b3ba9c
DH
193/* Pinnacle Hybrid Pro eb1a:2881 */
194static struct em28xx_reg_seq pinnacle_hybrid_pro_analog[] = {
44010440 195 {EM28XX_R08_GPIO, 0xfd, ~EM_GPIO_4, 10},
d5b3ba9c
DH
196 { -1, -1, -1, -1},
197};
198
199static struct em28xx_reg_seq pinnacle_hybrid_pro_digital[] = {
200 {EM28XX_R08_GPIO, 0x6e, ~EM_GPIO_4, 10},
201 {EM2880_R04_GPO, 0x04, 0xff, 100},/* zl10353 reset */
202 {EM2880_R04_GPO, 0x0c, 0xff, 1},
203 { -1, -1, -1, -1},
204};
205
cec4e6c1
MG
206static struct em28xx_reg_seq terratec_cinergy_USB_XS_FR_analog[] = {
207 {EM28XX_R08_GPIO, 0x6d, ~EM_GPIO_4, 10},
208 {EM2880_R04_GPO, 0x00, 0xff, 10},
209 { -1, -1, -1, -1},
210};
211
212static struct em28xx_reg_seq terratec_cinergy_USB_XS_FR_digital[] = {
213 {EM28XX_R08_GPIO, 0x6e, ~EM_GPIO_4, 10},
214 {EM2880_R04_GPO, 0x08, 0xff, 10},
215 { -1, -1, -1, -1},
216};
217
285eb1a4
AP
218/* eb1a:2868 Reddo DVB-C USB TV Box
219 GPIO4 - CU1216L NIM
220 Other GPIOs seems to be don't care. */
221static struct em28xx_reg_seq reddo_dvb_c_usb_box[] = {
222 {EM28XX_R08_GPIO, 0xfe, 0xff, 10},
223 {EM28XX_R08_GPIO, 0xde, 0xff, 10},
224 {EM28XX_R08_GPIO, 0xfe, 0xff, 10},
225 {EM28XX_R08_GPIO, 0xff, 0xff, 10},
226 {EM28XX_R08_GPIO, 0x7f, 0xff, 10},
227 {EM28XX_R08_GPIO, 0x6f, 0xff, 10},
228 {EM28XX_R08_GPIO, 0xff, 0xff, 10},
229 {-1, -1, -1, -1},
230};
d5b3ba9c 231
0ec202d1 232/* Callback for the most boards */
017ab4b1 233static struct em28xx_reg_seq default_tuner_gpio[] = {
0ec202d1
MCC
234 {EM28XX_R08_GPIO, EM_GPIO_4, EM_GPIO_4, 10},
235 {EM28XX_R08_GPIO, 0, EM_GPIO_4, 10},
236 {EM28XX_R08_GPIO, EM_GPIO_4, EM_GPIO_4, 10},
237 { -1, -1, -1, -1},
238};
239
2bd1d9eb
VW
240/* Mute/unmute */
241static struct em28xx_reg_seq compro_unmute_tv_gpio[] = {
242 {EM28XX_R08_GPIO, 5, 7, 10},
243 { -1, -1, -1, -1},
244};
245
246static struct em28xx_reg_seq compro_unmute_svid_gpio[] = {
247 {EM28XX_R08_GPIO, 4, 7, 10},
248 { -1, -1, -1, -1},
249};
250
251static struct em28xx_reg_seq compro_mute_gpio[] = {
252 {EM28XX_R08_GPIO, 6, 7, 10},
253 { -1, -1, -1, -1},
254};
255
766ed64d
MCC
256/* Terratec AV350 */
257static struct em28xx_reg_seq terratec_av350_mute_gpio[] = {
258 {EM28XX_R08_GPIO, 0xff, 0x7f, 10},
259 { -1, -1, -1, -1},
260};
261
262static struct em28xx_reg_seq terratec_av350_unmute_gpio[] = {
263 {EM28XX_R08_GPIO, 0xff, 0xff, 10},
264 { -1, -1, -1, -1},
265};
02e7804b
MCC
266
267static struct em28xx_reg_seq silvercrest_reg_seq[] = {
268 {EM28XX_R08_GPIO, 0xff, 0xff, 10},
269 {EM28XX_R08_GPIO, 0x01, 0xf7, 10},
270 { -1, -1, -1, -1},
271};
272
694a101e
MCC
273static struct em28xx_reg_seq vc211a_enable[] = {
274 {EM28XX_R08_GPIO, 0xff, 0x07, 10},
275 {EM28XX_R08_GPIO, 0xff, 0x0f, 10},
276 {EM28XX_R08_GPIO, 0xff, 0x0b, 10},
277 { -1, -1, -1, -1},
278};
279
7ca7ef60
AA
280static struct em28xx_reg_seq dikom_dk300_digital[] = {
281 {EM28XX_R08_GPIO, 0x6e, ~EM_GPIO_4, 10},
282 {EM2880_R04_GPO, 0x08, 0xff, 10},
283 { -1, -1, -1, -1},
284};
285
694a101e 286
ca3dfd6a
MCC
287/* Reset for the most [digital] boards */
288static struct em28xx_reg_seq leadership_digital[] = {
289 {EM2874_R80_GPIO, 0x70, 0xff, 10},
290 { -1, -1, -1, -1},
291};
292
293static struct em28xx_reg_seq leadership_reset[] = {
294 {EM2874_R80_GPIO, 0xf0, 0xff, 10},
295 {EM2874_R80_GPIO, 0xb0, 0xff, 10},
296 {EM2874_R80_GPIO, 0xf0, 0xff, 10},
297 { -1, -1, -1, -1},
298};
299
460312ec 300/* 2013:024f PCTV nanoStick T2 290e
d6a5f921
AP
301 * GPIO_6 - demod reset
302 * GPIO_7 - LED
303 */
304static struct em28xx_reg_seq pctv_290e[] = {
305 {EM2874_R80_GPIO, 0x00, 0xff, 80},
306 {EM2874_R80_GPIO, 0x40, 0xff, 80}, /* GPIO_6 = 1 */
307 {EM2874_R80_GPIO, 0xc0, 0xff, 80}, /* GPIO_7 = 1 */
308 {-1, -1, -1, -1},
309};
ca3dfd6a 310
fec528b7
MCC
311#if 0
312static struct em28xx_reg_seq terratec_h5_gpio[] = {
313 {EM28XX_R08_GPIO, 0xff, 0xff, 10},
314 {EM2874_R80_GPIO, 0xf6, 0xff, 100},
315 {EM2874_R80_GPIO, 0xf2, 0xff, 50},
316 {EM2874_R80_GPIO, 0xf6, 0xff, 50},
317 { -1, -1, -1, -1},
318};
319
320static struct em28xx_reg_seq terratec_h5_digital[] = {
321 {EM2874_R80_GPIO, 0xf6, 0xff, 10},
322 {EM2874_R80_GPIO, 0xe6, 0xff, 100},
323 {EM2874_R80_GPIO, 0xa6, 0xff, 10},
324 { -1, -1, -1, -1},
325};
326#endif
327
36588715
AP
328/* 2013:024f PCTV DVB-S2 Stick 460e
329 * GPIO_0 - POWER_ON
330 * GPIO_1 - BOOST
331 * GPIO_2 - VUV_LNB (red LED)
332 * GPIO_3 - EXT_12V
333 * GPIO_4 - INT_DEM (DEMOD GPIO_0)
334 * GPIO_5 - INT_LNB
335 * GPIO_6 - RESET_DEM
336 * GPIO_7 - LED (green LED)
337 */
338static struct em28xx_reg_seq pctv_460e[] = {
339 {EM2874_R80_GPIO, 0x01, 0xff, 50},
340 {0x0d, 0xff, 0xff, 50},
341 {EM2874_R80_GPIO, 0x41, 0xff, 50}, /* GPIO_6=1 */
342 {0x0d, 0x42, 0xff, 50},
343 {EM2874_R80_GPIO, 0x61, 0xff, 50}, /* GPIO_5=1 */
344 { -1, -1, -1, -1},
345};
346
4159d01b
MCC
347static struct em28xx_reg_seq c3tech_digital_duo_digital[] = {
348 {EM2874_R80_GPIO, 0xff, 0xff, 10},
349 {EM2874_R80_GPIO, 0xfd, 0xff, 10}, /* xc5000 reset */
350 {EM2874_R80_GPIO, 0xf9, 0xff, 35},
351 {EM2874_R80_GPIO, 0xfd, 0xff, 10},
352 {EM2874_R80_GPIO, 0xff, 0xff, 10},
353 {EM2874_R80_GPIO, 0xfe, 0xff, 10},
354 {EM2874_R80_GPIO, 0xbe, 0xff, 10},
355 {EM2874_R80_GPIO, 0xfe, 0xff, 20},
356 { -1, -1, -1, -1},
357};
358
8503232f 359#if 0
82e7dbbd 360static struct em28xx_reg_seq hauppauge_930c_gpio[] = {
82e7dbbd 361 {EM2874_R80_GPIO, 0x6f, 0xff, 10},
de72405f 362 {EM2874_R80_GPIO, 0x4f, 0xff, 10}, /* xc5000 reset */
82e7dbbd
EDP
363 {EM2874_R80_GPIO, 0x6f, 0xff, 10},
364 {EM2874_R80_GPIO, 0x4f, 0xff, 10},
365 { -1, -1, -1, -1},
366};
367
82e7dbbd
EDP
368static struct em28xx_reg_seq hauppauge_930c_digital[] = {
369 {EM2874_R80_GPIO, 0xf6, 0xff, 10},
370 {EM2874_R80_GPIO, 0xe6, 0xff, 100},
371 {EM2874_R80_GPIO, 0xa6, 0xff, 10},
372 { -1, -1, -1, -1},
373};
374#endif
375
3553085c 376/* 1b80:e425 MaxMedia UB425-TC
7c1dfdb0 377 * 1b80:e1cc Delock 61959
3553085c
AP
378 * GPIO_6 - demod reset, 0=active
379 * GPIO_7 - LED, 0=active
380 */
381static struct em28xx_reg_seq maxmedia_ub425_tc[] = {
382 {EM2874_R80_GPIO, 0x83, 0xff, 100},
383 {EM2874_R80_GPIO, 0xc3, 0xff, 100}, /* GPIO_6 = 1 */
384 {EM2874_R80_GPIO, 0x43, 0xff, 000}, /* GPIO_7 = 0 */
385 {-1, -1, -1, -1},
386};
387
fa5527cd
IK
388/* 2304:0242 PCTV QuatroStick (510e)
389 * GPIO_2: decoder reset, 0=active
390 * GPIO_4: decoder suspend, 0=active
391 * GPIO_6: demod reset, 0=active
392 * GPIO_7: LED, 1=active
393 */
394static struct em28xx_reg_seq pctv_510e[] = {
395 {EM2874_R80_GPIO, 0x10, 0xff, 100},
396 {EM2874_R80_GPIO, 0x14, 0xff, 100}, /* GPIO_2 = 1 */
397 {EM2874_R80_GPIO, 0x54, 0xff, 050}, /* GPIO_6 = 1 */
398 { -1, -1, -1, -1},
399};
400
c247d7b1
AP
401/* 2013:0251 PCTV QuatroStick nano (520e)
402 * GPIO_2: decoder reset, 0=active
403 * GPIO_4: decoder suspend, 0=active
404 * GPIO_6: demod reset, 0=active
405 * GPIO_7: LED, 1=active
406 */
407static struct em28xx_reg_seq pctv_520e[] = {
408 {EM2874_R80_GPIO, 0x10, 0xff, 100},
409 {EM2874_R80_GPIO, 0x14, 0xff, 100}, /* GPIO_2 = 1 */
410 {EM2874_R80_GPIO, 0x54, 0xff, 050}, /* GPIO_6 = 1 */
411 {EM2874_R80_GPIO, 0xd4, 0xff, 000}, /* GPIO_7 = 1 */
412 { -1, -1, -1, -1},
413};
414
0ec202d1
MCC
415/*
416 * Board definitions
417 */
3acf2809 418struct em28xx_board em28xx_boards[] = {
95b86a9a 419 [EM2750_BOARD_UNKNOWN] = {
8b220793 420 .name = "EM2710/EM2750/EM2751 webcam grabber",
3d3215c4 421 .xclk = EM28XX_XCLK_FREQUENCY_20MHZ,
8a2e6990
MCC
422 .tuner_type = TUNER_ABSENT,
423 .is_webcam = 1,
95b86a9a
DSL
424 .input = { {
425 .type = EM28XX_VMUX_COMPOSITE1,
426 .vmux = 0,
8a5caa6b 427 .amux = EM28XX_AMUX_VIDEO,
b80fd2d8 428 .gpio = silvercrest_reg_seq,
95b86a9a
DSL
429 } },
430 },
596d92d5
MCC
431 [EM2800_BOARD_UNKNOWN] = {
432 .name = "Unknown EM2800 video grabber",
433 .is_em2800 = 1,
596d92d5 434 .tda9887_conf = TDA9887_PRESENT,
ec5de990 435 .decoder = EM28XX_SAA711X,
1c67e76f 436 .tuner_type = TUNER_ABSENT,
d4d889e3 437 .input = { {
3acf2809 438 .type = EM28XX_VMUX_COMPOSITE1,
c7c0b34c 439 .vmux = SAA7115_COMPOSITE0,
8a5caa6b 440 .amux = EM28XX_AMUX_LINE_IN,
c23f5949 441 }, {
3acf2809 442 .type = EM28XX_VMUX_SVIDEO,
c7c0b34c 443 .vmux = SAA7115_SVIDEO3,
8a5caa6b 444 .amux = EM28XX_AMUX_LINE_IN,
c23f5949 445 } },
596d92d5
MCC
446 },
447 [EM2820_BOARD_UNKNOWN] = {
a2070c66
MCC
448 .name = "Unknown EM2750/28xx video grabber",
449 .tuner_type = TUNER_ABSENT,
b04fb661 450 .is_webcam = 1, /* To enable sensor probe */
596d92d5 451 },
95b86a9a
DSL
452 [EM2750_BOARD_DLCW_130] = {
453 /* Beijing Huaqi Information Digital Technology Co., Ltd */
454 .name = "Huaqi DLCW-130",
455 .valid = EM28XX_BOARD_NOT_VALIDATED,
a2070c66 456 .xclk = EM28XX_XCLK_FREQUENCY_48MHZ,
8a2e6990
MCC
457 .tuner_type = TUNER_ABSENT,
458 .is_webcam = 1,
95b86a9a
DSL
459 .input = { {
460 .type = EM28XX_VMUX_COMPOSITE1,
461 .vmux = 0,
8a5caa6b 462 .amux = EM28XX_AMUX_VIDEO,
95b86a9a
DSL
463 } },
464 },
4d17d083 465 [EM2820_BOARD_KWORLD_PVRTV2800RF] = {
33ccaa3f 466 .name = "Kworld PVR TV 2800 RF",
ed086314 467 .tuner_type = TUNER_TEMIC_PAL,
4d17d083 468 .tda9887_conf = TDA9887_PRESENT,
ec5de990 469 .decoder = EM28XX_SAA711X,
d4d889e3 470 .input = { {
4d17d083 471 .type = EM28XX_VMUX_COMPOSITE1,
c7c0b34c 472 .vmux = SAA7115_COMPOSITE0,
8a5caa6b 473 .amux = EM28XX_AMUX_LINE_IN,
c23f5949 474 }, {
4d17d083 475 .type = EM28XX_VMUX_SVIDEO,
c7c0b34c 476 .vmux = SAA7115_SVIDEO3,
8a5caa6b 477 .amux = EM28XX_AMUX_LINE_IN,
c23f5949 478 } },
4d17d083 479 },
f7fe3e6f
DSL
480 [EM2820_BOARD_GADMEI_TVR200] = {
481 .name = "Gadmei TVR200",
482 .tuner_type = TUNER_LG_PAL_NEW_TAPC,
483 .tda9887_conf = TDA9887_PRESENT,
484 .decoder = EM28XX_SAA711X,
485 .input = { {
486 .type = EM28XX_VMUX_TELEVISION,
487 .vmux = SAA7115_COMPOSITE2,
488 .amux = EM28XX_AMUX_LINE_IN,
489 }, {
490 .type = EM28XX_VMUX_COMPOSITE1,
491 .vmux = SAA7115_COMPOSITE0,
492 .amux = EM28XX_AMUX_LINE_IN,
493 }, {
494 .type = EM28XX_VMUX_SVIDEO,
495 .vmux = SAA7115_SVIDEO3,
496 .amux = EM28XX_AMUX_LINE_IN,
497 } },
498 },
a6c2ba28 499 [EM2820_BOARD_TERRATEC_CINERGY_250] = {
500 .name = "Terratec Cinergy 250 USB",
a6c2ba28 501 .tuner_type = TUNER_LG_PAL_NEW_TAPC,
ac07bb73 502 .has_ir_i2c = 1,
a6c2ba28 503 .tda9887_conf = TDA9887_PRESENT,
ec5de990 504 .decoder = EM28XX_SAA711X,
d4d889e3 505 .input = { {
3acf2809 506 .type = EM28XX_VMUX_TELEVISION,
c7c0b34c 507 .vmux = SAA7115_COMPOSITE2,
5e8d02bb 508 .amux = EM28XX_AMUX_VIDEO,
c23f5949 509 }, {
3acf2809 510 .type = EM28XX_VMUX_COMPOSITE1,
c7c0b34c 511 .vmux = SAA7115_COMPOSITE0,
8a5caa6b 512 .amux = EM28XX_AMUX_LINE_IN,
c23f5949 513 }, {
3acf2809 514 .type = EM28XX_VMUX_SVIDEO,
c7c0b34c 515 .vmux = SAA7115_SVIDEO3,
8a5caa6b 516 .amux = EM28XX_AMUX_LINE_IN,
c23f5949 517 } },
a6c2ba28 518 },
519 [EM2820_BOARD_PINNACLE_USB_2] = {
520 .name = "Pinnacle PCTV USB 2",
a6c2ba28 521 .tuner_type = TUNER_LG_PAL_NEW_TAPC,
ac07bb73 522 .has_ir_i2c = 1,
a6c2ba28 523 .tda9887_conf = TDA9887_PRESENT,
ec5de990 524 .decoder = EM28XX_SAA711X,
d4d889e3 525 .input = { {
3acf2809 526 .type = EM28XX_VMUX_TELEVISION,
c7c0b34c 527 .vmux = SAA7115_COMPOSITE2,
8a5caa6b 528 .amux = EM28XX_AMUX_VIDEO,
c23f5949 529 }, {
3acf2809 530 .type = EM28XX_VMUX_COMPOSITE1,
c7c0b34c 531 .vmux = SAA7115_COMPOSITE0,
8a5caa6b 532 .amux = EM28XX_AMUX_LINE_IN,
c23f5949 533 }, {
3acf2809 534 .type = EM28XX_VMUX_SVIDEO,
c7c0b34c 535 .vmux = SAA7115_SVIDEO3,
8a5caa6b 536 .amux = EM28XX_AMUX_LINE_IN,
c23f5949 537 } },
a6c2ba28 538 },
539 [EM2820_BOARD_HAUPPAUGE_WINTV_USB_2] = {
540 .name = "Hauppauge WinTV USB 2",
a6c2ba28 541 .tuner_type = TUNER_PHILIPS_FM1236_MK3,
c23f5949 542 .tda9887_conf = TDA9887_PRESENT |
a1a6ee74 543 TDA9887_PORT1_ACTIVE |
c23f5949 544 TDA9887_PORT2_ACTIVE,
3acf2809 545 .decoder = EM28XX_TVP5150,
a6c2ba28 546 .has_msp34xx = 1,
ac07bb73 547 .has_ir_i2c = 1,
d4d889e3 548 .input = { {
3acf2809 549 .type = EM28XX_VMUX_TELEVISION,
c7c0b34c 550 .vmux = TVP5150_COMPOSITE0,
2474ed44 551 .amux = MSP_INPUT_DEFAULT,
c23f5949 552 }, {
3acf2809 553 .type = EM28XX_VMUX_SVIDEO,
c7c0b34c 554 .vmux = TVP5150_SVIDEO,
07151724
HV
555 .amux = MSP_INPUT(MSP_IN_SCART1, MSP_IN_TUNER1,
556 MSP_DSP_IN_SCART, MSP_DSP_IN_SCART),
c23f5949 557 } },
a6c2ba28 558 },
95b86a9a
DSL
559 [EM2820_BOARD_DLINK_USB_TV] = {
560 .name = "D-Link DUB-T210 TV Tuner",
561 .valid = EM28XX_BOARD_NOT_VALIDATED,
95b86a9a
DSL
562 .tuner_type = TUNER_LG_PAL_NEW_TAPC,
563 .tda9887_conf = TDA9887_PRESENT,
ec5de990 564 .decoder = EM28XX_SAA711X,
d4d889e3 565 .input = { {
95b86a9a
DSL
566 .type = EM28XX_VMUX_TELEVISION,
567 .vmux = SAA7115_COMPOSITE2,
8a5caa6b 568 .amux = EM28XX_AMUX_LINE_IN,
95b86a9a
DSL
569 }, {
570 .type = EM28XX_VMUX_COMPOSITE1,
571 .vmux = SAA7115_COMPOSITE0,
8a5caa6b 572 .amux = EM28XX_AMUX_LINE_IN,
95b86a9a
DSL
573 }, {
574 .type = EM28XX_VMUX_SVIDEO,
575 .vmux = SAA7115_SVIDEO3,
8a5caa6b 576 .amux = EM28XX_AMUX_LINE_IN,
95b86a9a
DSL
577 } },
578 },
579 [EM2820_BOARD_HERCULES_SMART_TV_USB2] = {
580 .name = "Hercules Smart TV USB 2.0",
581 .valid = EM28XX_BOARD_NOT_VALIDATED,
95b86a9a
DSL
582 .tuner_type = TUNER_LG_PAL_NEW_TAPC,
583 .tda9887_conf = TDA9887_PRESENT,
ec5de990 584 .decoder = EM28XX_SAA711X,
95b86a9a
DSL
585 .input = { {
586 .type = EM28XX_VMUX_TELEVISION,
587 .vmux = SAA7115_COMPOSITE2,
8a5caa6b 588 .amux = EM28XX_AMUX_LINE_IN,
95b86a9a
DSL
589 }, {
590 .type = EM28XX_VMUX_COMPOSITE1,
591 .vmux = SAA7115_COMPOSITE0,
8a5caa6b 592 .amux = EM28XX_AMUX_LINE_IN,
95b86a9a
DSL
593 }, {
594 .type = EM28XX_VMUX_SVIDEO,
595 .vmux = SAA7115_SVIDEO3,
8a5caa6b 596 .amux = EM28XX_AMUX_LINE_IN,
95b86a9a
DSL
597 } },
598 },
599 [EM2820_BOARD_PINNACLE_USB_2_FM1216ME] = {
600 .name = "Pinnacle PCTV USB 2 (Philips FM1216ME)",
601 .valid = EM28XX_BOARD_NOT_VALIDATED,
95b86a9a
DSL
602 .tuner_type = TUNER_PHILIPS_FM1216ME_MK3,
603 .tda9887_conf = TDA9887_PRESENT,
ec5de990 604 .decoder = EM28XX_SAA711X,
d4d889e3 605 .input = { {
95b86a9a
DSL
606 .type = EM28XX_VMUX_TELEVISION,
607 .vmux = SAA7115_COMPOSITE2,
8a5caa6b 608 .amux = EM28XX_AMUX_VIDEO,
95b86a9a
DSL
609 }, {
610 .type = EM28XX_VMUX_COMPOSITE1,
611 .vmux = SAA7115_COMPOSITE0,
8a5caa6b 612 .amux = EM28XX_AMUX_LINE_IN,
95b86a9a
DSL
613 }, {
614 .type = EM28XX_VMUX_SVIDEO,
615 .vmux = SAA7115_SVIDEO3,
8a5caa6b 616 .amux = EM28XX_AMUX_LINE_IN,
95b86a9a
DSL
617 } },
618 },
619 [EM2820_BOARD_GADMEI_UTV310] = {
620 .name = "Gadmei UTV310",
621 .valid = EM28XX_BOARD_NOT_VALIDATED,
95b86a9a
DSL
622 .tuner_type = TUNER_TNF_5335MF,
623 .tda9887_conf = TDA9887_PRESENT,
ec5de990 624 .decoder = EM28XX_SAA711X,
d4d889e3 625 .input = { {
95b86a9a
DSL
626 .type = EM28XX_VMUX_TELEVISION,
627 .vmux = SAA7115_COMPOSITE1,
8a5caa6b 628 .amux = EM28XX_AMUX_LINE_IN,
95b86a9a
DSL
629 }, {
630 .type = EM28XX_VMUX_COMPOSITE1,
631 .vmux = SAA7115_COMPOSITE0,
8a5caa6b 632 .amux = EM28XX_AMUX_LINE_IN,
95b86a9a
DSL
633 }, {
634 .type = EM28XX_VMUX_SVIDEO,
635 .vmux = SAA7115_SVIDEO3,
8a5caa6b 636 .amux = EM28XX_AMUX_LINE_IN,
95b86a9a
DSL
637 } },
638 },
639 [EM2820_BOARD_LEADTEK_WINFAST_USBII_DELUXE] = {
640 .name = "Leadtek Winfast USB II Deluxe",
641 .valid = EM28XX_BOARD_NOT_VALIDATED,
95b86a9a 642 .tuner_type = TUNER_PHILIPS_FM1216ME_MK3,
ca39d84d
MA
643 .has_ir_i2c = 1,
644 .tvaudio_addr = 0x58,
645 .tda9887_conf = TDA9887_PRESENT |
646 TDA9887_PORT2_ACTIVE |
647 TDA9887_QSS,
ec5de990 648 .decoder = EM28XX_SAA711X,
ca39d84d 649 .adecoder = EM28XX_TVAUDIO,
d4d889e3 650 .input = { {
95b86a9a 651 .type = EM28XX_VMUX_TELEVISION,
ca39d84d
MA
652 .vmux = SAA7115_COMPOSITE4,
653 .amux = EM28XX_AMUX_AUX,
95b86a9a
DSL
654 }, {
655 .type = EM28XX_VMUX_COMPOSITE1,
ca39d84d 656 .vmux = SAA7115_COMPOSITE5,
8a5caa6b 657 .amux = EM28XX_AMUX_LINE_IN,
95b86a9a
DSL
658 }, {
659 .type = EM28XX_VMUX_SVIDEO,
ca39d84d 660 .vmux = SAA7115_SVIDEO3,
8a5caa6b 661 .amux = EM28XX_AMUX_LINE_IN,
95b86a9a 662 } },
ca39d84d
MA
663 .radio = {
664 .type = EM28XX_RADIO,
665 .amux = EM28XX_AMUX_AUX,
666 }
95b86a9a 667 },
95b86a9a 668 [EM2820_BOARD_VIDEOLOGY_20K14XUSB] = {
d4d889e3 669 .name = "Videology 20K14XUSB USB2.0",
95b86a9a 670 .valid = EM28XX_BOARD_NOT_VALIDATED,
8a2e6990
MCC
671 .tuner_type = TUNER_ABSENT,
672 .is_webcam = 1,
d4d889e3 673 .input = { {
95b86a9a
DSL
674 .type = EM28XX_VMUX_COMPOSITE1,
675 .vmux = 0,
8a5caa6b 676 .amux = EM28XX_AMUX_VIDEO,
95b86a9a
DSL
677 } },
678 },
02e7804b
MCC
679 [EM2820_BOARD_SILVERCREST_WEBCAM] = {
680 .name = "Silvercrest Webcam 1.3mpix",
681 .tuner_type = TUNER_ABSENT,
c43221df 682 .is_webcam = 1,
02e7804b
MCC
683 .input = { {
684 .type = EM28XX_VMUX_COMPOSITE1,
685 .vmux = 0,
686 .amux = EM28XX_AMUX_VIDEO,
687 .gpio = silvercrest_reg_seq,
688 } },
689 },
95b86a9a
DSL
690 [EM2821_BOARD_SUPERCOMP_USB_2] = {
691 .name = "Supercomp USB 2.0 TV",
692 .valid = EM28XX_BOARD_NOT_VALIDATED,
95b86a9a
DSL
693 .tuner_type = TUNER_PHILIPS_FM1236_MK3,
694 .tda9887_conf = TDA9887_PRESENT |
695 TDA9887_PORT1_ACTIVE |
696 TDA9887_PORT2_ACTIVE,
ec5de990 697 .decoder = EM28XX_SAA711X,
d4d889e3 698 .input = { {
95b86a9a
DSL
699 .type = EM28XX_VMUX_TELEVISION,
700 .vmux = SAA7115_COMPOSITE2,
8a5caa6b 701 .amux = EM28XX_AMUX_LINE_IN,
95b86a9a
DSL
702 }, {
703 .type = EM28XX_VMUX_COMPOSITE1,
704 .vmux = SAA7115_COMPOSITE0,
8a5caa6b 705 .amux = EM28XX_AMUX_VIDEO,
95b86a9a
DSL
706 }, {
707 .type = EM28XX_VMUX_SVIDEO,
708 .vmux = SAA7115_SVIDEO3,
8a5caa6b 709 .amux = EM28XX_AMUX_LINE_IN,
95b86a9a
DSL
710 } },
711 },
712 [EM2821_BOARD_USBGEAR_VD204] = {
d4d889e3 713 .name = "Usbgear VD204v9",
95b86a9a 714 .valid = EM28XX_BOARD_NOT_VALIDATED,
1c67e76f 715 .tuner_type = TUNER_ABSENT, /* Capture only device */
ec5de990 716 .decoder = EM28XX_SAA711X,
d4d889e3 717 .input = { {
95b86a9a
DSL
718 .type = EM28XX_VMUX_COMPOSITE1,
719 .vmux = SAA7115_COMPOSITE0,
8a5caa6b 720 .amux = EM28XX_AMUX_LINE_IN,
95b86a9a
DSL
721 }, {
722 .type = EM28XX_VMUX_SVIDEO,
723 .vmux = SAA7115_SVIDEO3,
8a5caa6b 724 .amux = EM28XX_AMUX_LINE_IN,
95b86a9a
DSL
725 } },
726 },
727 [EM2860_BOARD_NETGMBH_CAM] = {
728 /* Beijing Huaqi Information Digital Technology Co., Ltd */
d4d889e3
MCC
729 .name = "NetGMBH Cam",
730 .valid = EM28XX_BOARD_NOT_VALIDATED,
8a2e6990
MCC
731 .tuner_type = TUNER_ABSENT,
732 .is_webcam = 1,
d4d889e3 733 .input = { {
95b86a9a
DSL
734 .type = EM28XX_VMUX_COMPOSITE1,
735 .vmux = 0,
8a5caa6b 736 .amux = EM28XX_AMUX_VIDEO,
95b86a9a
DSL
737 } },
738 },
739 [EM2860_BOARD_TYPHOON_DVD_MAKER] = {
d4d889e3 740 .name = "Typhoon DVD Maker",
ec5de990 741 .decoder = EM28XX_SAA711X,
1c67e76f 742 .tuner_type = TUNER_ABSENT, /* Capture only device */
d4d889e3 743 .input = { {
95b86a9a
DSL
744 .type = EM28XX_VMUX_COMPOSITE1,
745 .vmux = SAA7115_COMPOSITE0,
8a5caa6b 746 .amux = EM28XX_AMUX_LINE_IN,
95b86a9a
DSL
747 }, {
748 .type = EM28XX_VMUX_SVIDEO,
749 .vmux = SAA7115_SVIDEO3,
8a5caa6b 750 .amux = EM28XX_AMUX_LINE_IN,
95b86a9a
DSL
751 } },
752 },
753 [EM2860_BOARD_GADMEI_UTV330] = {
754 .name = "Gadmei UTV330",
755 .valid = EM28XX_BOARD_NOT_VALIDATED,
95b86a9a 756 .tuner_type = TUNER_TNF_5335MF,
122d1588 757 .tda9887_conf = TDA9887_PRESENT,
ec5de990 758 .decoder = EM28XX_SAA711X,
d4d889e3 759 .input = { {
95b86a9a
DSL
760 .type = EM28XX_VMUX_TELEVISION,
761 .vmux = SAA7115_COMPOSITE2,
8a5caa6b 762 .amux = EM28XX_AMUX_VIDEO,
95b86a9a
DSL
763 }, {
764 .type = EM28XX_VMUX_COMPOSITE1,
765 .vmux = SAA7115_COMPOSITE0,
8a5caa6b 766 .amux = EM28XX_AMUX_LINE_IN,
95b86a9a
DSL
767 }, {
768 .type = EM28XX_VMUX_SVIDEO,
769 .vmux = SAA7115_SVIDEO3,
8a5caa6b 770 .amux = EM28XX_AMUX_LINE_IN,
95b86a9a
DSL
771 } },
772 },
6d888a66
MCC
773 [EM2861_BOARD_GADMEI_UTV330PLUS] = {
774 .name = "Gadmei UTV330+",
775 .tuner_type = TUNER_TNF_5335MF,
776 .tda9887_conf = TDA9887_PRESENT,
02858eed 777 .ir_codes = RC_MAP_GADMEI_RM008Z,
6d888a66
MCC
778 .decoder = EM28XX_SAA711X,
779 .xclk = EM28XX_XCLK_FREQUENCY_12MHZ,
780 .input = { {
781 .type = EM28XX_VMUX_TELEVISION,
782 .vmux = SAA7115_COMPOSITE2,
783 .amux = EM28XX_AMUX_VIDEO,
784 }, {
785 .type = EM28XX_VMUX_COMPOSITE1,
786 .vmux = SAA7115_COMPOSITE0,
787 .amux = EM28XX_AMUX_LINE_IN,
788 }, {
789 .type = EM28XX_VMUX_SVIDEO,
790 .vmux = SAA7115_SVIDEO3,
791 .amux = EM28XX_AMUX_LINE_IN,
792 } },
793 },
95b86a9a
DSL
794 [EM2860_BOARD_TERRATEC_HYBRID_XS] = {
795 .name = "Terratec Cinergy A Hybrid XS",
796 .valid = EM28XX_BOARD_NOT_VALIDATED,
122d1588 797 .tuner_type = TUNER_XC2028,
017ab4b1 798 .tuner_gpio = default_tuner_gpio,
122d1588 799 .decoder = EM28XX_TVP5150,
017ab4b1 800
d4d889e3 801 .input = { {
122d1588
AT
802 .type = EM28XX_VMUX_TELEVISION,
803 .vmux = TVP5150_COMPOSITE0,
8a5caa6b 804 .amux = EM28XX_AMUX_VIDEO,
122b77e5 805 .gpio = hauppauge_wintv_hvr_900_analog,
c23f5949 806 }, {
122d1588
AT
807 .type = EM28XX_VMUX_COMPOSITE1,
808 .vmux = TVP5150_COMPOSITE1,
8a5caa6b 809 .amux = EM28XX_AMUX_LINE_IN,
122b77e5 810 .gpio = hauppauge_wintv_hvr_900_analog,
c23f5949 811 }, {
122d1588
AT
812 .type = EM28XX_VMUX_SVIDEO,
813 .vmux = TVP5150_SVIDEO,
8a5caa6b 814 .amux = EM28XX_AMUX_LINE_IN,
122b77e5 815 .gpio = hauppauge_wintv_hvr_900_analog,
c23f5949 816 } },
122d1588 817 },
95b86a9a
DSL
818 [EM2861_BOARD_KWORLD_PVRTV_300U] = {
819 .name = "KWorld PVRTV 300U",
820 .valid = EM28XX_BOARD_NOT_VALIDATED,
17d9d558 821 .tuner_type = TUNER_XC2028,
017ab4b1 822 .tuner_gpio = default_tuner_gpio,
17d9d558 823 .decoder = EM28XX_TVP5150,
d4d889e3 824 .input = { {
17d9d558
DH
825 .type = EM28XX_VMUX_TELEVISION,
826 .vmux = TVP5150_COMPOSITE0,
8a5caa6b 827 .amux = EM28XX_AMUX_VIDEO,
17d9d558
DH
828 }, {
829 .type = EM28XX_VMUX_COMPOSITE1,
830 .vmux = TVP5150_COMPOSITE1,
8a5caa6b 831 .amux = EM28XX_AMUX_LINE_IN,
17d9d558
DH
832 }, {
833 .type = EM28XX_VMUX_SVIDEO,
834 .vmux = TVP5150_SVIDEO,
8a5caa6b 835 .amux = EM28XX_AMUX_LINE_IN,
17d9d558
DH
836 } },
837 },
95b86a9a
DSL
838 [EM2861_BOARD_YAKUMO_MOVIE_MIXER] = {
839 .name = "Yakumo MovieMixer",
a1a6ee74 840 .tuner_type = TUNER_ABSENT, /* Capture only device */
95b86a9a
DSL
841 .decoder = EM28XX_TVP5150,
842 .input = { {
12466577
MCC
843 .type = EM28XX_VMUX_TELEVISION,
844 .vmux = TVP5150_COMPOSITE0,
8a5caa6b 845 .amux = EM28XX_AMUX_VIDEO,
c23f5949 846 }, {
7d070e26
MCC
847 .type = EM28XX_VMUX_COMPOSITE1,
848 .vmux = TVP5150_COMPOSITE1,
8a5caa6b 849 .amux = EM28XX_AMUX_LINE_IN,
c23f5949 850 }, {
12466577
MCC
851 .type = EM28XX_VMUX_SVIDEO,
852 .vmux = TVP5150_SVIDEO,
8a5caa6b 853 .amux = EM28XX_AMUX_LINE_IN,
c23f5949 854 } },
12466577 855 },
443fed9f
DH
856 [EM2860_BOARD_TVP5150_REFERENCE_DESIGN] = {
857 .name = "EM2860/TVP5150 Reference Design",
858 .tuner_type = TUNER_ABSENT, /* Capture only device */
859 .decoder = EM28XX_TVP5150,
860 .input = { {
861 .type = EM28XX_VMUX_COMPOSITE1,
862 .vmux = TVP5150_COMPOSITE1,
863 .amux = EM28XX_AMUX_LINE_IN,
864 }, {
865 .type = EM28XX_VMUX_SVIDEO,
866 .vmux = TVP5150_SVIDEO,
867 .amux = EM28XX_AMUX_LINE_IN,
868 } },
869 },
95b86a9a
DSL
870 [EM2861_BOARD_PLEXTOR_PX_TV100U] = {
871 .name = "Plextor ConvertX PX-TV100U",
95b86a9a 872 .tuner_type = TUNER_TNF_5335MF,
0a6e44d1
MCC
873 .xclk = EM28XX_XCLK_I2S_MSB_TIMING |
874 EM28XX_XCLK_FREQUENCY_12MHZ,
95b86a9a
DSL
875 .tda9887_conf = TDA9887_PRESENT,
876 .decoder = EM28XX_TVP5150,
0a6e44d1 877 .has_msp34xx = 1,
d4d889e3 878 .input = { {
4fd305b2
DH
879 .type = EM28XX_VMUX_TELEVISION,
880 .vmux = TVP5150_COMPOSITE0,
8a5caa6b 881 .amux = EM28XX_AMUX_LINE_IN,
0a6e44d1 882 .gpio = pinnacle_hybrid_pro_analog,
4fd305b2
DH
883 }, {
884 .type = EM28XX_VMUX_COMPOSITE1,
885 .vmux = TVP5150_COMPOSITE1,
8a5caa6b 886 .amux = EM28XX_AMUX_LINE_IN,
0a6e44d1 887 .gpio = pinnacle_hybrid_pro_analog,
4fd305b2
DH
888 }, {
889 .type = EM28XX_VMUX_SVIDEO,
890 .vmux = TVP5150_SVIDEO,
8a5caa6b 891 .amux = EM28XX_AMUX_LINE_IN,
0a6e44d1 892 .gpio = pinnacle_hybrid_pro_analog,
4fd305b2
DH
893 } },
894 },
1c67e76f
MCC
895
896 /* Those boards with em2870 are DVB Only*/
897
95b86a9a
DSL
898 [EM2870_BOARD_TERRATEC_XS] = {
899 .name = "Terratec Cinergy T XS",
900 .valid = EM28XX_BOARD_NOT_VALIDATED,
901 .tuner_type = TUNER_XC2028,
017ab4b1 902 .tuner_gpio = default_tuner_gpio,
95b86a9a
DSL
903 },
904 [EM2870_BOARD_TERRATEC_XS_MT2060] = {
905 .name = "Terratec Cinergy T XS (MT2060)",
906 .valid = EM28XX_BOARD_NOT_VALIDATED,
907 .tuner_type = TUNER_ABSENT, /* MT2060 */
908 },
909 [EM2870_BOARD_KWORLD_350U] = {
910 .name = "Kworld 350 U DVB-T",
911 .valid = EM28XX_BOARD_NOT_VALIDATED,
912 .tuner_type = TUNER_XC2028,
017ab4b1 913 .tuner_gpio = default_tuner_gpio,
95b86a9a
DSL
914 },
915 [EM2870_BOARD_KWORLD_355U] = {
916 .name = "Kworld 355 U DVB-T",
917 .valid = EM28XX_BOARD_NOT_VALIDATED,
1985f6fb
AP
918 .tuner_type = TUNER_ABSENT,
919 .tuner_gpio = default_tuner_gpio,
920 .has_dvb = 1,
921 .dvb_gpio = default_digital,
95b86a9a
DSL
922 },
923 [EM2870_BOARD_PINNACLE_PCTV_DVB] = {
924 .name = "Pinnacle PCTV DVB-T",
925 .valid = EM28XX_BOARD_NOT_VALIDATED,
926 .tuner_type = TUNER_ABSENT, /* MT2060 */
a2070c66
MCC
927 /* djh - I have serious doubts this is right... */
928 .xclk = EM28XX_XCLK_IR_RC5_MODE |
929 EM28XX_XCLK_FREQUENCY_10MHZ,
95b86a9a
DSL
930 },
931 [EM2870_BOARD_COMPRO_VIDEOMATE] = {
932 .name = "Compro, VideoMate U3",
933 .valid = EM28XX_BOARD_NOT_VALIDATED,
934 .tuner_type = TUNER_ABSENT, /* MT2060 */
935 },
1c67e76f 936
95b86a9a
DSL
937 [EM2880_BOARD_TERRATEC_HYBRID_XS_FR] = {
938 .name = "Terratec Hybrid XS Secam",
95b86a9a
DSL
939 .has_msp34xx = 1,
940 .tuner_type = TUNER_XC2028,
017ab4b1 941 .tuner_gpio = default_tuner_gpio,
95b86a9a 942 .decoder = EM28XX_TVP5150,
65638011 943 .has_dvb = 1,
cec4e6c1 944 .dvb_gpio = terratec_cinergy_USB_XS_FR_digital,
d4d889e3 945 .input = { {
e14b3658
DH
946 .type = EM28XX_VMUX_TELEVISION,
947 .vmux = TVP5150_COMPOSITE0,
8a5caa6b 948 .amux = EM28XX_AMUX_VIDEO,
cec4e6c1 949 .gpio = terratec_cinergy_USB_XS_FR_analog,
e14b3658
DH
950 }, {
951 .type = EM28XX_VMUX_COMPOSITE1,
952 .vmux = TVP5150_COMPOSITE1,
8a5caa6b 953 .amux = EM28XX_AMUX_LINE_IN,
cec4e6c1 954 .gpio = terratec_cinergy_USB_XS_FR_analog,
e14b3658
DH
955 }, {
956 .type = EM28XX_VMUX_SVIDEO,
957 .vmux = TVP5150_SVIDEO,
8a5caa6b 958 .amux = EM28XX_AMUX_LINE_IN,
cec4e6c1 959 .gpio = terratec_cinergy_USB_XS_FR_analog,
e14b3658
DH
960 } },
961 },
fec528b7
MCC
962 [EM2884_BOARD_TERRATEC_H5] = {
963 .name = "Terratec Cinergy H5",
964 .has_dvb = 1,
965#if 0
966 .tuner_type = TUNER_PHILIPS_TDA8290,
967 .tuner_addr = 0x41,
968 .dvb_gpio = terratec_h5_digital, /* FIXME: probably wrong */
969 .tuner_gpio = terratec_h5_gpio,
de72405f
MCC
970#else
971 .tuner_type = TUNER_ABSENT,
fec528b7 972#endif
3aa2b3b9
MCC
973 .def_i2c_bus = 1,
974 .i2c_speed = EM28XX_I2C_CLK_WAIT_ENABLE |
fec528b7
MCC
975 EM28XX_I2C_FREQ_400_KHZ,
976 },
82e7dbbd
EDP
977 [EM2884_BOARD_HAUPPAUGE_WINTV_HVR_930C] = {
978 .name = "Hauppauge WinTV HVR 930C",
979 .has_dvb = 1,
de72405f
MCC
980#if 0 /* FIXME: Add analog support */
981 .tuner_type = TUNER_XC5000,
982 .tuner_addr = 0x41,
983 .dvb_gpio = hauppauge_930c_digital,
82e7dbbd 984 .tuner_gpio = hauppauge_930c_gpio,
de72405f
MCC
985#else
986 .tuner_type = TUNER_ABSENT,
987#endif
dfbbf5da 988 .ir_codes = RC_MAP_HAUPPAUGE,
3aa2b3b9
MCC
989 .def_i2c_bus = 1,
990 .i2c_speed = EM28XX_I2C_CLK_WAIT_ENABLE |
82e7dbbd
EDP
991 EM28XX_I2C_FREQ_400_KHZ,
992 },
4159d01b
MCC
993 [EM2884_BOARD_C3TECH_DIGITAL_DUO] = {
994 .name = "C3 Tech Digital Duo HDTV/SDTV USB",
995 .has_dvb = 1,
996 /* FIXME: Add analog support - need a saa7136 driver */
997 .tuner_type = TUNER_ABSENT, /* Digital-only TDA18271HD */
998 .ir_codes = RC_MAP_EMPTY,
999 .def_i2c_bus = 1,
1000 .i2c_speed = EM28XX_I2C_CLK_WAIT_ENABLE,
1001 .dvb_gpio = c3tech_digital_duo_digital,
1002 },
a1ed02e9
AO
1003 [EM2884_BOARD_CINERGY_HTC_STICK] = {
1004 .name = "Terratec Cinergy HTC Stick",
1005 .has_dvb = 1,
bdca5036 1006 .ir_codes = RC_MAP_NEC_TERRATEC_CINERGY_XS,
c8dce008 1007 .tuner_type = TUNER_ABSENT,
3aa2b3b9
MCC
1008 .def_i2c_bus = 1,
1009 .i2c_speed = EM28XX_I2C_CLK_WAIT_ENABLE |
fec528b7
MCC
1010 EM28XX_I2C_FREQ_400_KHZ,
1011 },
95b86a9a
DSL
1012 [EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900] = {
1013 .name = "Hauppauge WinTV HVR 900",
95b86a9a
DSL
1014 .tda9887_conf = TDA9887_PRESENT,
1015 .tuner_type = TUNER_XC2028,
017ab4b1 1016 .tuner_gpio = default_tuner_gpio,
95b86a9a 1017 .mts_firmware = 1,
a2070c66 1018 .has_dvb = 1,
122b77e5 1019 .dvb_gpio = hauppauge_wintv_hvr_900_digital,
af86ce79 1020 .ir_codes = RC_MAP_HAUPPAUGE,
95b86a9a 1021 .decoder = EM28XX_TVP5150,
d4d889e3 1022 .input = { {
95b86a9a
DSL
1023 .type = EM28XX_VMUX_TELEVISION,
1024 .vmux = TVP5150_COMPOSITE0,
8a5caa6b 1025 .amux = EM28XX_AMUX_VIDEO,
122b77e5 1026 .gpio = hauppauge_wintv_hvr_900_analog,
95b86a9a
DSL
1027 }, {
1028 .type = EM28XX_VMUX_COMPOSITE1,
1029 .vmux = TVP5150_COMPOSITE1,
8a5caa6b 1030 .amux = EM28XX_AMUX_LINE_IN,
122b77e5 1031 .gpio = hauppauge_wintv_hvr_900_analog,
95b86a9a
DSL
1032 }, {
1033 .type = EM28XX_VMUX_SVIDEO,
1034 .vmux = TVP5150_SVIDEO,
8a5caa6b 1035 .amux = EM28XX_AMUX_LINE_IN,
122b77e5 1036 .gpio = hauppauge_wintv_hvr_900_analog,
95b86a9a
DSL
1037 } },
1038 },
1039 [EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900_R2] = {
1040 .name = "Hauppauge WinTV HVR 900 (R2)",
95b86a9a
DSL
1041 .tda9887_conf = TDA9887_PRESENT,
1042 .tuner_type = TUNER_XC2028,
017ab4b1 1043 .tuner_gpio = default_tuner_gpio,
95b86a9a 1044 .mts_firmware = 1,
75e2b869 1045 .has_dvb = 1,
7030f52b 1046 .dvb_gpio = hauppauge_wintv_hvr_900R2_digital,
af86ce79 1047 .ir_codes = RC_MAP_HAUPPAUGE,
95b86a9a 1048 .decoder = EM28XX_TVP5150,
d4d889e3 1049 .input = { {
95b86a9a
DSL
1050 .type = EM28XX_VMUX_TELEVISION,
1051 .vmux = TVP5150_COMPOSITE0,
8a5caa6b 1052 .amux = EM28XX_AMUX_VIDEO,
122b77e5 1053 .gpio = hauppauge_wintv_hvr_900_analog,
95b86a9a
DSL
1054 }, {
1055 .type = EM28XX_VMUX_COMPOSITE1,
1056 .vmux = TVP5150_COMPOSITE1,
a5942b5c 1057 .amux = EM28XX_AMUX_LINE_IN,
122b77e5 1058 .gpio = hauppauge_wintv_hvr_900_analog,
95b86a9a
DSL
1059 }, {
1060 .type = EM28XX_VMUX_SVIDEO,
1061 .vmux = TVP5150_SVIDEO,
8a5caa6b 1062 .amux = EM28XX_AMUX_LINE_IN,
122b77e5 1063 .gpio = hauppauge_wintv_hvr_900_analog,
95b86a9a
DSL
1064 } },
1065 },
f89bc329
DSL
1066 [EM2883_BOARD_HAUPPAUGE_WINTV_HVR_850] = {
1067 .name = "Hauppauge WinTV HVR 850",
1068 .tuner_type = TUNER_XC2028,
1069 .tuner_gpio = default_tuner_gpio,
1070 .mts_firmware = 1,
1071 .has_dvb = 1,
1072 .dvb_gpio = hauppauge_wintv_hvr_900_digital,
af86ce79 1073 .ir_codes = RC_MAP_HAUPPAUGE,
f89bc329
DSL
1074 .decoder = EM28XX_TVP5150,
1075 .input = { {
1076 .type = EM28XX_VMUX_TELEVISION,
1077 .vmux = TVP5150_COMPOSITE0,
1078 .amux = EM28XX_AMUX_VIDEO,
1079 .gpio = hauppauge_wintv_hvr_900_analog,
1080 }, {
1081 .type = EM28XX_VMUX_COMPOSITE1,
1082 .vmux = TVP5150_COMPOSITE1,
1083 .amux = EM28XX_AMUX_LINE_IN,
1084 .gpio = hauppauge_wintv_hvr_900_analog,
1085 }, {
1086 .type = EM28XX_VMUX_SVIDEO,
1087 .vmux = TVP5150_SVIDEO,
1088 .amux = EM28XX_AMUX_LINE_IN,
1089 .gpio = hauppauge_wintv_hvr_900_analog,
1090 } },
1091 },
10ac6603 1092 [EM2883_BOARD_HAUPPAUGE_WINTV_HVR_950] = {
95b86a9a 1093 .name = "Hauppauge WinTV HVR 950",
95b86a9a 1094 .tuner_type = TUNER_XC2028,
017ab4b1 1095 .tuner_gpio = default_tuner_gpio,
95b86a9a 1096 .mts_firmware = 1,
95b86a9a 1097 .has_dvb = 1,
122b77e5 1098 .dvb_gpio = hauppauge_wintv_hvr_900_digital,
15195d3a 1099 .ir_codes = RC_MAP_HAUPPAUGE,
95b86a9a
DSL
1100 .decoder = EM28XX_TVP5150,
1101 .input = { {
1102 .type = EM28XX_VMUX_TELEVISION,
1103 .vmux = TVP5150_COMPOSITE0,
8a5caa6b 1104 .amux = EM28XX_AMUX_VIDEO,
122b77e5 1105 .gpio = hauppauge_wintv_hvr_900_analog,
95b86a9a
DSL
1106 }, {
1107 .type = EM28XX_VMUX_COMPOSITE1,
1108 .vmux = TVP5150_COMPOSITE1,
8a5caa6b 1109 .amux = EM28XX_AMUX_LINE_IN,
122b77e5 1110 .gpio = hauppauge_wintv_hvr_900_analog,
95b86a9a
DSL
1111 }, {
1112 .type = EM28XX_VMUX_SVIDEO,
1113 .vmux = TVP5150_SVIDEO,
8a5caa6b 1114 .amux = EM28XX_AMUX_LINE_IN,
122b77e5 1115 .gpio = hauppauge_wintv_hvr_900_analog,
95b86a9a
DSL
1116 } },
1117 },
1118 [EM2880_BOARD_PINNACLE_PCTV_HD_PRO] = {
1119 .name = "Pinnacle PCTV HD Pro Stick",
95b86a9a 1120 .tuner_type = TUNER_XC2028,
017ab4b1 1121 .tuner_gpio = default_tuner_gpio,
95b86a9a 1122 .mts_firmware = 1,
95b86a9a 1123 .has_dvb = 1,
122b77e5 1124 .dvb_gpio = hauppauge_wintv_hvr_900_digital,
02858eed 1125 .ir_codes = RC_MAP_PINNACLE_PCTV_HD,
95b86a9a
DSL
1126 .decoder = EM28XX_TVP5150,
1127 .input = { {
1128 .type = EM28XX_VMUX_TELEVISION,
1129 .vmux = TVP5150_COMPOSITE0,
8a5caa6b 1130 .amux = EM28XX_AMUX_VIDEO,
122b77e5 1131 .gpio = hauppauge_wintv_hvr_900_analog,
95b86a9a
DSL
1132 }, {
1133 .type = EM28XX_VMUX_COMPOSITE1,
1134 .vmux = TVP5150_COMPOSITE1,
8a5caa6b 1135 .amux = EM28XX_AMUX_LINE_IN,
122b77e5 1136 .gpio = hauppauge_wintv_hvr_900_analog,
95b86a9a
DSL
1137 }, {
1138 .type = EM28XX_VMUX_SVIDEO,
1139 .vmux = TVP5150_SVIDEO,
8a5caa6b 1140 .amux = EM28XX_AMUX_LINE_IN,
122b77e5 1141 .gpio = hauppauge_wintv_hvr_900_analog,
95b86a9a
DSL
1142 } },
1143 },
1144 [EM2880_BOARD_AMD_ATI_TV_WONDER_HD_600] = {
1145 .name = "AMD ATI TV Wonder HD 600",
95b86a9a 1146 .tuner_type = TUNER_XC2028,
017ab4b1 1147 .tuner_gpio = default_tuner_gpio,
95b86a9a 1148 .mts_firmware = 1,
95b86a9a 1149 .has_dvb = 1,
122b77e5 1150 .dvb_gpio = hauppauge_wintv_hvr_900_digital,
02858eed 1151 .ir_codes = RC_MAP_ATI_TV_WONDER_HD_600,
95b86a9a
DSL
1152 .decoder = EM28XX_TVP5150,
1153 .input = { {
1154 .type = EM28XX_VMUX_TELEVISION,
1155 .vmux = TVP5150_COMPOSITE0,
8a5caa6b 1156 .amux = EM28XX_AMUX_VIDEO,
122b77e5 1157 .gpio = hauppauge_wintv_hvr_900_analog,
95b86a9a
DSL
1158 }, {
1159 .type = EM28XX_VMUX_COMPOSITE1,
1160 .vmux = TVP5150_COMPOSITE1,
8a5caa6b 1161 .amux = EM28XX_AMUX_LINE_IN,
122b77e5 1162 .gpio = hauppauge_wintv_hvr_900_analog,
95b86a9a
DSL
1163 }, {
1164 .type = EM28XX_VMUX_SVIDEO,
1165 .vmux = TVP5150_SVIDEO,
8a5caa6b 1166 .amux = EM28XX_AMUX_LINE_IN,
122b77e5 1167 .gpio = hauppauge_wintv_hvr_900_analog,
95b86a9a
DSL
1168 } },
1169 },
1170 [EM2880_BOARD_TERRATEC_HYBRID_XS] = {
d4d889e3
MCC
1171 .name = "Terratec Hybrid XS",
1172 .tuner_type = TUNER_XC2028,
017ab4b1 1173 .tuner_gpio = default_tuner_gpio,
d4d889e3 1174 .decoder = EM28XX_TVP5150,
95b86a9a 1175 .has_dvb = 1,
f797608c 1176 .dvb_gpio = default_digital,
02858eed 1177 .ir_codes = RC_MAP_TERRATEC_CINERGY_XS,
8cd9aaef 1178 .xclk = EM28XX_XCLK_FREQUENCY_12MHZ, /* NEC IR */
95b86a9a
DSL
1179 .input = { {
1180 .type = EM28XX_VMUX_TELEVISION,
1181 .vmux = TVP5150_COMPOSITE0,
8a5caa6b 1182 .amux = EM28XX_AMUX_VIDEO,
122b77e5 1183 .gpio = default_analog,
95b86a9a
DSL
1184 }, {
1185 .type = EM28XX_VMUX_COMPOSITE1,
1186 .vmux = TVP5150_COMPOSITE1,
8a5caa6b 1187 .amux = EM28XX_AMUX_LINE_IN,
122b77e5 1188 .gpio = default_analog,
95b86a9a
DSL
1189 }, {
1190 .type = EM28XX_VMUX_SVIDEO,
1191 .vmux = TVP5150_SVIDEO,
8a5caa6b 1192 .amux = EM28XX_AMUX_LINE_IN,
122b77e5 1193 .gpio = default_analog,
95b86a9a
DSL
1194 } },
1195 },
1196 /* maybe there's a reason behind it why Terratec sells the Hybrid XS
1197 as Prodigy XS with a different PID, let's keep it separated for now
1198 maybe we'll need it lateron */
1199 [EM2880_BOARD_TERRATEC_PRODIGY_XS] = {
1200 .name = "Terratec Prodigy XS",
95b86a9a 1201 .tuner_type = TUNER_XC2028,
017ab4b1 1202 .tuner_gpio = default_tuner_gpio,
95b86a9a 1203 .decoder = EM28XX_TVP5150,
d4d889e3 1204 .input = { {
95b86a9a
DSL
1205 .type = EM28XX_VMUX_TELEVISION,
1206 .vmux = TVP5150_COMPOSITE0,
8a5caa6b 1207 .amux = EM28XX_AMUX_VIDEO,
122b77e5 1208 .gpio = hauppauge_wintv_hvr_900_analog,
95b86a9a
DSL
1209 }, {
1210 .type = EM28XX_VMUX_COMPOSITE1,
1211 .vmux = TVP5150_COMPOSITE1,
8a5caa6b 1212 .amux = EM28XX_AMUX_LINE_IN,
122b77e5 1213 .gpio = hauppauge_wintv_hvr_900_analog,
95b86a9a
DSL
1214 }, {
1215 .type = EM28XX_VMUX_SVIDEO,
1216 .vmux = TVP5150_SVIDEO,
8a5caa6b 1217 .amux = EM28XX_AMUX_LINE_IN,
122b77e5 1218 .gpio = hauppauge_wintv_hvr_900_analog,
95b86a9a
DSL
1219 } },
1220 },
1221 [EM2820_BOARD_MSI_VOX_USB_2] = {
1222 .name = "MSI VOX USB 2.0",
95b86a9a
DSL
1223 .tuner_type = TUNER_LG_PAL_NEW_TAPC,
1224 .tda9887_conf = TDA9887_PRESENT |
1225 TDA9887_PORT1_ACTIVE |
1226 TDA9887_PORT2_ACTIVE,
1227 .max_range_640_480 = 1,
ec5de990 1228 .decoder = EM28XX_SAA711X,
95b86a9a
DSL
1229 .input = { {
1230 .type = EM28XX_VMUX_TELEVISION,
1231 .vmux = SAA7115_COMPOSITE4,
8a5caa6b 1232 .amux = EM28XX_AMUX_VIDEO,
95b86a9a
DSL
1233 }, {
1234 .type = EM28XX_VMUX_COMPOSITE1,
1235 .vmux = SAA7115_COMPOSITE0,
8a5caa6b 1236 .amux = EM28XX_AMUX_LINE_IN,
95b86a9a
DSL
1237 }, {
1238 .type = EM28XX_VMUX_SVIDEO,
1239 .vmux = SAA7115_SVIDEO3,
8a5caa6b 1240 .amux = EM28XX_AMUX_LINE_IN,
95b86a9a
DSL
1241 } },
1242 },
1243 [EM2800_BOARD_TERRATEC_CINERGY_200] = {
1244 .name = "Terratec Cinergy 200 USB",
1245 .is_em2800 = 1,
ac07bb73 1246 .has_ir_i2c = 1,
53b667eb 1247 .tuner_type = TUNER_LG_TALN,
95b86a9a 1248 .tda9887_conf = TDA9887_PRESENT,
ec5de990 1249 .decoder = EM28XX_SAA711X,
d4d889e3 1250 .input = { {
95b86a9a
DSL
1251 .type = EM28XX_VMUX_TELEVISION,
1252 .vmux = SAA7115_COMPOSITE2,
8a5caa6b 1253 .amux = EM28XX_AMUX_VIDEO,
95b86a9a
DSL
1254 }, {
1255 .type = EM28XX_VMUX_COMPOSITE1,
1256 .vmux = SAA7115_COMPOSITE0,
8a5caa6b 1257 .amux = EM28XX_AMUX_LINE_IN,
95b86a9a
DSL
1258 }, {
1259 .type = EM28XX_VMUX_SVIDEO,
1260 .vmux = SAA7115_SVIDEO3,
8a5caa6b 1261 .amux = EM28XX_AMUX_LINE_IN,
95b86a9a
DSL
1262 } },
1263 },
1264 [EM2800_BOARD_GRABBEEX_USB2800] = {
a1a6ee74
NS
1265 .name = "eMPIA Technology, Inc. GrabBeeX+ Video Encoder",
1266 .is_em2800 = 1,
1267 .decoder = EM28XX_SAA711X,
1268 .tuner_type = TUNER_ABSENT, /* capture only board */
1269 .input = { {
95b86a9a
DSL
1270 .type = EM28XX_VMUX_COMPOSITE1,
1271 .vmux = SAA7115_COMPOSITE0,
8a5caa6b 1272 .amux = EM28XX_AMUX_LINE_IN,
95b86a9a
DSL
1273 }, {
1274 .type = EM28XX_VMUX_SVIDEO,
1275 .vmux = SAA7115_SVIDEO3,
8a5caa6b 1276 .amux = EM28XX_AMUX_LINE_IN,
95b86a9a
DSL
1277 } },
1278 },
694a101e
MCC
1279 [EM2800_BOARD_VC211A] = {
1280 .name = "Actionmaster/LinXcel/Digitus VC211A",
1281 .is_em2800 = 1,
1282 .tuner_type = TUNER_ABSENT, /* Capture-only board */
1283 .decoder = EM28XX_SAA711X,
1284 .input = { {
1285 .type = EM28XX_VMUX_COMPOSITE1,
1286 .vmux = SAA7115_COMPOSITE0,
1287 .amux = EM28XX_AMUX_LINE_IN,
1288 .gpio = vc211a_enable,
1289 }, {
1290 .type = EM28XX_VMUX_SVIDEO,
1291 .vmux = SAA7115_SVIDEO3,
1292 .amux = EM28XX_AMUX_LINE_IN,
1293 .gpio = vc211a_enable,
1294 } },
1295 },
95b86a9a
DSL
1296 [EM2800_BOARD_LEADTEK_WINFAST_USBII] = {
1297 .name = "Leadtek Winfast USB II",
1298 .is_em2800 = 1,
95b86a9a
DSL
1299 .tuner_type = TUNER_LG_PAL_NEW_TAPC,
1300 .tda9887_conf = TDA9887_PRESENT,
ec5de990 1301 .decoder = EM28XX_SAA711X,
d4d889e3 1302 .input = { {
95b86a9a
DSL
1303 .type = EM28XX_VMUX_TELEVISION,
1304 .vmux = SAA7115_COMPOSITE2,
8a5caa6b 1305 .amux = EM28XX_AMUX_VIDEO,
95b86a9a
DSL
1306 }, {
1307 .type = EM28XX_VMUX_COMPOSITE1,
1308 .vmux = SAA7115_COMPOSITE0,
8a5caa6b 1309 .amux = EM28XX_AMUX_LINE_IN,
95b86a9a
DSL
1310 }, {
1311 .type = EM28XX_VMUX_SVIDEO,
1312 .vmux = SAA7115_SVIDEO3,
8a5caa6b 1313 .amux = EM28XX_AMUX_LINE_IN,
95b86a9a
DSL
1314 } },
1315 },
1316 [EM2800_BOARD_KWORLD_USB2800] = {
1317 .name = "Kworld USB2800",
1318 .is_em2800 = 1,
95b86a9a
DSL
1319 .tuner_type = TUNER_PHILIPS_FCV1236D,
1320 .tda9887_conf = TDA9887_PRESENT,
ec5de990 1321 .decoder = EM28XX_SAA711X,
d4d889e3 1322 .input = { {
95b86a9a
DSL
1323 .type = EM28XX_VMUX_TELEVISION,
1324 .vmux = SAA7115_COMPOSITE2,
8a5caa6b 1325 .amux = EM28XX_AMUX_VIDEO,
95b86a9a
DSL
1326 }, {
1327 .type = EM28XX_VMUX_COMPOSITE1,
1328 .vmux = SAA7115_COMPOSITE0,
8a5caa6b 1329 .amux = EM28XX_AMUX_LINE_IN,
95b86a9a
DSL
1330 }, {
1331 .type = EM28XX_VMUX_SVIDEO,
1332 .vmux = SAA7115_SVIDEO3,
8a5caa6b 1333 .amux = EM28XX_AMUX_LINE_IN,
95b86a9a
DSL
1334 } },
1335 },
1336 [EM2820_BOARD_PINNACLE_DVC_90] = {
ea47689e 1337 .name = "Pinnacle Dazzle DVC 90/100/101/107 / Kaiser Baas Video to DVD maker "
74e07f3e 1338 "/ Kworld DVD Maker 2 / Plextor ConvertX PX-AV100U",
1c67e76f 1339 .tuner_type = TUNER_ABSENT, /* capture only board */
ec5de990 1340 .decoder = EM28XX_SAA711X,
d4d889e3 1341 .input = { {
95b86a9a
DSL
1342 .type = EM28XX_VMUX_COMPOSITE1,
1343 .vmux = SAA7115_COMPOSITE0,
8a5caa6b 1344 .amux = EM28XX_AMUX_LINE_IN,
95b86a9a
DSL
1345 }, {
1346 .type = EM28XX_VMUX_SVIDEO,
1347 .vmux = SAA7115_SVIDEO3,
8a5caa6b 1348 .amux = EM28XX_AMUX_LINE_IN,
95b86a9a
DSL
1349 } },
1350 },
1351 [EM2800_BOARD_VGEAR_POCKETTV] = {
1352 .name = "V-Gear PocketTV",
1353 .is_em2800 = 1,
95b86a9a
DSL
1354 .tuner_type = TUNER_LG_PAL_NEW_TAPC,
1355 .tda9887_conf = TDA9887_PRESENT,
ec5de990 1356 .decoder = EM28XX_SAA711X,
d4d889e3 1357 .input = { {
95b86a9a
DSL
1358 .type = EM28XX_VMUX_TELEVISION,
1359 .vmux = SAA7115_COMPOSITE2,
8a5caa6b 1360 .amux = EM28XX_AMUX_VIDEO,
95b86a9a
DSL
1361 }, {
1362 .type = EM28XX_VMUX_COMPOSITE1,
1363 .vmux = SAA7115_COMPOSITE0,
8a5caa6b 1364 .amux = EM28XX_AMUX_LINE_IN,
95b86a9a
DSL
1365 }, {
1366 .type = EM28XX_VMUX_SVIDEO,
1367 .vmux = SAA7115_SVIDEO3,
8a5caa6b 1368 .amux = EM28XX_AMUX_LINE_IN,
95b86a9a
DSL
1369 } },
1370 },
1e1addd5
DSL
1371 [EM2820_BOARD_PROLINK_PLAYTV_BOX4_USB2] = {
1372 .name = "Pixelview PlayTV Box 4 USB 2.0",
1373 .tda9887_conf = TDA9887_PRESENT,
1374 .tuner_type = TUNER_YMEC_TVF_5533MF,
1375 .decoder = EM28XX_SAA711X,
1376 .input = { {
1377 .type = EM28XX_VMUX_TELEVISION,
1378 .vmux = SAA7115_COMPOSITE2,
1379 .amux = EM28XX_AMUX_VIDEO,
1380 .aout = EM28XX_AOUT_MONO | /* I2S */
1381 EM28XX_AOUT_MASTER, /* Line out pin */
1382 }, {
1383 .type = EM28XX_VMUX_COMPOSITE1,
1384 .vmux = SAA7115_COMPOSITE0,
1385 .amux = EM28XX_AMUX_LINE_IN,
1386 }, {
1387 .type = EM28XX_VMUX_SVIDEO,
1388 .vmux = SAA7115_SVIDEO3,
1389 .amux = EM28XX_AMUX_LINE_IN,
1390 } },
1391 },
95b86a9a 1392 [EM2820_BOARD_PROLINK_PLAYTV_USB2] = {
1f372a93 1393 .name = "SIIG AVTuner-PVR / Pixelview Prolink PlayTV USB 2.0",
5609cfd2 1394 .has_snapshot_button = 1,
95b86a9a
DSL
1395 .tda9887_conf = TDA9887_PRESENT,
1396 .tuner_type = TUNER_YMEC_TVF_5533MF,
ec5de990 1397 .decoder = EM28XX_SAA711X,
d4d889e3 1398 .input = { {
95b86a9a
DSL
1399 .type = EM28XX_VMUX_TELEVISION,
1400 .vmux = SAA7115_COMPOSITE2,
30e4ac7c
MCC
1401 .amux = EM28XX_AMUX_VIDEO,
1402 .aout = EM28XX_AOUT_MONO | /* I2S */
1403 EM28XX_AOUT_MASTER, /* Line out pin */
95b86a9a
DSL
1404 }, {
1405 .type = EM28XX_VMUX_COMPOSITE1,
1406 .vmux = SAA7115_COMPOSITE0,
1407 .amux = EM28XX_AMUX_LINE_IN,
1408 }, {
1409 .type = EM28XX_VMUX_SVIDEO,
1410 .vmux = SAA7115_SVIDEO3,
1411 .amux = EM28XX_AMUX_LINE_IN,
1412 } },
1413 },
3ed58baf
DH
1414 [EM2860_BOARD_SAA711X_REFERENCE_DESIGN] = {
1415 .name = "EM2860/SAA711X Reference Design",
95b86a9a 1416 .has_snapshot_button = 1,
d4d889e3 1417 .tuner_type = TUNER_ABSENT,
ec5de990 1418 .decoder = EM28XX_SAA711X,
d4d889e3 1419 .input = { {
95b86a9a
DSL
1420 .type = EM28XX_VMUX_SVIDEO,
1421 .vmux = SAA7115_SVIDEO3,
3ed58baf
DH
1422 }, {
1423 .type = EM28XX_VMUX_COMPOSITE1,
1424 .vmux = SAA7115_COMPOSITE0,
95b86a9a
DSL
1425 } },
1426 },
ca3dfd6a 1427
ebaefdb7 1428 [EM2874_BOARD_LEADERSHIP_ISDBT] = {
3aa2b3b9
MCC
1429 .def_i2c_bus = 1,
1430 .i2c_speed = EM28XX_I2C_CLK_WAIT_ENABLE |
ca3dfd6a
MCC
1431 EM28XX_I2C_FREQ_100_KHZ,
1432 .xclk = EM28XX_XCLK_FREQUENCY_10MHZ,
1433 .name = "EM2874 Leadership ISDBT",
1434 .tuner_type = TUNER_ABSENT,
1435 .tuner_gpio = leadership_reset,
1436 .dvb_gpio = leadership_digital,
1437 .has_dvb = 1,
1438 },
1439
95b86a9a
DSL
1440 [EM2880_BOARD_MSI_DIGIVOX_AD] = {
1441 .name = "MSI DigiVox A/D",
1442 .valid = EM28XX_BOARD_NOT_VALIDATED,
95b86a9a 1443 .tuner_type = TUNER_XC2028,
017ab4b1 1444 .tuner_gpio = default_tuner_gpio,
95b86a9a 1445 .decoder = EM28XX_TVP5150,
d4d889e3 1446 .input = { {
95b86a9a
DSL
1447 .type = EM28XX_VMUX_TELEVISION,
1448 .vmux = TVP5150_COMPOSITE0,
8a5caa6b 1449 .amux = EM28XX_AMUX_VIDEO,
122b77e5 1450 .gpio = em2880_msi_digivox_ad_analog,
95b86a9a
DSL
1451 }, {
1452 .type = EM28XX_VMUX_COMPOSITE1,
1453 .vmux = TVP5150_COMPOSITE1,
8a5caa6b 1454 .amux = EM28XX_AMUX_LINE_IN,
122b77e5 1455 .gpio = em2880_msi_digivox_ad_analog,
95b86a9a
DSL
1456 }, {
1457 .type = EM28XX_VMUX_SVIDEO,
1458 .vmux = TVP5150_SVIDEO,
8a5caa6b 1459 .amux = EM28XX_AMUX_LINE_IN,
122b77e5 1460 .gpio = em2880_msi_digivox_ad_analog,
95b86a9a
DSL
1461 } },
1462 },
1463 [EM2880_BOARD_MSI_DIGIVOX_AD_II] = {
1464 .name = "MSI DigiVox A/D II",
1465 .valid = EM28XX_BOARD_NOT_VALIDATED,
95b86a9a 1466 .tuner_type = TUNER_XC2028,
017ab4b1 1467 .tuner_gpio = default_tuner_gpio,
95b86a9a 1468 .decoder = EM28XX_TVP5150,
d4d889e3 1469 .input = { {
e14b3658
DH
1470 .type = EM28XX_VMUX_TELEVISION,
1471 .vmux = TVP5150_COMPOSITE0,
8a5caa6b 1472 .amux = EM28XX_AMUX_VIDEO,
122b77e5 1473 .gpio = em2880_msi_digivox_ad_analog,
e14b3658
DH
1474 }, {
1475 .type = EM28XX_VMUX_COMPOSITE1,
1476 .vmux = TVP5150_COMPOSITE1,
8a5caa6b 1477 .amux = EM28XX_AMUX_LINE_IN,
122b77e5 1478 .gpio = em2880_msi_digivox_ad_analog,
e14b3658
DH
1479 }, {
1480 .type = EM28XX_VMUX_SVIDEO,
1481 .vmux = TVP5150_SVIDEO,
8a5caa6b 1482 .amux = EM28XX_AMUX_LINE_IN,
122b77e5 1483 .gpio = em2880_msi_digivox_ad_analog,
e14b3658
DH
1484 } },
1485 },
95b86a9a
DSL
1486 [EM2880_BOARD_KWORLD_DVB_305U] = {
1487 .name = "KWorld DVB-T 305U",
12466577 1488 .tuner_type = TUNER_XC2028,
017ab4b1 1489 .tuner_gpio = default_tuner_gpio,
12466577 1490 .decoder = EM28XX_TVP5150,
d4d889e3 1491 .input = { {
12466577
MCC
1492 .type = EM28XX_VMUX_TELEVISION,
1493 .vmux = TVP5150_COMPOSITE0,
8a5caa6b 1494 .amux = EM28XX_AMUX_VIDEO,
c23f5949 1495 }, {
12466577
MCC
1496 .type = EM28XX_VMUX_COMPOSITE1,
1497 .vmux = TVP5150_COMPOSITE1,
8a5caa6b 1498 .amux = EM28XX_AMUX_LINE_IN,
c23f5949 1499 }, {
12466577
MCC
1500 .type = EM28XX_VMUX_SVIDEO,
1501 .vmux = TVP5150_SVIDEO,
8a5caa6b 1502 .amux = EM28XX_AMUX_LINE_IN,
c23f5949 1503 } },
12466577 1504 },
95b86a9a
DSL
1505 [EM2880_BOARD_KWORLD_DVB_310U] = {
1506 .name = "KWorld DVB-T 310U",
12466577 1507 .tuner_type = TUNER_XC2028,
017ab4b1 1508 .tuner_gpio = default_tuner_gpio,
da3808e1 1509 .has_dvb = 1,
122b77e5 1510 .dvb_gpio = default_digital,
da3808e1 1511 .mts_firmware = 1,
12466577 1512 .decoder = EM28XX_TVP5150,
d4d889e3 1513 .input = { {
12466577
MCC
1514 .type = EM28XX_VMUX_TELEVISION,
1515 .vmux = TVP5150_COMPOSITE0,
da3808e1 1516 .amux = EM28XX_AMUX_VIDEO,
122b77e5 1517 .gpio = default_analog,
c23f5949 1518 }, {
12466577
MCC
1519 .type = EM28XX_VMUX_COMPOSITE1,
1520 .vmux = TVP5150_COMPOSITE1,
a42aa191 1521 .amux = EM28XX_AMUX_LINE_IN,
122b77e5 1522 .gpio = default_analog,
da3808e1 1523 }, { /* S-video has not been tested yet */
12466577
MCC
1524 .type = EM28XX_VMUX_SVIDEO,
1525 .vmux = TVP5150_SVIDEO,
a42aa191 1526 .amux = EM28XX_AMUX_LINE_IN,
122b77e5 1527 .gpio = default_analog,
c23f5949 1528 } },
12466577 1529 },
d7de5d8f
FM
1530 [EM2882_BOARD_KWORLD_ATSC_315U] = {
1531 .name = "KWorld ATSC 315U HDTV TV Box",
1532 .valid = EM28XX_BOARD_NOT_VALIDATED,
1533 .tuner_type = TUNER_THOMSON_DTT761X,
1534 .tuner_gpio = em2882_kworld_315u_tuner_gpio,
1535 .tda9887_conf = TDA9887_PRESENT,
1536 .decoder = EM28XX_SAA711X,
1537 .has_dvb = 1,
1538 .dvb_gpio = em2882_kworld_315u_digital,
02858eed 1539 .ir_codes = RC_MAP_KWORLD_315U,
d7de5d8f
FM
1540 .xclk = EM28XX_XCLK_FREQUENCY_12MHZ,
1541 .i2c_speed = EM28XX_I2C_CLK_WAIT_ENABLE,
1542 /* Analog mode - still not ready */
1543 /*.input = { {
1544 .type = EM28XX_VMUX_TELEVISION,
1545 .vmux = SAA7115_COMPOSITE2,
1546 .amux = EM28XX_AMUX_VIDEO,
1547 .gpio = em2882_kworld_315u_analog,
1548 .aout = EM28XX_AOUT_PCM_IN | EM28XX_AOUT_PCM_STEREO,
1549 }, {
1550 .type = EM28XX_VMUX_COMPOSITE1,
1551 .vmux = SAA7115_COMPOSITE0,
1552 .amux = EM28XX_AMUX_LINE_IN,
1553 .gpio = em2882_kworld_315u_analog1,
1554 .aout = EM28XX_AOUT_PCM_IN | EM28XX_AOUT_PCM_STEREO,
1555 }, {
1556 .type = EM28XX_VMUX_SVIDEO,
1557 .vmux = SAA7115_SVIDEO3,
1558 .amux = EM28XX_AMUX_LINE_IN,
1559 .gpio = em2882_kworld_315u_analog1,
1560 .aout = EM28XX_AOUT_PCM_IN | EM28XX_AOUT_PCM_STEREO,
1561 } }, */
1562 },
e5db5d44
DSL
1563 [EM2880_BOARD_EMPIRE_DUAL_TV] = {
1564 .name = "Empire dual TV",
1565 .tuner_type = TUNER_XC2028,
1566 .tuner_gpio = default_tuner_gpio,
1567 .has_dvb = 1,
1568 .dvb_gpio = default_digital,
1569 .mts_firmware = 1,
1570 .decoder = EM28XX_TVP5150,
1571 .input = { {
1572 .type = EM28XX_VMUX_TELEVISION,
1573 .vmux = TVP5150_COMPOSITE0,
1574 .amux = EM28XX_AMUX_VIDEO,
1575 .gpio = default_analog,
1576 }, {
1577 .type = EM28XX_VMUX_COMPOSITE1,
1578 .vmux = TVP5150_COMPOSITE1,
1579 .amux = EM28XX_AMUX_LINE_IN,
1580 .gpio = default_analog,
1581 }, {
1582 .type = EM28XX_VMUX_SVIDEO,
1583 .vmux = TVP5150_SVIDEO,
1584 .amux = EM28XX_AMUX_LINE_IN,
1585 .gpio = default_analog,
1586 } },
1587 },
95b86a9a
DSL
1588 [EM2881_BOARD_DNT_DA2_HYBRID] = {
1589 .name = "DNT DA2 Hybrid",
1590 .valid = EM28XX_BOARD_NOT_VALIDATED,
95b86a9a 1591 .tuner_type = TUNER_XC2028,
017ab4b1 1592 .tuner_gpio = default_tuner_gpio,
95b86a9a 1593 .decoder = EM28XX_TVP5150,
d4d889e3 1594 .input = { {
3acf2809 1595 .type = EM28XX_VMUX_TELEVISION,
95b86a9a 1596 .vmux = TVP5150_COMPOSITE0,
8a5caa6b 1597 .amux = EM28XX_AMUX_VIDEO,
122b77e5 1598 .gpio = default_analog,
c23f5949 1599 }, {
3acf2809 1600 .type = EM28XX_VMUX_COMPOSITE1,
95b86a9a 1601 .vmux = TVP5150_COMPOSITE1,
8a5caa6b 1602 .amux = EM28XX_AMUX_LINE_IN,
122b77e5 1603 .gpio = default_analog,
c23f5949 1604 }, {
3acf2809 1605 .type = EM28XX_VMUX_SVIDEO,
95b86a9a 1606 .vmux = TVP5150_SVIDEO,
8a5caa6b 1607 .amux = EM28XX_AMUX_LINE_IN,
122b77e5 1608 .gpio = default_analog,
c23f5949 1609 } },
596d92d5 1610 },
95b86a9a
DSL
1611 [EM2881_BOARD_PINNACLE_HYBRID_PRO] = {
1612 .name = "Pinnacle Hybrid Pro",
95b86a9a 1613 .tuner_type = TUNER_XC2028,
017ab4b1 1614 .tuner_gpio = default_tuner_gpio,
95b86a9a 1615 .decoder = EM28XX_TVP5150,
d5b3ba9c
DH
1616 .has_dvb = 1,
1617 .dvb_gpio = pinnacle_hybrid_pro_digital,
d4d889e3 1618 .input = { {
95b86a9a
DSL
1619 .type = EM28XX_VMUX_TELEVISION,
1620 .vmux = TVP5150_COMPOSITE0,
8a5caa6b 1621 .amux = EM28XX_AMUX_VIDEO,
d5b3ba9c 1622 .gpio = pinnacle_hybrid_pro_analog,
95b86a9a 1623 }, {
59d07f1b 1624 .type = EM28XX_VMUX_COMPOSITE1,
95b86a9a 1625 .vmux = TVP5150_COMPOSITE1,
8a5caa6b 1626 .amux = EM28XX_AMUX_LINE_IN,
d5b3ba9c 1627 .gpio = pinnacle_hybrid_pro_analog,
59d07f1b
AS
1628 }, {
1629 .type = EM28XX_VMUX_SVIDEO,
95b86a9a 1630 .vmux = TVP5150_SVIDEO,
8a5caa6b 1631 .amux = EM28XX_AMUX_LINE_IN,
d5b3ba9c 1632 .gpio = pinnacle_hybrid_pro_analog,
59d07f1b
AS
1633 } },
1634 },
09bc1942
DH
1635 [EM2882_BOARD_PINNACLE_HYBRID_PRO_330E] = {
1636 .name = "Pinnacle Hybrid Pro (330e)",
95b86a9a 1637 .tuner_type = TUNER_XC2028,
017ab4b1 1638 .tuner_gpio = default_tuner_gpio,
a674a3b4 1639 .mts_firmware = 1,
ad9b4bb2
DH
1640 .has_dvb = 1,
1641 .dvb_gpio = hauppauge_wintv_hvr_900R2_digital,
9b316d6b 1642 .ir_codes = RC_MAP_PINNACLE_PCTV_HD,
95b86a9a 1643 .decoder = EM28XX_TVP5150,
d4d889e3 1644 .input = { {
3acf2809 1645 .type = EM28XX_VMUX_TELEVISION,
95b86a9a 1646 .vmux = TVP5150_COMPOSITE0,
8a5caa6b 1647 .amux = EM28XX_AMUX_VIDEO,
122b77e5 1648 .gpio = hauppauge_wintv_hvr_900_analog,
c23f5949 1649 }, {
3acf2809 1650 .type = EM28XX_VMUX_COMPOSITE1,
95b86a9a 1651 .vmux = TVP5150_COMPOSITE1,
8a5caa6b 1652 .amux = EM28XX_AMUX_LINE_IN,
122b77e5 1653 .gpio = hauppauge_wintv_hvr_900_analog,
c23f5949 1654 }, {
3acf2809 1655 .type = EM28XX_VMUX_SVIDEO,
95b86a9a 1656 .vmux = TVP5150_SVIDEO,
8a5caa6b 1657 .amux = EM28XX_AMUX_LINE_IN,
122b77e5 1658 .gpio = hauppauge_wintv_hvr_900_analog,
c23f5949 1659 } },
596d92d5 1660 },
95b86a9a
DSL
1661 [EM2882_BOARD_KWORLD_VS_DVBT] = {
1662 .name = "Kworld VS-DVB-T 323UR",
95b86a9a 1663 .tuner_type = TUNER_XC2028,
017ab4b1 1664 .tuner_gpio = default_tuner_gpio,
95b86a9a 1665 .decoder = EM28XX_TVP5150,
811fab62
AL
1666 .mts_firmware = 1,
1667 .has_dvb = 1,
1668 .dvb_gpio = kworld_330u_digital,
1669 .xclk = EM28XX_XCLK_FREQUENCY_12MHZ, /* NEC IR */
02858eed 1670 .ir_codes = RC_MAP_KWORLD_315U,
d4d889e3 1671 .input = { {
3acf2809 1672 .type = EM28XX_VMUX_TELEVISION,
95b86a9a 1673 .vmux = TVP5150_COMPOSITE0,
8a5caa6b 1674 .amux = EM28XX_AMUX_VIDEO,
c23f5949 1675 }, {
3acf2809 1676 .type = EM28XX_VMUX_COMPOSITE1,
95b86a9a 1677 .vmux = TVP5150_COMPOSITE1,
8a5caa6b 1678 .amux = EM28XX_AMUX_LINE_IN,
c23f5949 1679 }, {
3acf2809 1680 .type = EM28XX_VMUX_SVIDEO,
95b86a9a 1681 .vmux = TVP5150_SVIDEO,
8a5caa6b 1682 .amux = EM28XX_AMUX_LINE_IN,
c23f5949 1683 } },
596d92d5 1684 },
95b86a9a 1685 [EM2882_BOARD_TERRATEC_HYBRID_XS] = {
91245443 1686 .name = "Terratec Cinnergy Hybrid T USB XS (em2882)",
95b86a9a 1687 .tuner_type = TUNER_XC2028,
017ab4b1 1688 .tuner_gpio = default_tuner_gpio,
ec994d05 1689 .mts_firmware = 1,
95b86a9a 1690 .decoder = EM28XX_TVP5150,
ec994d05
UV
1691 .has_dvb = 1,
1692 .dvb_gpio = hauppauge_wintv_hvr_900_digital,
02858eed 1693 .ir_codes = RC_MAP_TERRATEC_CINERGY_XS,
ec994d05 1694 .xclk = EM28XX_XCLK_FREQUENCY_12MHZ,
d4d889e3 1695 .input = { {
95b86a9a
DSL
1696 .type = EM28XX_VMUX_TELEVISION,
1697 .vmux = TVP5150_COMPOSITE0,
8a5caa6b 1698 .amux = EM28XX_AMUX_VIDEO,
122b77e5 1699 .gpio = hauppauge_wintv_hvr_900_analog,
95b86a9a 1700 }, {
3acf2809 1701 .type = EM28XX_VMUX_COMPOSITE1,
95b86a9a 1702 .vmux = TVP5150_COMPOSITE1,
8a5caa6b 1703 .amux = EM28XX_AMUX_LINE_IN,
122b77e5 1704 .gpio = hauppauge_wintv_hvr_900_analog,
c23f5949 1705 }, {
3acf2809 1706 .type = EM28XX_VMUX_SVIDEO,
95b86a9a 1707 .vmux = TVP5150_SVIDEO,
8a5caa6b 1708 .amux = EM28XX_AMUX_LINE_IN,
122b77e5 1709 .gpio = hauppauge_wintv_hvr_900_analog,
c23f5949 1710 } },
45632c4f 1711 },
7ca7ef60
AA
1712 [EM2882_BOARD_DIKOM_DK300] = {
1713 .name = "Dikom DK300",
1714 .tuner_type = TUNER_XC2028,
1715 .tuner_gpio = default_tuner_gpio,
1716 .decoder = EM28XX_TVP5150,
1717 .mts_firmware = 1,
1718 .has_dvb = 1,
1719 .dvb_gpio = dikom_dk300_digital,
1720 .input = { {
1721 .type = EM28XX_VMUX_TELEVISION,
1722 .vmux = TVP5150_COMPOSITE0,
1723 .amux = EM28XX_AMUX_VIDEO,
1724 .gpio = default_analog,
1725 } },
1726 },
6e7b9ea0 1727 [EM2883_BOARD_KWORLD_HYBRID_330U] = {
95b86a9a 1728 .name = "Kworld PlusTV HD Hybrid 330",
95b86a9a 1729 .tuner_type = TUNER_XC2028,
017ab4b1 1730 .tuner_gpio = default_tuner_gpio,
95b86a9a 1731 .decoder = EM28XX_TVP5150,
be2c6db1
MCC
1732 .mts_firmware = 1,
1733 .has_dvb = 1,
6e7b9ea0
RK
1734 .dvb_gpio = kworld_330u_digital,
1735 .xclk = EM28XX_XCLK_FREQUENCY_12MHZ,
a1a6ee74
NS
1736 .i2c_speed = EM28XX_I2C_CLK_WAIT_ENABLE |
1737 EM28XX_I2C_EEPROM_ON_BOARD |
1738 EM28XX_I2C_EEPROM_KEY_VALID,
d4d889e3 1739 .input = { {
ea4fd567 1740 .type = EM28XX_VMUX_TELEVISION,
95b86a9a 1741 .vmux = TVP5150_COMPOSITE0,
8a5caa6b 1742 .amux = EM28XX_AMUX_VIDEO,
6e7b9ea0
RK
1743 .gpio = kworld_330u_analog,
1744 .aout = EM28XX_AOUT_PCM_IN | EM28XX_AOUT_PCM_STEREO,
c23f5949 1745 }, {
ea4fd567 1746 .type = EM28XX_VMUX_COMPOSITE1,
95b86a9a 1747 .vmux = TVP5150_COMPOSITE1,
8a5caa6b 1748 .amux = EM28XX_AMUX_LINE_IN,
6e7b9ea0
RK
1749 .gpio = kworld_330u_analog,
1750 .aout = EM28XX_AOUT_PCM_IN | EM28XX_AOUT_PCM_STEREO,
c23f5949 1751 }, {
ea4fd567 1752 .type = EM28XX_VMUX_SVIDEO,
95b86a9a 1753 .vmux = TVP5150_SVIDEO,
8a5caa6b 1754 .amux = EM28XX_AMUX_LINE_IN,
6e7b9ea0 1755 .gpio = kworld_330u_analog,
a9fc52bc
DH
1756 } },
1757 },
ee281b85 1758 [EM2820_BOARD_COMPRO_VIDEOMATE_FORYOU] = {
d3603341 1759 .name = "Compro VideoMate ForYou/Stereo",
d3603341 1760 .tuner_type = TUNER_LG_PAL_NEW_TAPC,
f2cf250a 1761 .tvaudio_addr = 0xb0,
d3603341
VW
1762 .tda9887_conf = TDA9887_PRESENT,
1763 .decoder = EM28XX_TVP5150,
df7fa09c 1764 .adecoder = EM28XX_TVAUDIO,
2bd1d9eb 1765 .mute_gpio = compro_mute_gpio,
d4d889e3 1766 .input = { {
d3603341
VW
1767 .type = EM28XX_VMUX_TELEVISION,
1768 .vmux = TVP5150_COMPOSITE0,
2bd1d9eb
VW
1769 .amux = EM28XX_AMUX_VIDEO,
1770 .gpio = compro_unmute_tv_gpio,
d3603341
VW
1771 }, {
1772 .type = EM28XX_VMUX_SVIDEO,
1773 .vmux = TVP5150_SVIDEO,
1774 .amux = EM28XX_AMUX_LINE_IN,
2bd1d9eb 1775 .gpio = compro_unmute_svid_gpio,
d3603341
VW
1776 } },
1777 },
0bf4f6ce
MCC
1778 [EM2860_BOARD_KAIOMY_TVNPC_U2] = {
1779 .name = "Kaiomy TVnPC U2",
1780 .vchannels = 3,
1781 .tuner_type = TUNER_XC2028,
1782 .tuner_addr = 0x61,
1783 .mts_firmware = 1,
1784 .decoder = EM28XX_TVP5150,
1785 .tuner_gpio = default_tuner_gpio,
02858eed 1786 .ir_codes = RC_MAP_KAIOMY,
0bf4f6ce
MCC
1787 .input = { {
1788 .type = EM28XX_VMUX_TELEVISION,
1789 .vmux = TVP5150_COMPOSITE0,
1790 .amux = EM28XX_AMUX_VIDEO,
1791
1792 }, {
1793 .type = EM28XX_VMUX_COMPOSITE1,
1794 .vmux = TVP5150_COMPOSITE1,
1795 .amux = EM28XX_AMUX_LINE_IN,
1796 }, {
1797 .type = EM28XX_VMUX_SVIDEO,
1798 .vmux = TVP5150_SVIDEO,
1799 .amux = EM28XX_AMUX_LINE_IN,
1800 } },
1801 .radio = {
1802 .type = EM28XX_RADIO,
1803 .amux = EM28XX_AMUX_LINE_IN,
1804 }
56ee3807
MCC
1805 },
1806 [EM2860_BOARD_EASYCAP] = {
1807 .name = "Easy Cap Capture DC-60",
1808 .vchannels = 2,
1809 .tuner_type = TUNER_ABSENT,
1810 .decoder = EM28XX_SAA711X,
1811 .input = { {
1812 .type = EM28XX_VMUX_COMPOSITE1,
1813 .vmux = SAA7115_COMPOSITE0,
1814 .amux = EM28XX_AMUX_LINE_IN,
1815 }, {
1816 .type = EM28XX_VMUX_SVIDEO,
1817 .vmux = SAA7115_SVIDEO3,
1818 .amux = EM28XX_AMUX_LINE_IN,
1819 } },
1820 },
f74a61e3
IK
1821 [EM2820_BOARD_IODATA_GVMVP_SZ] = {
1822 .name = "IO-DATA GV-MVP/SZ",
1823 .tuner_type = TUNER_PHILIPS_FM1236_MK3,
1824 .tuner_gpio = default_tuner_gpio,
1825 .tda9887_conf = TDA9887_PRESENT,
1826 .decoder = EM28XX_TVP5150,
1827 .input = { {
1828 .type = EM28XX_VMUX_TELEVISION,
1829 .vmux = TVP5150_COMPOSITE0,
1830 .amux = EM28XX_AMUX_VIDEO,
1831 }, { /* Composite has not been tested yet */
1832 .type = EM28XX_VMUX_COMPOSITE1,
1833 .vmux = TVP5150_COMPOSITE1,
1834 .amux = EM28XX_AMUX_VIDEO,
1835 }, { /* S-video has not been tested yet */
1836 .type = EM28XX_VMUX_SVIDEO,
1837 .vmux = TVP5150_SVIDEO,
1838 .amux = EM28XX_AMUX_VIDEO,
1839 } },
1840 },
4557af9c
MCC
1841 [EM2860_BOARD_TERRATEC_GRABBY] = {
1842 .name = "Terratec Grabby",
1843 .vchannels = 2,
1844 .tuner_type = TUNER_ABSENT,
1845 .decoder = EM28XX_SAA711X,
1846 .xclk = EM28XX_XCLK_FREQUENCY_12MHZ,
1847 .input = { {
1848 .type = EM28XX_VMUX_COMPOSITE1,
1849 .vmux = SAA7115_COMPOSITE0,
a3fa904e 1850 .amux = EM28XX_AMUX_LINE_IN,
4557af9c
MCC
1851 }, {
1852 .type = EM28XX_VMUX_SVIDEO,
1853 .vmux = SAA7115_SVIDEO3,
a3fa904e 1854 .amux = EM28XX_AMUX_LINE_IN,
4557af9c
MCC
1855 } },
1856 },
766ed64d
MCC
1857 [EM2860_BOARD_TERRATEC_AV350] = {
1858 .name = "Terratec AV350",
1859 .vchannels = 2,
1860 .tuner_type = TUNER_ABSENT,
1861 .decoder = EM28XX_TVP5150,
1862 .xclk = EM28XX_XCLK_FREQUENCY_12MHZ,
1863 .mute_gpio = terratec_av350_mute_gpio,
1864 .input = { {
1865 .type = EM28XX_VMUX_COMPOSITE1,
1866 .vmux = TVP5150_COMPOSITE1,
1867 .amux = EM28XX_AUDIO_SRC_LINE,
1df8e986 1868 .gpio = terratec_av350_unmute_gpio,
766ed64d
MCC
1869
1870 }, {
1871 .type = EM28XX_VMUX_SVIDEO,
1872 .vmux = TVP5150_SVIDEO,
1873 .amux = EM28XX_AUDIO_SRC_LINE,
1df8e986 1874 .gpio = terratec_av350_unmute_gpio,
766ed64d
MCC
1875 } },
1876 },
8298f2f8
AT
1877
1878 [EM2860_BOARD_ELGATO_VIDEO_CAPTURE] = {
1879 .name = "Elgato Video Capture",
1880 .decoder = EM28XX_SAA711X,
1881 .tuner_type = TUNER_ABSENT, /* Capture only device */
1882 .input = { {
1883 .type = EM28XX_VMUX_COMPOSITE1,
1884 .vmux = SAA7115_COMPOSITE0,
1885 .amux = EM28XX_AMUX_LINE_IN,
1886 }, {
1887 .type = EM28XX_VMUX_SVIDEO,
1888 .vmux = SAA7115_SVIDEO3,
1889 .amux = EM28XX_AMUX_LINE_IN,
1890 } },
1891 },
1892
19859229
DH
1893 [EM2882_BOARD_EVGA_INDTUBE] = {
1894 .name = "Evga inDtube",
1895 .tuner_type = TUNER_XC2028,
1896 .tuner_gpio = default_tuner_gpio,
1897 .decoder = EM28XX_TVP5150,
a4c47303 1898 .xclk = EM28XX_XCLK_FREQUENCY_12MHZ, /* NEC IR */
19859229
DH
1899 .mts_firmware = 1,
1900 .has_dvb = 1,
1901 .dvb_gpio = evga_indtube_digital,
02858eed 1902 .ir_codes = RC_MAP_EVGA_INDTUBE,
19859229
DH
1903 .input = { {
1904 .type = EM28XX_VMUX_TELEVISION,
1905 .vmux = TVP5150_COMPOSITE0,
1906 .amux = EM28XX_AMUX_VIDEO,
1907 .gpio = evga_indtube_analog,
1908 }, {
1909 .type = EM28XX_VMUX_COMPOSITE1,
1910 .vmux = TVP5150_COMPOSITE1,
1911 .amux = EM28XX_AMUX_LINE_IN,
1912 .gpio = evga_indtube_analog,
1913 }, {
1914 .type = EM28XX_VMUX_SVIDEO,
1915 .vmux = TVP5150_SVIDEO,
1916 .amux = EM28XX_AMUX_LINE_IN,
1917 .gpio = evga_indtube_analog,
1918 } },
1919 },
285eb1a4
AP
1920 /* eb1a:2868 Empia EM2870 + Philips CU1216L NIM (Philips TDA10023 +
1921 Infineon TUA6034) */
1922 [EM2870_BOARD_REDDO_DVB_C_USB_BOX] = {
1923 .name = "Reddo DVB-C USB TV Box",
1924 .tuner_type = TUNER_ABSENT,
28f4ddd1 1925 .tuner_gpio = reddo_dvb_c_usb_box,
285eb1a4 1926 .has_dvb = 1,
285eb1a4 1927 },
7e48b30a
JW
1928 /* 1b80:a340 - Empia EM2870, NXP TDA18271HD and LG DT3304, sold
1929 * initially as the KWorld PlusTV 340U, then as the UB435-Q.
1930 * Early variants have a TDA18271HD/C1, later ones a TDA18271HD/C2 */
1931 [EM2870_BOARD_KWORLD_A340] = {
1932 .name = "KWorld PlusTV 340U or UB435-Q (ATSC)",
1933 .tuner_type = TUNER_ABSENT, /* Digital-only TDA18271HD */
1934 .has_dvb = 1,
1935 .dvb_gpio = kworld_a340_digital,
1936 .tuner_gpio = default_tuner_gpio,
1937 },
460312ec 1938 /* 2013:024f PCTV nanoStick T2 290e.
d6a5f921
AP
1939 * Empia EM28174, Sony CXD2820R and NXP TDA18271HD/C2 */
1940 [EM28174_BOARD_PCTV_290E] = {
460312ec 1941 .name = "PCTV nanoStick T2 290e",
3aa2b3b9
MCC
1942 .def_i2c_bus = 1,
1943 .i2c_speed = EM28XX_I2C_CLK_WAIT_ENABLE | EM28XX_I2C_FREQ_100_KHZ,
d6a5f921
AP
1944 .tuner_type = TUNER_ABSENT,
1945 .tuner_gpio = pctv_290e,
1946 .has_dvb = 1,
ff7b929f 1947 .ir_codes = RC_MAP_PINNACLE_PCTV_HD,
d6a5f921 1948 },
36588715
AP
1949 /* 2013:024f PCTV DVB-S2 Stick 460e
1950 * Empia EM28174, NXP TDA10071, Conexant CX24118A and Allegro A8293 */
1951 [EM28174_BOARD_PCTV_460E] = {
3aa2b3b9
MCC
1952 .def_i2c_bus = 1,
1953 .i2c_speed = EM28XX_I2C_CLK_WAIT_ENABLE | EM28XX_I2C_FREQ_400_KHZ,
36588715
AP
1954 .name = "PCTV DVB-S2 Stick (460e)",
1955 .tuner_type = TUNER_ABSENT,
1956 .tuner_gpio = pctv_460e,
1957 .has_dvb = 1,
1958 .ir_codes = RC_MAP_PINNACLE_PCTV_HD,
1959 },
4d28d3d9
GW
1960 /* eb1a:5006 Honestech VIDBOX NW03
1961 * Empia EM2860, Philips SAA7113, Empia EMP202, No Tuner */
1962 [EM2860_BOARD_HT_VIDBOX_NW03] = {
1963 .name = "Honestech Vidbox NW03",
1964 .tuner_type = TUNER_ABSENT,
1965 .decoder = EM28XX_SAA711X,
1966 .input = { {
1967 .type = EM28XX_VMUX_COMPOSITE1,
1968 .vmux = SAA7115_COMPOSITE0,
1969 .amux = EM28XX_AMUX_LINE_IN,
1970 }, {
1971 .type = EM28XX_VMUX_SVIDEO,
1972 .vmux = SAA7115_SVIDEO3, /* S-VIDEO needs confirming */
1973 .amux = EM28XX_AMUX_LINE_IN,
1974 } },
1975 },
3553085c
AP
1976 /* 1b80:e425 MaxMedia UB425-TC
1977 * Empia EM2874B + Micronas DRX 3913KA2 + NXP TDA18271HDC2 */
1978 [EM2874_BOARD_MAXMEDIA_UB425_TC] = {
1979 .name = "MaxMedia UB425-TC",
1980 .tuner_type = TUNER_ABSENT,
1981 .tuner_gpio = maxmedia_ub425_tc,
1982 .has_dvb = 1,
831378db 1983 .ir_codes = RC_MAP_REDDO,
3aa2b3b9
MCC
1984 .def_i2c_bus = 1,
1985 .i2c_speed = EM28XX_I2C_CLK_WAIT_ENABLE |
3553085c
AP
1986 EM28XX_I2C_FREQ_400_KHZ,
1987 },
fa5527cd
IK
1988 /* 2304:0242 PCTV QuatroStick (510e)
1989 * Empia EM2884 + Micronas DRX 3926K + NXP TDA18271HDC2 */
1990 [EM2884_BOARD_PCTV_510E] = {
1991 .name = "PCTV QuatroStick (510e)",
1992 .tuner_type = TUNER_ABSENT,
1993 .tuner_gpio = pctv_510e,
1994 .has_dvb = 1,
1995 .ir_codes = RC_MAP_PINNACLE_PCTV_HD,
3aa2b3b9
MCC
1996 .def_i2c_bus = 1,
1997 .i2c_speed = EM28XX_I2C_CLK_WAIT_ENABLE |
fa5527cd
IK
1998 EM28XX_I2C_FREQ_400_KHZ,
1999 },
c247d7b1
AP
2000 /* 2013:0251 PCTV QuatroStick nano (520e)
2001 * Empia EM2884 + Micronas DRX 3926K + NXP TDA18271HDC2 */
2002 [EM2884_BOARD_PCTV_520E] = {
2003 .name = "PCTV QuatroStick nano (520e)",
2004 .tuner_type = TUNER_ABSENT,
2005 .tuner_gpio = pctv_520e,
2006 .has_dvb = 1,
2007 .ir_codes = RC_MAP_PINNACLE_PCTV_HD,
3aa2b3b9
MCC
2008 .def_i2c_bus = 1,
2009 .i2c_speed = EM28XX_I2C_CLK_WAIT_ENABLE |
c247d7b1
AP
2010 EM28XX_I2C_FREQ_400_KHZ,
2011 },
89040136
MB
2012 [EM2884_BOARD_TERRATEC_HTC_USB_XS] = {
2013 .name = "Terratec Cinergy HTC USB XS",
2014 .has_dvb = 1,
2015 .ir_codes = RC_MAP_NEC_TERRATEC_CINERGY_XS,
2016 .tuner_type = TUNER_ABSENT,
3aa2b3b9
MCC
2017 .def_i2c_bus = 1,
2018 .i2c_speed = EM28XX_I2C_CLK_WAIT_ENABLE |
89040136
MB
2019 EM28XX_I2C_FREQ_400_KHZ,
2020 },
7c1dfdb0
JH
2021 /* 1b80:e1cc Delock 61959
2022 * Empia EM2874B + Micronas DRX 3913KA2 + NXP TDA18271HDC2
2023 * mostly the same as MaxMedia UB-425-TC but different remote */
2024 [EM2874_BOARD_DELOCK_61959] = {
2025 .name = "Delock 61959",
2026 .tuner_type = TUNER_ABSENT,
2027 .tuner_gpio = maxmedia_ub425_tc,
2028 .has_dvb = 1,
2029 .ir_codes = RC_MAP_DELOCK_61959,
2030 .def_i2c_bus = 1,
2031 .i2c_speed = EM28XX_I2C_CLK_WAIT_ENABLE |
2032 EM28XX_I2C_FREQ_400_KHZ,
2033 },
a6c2ba28 2034};
3acf2809 2035const unsigned int em28xx_bcount = ARRAY_SIZE(em28xx_boards);
a6c2ba28 2036
2037/* table of devices that work with this driver */
a1a6ee74 2038struct usb_device_id em28xx_id_table[] = {
c23f5949 2039 { USB_DEVICE(0xeb1a, 0x2750),
95b86a9a
DSL
2040 .driver_info = EM2750_BOARD_UNKNOWN },
2041 { USB_DEVICE(0xeb1a, 0x2751),
2042 .driver_info = EM2750_BOARD_UNKNOWN },
c23f5949
MCC
2043 { USB_DEVICE(0xeb1a, 0x2800),
2044 .driver_info = EM2800_BOARD_UNKNOWN },
9b4e845c
MCC
2045 { USB_DEVICE(0xeb1a, 0x2710),
2046 .driver_info = EM2820_BOARD_UNKNOWN },
c23f5949
MCC
2047 { USB_DEVICE(0xeb1a, 0x2820),
2048 .driver_info = EM2820_BOARD_UNKNOWN },
2049 { USB_DEVICE(0xeb1a, 0x2821),
c665f4dd 2050 .driver_info = EM2820_BOARD_UNKNOWN },
c23f5949
MCC
2051 { USB_DEVICE(0xeb1a, 0x2860),
2052 .driver_info = EM2820_BOARD_UNKNOWN },
2053 { USB_DEVICE(0xeb1a, 0x2861),
2054 .driver_info = EM2820_BOARD_UNKNOWN },
f91cb65b
DH
2055 { USB_DEVICE(0xeb1a, 0x2862),
2056 .driver_info = EM2820_BOARD_UNKNOWN },
443fed9f
DH
2057 { USB_DEVICE(0xeb1a, 0x2863),
2058 .driver_info = EM2820_BOARD_UNKNOWN },
c23f5949
MCC
2059 { USB_DEVICE(0xeb1a, 0x2870),
2060 .driver_info = EM2820_BOARD_UNKNOWN },
2061 { USB_DEVICE(0xeb1a, 0x2881),
2062 .driver_info = EM2820_BOARD_UNKNOWN },
2063 { USB_DEVICE(0xeb1a, 0x2883),
2064 .driver_info = EM2820_BOARD_UNKNOWN },
285eb1a4
AP
2065 { USB_DEVICE(0xeb1a, 0x2868),
2066 .driver_info = EM2820_BOARD_UNKNOWN },
ca3dfd6a
MCC
2067 { USB_DEVICE(0xeb1a, 0x2875),
2068 .driver_info = EM2820_BOARD_UNKNOWN },
95b86a9a
DSL
2069 { USB_DEVICE(0xeb1a, 0xe300),
2070 .driver_info = EM2861_BOARD_KWORLD_PVRTV_300U },
0bf4f6ce
MCC
2071 { USB_DEVICE(0xeb1a, 0xe303),
2072 .driver_info = EM2860_BOARD_KAIOMY_TVNPC_U2 },
95b86a9a
DSL
2073 { USB_DEVICE(0xeb1a, 0xe305),
2074 .driver_info = EM2880_BOARD_KWORLD_DVB_305U },
2075 { USB_DEVICE(0xeb1a, 0xe310),
2076 .driver_info = EM2880_BOARD_MSI_DIGIVOX_AD },
d7de5d8f
FM
2077 { USB_DEVICE(0xeb1a, 0xa313),
2078 .driver_info = EM2882_BOARD_KWORLD_ATSC_315U },
95b86a9a 2079 { USB_DEVICE(0xeb1a, 0xa316),
6e7b9ea0 2080 .driver_info = EM2883_BOARD_KWORLD_HYBRID_330U },
95b86a9a
DSL
2081 { USB_DEVICE(0xeb1a, 0xe320),
2082 .driver_info = EM2880_BOARD_MSI_DIGIVOX_AD_II },
2083 { USB_DEVICE(0xeb1a, 0xe323),
2084 .driver_info = EM2882_BOARD_KWORLD_VS_DVBT },
2085 { USB_DEVICE(0xeb1a, 0xe350),
2086 .driver_info = EM2870_BOARD_KWORLD_350U },
2087 { USB_DEVICE(0xeb1a, 0xe355),
2088 .driver_info = EM2870_BOARD_KWORLD_355U },
2089 { USB_DEVICE(0xeb1a, 0x2801),
2090 .driver_info = EM2800_BOARD_GRABBEEX_USB2800 },
2091 { USB_DEVICE(0xeb1a, 0xe357),
2092 .driver_info = EM2870_BOARD_KWORLD_355U },
1985f6fb
AP
2093 { USB_DEVICE(0xeb1a, 0xe359),
2094 .driver_info = EM2870_BOARD_KWORLD_355U },
ac40d9e0
DSL
2095 { USB_DEVICE(0x1b80, 0xe302),
2096 .driver_info = EM2820_BOARD_PINNACLE_DVC_90 }, /* Kaiser Baas Video to DVD maker */
ea47689e
DSL
2097 { USB_DEVICE(0x1b80, 0xe304),
2098 .driver_info = EM2820_BOARD_PINNACLE_DVC_90 }, /* Kworld DVD Maker 2 */
c23f5949
MCC
2099 { USB_DEVICE(0x0ccd, 0x0036),
2100 .driver_info = EM2820_BOARD_TERRATEC_CINERGY_250 },
95b86a9a
DSL
2101 { USB_DEVICE(0x0ccd, 0x004c),
2102 .driver_info = EM2880_BOARD_TERRATEC_HYBRID_XS_FR },
2103 { USB_DEVICE(0x0ccd, 0x004f),
2104 .driver_info = EM2860_BOARD_TERRATEC_HYBRID_XS },
2105 { USB_DEVICE(0x0ccd, 0x005e),
2106 .driver_info = EM2882_BOARD_TERRATEC_HYBRID_XS },
2107 { USB_DEVICE(0x0ccd, 0x0042),
91245443 2108 .driver_info = EM2882_BOARD_TERRATEC_HYBRID_XS },
95b86a9a 2109 { USB_DEVICE(0x0ccd, 0x0043),
4e145349 2110 .driver_info = EM2870_BOARD_TERRATEC_XS },
6c3b906c 2111 { USB_DEVICE(0x0ccd, 0x008e), /* Cinergy HTC USB XS Rev. 1 */
89040136 2112 .driver_info = EM2884_BOARD_TERRATEC_HTC_USB_XS },
6c3b906c 2113 { USB_DEVICE(0x0ccd, 0x00ac), /* Cinergy HTC USB XS Rev. 2 */
89040136 2114 .driver_info = EM2884_BOARD_TERRATEC_HTC_USB_XS },
4e145349 2115 { USB_DEVICE(0x0ccd, 0x10a2), /* H5 Rev. 1 */
fec528b7 2116 .driver_info = EM2884_BOARD_TERRATEC_H5 },
4e145349 2117 { USB_DEVICE(0x0ccd, 0x10ad), /* H5 Rev. 2 */
33ba28ee 2118 .driver_info = EM2884_BOARD_TERRATEC_H5 },
676fa7d4
RS
2119 { USB_DEVICE(0x0ccd, 0x10b6), /* H5 Rev. 3 */
2120 .driver_info = EM2884_BOARD_TERRATEC_H5 },
766ed64d
MCC
2121 { USB_DEVICE(0x0ccd, 0x0084),
2122 .driver_info = EM2860_BOARD_TERRATEC_AV350 },
4557af9c
MCC
2123 { USB_DEVICE(0x0ccd, 0x0096),
2124 .driver_info = EM2860_BOARD_TERRATEC_GRABBY },
efabaaf3
T
2125 { USB_DEVICE(0x0ccd, 0x10AF),
2126 .driver_info = EM2860_BOARD_TERRATEC_GRABBY },
a1ed02e9
AO
2127 { USB_DEVICE(0x0ccd, 0x00b2),
2128 .driver_info = EM2884_BOARD_CINERGY_HTC_STICK },
8298f2f8
AT
2129 { USB_DEVICE(0x0fd9, 0x0033),
2130 .driver_info = EM2860_BOARD_ELGATO_VIDEO_CAPTURE},
95b86a9a
DSL
2131 { USB_DEVICE(0x185b, 0x2870),
2132 .driver_info = EM2870_BOARD_COMPRO_VIDEOMATE },
d3603341 2133 { USB_DEVICE(0x185b, 0x2041),
ee281b85 2134 .driver_info = EM2820_BOARD_COMPRO_VIDEOMATE_FORYOU },
c23f5949
MCC
2135 { USB_DEVICE(0x2040, 0x4200),
2136 .driver_info = EM2820_BOARD_HAUPPAUGE_WINTV_USB_2 },
15b9becc
MCC
2137 { USB_DEVICE(0x2040, 0x4201),
2138 .driver_info = EM2820_BOARD_HAUPPAUGE_WINTV_USB_2 },
c23f5949
MCC
2139 { USB_DEVICE(0x2040, 0x6500),
2140 .driver_info = EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900 },
427d20c4 2141 { USB_DEVICE(0x2040, 0x6502),
17d9d558 2142 .driver_info = EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900_R2 },
74ee0510 2143 { USB_DEVICE(0x2040, 0x6513), /* HCW HVR-980 */
10ac6603 2144 .driver_info = EM2883_BOARD_HAUPPAUGE_WINTV_HVR_950 },
74ee0510 2145 { USB_DEVICE(0x2040, 0x6517), /* HP HVR-950 */
10ac6603 2146 .driver_info = EM2883_BOARD_HAUPPAUGE_WINTV_HVR_950 },
74ee0510 2147 { USB_DEVICE(0x2040, 0x651b), /* RP HVR-950 */
10ac6603 2148 .driver_info = EM2883_BOARD_HAUPPAUGE_WINTV_HVR_950 },
f89bc329
DSL
2149 { USB_DEVICE(0x2040, 0x651f),
2150 .driver_info = EM2883_BOARD_HAUPPAUGE_WINTV_HVR_850 },
e14b3658
DH
2151 { USB_DEVICE(0x0438, 0xb002),
2152 .driver_info = EM2880_BOARD_AMD_ATI_TV_WONDER_HD_600 },
95b86a9a
DSL
2153 { USB_DEVICE(0x2001, 0xf112),
2154 .driver_info = EM2820_BOARD_DLINK_USB_TV },
2155 { USB_DEVICE(0x2304, 0x0207),
2156 .driver_info = EM2820_BOARD_PINNACLE_DVC_90 },
2157 { USB_DEVICE(0x2304, 0x0208),
2158 .driver_info = EM2820_BOARD_PINNACLE_USB_2 },
2159 { USB_DEVICE(0x2304, 0x021a),
2160 .driver_info = EM2820_BOARD_PINNACLE_DVC_90 },
2161 { USB_DEVICE(0x2304, 0x0226),
09bc1942 2162 .driver_info = EM2882_BOARD_PINNACLE_HYBRID_PRO_330E },
95b86a9a
DSL
2163 { USB_DEVICE(0x2304, 0x0227),
2164 .driver_info = EM2880_BOARD_PINNACLE_PCTV_HD_PRO },
2165 { USB_DEVICE(0x0413, 0x6023),
2166 .driver_info = EM2800_BOARD_LEADTEK_WINFAST_USBII },
74e07f3e
DK
2167 { USB_DEVICE(0x093b, 0xa003),
2168 .driver_info = EM2820_BOARD_PINNACLE_DVC_90 },
95b86a9a
DSL
2169 { USB_DEVICE(0x093b, 0xa005),
2170 .driver_info = EM2861_BOARD_PLEXTOR_PX_TV100U },
f74a61e3
IK
2171 { USB_DEVICE(0x04bb, 0x0515),
2172 .driver_info = EM2820_BOARD_IODATA_GVMVP_SZ },
7c8b5679
ZW
2173 { USB_DEVICE(0xeb1a, 0x50a6),
2174 .driver_info = EM2860_BOARD_GADMEI_UTV330 },
7e48b30a
JW
2175 { USB_DEVICE(0x1b80, 0xa340),
2176 .driver_info = EM2870_BOARD_KWORLD_A340 },
d6a5f921
AP
2177 { USB_DEVICE(0x2013, 0x024f),
2178 .driver_info = EM28174_BOARD_PCTV_290E },
36588715
AP
2179 { USB_DEVICE(0x2013, 0x024c),
2180 .driver_info = EM28174_BOARD_PCTV_460E },
82e7dbbd
EDP
2181 { USB_DEVICE(0x2040, 0x1605),
2182 .driver_info = EM2884_BOARD_HAUPPAUGE_WINTV_HVR_930C },
4159d01b
MCC
2183 { USB_DEVICE(0x1b80, 0xe755),
2184 .driver_info = EM2884_BOARD_C3TECH_DIGITAL_DUO },
4d28d3d9
GW
2185 { USB_DEVICE(0xeb1a, 0x5006),
2186 .driver_info = EM2860_BOARD_HT_VIDBOX_NW03 },
2f78604a
MC
2187 { USB_DEVICE(0x1b80, 0xe309), /* Sveon STV40 */
2188 .driver_info = EM2860_BOARD_EASYCAP },
3553085c
AP
2189 { USB_DEVICE(0x1b80, 0xe425),
2190 .driver_info = EM2874_BOARD_MAXMEDIA_UB425_TC },
fa5527cd
IK
2191 { USB_DEVICE(0x2304, 0x0242),
2192 .driver_info = EM2884_BOARD_PCTV_510E },
c247d7b1
AP
2193 { USB_DEVICE(0x2013, 0x0251),
2194 .driver_info = EM2884_BOARD_PCTV_520E },
7c1dfdb0
JH
2195 { USB_DEVICE(0x1b80, 0xe1cc),
2196 .driver_info = EM2874_BOARD_DELOCK_61959 },
a6c2ba28 2197 { },
2198};
c23f5949 2199MODULE_DEVICE_TABLE(usb, em28xx_id_table);
03910cc3 2200
102a0b08
MCC
2201/*
2202 * EEPROM hash table for devices with generic USB IDs
2203 */
a1a6ee74 2204static struct em28xx_hash_table em28xx_eeprom_hash[] = {
ea4fd567 2205 /* P/N: SA 60002070465 Tuner: TVF7533-MF */
c23f5949 2206 {0x6ce05a8f, EM2820_BOARD_PROLINK_PLAYTV_USB2, TUNER_YMEC_TVF_5533MF},
1e1addd5 2207 {0x72cc5a8b, EM2820_BOARD_PROLINK_PLAYTV_BOX4_USB2, TUNER_YMEC_TVF_5533MF},
da3808e1 2208 {0x966a0441, EM2880_BOARD_KWORLD_DVB_310U, TUNER_XC2028},
a35c87c7 2209 {0x166a0441, EM2880_BOARD_EMPIRE_DUAL_TV, TUNER_XC2028},
19859229 2210 {0xcee44a99, EM2882_BOARD_EVGA_INDTUBE, TUNER_XC2028},
d5b3ba9c 2211 {0xb8846b20, EM2881_BOARD_PINNACLE_HYBRID_PRO, TUNER_XC2028},
285eb1a4 2212 {0x63f653bd, EM2870_BOARD_REDDO_DVB_C_USB_BOX, TUNER_ABSENT},
7ca7ef60 2213 {0x4e913442, EM2882_BOARD_DIKOM_DK300, TUNER_XC2028},
03910cc3 2214};
a6c2ba28 2215
d2ba055d 2216/* I2C devicelist hash table for devices with generic USB IDs */
fad7b958 2217static struct em28xx_hash_table em28xx_i2c_hash[] = {
c23f5949
MCC
2218 {0xb06a32c3, EM2800_BOARD_TERRATEC_CINERGY_200, TUNER_LG_PAL_NEW_TAPC},
2219 {0xf51200e3, EM2800_BOARD_VGEAR_POCKETTV, TUNER_LG_PAL_NEW_TAPC},
3ed58baf 2220 {0x1ba50080, EM2860_BOARD_SAA711X_REFERENCE_DESIGN, TUNER_ABSENT},
443fed9f 2221 {0x77800080, EM2860_BOARD_TVP5150_REFERENCE_DESIGN, TUNER_ABSENT},
f7fe3e6f 2222 {0xc51200e3, EM2820_BOARD_GADMEI_TVR200, TUNER_LG_PAL_NEW_TAPC},
6d888a66 2223 {0x4ba50080, EM2861_BOARD_GADMEI_UTV330PLUS, TUNER_TNF_5335MF},
ebaefdb7 2224 {0x6b800080, EM2874_BOARD_LEADERSHIP_ISDBT, TUNER_ABSENT},
fad7b958 2225};
87b52439 2226/* NOTE: introduce a separate hash table for devices with 16 bit eeproms */
fad7b958 2227
f2cf250a
DSL
2228/* I2C possible address to saa7115, tvp5150, msp3400, tvaudio */
2229static unsigned short saa711x_addrs[] = {
2230 0x4a >> 1, 0x48 >> 1, /* SAA7111, SAA7111A and SAA7113 */
2231 0x42 >> 1, 0x40 >> 1, /* SAA7114, SAA7115 and SAA7118 */
2232 I2C_CLIENT_END };
2233
2234static unsigned short tvp5150_addrs[] = {
2235 0xb8 >> 1,
2236 0xba >> 1,
2237 I2C_CLIENT_END
2238};
2239
2240static unsigned short msp3400_addrs[] = {
2241 0x80 >> 1,
2242 0x88 >> 1,
2243 I2C_CLIENT_END
2244};
2245
d7cba043 2246int em28xx_tuner_callback(void *ptr, int component, int command, int arg)
ee6e3a86 2247{
bc3d2928
HV
2248 struct em28xx_i2c_bus *i2c_bus = ptr;
2249 struct em28xx *dev = i2c_bus->dev;
102a0b08 2250 int rc = 0;
ee6e3a86 2251
82e7dbbd 2252 if (dev->tuner_type != TUNER_XC2028 && dev->tuner_type != TUNER_XC5000)
ee6e3a86
MCC
2253 return 0;
2254
82e7dbbd 2255 if (command != XC2028_TUNER_RESET && command != XC5000_TUNER_RESET)
ee6e3a86
MCC
2256 return 0;
2257
017ab4b1 2258 rc = em28xx_gpio_set(dev, dev->board.tuner_gpio);
ee6e3a86 2259
ee6e3a86
MCC
2260 return rc;
2261}
2262EXPORT_SYMBOL_GPL(em28xx_tuner_callback);
2263
a1a6ee74 2264static inline void em28xx_set_model(struct em28xx *dev)
ee6e3a86 2265{
e0f6e4d6 2266 dev->board = em28xx_boards[dev->model];
ed14e1c2
DH
2267
2268 /* Those are the default values for the majority of boards
2269 Use those values if not specified otherwise at boards entry
2270 */
2271 if (!dev->board.xclk)
2272 dev->board.xclk = EM28XX_XCLK_IR_RC5_MODE |
2273 EM28XX_XCLK_FREQUENCY_12MHZ;
2274
2275 if (!dev->board.i2c_speed)
2276 dev->board.i2c_speed = EM28XX_I2C_CLK_WAIT_ENABLE |
2277 EM28XX_I2C_FREQ_100_KHZ;
3aa2b3b9 2278
aab3125c
MCC
2279 /* Should be initialized early, for I2C to work */
2280 dev->def_i2c_bus = dev->board.def_i2c_bus;
ee6e3a86
MCC
2281}
2282
03910cc3
MCC
2283/* Since em28xx_pre_card_setup() requires a proper dev->model,
2284 * this won't work for boards with generic PCI IDs
2285 */
60332f03 2286static void em28xx_pre_card_setup(struct em28xx *dev)
a94e95b4 2287{
ed14e1c2
DH
2288 /* Set the initial XCLK and I2C clock values based on the board
2289 definition */
505b6d0b 2290 em28xx_write_reg(dev, EM28XX_R0F_XCLK, dev->board.xclk & 0x7f);
ca80cf60
SS
2291 if (!dev->board.is_em2800)
2292 em28xx_write_reg(dev, EM28XX_R06_I2C_CLK, dev->board.i2c_speed);
a2070c66
MCC
2293 msleep(50);
2294
a94e95b4 2295 /* request some modules */
c23f5949 2296 switch (dev->model) {
95b86a9a 2297 case EM2861_BOARD_PLEXTOR_PX_TV100U:
0a6e44d1
MCC
2298 /* Sets the msp34xx I2S speed */
2299 dev->i2s_speed = 2048000;
95b86a9a 2300 break;
95b86a9a
DSL
2301 case EM2861_BOARD_KWORLD_PVRTV_300U:
2302 case EM2880_BOARD_KWORLD_DVB_305U:
6d676d8a 2303 em28xx_write_reg(dev, EM28XX_R08_GPIO, 0x6d);
95b86a9a 2304 msleep(10);
6d676d8a 2305 em28xx_write_reg(dev, EM28XX_R08_GPIO, 0x7d);
95b86a9a
DSL
2306 msleep(10);
2307 break;
95b86a9a 2308 case EM2870_BOARD_COMPRO_VIDEOMATE:
95b86a9a
DSL
2309 /* TODO: someone can do some cleanup here...
2310 not everything's needed */
6d676d8a 2311 em28xx_write_reg(dev, EM2880_R04_GPO, 0x00);
95b86a9a 2312 msleep(10);
6d676d8a 2313 em28xx_write_reg(dev, EM2880_R04_GPO, 0x01);
95b86a9a 2314 msleep(10);
6d676d8a 2315 em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xfd);
95b86a9a 2316 mdelay(70);
6d676d8a 2317 em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xfc);
95b86a9a 2318 mdelay(70);
6d676d8a 2319 em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xdc);
95b86a9a 2320 mdelay(70);
6d676d8a 2321 em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xfc);
95b86a9a
DSL
2322 mdelay(70);
2323 break;
95b86a9a 2324 case EM2870_BOARD_TERRATEC_XS_MT2060:
95b86a9a
DSL
2325 /* this device needs some gpio writes to get the DVB-T
2326 demod work */
6d676d8a 2327 em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xfe);
95b86a9a 2328 mdelay(70);
6d676d8a 2329 em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xde);
95b86a9a 2330 mdelay(70);
6d676d8a 2331 em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xfe);
95b86a9a
DSL
2332 mdelay(70);
2333 break;
95b86a9a 2334 case EM2870_BOARD_PINNACLE_PCTV_DVB:
95b86a9a
DSL
2335 /* this device needs some gpio writes to get the
2336 DVB-T demod work */
6d676d8a 2337 em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xfe);
95b86a9a 2338 mdelay(70);
6d676d8a 2339 em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xde);
95b86a9a 2340 mdelay(70);
6d676d8a 2341 em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xfe);
95b86a9a 2342 mdelay(70);
95b86a9a 2343 break;
95b86a9a 2344 case EM2820_BOARD_GADMEI_UTV310:
95b86a9a 2345 case EM2820_BOARD_MSI_VOX_USB_2:
a2070c66 2346 /* enables audio for that devices */
6d676d8a 2347 em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xfd);
102a0b08 2348 break;
0bf4f6ce 2349
d7de5d8f
FM
2350 case EM2882_BOARD_KWORLD_ATSC_315U:
2351 em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xff);
2352 msleep(10);
2353 em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xfe);
2354 msleep(10);
2355 em28xx_write_reg(dev, EM2880_R04_GPO, 0x00);
2356 msleep(10);
2357 em28xx_write_reg(dev, EM2880_R04_GPO, 0x08);
2358 msleep(10);
2359 break;
2360
0bf4f6ce
MCC
2361 case EM2860_BOARD_KAIOMY_TVNPC_U2:
2362 em28xx_write_regs(dev, EM28XX_R0F_XCLK, "\x07", 1);
2363 em28xx_write_regs(dev, EM28XX_R06_I2C_CLK, "\x40", 1);
2364 em28xx_write_regs(dev, 0x0d, "\x42", 1);
2365 em28xx_write_regs(dev, 0x08, "\xfd", 1);
2366 msleep(10);
2367 em28xx_write_regs(dev, 0x08, "\xff", 1);
2368 msleep(10);
2369 em28xx_write_regs(dev, 0x08, "\x7f", 1);
2370 msleep(10);
2371 em28xx_write_regs(dev, 0x08, "\x6b", 1);
2372
2373 break;
56ee3807
MCC
2374 case EM2860_BOARD_EASYCAP:
2375 em28xx_write_regs(dev, 0x08, "\xf8", 1);
2376 break;
2377
f74a61e3
IK
2378 case EM2820_BOARD_IODATA_GVMVP_SZ:
2379 em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xff);
2380 msleep(70);
2381 em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xf7);
2382 msleep(10);
2383 em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xfe);
2384 msleep(70);
2385 em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xfd);
2386 msleep(70);
2387 break;
102a0b08 2388 }
c67ec53f 2389
017ab4b1 2390 em28xx_gpio_set(dev, dev->board.tuner_gpio);
c67ec53f
MCC
2391 em28xx_set_mode(dev, EM28XX_ANALOG_MODE);
2392
2393 /* Unlock device */
2fe3e2ee 2394 em28xx_set_mode(dev, EM28XX_SUSPEND);
a94e95b4
MR
2395}
2396
e54318e5 2397static void em28xx_setup_xc3028(struct em28xx *dev, struct xc2028_ctrl *ctl)
3ca9c093
MCC
2398{
2399 memset(ctl, 0, sizeof(*ctl));
2400
2401 ctl->fname = XC2028_DEFAULT_FIRMWARE;
2402 ctl->max_len = 64;
2403 ctl->mts = em28xx_boards[dev->model].mts_firmware;
2404
2405 switch (dev->model) {
e5db5d44 2406 case EM2880_BOARD_EMPIRE_DUAL_TV:
e77ebdaa 2407 case EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900:
ec994d05 2408 case EM2882_BOARD_TERRATEC_HYBRID_XS:
e77ebdaa
MCC
2409 ctl->demod = XC3028_FE_ZARLINK456;
2410 break;
655b8408 2411 case EM2880_BOARD_TERRATEC_HYBRID_XS:
cec4e6c1 2412 case EM2880_BOARD_TERRATEC_HYBRID_XS_FR:
e16e5a37 2413 case EM2881_BOARD_PINNACLE_HYBRID_PRO:
655b8408 2414 ctl->demod = XC3028_FE_ZARLINK456;
2415 break;
17d9d558 2416 case EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900_R2:
ad9b4bb2 2417 case EM2882_BOARD_PINNACLE_HYBRID_PRO_330E:
17d9d558
DH
2418 ctl->demod = XC3028_FE_DEFAULT;
2419 break;
5ea7fe48
DH
2420 case EM2880_BOARD_AMD_ATI_TV_WONDER_HD_600:
2421 ctl->demod = XC3028_FE_DEFAULT;
2422 ctl->fname = XC3028L_DEFAULT_FIRMWARE;
2423 break;
f89bc329 2424 case EM2883_BOARD_HAUPPAUGE_WINTV_HVR_850:
10ac6603 2425 case EM2883_BOARD_HAUPPAUGE_WINTV_HVR_950:
4fd305b2 2426 case EM2880_BOARD_PINNACLE_PCTV_HD_PRO:
e77ebdaa 2427 /* FIXME: Better to specify the needed IF */
bdfbf952
DH
2428 ctl->demod = XC3028_FE_DEFAULT;
2429 break;
6e7b9ea0 2430 case EM2883_BOARD_KWORLD_HYBRID_330U:
7ca7ef60 2431 case EM2882_BOARD_DIKOM_DK300:
811fab62 2432 case EM2882_BOARD_KWORLD_VS_DVBT:
6e7b9ea0
RK
2433 ctl->demod = XC3028_FE_CHINA;
2434 ctl->fname = XC2028_DEFAULT_FIRMWARE;
2435 break;
19859229
DH
2436 case EM2882_BOARD_EVGA_INDTUBE:
2437 ctl->demod = XC3028_FE_CHINA;
2438 ctl->fname = XC3028L_DEFAULT_FIRMWARE;
2439 break;
3ca9c093
MCC
2440 default:
2441 ctl->demod = XC3028_FE_OREN538;
2442 }
2443}
3ca9c093 2444
f2cf250a 2445static void em28xx_tuner_setup(struct em28xx *dev)
882876bf 2446{
03910cc3
MCC
2447 struct tuner_setup tun_setup;
2448 struct v4l2_frequency f;
2449
ed086314 2450 if (dev->tuner_type == TUNER_ABSENT)
03910cc3
MCC
2451 return;
2452
f2cf250a
DSL
2453 memset(&tun_setup, 0, sizeof(tun_setup));
2454
03910cc3 2455 tun_setup.mode_mask = T_ANALOG_TV | T_RADIO;
03910cc3
MCC
2456 tun_setup.tuner_callback = em28xx_tuner_callback;
2457
f2cf250a
DSL
2458 if (dev->board.radio.type) {
2459 tun_setup.type = dev->board.radio.type;
2460 tun_setup.addr = dev->board.radio_addr;
2461
2462 v4l2_device_call_all(&dev->v4l2_dev, 0, tuner, s_type_addr, &tun_setup);
2463 }
2464
2465 if ((dev->tuner_type != TUNER_ABSENT) && (dev->tuner_type)) {
2466 tun_setup.type = dev->tuner_type;
2467 tun_setup.addr = dev->tuner_addr;
2468
2469 v4l2_device_call_all(&dev->v4l2_dev, 0, tuner, s_type_addr, &tun_setup);
2470 }
2471
2472 if (dev->tda9887_conf) {
2473 struct v4l2_priv_tun_config tda9887_cfg;
2474
2475 tda9887_cfg.tuner = TUNER_TDA9887;
2476 tda9887_cfg.priv = &dev->tda9887_conf;
2477
2478 v4l2_device_call_all(&dev->v4l2_dev, 0, tuner, s_config, &tda9887_cfg);
2479 }
03910cc3
MCC
2480
2481 if (dev->tuner_type == TUNER_XC2028) {
f2cf250a 2482 struct v4l2_priv_tun_config xc2028_cfg;
3ca9c093 2483 struct xc2028_ctrl ctl;
03910cc3 2484
f2cf250a
DSL
2485 memset(&xc2028_cfg, 0, sizeof(xc2028_cfg));
2486 memset(&ctl, 0, sizeof(ctl));
2487
3ca9c093 2488 em28xx_setup_xc3028(dev, &ctl);
03910cc3
MCC
2489
2490 xc2028_cfg.tuner = TUNER_XC2028;
2491 xc2028_cfg.priv = &ctl;
882876bf 2492
f2cf250a 2493 v4l2_device_call_all(&dev->v4l2_dev, 0, tuner, s_config, &xc2028_cfg);
03910cc3
MCC
2494 }
2495
2496 /* configure tuner */
2497 f.tuner = 0;
2498 f.type = V4L2_TUNER_ANALOG_TV;
2499 f.frequency = 9076; /* just a magic number */
2500 dev->ctl_freq = f.frequency;
f2cf250a 2501 v4l2_device_call_all(&dev->v4l2_dev, 0, tuner, s_frequency, &f);
03910cc3
MCC
2502}
2503
2504static int em28xx_hint_board(struct em28xx *dev)
2505{
2506 int i;
882876bf 2507
2d466e11
FS
2508 if (dev->board.is_webcam) {
2509 if (dev->em28xx_sensor == EM28XX_MT9V011) {
2510 dev->model = EM2820_BOARD_SILVERCREST_WEBCAM;
2511 } else if (dev->em28xx_sensor == EM28XX_MT9M001 ||
2512 dev->em28xx_sensor == EM28XX_MT9M111) {
2513 dev->model = EM2750_BOARD_UNKNOWN;
2514 }
2515 /* FIXME: IMPROVE ! */
2516
2517 return 0;
2518 }
2519
d2ba055d
MCC
2520 /* HINT method: EEPROM
2521 *
2522 * This method works only for boards with eeprom.
2523 * Uses a hash of all eeprom bytes. The hash should be
2524 * unique for a vendor/tuner pair.
2525 * There are a high chance that tuners for different
2526 * video standards produce different hashes.
2527 */
2528 for (i = 0; i < ARRAY_SIZE(em28xx_eeprom_hash); i++) {
2529 if (dev->hash == em28xx_eeprom_hash[i].hash) {
2530 dev->model = em28xx_eeprom_hash[i].model;
2531 dev->tuner_type = em28xx_eeprom_hash[i].tuner;
882876bf 2532
03910cc3
MCC
2533 em28xx_errdev("Your board has no unique USB ID.\n");
2534 em28xx_errdev("A hint were successfully done, "
2535 "based on eeprom hash.\n");
2536 em28xx_errdev("This method is not 100%% failproof.\n");
2537 em28xx_errdev("If the board were missdetected, "
2538 "please email this log to:\n");
2539 em28xx_errdev("\tV4L Mailing List "
51caf91f 2540 " <linux-media@vger.kernel.org>\n");
03910cc3
MCC
2541 em28xx_errdev("Board detected as %s\n",
2542 em28xx_boards[dev->model].name);
882876bf 2543
03910cc3
MCC
2544 return 0;
2545 }
2546 }
fad7b958 2547
d2ba055d
MCC
2548 /* HINT method: I2C attached devices
2549 *
2550 * This method works for all boards.
2551 * Uses a hash of i2c scanned devices.
2552 * Devices with the same i2c attached chips will
2553 * be considered equal.
2554 * This method is less precise than the eeprom one.
2555 */
2556
fad7b958
SS
2557 /* user did not request i2c scanning => do it now */
2558 if (!dev->i2c_hash)
aab3125c 2559 em28xx_do_i2c_scan(dev, dev->def_i2c_bus);
fad7b958
SS
2560
2561 for (i = 0; i < ARRAY_SIZE(em28xx_i2c_hash); i++) {
2562 if (dev->i2c_hash == em28xx_i2c_hash[i].hash) {
2563 dev->model = em28xx_i2c_hash[i].model;
2564 dev->tuner_type = em28xx_i2c_hash[i].tuner;
2565 em28xx_errdev("Your board has no unique USB ID.\n");
2566 em28xx_errdev("A hint were successfully done, "
2567 "based on i2c devicelist hash.\n");
2568 em28xx_errdev("This method is not 100%% failproof.\n");
2569 em28xx_errdev("If the board were missdetected, "
2570 "please email this log to:\n");
2571 em28xx_errdev("\tV4L Mailing List "
51caf91f 2572 " <linux-media@vger.kernel.org>\n");
fad7b958
SS
2573 em28xx_errdev("Board detected as %s\n",
2574 em28xx_boards[dev->model].name);
2575
2576 return 0;
2577 }
2578 }
2579
03910cc3
MCC
2580 em28xx_errdev("Your board has no unique USB ID and thus need a "
2581 "hint to be detected.\n");
2582 em28xx_errdev("You may try to use card=<n> insmod option to "
2583 "workaround that.\n");
2584 em28xx_errdev("Please send an email with this log to:\n");
51caf91f 2585 em28xx_errdev("\tV4L Mailing List <linux-media@vger.kernel.org>\n");
03910cc3 2586 em28xx_errdev("Board eeprom hash is 0x%08lx\n", dev->hash);
fad7b958 2587 em28xx_errdev("Board i2c devicelist hash is 0x%08lx\n", dev->i2c_hash);
03910cc3
MCC
2588
2589 em28xx_errdev("Here is a list of valid choices for the card=<n>"
2590 " insmod option:\n");
2591 for (i = 0; i < em28xx_bcount; i++) {
2592 em28xx_errdev(" card=%d -> %s\n",
2593 i, em28xx_boards[i].name);
2594 }
2595 return -1;
882876bf
MCC
2596}
2597
60332f03 2598static void em28xx_card_setup(struct em28xx *dev)
a6c2ba28 2599{
3d3215c4
MCC
2600 /*
2601 * If the device can be a webcam, seek for a sensor.
2602 * If sensor is not found, then it isn't a webcam.
2603 */
2604 if (dev->board.is_webcam) {
b3944c8f 2605 if (em28xx_detect_sensor(dev) < 0)
3d3215c4
MCC
2606 dev->board.is_webcam = 0;
2607 else
2608 dev->progressive = 1;
ca3dfd6a
MCC
2609 }
2610
2d466e11
FS
2611 switch (dev->model) {
2612 case EM2750_BOARD_UNKNOWN:
2613 case EM2820_BOARD_UNKNOWN:
2614 case EM2800_BOARD_UNKNOWN:
ca3dfd6a
MCC
2615 /*
2616 * The K-WORLD DVB-T 310U is detected as an MSI Digivox AD.
2617 *
2618 * This occurs because they share identical USB vendor and
2619 * product IDs.
2620 *
2621 * What we do here is look up the EEPROM hash of the K-WORLD
2622 * and if it is found then we decide that we do not have
2623 * a DIGIVOX and reset the device to the K-WORLD instead.
2624 *
2625 * This solution is only valid if they do not share eeprom
2626 * hash identities which has not been determined as yet.
2627 */
2628 if (em28xx_hint_board(dev) < 0)
2629 em28xx_errdev("Board not discovered\n");
2630 else {
2631 em28xx_set_model(dev);
2632 em28xx_pre_card_setup(dev);
2633 }
2634 break;
2d466e11
FS
2635 default:
2636 em28xx_set_model(dev);
ca3dfd6a 2637 }
3d3215c4
MCC
2638
2639 em28xx_info("Identified as %s (card=%d)\n",
2640 dev->board.name, dev->model);
f8b6030c
MCC
2641
2642 dev->tuner_type = em28xx_boards[dev->model].tuner_type;
31e0530c
MCC
2643 if (em28xx_boards[dev->model].tuner_addr)
2644 dev->tuner_addr = em28xx_boards[dev->model].tuner_addr;
f8b6030c 2645
ae3340cb
FM
2646 if (em28xx_boards[dev->model].tda9887_conf)
2647 dev->tda9887_conf = em28xx_boards[dev->model].tda9887_conf;
2648
a6c2ba28 2649 /* request some modules */
03910cc3
MCC
2650 switch (dev->model) {
2651 case EM2820_BOARD_HAUPPAUGE_WINTV_USB_2:
98ae127c 2652 case EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900:
17d9d558 2653 case EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900_R2:
f89bc329 2654 case EM2883_BOARD_HAUPPAUGE_WINTV_HVR_850:
10ac6603 2655 case EM2883_BOARD_HAUPPAUGE_WINTV_HVR_950:
a6166018 2656 case EM2884_BOARD_HAUPPAUGE_WINTV_HVR_930C:
03910cc3
MCC
2657 {
2658 struct tveeprom tv;
a217968f
FS
2659
2660 if (dev->eedata == NULL)
2661 break;
ac07bb73 2662#if defined(CONFIG_MODULES) && defined(MODULE)
03910cc3 2663 request_module("tveeprom");
a6c2ba28 2664#endif
03910cc3
MCC
2665 /* Call first TVeeprom */
2666
c7a45e5b
MCC
2667 dev->i2c_client[dev->def_i2c_bus].addr = 0xa0 >> 1;
2668 tveeprom_hauppauge_analog(&dev->i2c_client[dev->def_i2c_bus], &tv, dev->eedata);
4d17d083 2669
03910cc3 2670 dev->tuner_type = tv.tuner_type;
ed086314 2671
38f9d308 2672 if (tv.audio_processor == V4L2_IDENT_MSPX4XX) {
03910cc3 2673 dev->i2s_speed = 2048000;
505b6d0b 2674 dev->board.has_msp34xx = 1;
03910cc3
MCC
2675 }
2676 break;
a6c2ba28 2677 }
d7de5d8f
FM
2678 case EM2882_BOARD_KWORLD_ATSC_315U:
2679 em28xx_write_reg(dev, 0x0d, 0x42);
2680 msleep(10);
2681 em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xfd);
2682 msleep(10);
2683 break;
03910cc3
MCC
2684 case EM2820_BOARD_KWORLD_PVRTV2800RF:
2685 /* GPIO enables sound on KWORLD PVR TV 2800RF */
6d676d8a 2686 em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xf9);
03910cc3
MCC
2687 break;
2688 case EM2820_BOARD_UNKNOWN:
2689 case EM2800_BOARD_UNKNOWN:
da3808e1
DB
2690 /*
2691 * The K-WORLD DVB-T 310U is detected as an MSI Digivox AD.
2692 *
2693 * This occurs because they share identical USB vendor and
2694 * product IDs.
2695 *
2696 * What we do here is look up the EEPROM hash of the K-WORLD
2697 * and if it is found then we decide that we do not have
2698 * a DIGIVOX and reset the device to the K-WORLD instead.
2699 *
2700 * This solution is only valid if they do not share eeprom
2701 * hash identities which has not been determined as yet.
2702 */
2703 case EM2880_BOARD_MSI_DIGIVOX_AD:
f8b6030c
MCC
2704 if (!em28xx_hint_board(dev))
2705 em28xx_set_model(dev);
cdf7bfa8
DH
2706
2707 /* In cases where we had to use a board hint, the call to
7ca7ef60
AA
2708 em28xx_set_mode() in em28xx_pre_card_setup() was a no-op,
2709 so make the call now so the analog GPIOs are set properly
2710 before probing the i2c bus. */
2711 em28xx_gpio_set(dev, dev->board.tuner_gpio);
2712 em28xx_set_mode(dev, EM28XX_ANALOG_MODE);
2713 break;
2714
a217968f 2715 /*
7ca7ef60
AA
2716 * The Dikom DK300 is detected as an Kworld VS-DVB-T 323UR.
2717 *
2718 * This occurs because they share identical USB vendor and
2719 * product IDs.
2720 *
2721 * What we do here is look up the EEPROM hash of the Dikom
2722 * and if it is found then we decide that we do not have
2723 * a Kworld and reset the device to the Dikom instead.
2724 *
2725 * This solution is only valid if they do not share eeprom
2726 * hash identities which has not been determined as yet.
2727 */
2728 case EM2882_BOARD_KWORLD_VS_DVBT:
2729 if (!em28xx_hint_board(dev))
2730 em28xx_set_model(dev);
2731
2732 /* In cases where we had to use a board hint, the call to
cdf7bfa8
DH
2733 em28xx_set_mode() in em28xx_pre_card_setup() was a no-op,
2734 so make the call now so the analog GPIOs are set properly
2735 before probing the i2c bus. */
5343e446 2736 em28xx_gpio_set(dev, dev->board.tuner_gpio);
cdf7bfa8 2737 em28xx_set_mode(dev, EM28XX_ANALOG_MODE);
95b86a9a 2738 break;
03910cc3
MCC
2739 }
2740
505b6d0b 2741 if (dev->board.valid == EM28XX_BOARD_NOT_VALIDATED) {
95b86a9a
DSL
2742 em28xx_errdev("\n\n");
2743 em28xx_errdev("The support for this board weren't "
2744 "valid yet.\n");
2745 em28xx_errdev("Please send a report of having this working\n");
2746 em28xx_errdev("not to V4L mailing list (and/or to other "
2747 "addresses)\n\n");
2748 }
2749
a217968f
FS
2750 /* Free eeprom data memory */
2751 kfree(dev->eedata);
2752 dev->eedata = NULL;
2753
f8b6030c 2754 /* Allow override tuner type by a module parameter */
03910cc3
MCC
2755 if (tuner >= 0)
2756 dev->tuner_type = tuner;
2757
03910cc3 2758 /* request some modules */
505b6d0b 2759 if (dev->board.has_msp34xx)
c7a45e5b 2760 v4l2_i2c_new_subdev(&dev->v4l2_dev, &dev->i2c_adap[dev->def_i2c_bus],
9a1f8b34 2761 "msp3400", 0, msp3400_addrs);
f2cf250a 2762
ec5de990 2763 if (dev->board.decoder == EM28XX_SAA711X)
c7a45e5b 2764 v4l2_i2c_new_subdev(&dev->v4l2_dev, &dev->i2c_adap[dev->def_i2c_bus],
9a1f8b34 2765 "saa7115_auto", 0, saa711x_addrs);
f2cf250a 2766
505b6d0b 2767 if (dev->board.decoder == EM28XX_TVP5150)
c7a45e5b 2768 v4l2_i2c_new_subdev(&dev->v4l2_dev, &dev->i2c_adap[dev->def_i2c_bus],
9a1f8b34 2769 "tvp5150", 0, tvp5150_addrs);
03910cc3 2770
f2cf250a 2771 if (dev->board.adecoder == EM28XX_TVAUDIO)
c7a45e5b 2772 v4l2_i2c_new_subdev(&dev->v4l2_dev, &dev->i2c_adap[dev->def_i2c_bus],
9a1f8b34 2773 "tvaudio", dev->board.tvaudio_addr, NULL);
f2cf250a
DSL
2774
2775 if (dev->board.tuner_type != TUNER_ABSENT) {
2776 int has_demod = (dev->tda9887_conf & TDA9887_PRESENT);
2777
2778 if (dev->board.radio.type)
c7a45e5b 2779 v4l2_i2c_new_subdev(&dev->v4l2_dev, &dev->i2c_adap[dev->def_i2c_bus],
9a1f8b34 2780 "tuner", dev->board.radio_addr, NULL);
f2cf250a
DSL
2781
2782 if (has_demod)
53dacb15 2783 v4l2_i2c_new_subdev(&dev->v4l2_dev,
c7a45e5b 2784 &dev->i2c_adap[dev->def_i2c_bus], "tuner",
53dacb15 2785 0, v4l2_i2c_tuner_addrs(ADDRS_DEMOD));
f2cf250a
DSL
2786 if (dev->tuner_addr == 0) {
2787 enum v4l2_i2c_tuner_type type =
2788 has_demod ? ADDRS_TV_WITH_DEMOD : ADDRS_TV;
2789 struct v4l2_subdev *sd;
2790
53dacb15 2791 sd = v4l2_i2c_new_subdev(&dev->v4l2_dev,
c7a45e5b 2792 &dev->i2c_adap[dev->def_i2c_bus], "tuner",
53dacb15 2793 0, v4l2_i2c_tuner_addrs(type));
f2cf250a
DSL
2794
2795 if (sd)
2796 dev->tuner_addr = v4l2_i2c_subdev_addr(sd);
2797 } else {
c7a45e5b 2798 v4l2_i2c_new_subdev(&dev->v4l2_dev, &dev->i2c_adap[dev->def_i2c_bus],
9a1f8b34 2799 "tuner", dev->tuner_addr, NULL);
f2cf250a
DSL
2800 }
2801 }
a924a499 2802
f2cf250a 2803 em28xx_tuner_setup(dev);
484fbbeb
FS
2804
2805 em28xx_init_camera(dev);
a6c2ba28 2806}
c8644057 2807
1a23f81b 2808
1a23f81b
MCC
2809static void request_module_async(struct work_struct *work)
2810{
2811 struct em28xx *dev = container_of(work,
2812 struct em28xx, request_module_wk);
2813
6ae5e060
MCC
2814 /*
2815 * The em28xx extensions can be modules or builtin. If the
2816 * modules are already loaded or are built in, those extensions
2817 * can be initialised right now. Otherwise, the module init
2818 * code will do it.
2819 */
2820 em28xx_init_extension(dev);
2821
2822#if defined(CONFIG_MODULES) && defined(MODULE)
1a23f81b
MCC
2823 if (dev->has_audio_class)
2824 request_module("snd-usb-audio");
2825 else if (dev->has_alsa_audio)
2826 request_module("em28xx-alsa");
2827
2828 if (dev->board.has_dvb)
2829 request_module("em28xx-dvb");
2b64cbd1
FS
2830 if (dev->board.has_snapshot_button ||
2831 ((dev->board.ir_codes || dev->board.has_ir_i2c) && !disable_ir))
f4d4e765 2832 request_module("em28xx-rc");
6ae5e060 2833#endif /* CONFIG_MODULES */
1a23f81b
MCC
2834}
2835
2836static void request_modules(struct em28xx *dev)
2837{
2838 INIT_WORK(&dev->request_module_wk, request_module_async);
2839 schedule_work(&dev->request_module_wk);
2840}
707bcf32
TH
2841
2842static void flush_request_modules(struct em28xx *dev)
2843{
43829731 2844 flush_work(&dev->request_module_wk);
707bcf32 2845}
1a23f81b
MCC
2846
2847/*
d7222e7d 2848 * em28xx_release_resources()
1a23f81b 2849 * unregisters the v4l2,i2c and usb devices
d7222e7d 2850 * called when the device gets disconnected or at module unload
1a23f81b
MCC
2851*/
2852void em28xx_release_resources(struct em28xx *dev)
2853{
1a23f81b
MCC
2854 /*FIXME: I2C IR should be disconnected */
2855
2856 em28xx_release_analog_resources(dev);
2857
aab3125c
MCC
2858 if (dev->def_i2c_bus)
2859 em28xx_i2c_unregister(dev, 1);
2860 em28xx_i2c_unregister(dev, 0);
f2cf250a 2861
081b945e
HV
2862 v4l2_ctrl_handler_free(&dev->ctrl_handler);
2863
f2cf250a
DSL
2864 v4l2_device_unregister(&dev->v4l2_dev);
2865
1a23f81b
MCC
2866 usb_put_dev(dev->udev);
2867
2868 /* Mark device as unused */
38b61eb2 2869 clear_bit(dev->devno, &em28xx_devused);
1a23f81b
MCC
2870};
2871
2872/*
2873 * em28xx_init_dev()
2874 * allocates and inits the device structs, registers i2c bus and v4l device
2875 */
622c2fc1 2876static int em28xx_init_dev(struct em28xx *dev, struct usb_device *udev,
36fa674e 2877 struct usb_interface *interface,
1a23f81b
MCC
2878 int minor)
2879{
081b945e 2880 struct v4l2_ctrl_handler *hdl = &dev->ctrl_handler;
fcd20e3c 2881 int retval;
a3efa1cc
MCC
2882 static const char *default_chip_name = "em28xx";
2883 const char *chip_name = default_chip_name;
1a23f81b
MCC
2884
2885 dev->udev = udev;
d3829fad
DH
2886 mutex_init(&dev->vb_queue_lock);
2887 mutex_init(&dev->vb_vbi_queue_lock);
1a23f81b
MCC
2888 mutex_init(&dev->ctrl_urb_lock);
2889 spin_lock_init(&dev->slock);
1a23f81b
MCC
2890
2891 dev->em28xx_write_regs = em28xx_write_regs;
2892 dev->em28xx_read_reg = em28xx_read_reg;
2893 dev->em28xx_read_reg_req_len = em28xx_read_reg_req_len;
2894 dev->em28xx_write_regs_req = em28xx_write_regs_req;
2895 dev->em28xx_read_reg_req = em28xx_read_reg_req;
2896 dev->board.is_em2800 = em28xx_boards[dev->model].is_em2800;
2897
fcd20e3c
MCC
2898 em28xx_set_model(dev);
2899
2900 /* Set the default GPO/GPIO for legacy devices */
2901 dev->reg_gpo_num = EM2880_R04_GPO;
2902 dev->reg_gpio_num = EM28XX_R08_GPIO;
2903
2904 dev->wait_after_write = 5;
2905
2906 /* Based on the Chip ID, set the device configuration */
2907 retval = em28xx_read_reg(dev, EM28XX_R0A_CHIPID);
2908 if (retval > 0) {
2909 dev->chip_id = retval;
2910
2911 switch (dev->chip_id) {
f57b17c3 2912 case CHIP_ID_EM2800:
a3efa1cc 2913 chip_name = "em2800";
f57b17c3 2914 break;
fcd20e3c 2915 case CHIP_ID_EM2710:
a3efa1cc 2916 chip_name = "em2710";
fcd20e3c
MCC
2917 break;
2918 case CHIP_ID_EM2750:
a3efa1cc 2919 chip_name = "em2750";
fcd20e3c 2920 break;
736a320b
FS
2921 case CHIP_ID_EM2765:
2922 chip_name = "em2765";
2923 dev->wait_after_write = 0;
2924 dev->is_em25xx = 1;
2925 dev->eeprom_addrwidth_16bit = 1;
2926 break;
fcd20e3c 2927 case CHIP_ID_EM2820:
a3efa1cc 2928 chip_name = "em2710/2820";
1552fb34
FS
2929 if (le16_to_cpu(dev->udev->descriptor.idVendor)
2930 == 0xeb1a) {
61ff5d69
FS
2931 __le16 idProd = dev->udev->descriptor.idProduct;
2932 if (le16_to_cpu(idProd) == 0x2710)
2933 chip_name = "em2710";
2934 else if (le16_to_cpu(idProd) == 0x2820)
2935 chip_name = "em2820";
2936 }
2937 /* NOTE: the em2820 is used in webcams, too ! */
fcd20e3c
MCC
2938 break;
2939 case CHIP_ID_EM2840:
a3efa1cc 2940 chip_name = "em2840";
fcd20e3c
MCC
2941 break;
2942 case CHIP_ID_EM2860:
a3efa1cc 2943 chip_name = "em2860";
fcd20e3c
MCC
2944 break;
2945 case CHIP_ID_EM2870:
a3efa1cc 2946 chip_name = "em2870";
fcd20e3c
MCC
2947 dev->wait_after_write = 0;
2948 break;
2949 case CHIP_ID_EM2874:
a3efa1cc 2950 chip_name = "em2874";
fcd20e3c
MCC
2951 dev->reg_gpio_num = EM2874_R80_GPIO;
2952 dev->wait_after_write = 0;
87b52439 2953 dev->eeprom_addrwidth_16bit = 1;
fcd20e3c 2954 break;
bc022694 2955 case CHIP_ID_EM28174:
a3efa1cc 2956 chip_name = "em28174";
bc022694
AP
2957 dev->reg_gpio_num = EM2874_R80_GPIO;
2958 dev->wait_after_write = 0;
87b52439 2959 dev->eeprom_addrwidth_16bit = 1;
bc022694 2960 break;
fcd20e3c 2961 case CHIP_ID_EM2883:
a3efa1cc 2962 chip_name = "em2882/3";
fcd20e3c
MCC
2963 dev->wait_after_write = 0;
2964 break;
fec528b7 2965 case CHIP_ID_EM2884:
a3efa1cc 2966 chip_name = "em2884";
fec528b7
MCC
2967 dev->reg_gpio_num = EM2874_R80_GPIO;
2968 dev->wait_after_write = 0;
87b52439 2969 dev->eeprom_addrwidth_16bit = 1;
fec528b7 2970 break;
fcd20e3c 2971 default:
a3efa1cc
MCC
2972 printk(KERN_INFO DRIVER_NAME
2973 ": unknown em28xx chip ID (%d)\n", dev->chip_id);
fcd20e3c
MCC
2974 }
2975 }
2976
a3efa1cc
MCC
2977 if (chip_name != default_chip_name)
2978 printk(KERN_INFO DRIVER_NAME
2979 ": chip ID is %s\n", chip_name);
2980
2981 /*
2982 * For em2820/em2710, the name may change latter, after checking
2983 * if the device has a sensor (so, it is em2710) or not.
2984 */
2985 snprintf(dev->name, sizeof(dev->name), "%s #%d", chip_name, dev->devno);
2986
4f83e7b3 2987 if (dev->is_audio_only) {
6c03e38b
CR
2988 retval = em28xx_audio_setup(dev);
2989 if (retval)
4f83e7b3 2990 return -ENODEV;
4f83e7b3
MCC
2991 em28xx_init_extension(dev);
2992
2993 return 0;
2994 }
2995
fcd20e3c
MCC
2996 /* Prepopulate cached GPO register content */
2997 retval = em28xx_read_reg(dev, dev->reg_gpo_num);
2998 if (retval >= 0)
2999 dev->reg_gpo = retval;
3000
1a23f81b
MCC
3001 em28xx_pre_card_setup(dev);
3002
3003 if (!dev->board.is_em2800) {
ca3dfd6a 3004 /* Resets I2C speed */
0903bb54 3005 retval = em28xx_write_reg(dev, EM28XX_R06_I2C_CLK, dev->board.i2c_speed);
1a23f81b 3006 if (retval < 0) {
6c03e38b 3007 em28xx_errdev("%s: em28xx_write_reg failed!"
1a23f81b
MCC
3008 " retval [%d]\n",
3009 __func__, retval);
3010 return retval;
3011 }
3012 }
3013
36fa674e 3014 retval = v4l2_device_register(&interface->dev, &dev->v4l2_dev);
f2cf250a
DSL
3015 if (retval < 0) {
3016 em28xx_errdev("Call to v4l2_device_register() failed!\n");
3017 return retval;
3018 }
3019
8f8b113a 3020 v4l2_ctrl_handler_init(hdl, 8);
081b945e
HV
3021 dev->v4l2_dev.ctrl_handler = hdl;
3022
aab3125c
MCC
3023 rt_mutex_init(&dev->i2c_bus_lock);
3024
3025 /* register i2c bus 0 */
a3ea4bf9
FS
3026 if (dev->board.is_em2800)
3027 retval = em28xx_i2c_register(dev, 0, EM28XX_I2C_ALGO_EM2800);
3028 else
3029 retval = em28xx_i2c_register(dev, 0, EM28XX_I2C_ALGO_EM28XX);
6c03e38b 3030 if (retval < 0) {
aab3125c 3031 em28xx_errdev("%s: em28xx_i2c_register bus 0 - error [%d]!\n",
6c03e38b
CR
3032 __func__, retval);
3033 goto unregister_dev;
1a23f81b
MCC
3034 }
3035
a3ea4bf9 3036 /* register i2c bus 1 */
aab3125c 3037 if (dev->def_i2c_bus) {
736a320b
FS
3038 if (dev->is_em25xx)
3039 retval = em28xx_i2c_register(dev, 1,
3040 EM28XX_I2C_ALGO_EM25XX_BUS_B);
3041 else
3042 retval = em28xx_i2c_register(dev, 1,
3043 EM28XX_I2C_ALGO_EM28XX);
aab3125c
MCC
3044 if (retval < 0) {
3045 em28xx_errdev("%s: em28xx_i2c_register bus 1 - error [%d]!\n",
3046 __func__, retval);
3047 goto unregister_dev;
3048 }
3049 }
3050
579d3152
MCC
3051 /*
3052 * Default format, used for tvp5150 or saa711x output formats
3053 */
3054 dev->vinmode = 0x10;
206313db
DH
3055 dev->vinctl = EM28XX_VINCTRL_INTERLACED |
3056 EM28XX_VINCTRL_CCIR656_ENABLE;
579d3152 3057
1a23f81b
MCC
3058 /* Do board specific init and eeprom reading */
3059 em28xx_card_setup(dev);
3060
3061 /* Configure audio */
6c03e38b
CR
3062 retval = em28xx_audio_setup(dev);
3063 if (retval < 0) {
3064 em28xx_errdev("%s: Error while setting audio - error [%d]!\n",
3065 __func__, retval);
3066 goto fail;
1a23f81b 3067 }
081b945e
HV
3068 if (dev->audio_mode.ac97 != EM28XX_NO_AC97) {
3069 v4l2_ctrl_new_std(hdl, &em28xx_ctrl_ops,
3070 V4L2_CID_AUDIO_MUTE, 0, 1, 1, 1);
3071 v4l2_ctrl_new_std(hdl, &em28xx_ctrl_ops,
3072 V4L2_CID_AUDIO_VOLUME, 0, 0x1f, 1, 0x1f);
3073 } else {
3074 /* install the em28xx notify callback */
3075 v4l2_ctrl_notify(v4l2_ctrl_find(hdl, V4L2_CID_AUDIO_MUTE),
3076 em28xx_ctrl_notify, dev);
3077 v4l2_ctrl_notify(v4l2_ctrl_find(hdl, V4L2_CID_AUDIO_VOLUME),
3078 em28xx_ctrl_notify, dev);
3079 }
1a23f81b
MCC
3080
3081 /* wake i2c devices */
3082 em28xx_wake_i2c(dev);
3083
3084 /* init video dma queues */
3085 INIT_LIST_HEAD(&dev->vidq.active);
28abf083 3086 INIT_LIST_HEAD(&dev->vbiq.active);
1a23f81b 3087
1a23f81b
MCC
3088 if (dev->board.has_msp34xx) {
3089 /* Send a reset to other chips via gpio */
6c03e38b
CR
3090 retval = em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xf7);
3091 if (retval < 0) {
3092 em28xx_errdev("%s: em28xx_write_reg - "
3093 "msp34xx(1) failed! error [%d]\n",
3094 __func__, retval);
3095 goto fail;
1a23f81b
MCC
3096 }
3097 msleep(3);
3098
6c03e38b
CR
3099 retval = em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xff);
3100 if (retval < 0) {
3101 em28xx_errdev("%s: em28xx_write_reg - "
3102 "msp34xx(2) failed! error [%d]\n",
3103 __func__, retval);
3104 goto fail;
1a23f81b
MCC
3105 }
3106 msleep(3);
3107 }
3108
1a23f81b
MCC
3109 retval = em28xx_register_analog_devices(dev);
3110 if (retval < 0) {
6c03e38b 3111 goto fail;
1a23f81b
MCC
3112 }
3113
1a23f81b 3114 /* Save some power by putting tuner to sleep */
622b828a 3115 v4l2_device_call_all(&dev->v4l2_dev, 0, core, s_power, 0);
1a23f81b
MCC
3116
3117 return 0;
3118
6c03e38b 3119fail:
aab3125c
MCC
3120 if (dev->def_i2c_bus)
3121 em28xx_i2c_unregister(dev, 1);
3122 em28xx_i2c_unregister(dev, 0);
081b945e 3123 v4l2_ctrl_handler_free(&dev->ctrl_handler);
6c03e38b
CR
3124
3125unregister_dev:
3126 v4l2_device_unregister(&dev->v4l2_dev);
3127
1a23f81b
MCC
3128 return retval;
3129}
3130
4f83e7b3
MCC
3131/* high bandwidth multiplier, as encoded in highspeed endpoint descriptors */
3132#define hb_mult(wMaxPacketSize) (1 + (((wMaxPacketSize) >> 11) & 0x03))
3133
1a23f81b
MCC
3134/*
3135 * em28xx_usb_probe()
3136 * checks for supported devices
3137 */
3138static int em28xx_usb_probe(struct usb_interface *interface,
3139 const struct usb_device_id *id)
3140{
1a23f81b 3141 struct usb_device *udev;
1a23f81b 3142 struct em28xx *dev = NULL;
f2cf250a 3143 int retval;
8ab33626 3144 bool has_audio = false, has_video = false, has_dvb = false;
8b2aea78 3145 int i, nr, try_bulk;
4f83e7b3 3146 const int ifnum = interface->altsetting[0].desc.bInterfaceNumber;
1a23f81b 3147 char *speed;
1a23f81b
MCC
3148
3149 udev = usb_get_dev(interface_to_usbdev(interface));
1a23f81b
MCC
3150
3151 /* Check to see next free device and mark as used */
38b61eb2
CR
3152 do {
3153 nr = find_first_zero_bit(&em28xx_devused, EM28XX_MAXBOARDS);
3154 if (nr >= EM28XX_MAXBOARDS) {
3155 /* No free device slots */
3156 printk(DRIVER_NAME ": Supports only %i em28xx boards.\n",
3157 EM28XX_MAXBOARDS);
3158 retval = -ENOMEM;
3159 goto err_no_slot;
3160 }
3161 } while (test_and_set_bit(nr, &em28xx_devused));
1a23f81b
MCC
3162
3163 /* Don't register audio interfaces */
3164 if (interface->altsetting[0].desc.bInterfaceClass == USB_CLASS_AUDIO) {
3165 em28xx_err(DRIVER_NAME " audio device (%04x:%04x): "
3166 "interface %i, class %i\n",
3167 le16_to_cpu(udev->descriptor.idVendor),
3168 le16_to_cpu(udev->descriptor.idProduct),
3169 ifnum,
3170 interface->altsetting[0].desc.bInterfaceClass);
3171
f2cf250a
DSL
3172 retval = -ENODEV;
3173 goto err;
1a23f81b
MCC
3174 }
3175
8ab33626
HN
3176 /* allocate memory for our device state and initialize it */
3177 dev = kzalloc(sizeof(*dev), GFP_KERNEL);
3178 if (dev == NULL) {
3179 em28xx_err(DRIVER_NAME ": out of memory!\n");
3180 retval = -ENOMEM;
3181 goto err;
3182 }
3183
3184 /* compute alternate max packet sizes */
0cf544a6
FS
3185 dev->alt_max_pkt_size_isoc =
3186 kmalloc(sizeof(dev->alt_max_pkt_size_isoc[0]) *
8ab33626 3187 interface->num_altsetting, GFP_KERNEL);
0cf544a6 3188 if (dev->alt_max_pkt_size_isoc == NULL) {
8ab33626
HN
3189 em28xx_errdev("out of memory!\n");
3190 kfree(dev);
3191 retval = -ENOMEM;
3192 goto err;
3193 }
3194
4f83e7b3
MCC
3195 /* Get endpoints */
3196 for (i = 0; i < interface->num_altsetting; i++) {
3197 int ep;
3198
3199 for (ep = 0; ep < interface->altsetting[i].desc.bNumEndpoints; ep++) {
8ab33626
HN
3200 const struct usb_endpoint_descriptor *e;
3201 int sizedescr, size;
3202
3203 e = &interface->altsetting[i].endpoint[ep].desc;
3204
3205 sizedescr = le16_to_cpu(e->wMaxPacketSize);
3206 size = sizedescr & 0x7ff;
3207
3208 if (udev->speed == USB_SPEED_HIGH)
3209 size = size * hb_mult(sizedescr);
3210
c647a91a 3211 if (usb_endpoint_dir_in(e)) {
8ab33626 3212 switch (e->bEndpointAddress) {
c647a91a 3213 case 0x82:
8ab33626 3214 has_video = true;
c647a91a
FS
3215 if (usb_endpoint_xfer_isoc(e)) {
3216 dev->analog_ep_isoc =
3217 e->bEndpointAddress;
3218 dev->alt_max_pkt_size_isoc[i] = size;
3219 } else if (usb_endpoint_xfer_bulk(e)) {
3220 dev->analog_ep_bulk =
3221 e->bEndpointAddress;
3222 }
3223 break;
3224 case 0x83:
3225 if (usb_endpoint_xfer_isoc(e)) {
3226 has_audio = true;
3227 } else {
3228 printk(KERN_INFO DRIVER_NAME
3229 ": error: skipping audio endpoint 0x83, because it uses bulk transfers !\n");
3230 }
8ab33626 3231 break;
c647a91a
FS
3232 case 0x84:
3233 if (has_video &&
3234 (usb_endpoint_xfer_bulk(e))) {
3235 dev->analog_ep_bulk =
3236 e->bEndpointAddress;
3237 } else {
c647a91a 3238 if (usb_endpoint_xfer_isoc(e)) {
c647a91a 3239 if (size > dev->dvb_max_pkt_size_isoc) {
72cc9ba3 3240 has_dvb = true; /* see NOTE (~) */
b3404a8e 3241 dev->dvb_ep_isoc = e->bEndpointAddress;
c647a91a
FS
3242 dev->dvb_max_pkt_size_isoc = size;
3243 dev->dvb_alt_isoc = i;
3244 }
3245 } else {
72cc9ba3 3246 has_dvb = true;
c647a91a
FS
3247 dev->dvb_ep_bulk = e->bEndpointAddress;
3248 }
8ab33626
HN
3249 }
3250 break;
3251 }
3252 }
c647a91a
FS
3253 /* NOTE:
3254 * Old logic with support for isoc transfers only was:
3255 * 0x82 isoc => analog
3256 * 0x83 isoc => audio
3257 * 0x84 isoc => digital
3258 *
3259 * New logic with support for bulk transfers
3260 * 0x82 isoc => analog
3261 * 0x82 bulk => analog
3262 * 0x83 isoc* => audio
3263 * 0x84 isoc => digital
3264 * 0x84 bulk => analog or digital**
3265 * (*: audio should always be isoc)
3266 * (**: analog, if ep 0x82 is isoc, otherwise digital)
3267 *
3268 * The new logic preserves backwards compatibility and
3269 * reflects the endpoint configurations we have seen
3270 * so far. But there might be devices for which this
3271 * logic is not sufficient...
3272 */
72cc9ba3
FS
3273 /*
3274 * NOTE (~): some manufacturers (e.g. Terratec) disable
3275 * endpoints by setting wMaxPacketSize to 0 bytes for
3276 * all alt settings. So far, we've seen this for
3277 * DVB isoc endpoints only.
3278 */
4f83e7b3
MCC
3279 }
3280 }
3281
8ab33626
HN
3282 if (!(has_audio || has_video || has_dvb)) {
3283 retval = -ENODEV;
3284 goto err_free;
1a23f81b
MCC
3285 }
3286
3287 switch (udev->speed) {
3288 case USB_SPEED_LOW:
3289 speed = "1.5";
3290 break;
3291 case USB_SPEED_UNKNOWN:
3292 case USB_SPEED_FULL:
3293 speed = "12";
3294 break;
3295 case USB_SPEED_HIGH:
3296 speed = "480";
3297 break;
3298 default:
3299 speed = "unknown";
3300 }
3301
4f83e7b3 3302 printk(KERN_INFO DRIVER_NAME
401a582f
EG
3303 ": New device %s %s @ %s Mbps "
3304 "(%04x:%04x, interface %d, class %d)\n",
3305 udev->manufacturer ? udev->manufacturer : "",
3306 udev->product ? udev->product : "",
1a23f81b
MCC
3307 speed,
3308 le16_to_cpu(udev->descriptor.idVendor),
3309 le16_to_cpu(udev->descriptor.idProduct),
3310 ifnum,
3311 interface->altsetting->desc.bInterfaceNumber);
3312
64a00b43
DH
3313 /*
3314 * Make sure we have 480 Mbps of bandwidth, otherwise things like
3315 * video stream wouldn't likely work, since 12 Mbps is generally
3316 * not enough even for most Digital TV streams.
3317 */
e2a1b79f 3318 if (udev->speed != USB_SPEED_HIGH && disable_usb_speed_check == 0) {
64a00b43
DH
3319 printk(DRIVER_NAME ": Device initialization failed.\n");
3320 printk(DRIVER_NAME ": Device must be connected to a high-speed"
3321 " USB 2.0 port.\n");
64a00b43 3322 retval = -ENODEV;
8ab33626 3323 goto err_free;
1a23f81b
MCC
3324 }
3325
1a23f81b
MCC
3326 dev->devno = nr;
3327 dev->model = id->driver_info;
3328 dev->alt = -1;
8ab33626 3329 dev->is_audio_only = has_audio && !(has_video || has_dvb);
4f83e7b3
MCC
3330 dev->has_alsa_audio = has_audio;
3331 dev->audio_ifnum = ifnum;
1a23f81b
MCC
3332
3333 /* Checks if audio is provided by some interface */
3334 for (i = 0; i < udev->config->desc.bNumInterfaces; i++) {
4f83e7b3 3335 struct usb_interface *uif = udev->config->interface[i];
1a23f81b
MCC
3336 if (uif->altsetting[0].desc.bInterfaceClass == USB_CLASS_AUDIO) {
3337 dev->has_audio_class = 1;
3338 break;
3339 }
3340 }
3341
aa51496b
MCC
3342 if (has_audio)
3343 printk(KERN_INFO DRIVER_NAME
3344 ": Audio interface %i found %s\n",
3345 ifnum,
3346 dev->has_audio_class ? "(USB Audio Class)" : "(Vendor Class)");
3347 if (has_video)
3348 printk(KERN_INFO DRIVER_NAME
3349 ": Video interface %i found:%s%s\n",
3350 ifnum,
3351 dev->analog_ep_bulk ? " bulk" : "",
3352 dev->analog_ep_isoc ? " isoc" : "");
3353 if (has_dvb)
3354 printk(KERN_INFO DRIVER_NAME
3355 ": DVB interface %i found:%s%s\n",
3356 ifnum,
3357 dev->dvb_ep_bulk ? " bulk" : "",
3358 dev->dvb_ep_isoc ? " isoc" : "");
3359
4f83e7b3 3360 dev->num_alt = interface->num_altsetting;
1a23f81b 3361
d3e4ea01 3362 if ((unsigned)card[nr] < em28xx_bcount)
1a23f81b
MCC
3363 dev->model = card[nr];
3364
4f83e7b3
MCC
3365 /* save our data pointer in this interface device */
3366 usb_set_intfdata(interface, dev);
3367
d3829fad
DH
3368 /* initialize videobuf2 stuff */
3369 em28xx_vb2_setup(dev);
3370
1a23f81b
MCC
3371 /* allocate device struct */
3372 mutex_init(&dev->lock);
3373 mutex_lock(&dev->lock);
622c2fc1 3374 retval = em28xx_init_dev(dev, udev, interface, nr);
1a23f81b 3375 if (retval) {
8ab33626 3376 goto unlock_and_free;
1a23f81b
MCC
3377 }
3378
7e5d74ee 3379 if (usb_xfer_mode < 0) {
8b2aea78
MCC
3380 if (dev->board.is_webcam)
3381 try_bulk = 1;
3382 else
3383 try_bulk = 0;
3384 } else {
7e5d74ee 3385 try_bulk = usb_xfer_mode > 0;
8b2aea78
MCC
3386 }
3387
3388 /* Select USB transfer types to use */
3389 if (has_video) {
3390 if (!dev->analog_ep_isoc || (try_bulk && dev->analog_ep_bulk))
3391 dev->analog_xfer_bulk = 1;
3392 em28xx_info("analog set to %s mode.\n",
3393 dev->analog_xfer_bulk ? "bulk" : "isoc");
3394 }
86d38d1e 3395 if (has_dvb) {
8b2aea78
MCC
3396 if (!dev->dvb_ep_isoc || (try_bulk && dev->dvb_ep_bulk))
3397 dev->dvb_xfer_bulk = 1;
3398
3399 em28xx_info("dvb set to %s mode.\n",
3400 dev->dvb_xfer_bulk ? "bulk" : "isoc");
3401
c647a91a
FS
3402 /* pre-allocate DVB usb transfer buffers */
3403 if (dev->dvb_xfer_bulk) {
3404 retval = em28xx_alloc_urbs(dev, EM28XX_DIGITAL_MODE,
3405 dev->dvb_xfer_bulk,
3406 EM28XX_DVB_NUM_BUFS,
3407 512,
3408 EM28XX_DVB_BULK_PACKET_MULTIPLIER);
3409 } else {
3410 retval = em28xx_alloc_urbs(dev, EM28XX_DIGITAL_MODE,
3411 dev->dvb_xfer_bulk,
3412 EM28XX_DVB_NUM_BUFS,
3413 dev->dvb_max_pkt_size_isoc,
3414 EM28XX_DVB_NUM_ISOC_PACKETS);
3415 }
86d38d1e 3416 if (retval) {
c647a91a
FS
3417 printk(DRIVER_NAME
3418 ": Failed to pre-allocate USB transfer buffers for DVB.\n");
86d38d1e
GG
3419 goto unlock_and_free;
3420 }
3421 }
3422
1a23f81b
MCC
3423 request_modules(dev);
3424
3425 /* Should be the last thing to do, to avoid newer udev's to
3426 open the device before fully initializing it
3427 */
3428 mutex_unlock(&dev->lock);
3429
3430 return 0;
f2cf250a 3431
8ab33626
HN
3432unlock_and_free:
3433 mutex_unlock(&dev->lock);
3434
3435err_free:
0cf544a6 3436 kfree(dev->alt_max_pkt_size_isoc);
8ab33626
HN
3437 kfree(dev);
3438
f2cf250a 3439err:
38b61eb2
CR
3440 clear_bit(nr, &em28xx_devused);
3441
3442err_no_slot:
3443 usb_put_dev(udev);
f2cf250a 3444 return retval;
1a23f81b
MCC
3445}
3446
3447/*
3448 * em28xx_usb_disconnect()
d7222e7d 3449 * called when the device gets disconnected
1a23f81b
MCC
3450 * video device will be unregistered on v4l2_close in case it is still open
3451 */
3452static void em28xx_usb_disconnect(struct usb_interface *interface)
3453{
3454 struct em28xx *dev;
3455
3456 dev = usb_get_intfdata(interface);
3457 usb_set_intfdata(interface, NULL);
3458
3459 if (!dev)
3460 return;
3461
05fe2175
FS
3462 dev->disconnected = 1;
3463
4f83e7b3
MCC
3464 if (dev->is_audio_only) {
3465 mutex_lock(&dev->lock);
3466 em28xx_close_extension(dev);
3467 mutex_unlock(&dev->lock);
3468 return;
3469 }
3470
1a23f81b
MCC
3471 em28xx_info("disconnecting %s\n", dev->vdev->name);
3472
707bcf32
TH
3473 flush_request_modules(dev);
3474
1a23f81b
MCC
3475 mutex_lock(&dev->lock);
3476
f2cf250a
DSL
3477 v4l2_device_disconnect(&dev->v4l2_dev);
3478
1a23f81b 3479 if (dev->users) {
05fe2175
FS
3480 em28xx_warn("device %s is open! Deregistration and memory deallocation are deferred on close.\n",
3481 video_device_node_name(dev->vdev));
1a23f81b 3482
05fe2175
FS
3483 em28xx_uninit_usb_xfer(dev, EM28XX_ANALOG_MODE);
3484 em28xx_uninit_usb_xfer(dev, EM28XX_DIGITAL_MODE);
1a23f81b
MCC
3485 }
3486
05fe2175
FS
3487 em28xx_close_extension(dev);
3488 /* NOTE: must be called BEFORE the resources are released */
3489
3490 if (!dev->users)
3491 em28xx_release_resources(dev);
86d38d1e 3492
1a23f81b
MCC
3493 mutex_unlock(&dev->lock);
3494
3495 if (!dev->users) {
0cf544a6 3496 kfree(dev->alt_max_pkt_size_isoc);
1a23f81b
MCC
3497 kfree(dev);
3498 }
3499}
3500
3501static struct usb_driver em28xx_usb_driver = {
3502 .name = "em28xx",
3503 .probe = em28xx_usb_probe,
3504 .disconnect = em28xx_usb_disconnect,
3505 .id_table = em28xx_id_table,
3506};
3507
ecb3b2b3 3508module_usb_driver(em28xx_usb_driver);
This page took 1.04967 seconds and 5 git commands to generate.