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