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