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