Attachment 'em28xx-cards.c'

Download

   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 
  10    This program is free software; you can redistribute it and/or modify
  11    it under the terms of the GNU General Public License as published by
  12    the Free Software Foundation; either version 2 of the License, or
  13    (at your option) any later version.
  14 
  15    This program is distributed in the hope that it will be useful,
  16    but WITHOUT ANY WARRANTY; without even the implied warranty of
  17    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  18    GNU General Public License for more details.
  19 
  20    You should have received a copy of the GNU General Public License
  21    along with this program; if not, write to the Free Software
  22    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  23  */
  24 
  25 #include <linux/init.h>
  26 #include <linux/module.h>
  27 #include <linux/delay.h>
  28 #include <linux/i2c.h>
  29 #include <linux/usb.h>
  30 #include <media/tuner.h>
  31 #include <media/msp3400.h>
  32 #include <media/saa7115.h>
  33 #include <media/tvp5150.h>
  34 #include <media/tveeprom.h>
  35 #include <media/v4l2-common.h>
  36 #include <media/v4l2-chip-ident.h>
  37 
  38 #include "em28xx.h"
  39 
  40 static int tuner = -1;
  41 module_param(tuner, int, 0444);
  42 MODULE_PARM_DESC(tuner, "tuner type");
  43 
  44 static unsigned int disable_ir;
  45 module_param(disable_ir, int, 0444);
  46 MODULE_PARM_DESC(disable_ir, "disable infrared remote support");
  47 
  48 struct em28xx_hash_table {
  49 	unsigned long hash;
  50 	unsigned int  model;
  51 	unsigned int  tuner;
  52 };
  53 
  54 struct em28xx_board em28xx_boards[] = {
  55 	[EM2750_BOARD_UNKNOWN] = {
  56 		.name          = "Unknown EM2750/EM2751 webcam grabber",
  57 		.vchannels     = 1,
  58 		.input         = { {
  59 			.type     = EM28XX_VMUX_COMPOSITE1,
  60 			.vmux     = 0,
  61 			.amux     = 0,
  62 		} },
  63 	},
  64 	[EM2800_BOARD_UNKNOWN] = {
  65 		.name         = "Unknown EM2800 video grabber",
  66 		.is_em2800    = 1,
  67 		.vchannels    = 2,
  68 		.tda9887_conf = TDA9887_PRESENT,
  69 		.decoder      = EM28XX_SAA7113,
  70 		.input           = { {
  71 			.type     = EM28XX_VMUX_COMPOSITE1,
  72 			.vmux     = SAA7115_COMPOSITE0,
  73 			.amux     = 1,
  74 		}, {
  75 			.type     = EM28XX_VMUX_SVIDEO,
  76 			.vmux     = SAA7115_SVIDEO3,
  77 			.amux     = 1,
  78 		} },
  79 	},
  80 	[EM2820_BOARD_UNKNOWN] = {
  81 		.name         = "Unknown EM2750/28xx video grabber",
  82 		.is_em2800    = 0,
  83 		.tuner_type   = TUNER_ABSENT,
  84 	},
  85 	[EM2750_BOARD_DLCW_130] = {
  86 		/* Beijing Huaqi Information Digital Technology Co., Ltd */
  87 		.name          = "Huaqi DLCW-130",
  88 		.valid         = EM28XX_BOARD_NOT_VALIDATED,
  89 		.vchannels     = 1,
  90 		.input         = { {
  91 			.type     = EM28XX_VMUX_COMPOSITE1,
  92 			.vmux     = 0,
  93 			.amux     = 0,
  94 		} },
  95 	},
  96 	[EM2820_BOARD_KWORLD_PVRTV2800RF] = {
  97 		.name         = "Kworld PVR TV 2800 RF",
  98 		.is_em2800    = 0,
  99 		.vchannels    = 2,
 100 		.tuner_type   = TUNER_TEMIC_PAL,
 101 		.tda9887_conf = TDA9887_PRESENT,
 102 		.decoder      = EM28XX_SAA7113,
 103 		.input           = { {
 104 			.type     = EM28XX_VMUX_COMPOSITE1,
 105 			.vmux     = SAA7115_COMPOSITE0,
 106 			.amux     = 1,
 107 		}, {
 108 			.type     = EM28XX_VMUX_SVIDEO,
 109 			.vmux     = SAA7115_SVIDEO3,
 110 			.amux     = 1,
 111 		} },
 112 	},
 113 	[EM2820_BOARD_TERRATEC_CINERGY_250] = {
 114 		.name         = "Terratec Cinergy 250 USB",
 115 		.vchannels    = 3,
 116 		.tuner_type   = TUNER_LG_PAL_NEW_TAPC,
 117 		.tda9887_conf = TDA9887_PRESENT,
 118 		.decoder      = EM28XX_SAA7113,
 119 		.input          = { {
 120 			.type     = EM28XX_VMUX_TELEVISION,
 121 			.vmux     = SAA7115_COMPOSITE2,
 122 			.amux     = 1,
 123 		}, {
 124 			.type     = EM28XX_VMUX_COMPOSITE1,
 125 			.vmux     = SAA7115_COMPOSITE0,
 126 			.amux     = 1,
 127 		}, {
 128 			.type     = EM28XX_VMUX_SVIDEO,
 129 			.vmux     = SAA7115_SVIDEO3,
 130 			.amux     = 1,
 131 		} },
 132 	},
 133 	[EM2820_BOARD_PINNACLE_USB_2] = {
 134 		.name         = "Pinnacle PCTV USB 2",
 135 		.vchannels    = 3,
 136 		.tuner_type   = TUNER_LG_PAL_NEW_TAPC,
 137 		.tda9887_conf = TDA9887_PRESENT,
 138 		.decoder      = EM28XX_SAA7113,
 139 		.input          = { {
 140 			.type     = EM28XX_VMUX_TELEVISION,
 141 			.vmux     = SAA7115_COMPOSITE2,
 142 			.amux     = 0,
 143 		}, {
 144 			.type     = EM28XX_VMUX_COMPOSITE1,
 145 			.vmux     = SAA7115_COMPOSITE0,
 146 			.amux     = 1,
 147 		}, {
 148 			.type     = EM28XX_VMUX_SVIDEO,
 149 			.vmux     = SAA7115_SVIDEO3,
 150 			.amux     = 1,
 151 		} },
 152 	},
 153 	[EM2820_BOARD_HAUPPAUGE_WINTV_USB_2] = {
 154 		.name         = "Hauppauge WinTV USB 2",
 155 		.vchannels    = 3,
 156 		.tuner_type   = TUNER_PHILIPS_FM1236_MK3,
 157 		.tda9887_conf = TDA9887_PRESENT |
 158 				TDA9887_PORT1_ACTIVE|
 159 				TDA9887_PORT2_ACTIVE,
 160 		.decoder      = EM28XX_TVP5150,
 161 		.has_msp34xx  = 1,
 162 		/*FIXME: S-Video not tested */
 163 		.input          = { {
 164 			.type     = EM28XX_VMUX_TELEVISION,
 165 			.vmux     = TVP5150_COMPOSITE0,
 166 			.amux     = MSP_INPUT_DEFAULT,
 167 		}, {
 168 			.type     = EM28XX_VMUX_SVIDEO,
 169 			.vmux     = TVP5150_SVIDEO,
 170 			.amux     = MSP_INPUT(MSP_IN_SCART1, MSP_IN_TUNER1,
 171 					MSP_DSP_IN_SCART, MSP_DSP_IN_SCART),
 172 		} },
 173 	},
 174 	[EM2820_BOARD_DLINK_USB_TV] = {
 175 		.name         = "D-Link DUB-T210 TV Tuner",
 176 		.valid        = EM28XX_BOARD_NOT_VALIDATED,
 177 		.vchannels    = 3,
 178 		.is_em2800    = 0,
 179 		.tuner_type   = TUNER_LG_PAL_NEW_TAPC,
 180 		.tda9887_conf = TDA9887_PRESENT,
 181 		.decoder      = EM28XX_SAA7113,
 182 		.input          = { {
 183 			.type     = EM28XX_VMUX_TELEVISION,
 184 			.vmux     = SAA7115_COMPOSITE2,
 185 			.amux     = 1,
 186 		}, {
 187 			.type     = EM28XX_VMUX_COMPOSITE1,
 188 			.vmux     = SAA7115_COMPOSITE0,
 189 			.amux     = 1,
 190 		}, {
 191 			.type     = EM28XX_VMUX_SVIDEO,
 192 			.vmux     = SAA7115_SVIDEO3,
 193 			.amux     = 1,
 194 		} },
 195 	},
 196 	[EM2820_BOARD_HERCULES_SMART_TV_USB2] = {
 197 		.name         = "Hercules Smart TV USB 2.0",
 198 		.valid        = EM28XX_BOARD_NOT_VALIDATED,
 199 		.vchannels    = 3,
 200 		.tuner_type   = TUNER_LG_PAL_NEW_TAPC,
 201 		.tda9887_conf = TDA9887_PRESENT,
 202 		.decoder      = EM28XX_SAA7113,
 203 		.input        = { {
 204 			.type     = EM28XX_VMUX_TELEVISION,
 205 			.vmux     = SAA7115_COMPOSITE2,
 206 			.amux     = 1,
 207 		}, {
 208 			.type     = EM28XX_VMUX_COMPOSITE1,
 209 			.vmux     = SAA7115_COMPOSITE0,
 210 			.amux     = 1,
 211 		}, {
 212 			.type     = EM28XX_VMUX_SVIDEO,
 213 			.vmux     = SAA7115_SVIDEO3,
 214 			.amux     = 1,
 215 		} },
 216 	},
 217 	[EM2820_BOARD_PINNACLE_USB_2_FM1216ME] = {
 218 		.name         = "Pinnacle PCTV USB 2 (Philips FM1216ME)",
 219 		.valid        = EM28XX_BOARD_NOT_VALIDATED,
 220 		.vchannels    = 3,
 221 		.is_em2800    = 0,
 222 		.tuner_type   = TUNER_PHILIPS_FM1216ME_MK3,
 223 		.tda9887_conf = TDA9887_PRESENT,
 224 		.decoder      = EM28XX_SAA7113,
 225 		.input          = { {
 226 			.type     = EM28XX_VMUX_TELEVISION,
 227 			.vmux     = SAA7115_COMPOSITE2,
 228 			.amux     = 0,
 229 		}, {
 230 			.type     = EM28XX_VMUX_COMPOSITE1,
 231 			.vmux     = SAA7115_COMPOSITE0,
 232 			.amux     = 1,
 233 		}, {
 234 			.type     = EM28XX_VMUX_SVIDEO,
 235 			.vmux     = SAA7115_SVIDEO3,
 236 			.amux     = 1,
 237 		} },
 238 	},
 239 	[EM2820_BOARD_GADMEI_UTV310] = {
 240 		.name         = "Gadmei UTV310",
 241 		.valid        = EM28XX_BOARD_NOT_VALIDATED,
 242 		.vchannels    = 3,
 243 		.tuner_type   = TUNER_TNF_5335MF,
 244 		.tda9887_conf = TDA9887_PRESENT,
 245 		.decoder      = EM28XX_SAA7113,
 246 		.input          = { {
 247 			.type     = EM28XX_VMUX_TELEVISION,
 248 			.vmux     = SAA7115_COMPOSITE1,
 249 			.amux     = 1,
 250 		}, {
 251 			.type     = EM28XX_VMUX_COMPOSITE1,
 252 			.vmux     = SAA7115_COMPOSITE0,
 253 			.amux     = 1,
 254 		}, {
 255 			.type     = EM28XX_VMUX_SVIDEO,
 256 			.vmux     = SAA7115_SVIDEO3,
 257 			.amux     = 1,
 258 		} },
 259 	},
 260 	[EM2820_BOARD_LEADTEK_WINFAST_USBII_DELUXE] = {
 261 		.name         = "Leadtek Winfast USB II Deluxe",
 262 		.valid        = EM28XX_BOARD_NOT_VALIDATED,
 263 		.vchannels    = 3,
 264 		.tuner_type   = TUNER_PHILIPS_FM1216ME_MK3,
 265 		.tda9887_conf = TDA9887_PRESENT,
 266 		.decoder      = EM28XX_SAA7114,
 267 		.input          = { {
 268 			.type     = EM28XX_VMUX_TELEVISION,
 269 			.vmux     = 2,
 270 			.amux     = 0,
 271 		}, {
 272 			.type     = EM28XX_VMUX_COMPOSITE1,
 273 			.vmux     = 0,
 274 			.amux     = 1,
 275 		}, {
 276 			.type     = EM28XX_VMUX_SVIDEO,
 277 			.vmux     = 9,
 278 			.amux     = 1,
 279 		} },
 280 	},
 281 	[EM2820_BOARD_PINNACLE_DVC_100] = {
 282 		.name         = "Pinnacle Dazzle DVC 100",
 283 		.valid        = EM28XX_BOARD_NOT_VALIDATED,
 284 		.vchannels    = 3,
 285 		.decoder      = EM28XX_SAA7113,
 286 		.input          = { {
 287 			.type     = EM28XX_VMUX_COMPOSITE1,
 288 			.vmux     = SAA7115_COMPOSITE0,
 289 			.amux     = 1,
 290 		}, {
 291 			.type     = EM28XX_VMUX_SVIDEO,
 292 			.vmux     = SAA7115_SVIDEO3,
 293 			.amux     = 1,
 294 		} },
 295 	},
 296 	[EM2820_BOARD_VIDEOLOGY_20K14XUSB] = {
 297 		.name          = "Videology 20K14XUSB USB2.0",
 298 		.valid        = EM28XX_BOARD_NOT_VALIDATED,
 299 		.vchannels     = 1,
 300 		.input         = { {
 301 			.type     = EM28XX_VMUX_COMPOSITE1,
 302 			.vmux     = 0,
 303 			.amux     = 0,
 304 		} },
 305 	},
 306 	[EM2821_BOARD_PROLINK_PLAYTV_USB2] = {
 307 		.name         = "SIIG AVTuner-PVR/Prolink PlayTV USB 2.0",
 308 		.valid        = EM28XX_BOARD_NOT_VALIDATED,
 309 		.vchannels    = 3,
 310 		.is_em2800    = 0,
 311 		.tuner_type   = TUNER_LG_PAL_NEW_TAPC,	/* unknown? */
 312 		.tda9887_conf = TDA9887_PRESENT,	/* unknown? */
 313 		.decoder      = EM28XX_SAA7113,
 314 		.input          = { {
 315 			.type     = EM28XX_VMUX_TELEVISION,
 316 			.vmux     = SAA7115_COMPOSITE2,
 317 			.amux     = 1,
 318 		}, {
 319 			.type     = EM28XX_VMUX_COMPOSITE1,
 320 			.vmux     = SAA7115_COMPOSITE0,
 321 			.amux     = 1,
 322 		}, {
 323 			.type     = EM28XX_VMUX_SVIDEO,
 324 			.vmux     = SAA7115_SVIDEO3,
 325 			.amux     = 1,
 326 		} },
 327 	},
 328 	[EM2821_BOARD_SUPERCOMP_USB_2] = {
 329 		.name         = "Supercomp USB 2.0 TV",
 330 		.valid        = EM28XX_BOARD_NOT_VALIDATED,
 331 		.vchannels    = 3,
 332 		.is_em2800    = 0,
 333 		.tuner_type   = TUNER_PHILIPS_FM1236_MK3,
 334 		.tda9887_conf = TDA9887_PRESENT |
 335 				TDA9887_PORT1_ACTIVE |
 336 				TDA9887_PORT2_ACTIVE,
 337 		.decoder      = EM28XX_SAA7113,
 338 		.input          = { {
 339 			.type     = EM28XX_VMUX_TELEVISION,
 340 			.vmux     = SAA7115_COMPOSITE2,
 341 			.amux     = 1,
 342 		}, {
 343 			.type     = EM28XX_VMUX_COMPOSITE1,
 344 			.vmux     = SAA7115_COMPOSITE0,
 345 			.amux     = 0,
 346 		}, {
 347 			.type     = EM28XX_VMUX_SVIDEO,
 348 			.vmux     = SAA7115_SVIDEO3,
 349 			.amux     = 1,
 350 		} },
 351 	},
 352 	[EM2821_BOARD_USBGEAR_VD204] = {
 353 		.name          = "Usbgear VD204v9",
 354 		.valid        = EM28XX_BOARD_NOT_VALIDATED,
 355 		.vchannels     = 2,
 356 		.decoder       = EM28XX_SAA7113,
 357 		.input          = { {
 358 			.type  = EM28XX_VMUX_COMPOSITE1,
 359 			.vmux  = SAA7115_COMPOSITE0,
 360 			.amux  = 1,
 361 		}, {
 362 			.type  = EM28XX_VMUX_SVIDEO,
 363 			.vmux  = SAA7115_SVIDEO3,
 364 			.amux  = 1,
 365 		} },
 366 	},
 367 	[EM2860_BOARD_NETGMBH_CAM] = {
 368 		/* Beijing Huaqi Information Digital Technology Co., Ltd */
 369 		.name          = "NetGMBH Cam",
 370 		.valid       = EM28XX_BOARD_NOT_VALIDATED,
 371 		.vchannels     = 1,
 372 		.input         = { {
 373 			.type     = EM28XX_VMUX_COMPOSITE1,
 374 			.vmux     = 0,
 375 			.amux     = 0,
 376 		} },
 377 	},
 378 	[EM2860_BOARD_TYPHOON_DVD_MAKER] = {
 379 		.name          = "Typhoon DVD Maker",
 380 		.valid        = EM28XX_BOARD_NOT_VALIDATED,
 381 		.vchannels     = 2,
 382 		.decoder       = EM28XX_SAA7113,
 383 		.input          = { {
 384 			.type  = EM28XX_VMUX_COMPOSITE1,
 385 			.vmux  = SAA7115_COMPOSITE0,
 386 			.amux  = 1,
 387 		}, {
 388 			.type  = EM28XX_VMUX_SVIDEO,
 389 			.vmux  = SAA7115_SVIDEO3,
 390 			.amux  = 1,
 391 		} },
 392 	},
 393 	[EM2860_BOARD_GADMEI_UTV330] = {
 394 		.name         = "Gadmei UTV330",
 395 		.valid        = EM28XX_BOARD_NOT_VALIDATED,
 396 		.vchannels    = 3,
 397 		.tuner_type   = TUNER_TNF_5335MF,
 398 		.tda9887_conf = TDA9887_PRESENT,
 399 		.decoder      = EM28XX_SAA7113,
 400 		.input          = { {
 401 			.type     = EM28XX_VMUX_TELEVISION,
 402 			.vmux     = SAA7115_COMPOSITE2,
 403 			.amux     = 0,
 404 		}, {
 405 			.type     = EM28XX_VMUX_COMPOSITE1,
 406 			.vmux     = SAA7115_COMPOSITE0,
 407 			.amux     = 1,
 408 		}, {
 409 			.type     = EM28XX_VMUX_SVIDEO,
 410 			.vmux     = SAA7115_SVIDEO3,
 411 			.amux     = 1,
 412 		} },
 413 	},
 414 	[EM2860_BOARD_TERRATEC_HYBRID_XS] = {
 415 		.name         = "Terratec Cinergy A Hybrid XS",
 416 		.valid        = EM28XX_BOARD_NOT_VALIDATED,
 417 		.vchannels    = 3,
 418 		.tuner_type   = TUNER_XC2028,
 419 		.decoder      = EM28XX_TVP5150,
 420 		.input          = { {
 421 			.type     = EM28XX_VMUX_TELEVISION,
 422 			.vmux     = TVP5150_COMPOSITE0,
 423 			.amux     = 0,
 424 		}, {
 425 			.type     = EM28XX_VMUX_COMPOSITE1,
 426 			.vmux     = TVP5150_COMPOSITE1,
 427 			.amux     = 1,
 428 		}, {
 429 			.type     = EM28XX_VMUX_SVIDEO,
 430 			.vmux     = TVP5150_SVIDEO,
 431 			.amux     = 1,
 432 		} },
 433 	},
 434 	[EM2861_BOARD_KWORLD_PVRTV_300U] = {
 435 		.name	      = "KWorld PVRTV 300U",
 436 		.valid        = EM28XX_BOARD_NOT_VALIDATED,
 437 		.vchannels    = 3,
 438 		.tuner_type   = TUNER_XC2028,
 439 		.decoder      = EM28XX_TVP5150,
 440 		.input          = { {
 441 			.type     = EM28XX_VMUX_TELEVISION,
 442 			.vmux     = TVP5150_COMPOSITE0,
 443 			.amux     = 0,
 444 		}, {
 445 			.type     = EM28XX_VMUX_COMPOSITE1,
 446 			.vmux     = TVP5150_COMPOSITE1,
 447 			.amux     = 1,
 448 		}, {
 449 			.type     = EM28XX_VMUX_SVIDEO,
 450 			.vmux     = TVP5150_SVIDEO,
 451 			.amux     = 1,
 452 		} },
 453 	},
 454 	[EM2861_BOARD_YAKUMO_MOVIE_MIXER] = {
 455 		.name          = "Yakumo MovieMixer",
 456 		.valid       = EM28XX_BOARD_NOT_VALIDATED,
 457 		.vchannels     = 1,
 458 		.decoder       = EM28XX_TVP5150,
 459 		.input         = { {
 460 			.type     = EM28XX_VMUX_TELEVISION,
 461 			.vmux     = TVP5150_COMPOSITE0,
 462 			.amux     = 0,
 463 		}, {
 464 			.type     = EM28XX_VMUX_COMPOSITE1,
 465 			.vmux     = TVP5150_COMPOSITE1,
 466 			.amux     = 1,
 467 		}, {
 468 			.type     = EM28XX_VMUX_SVIDEO,
 469 			.vmux     = TVP5150_SVIDEO,
 470 			.amux     = 1,
 471 		} },
 472 	},
 473 	[EM2861_BOARD_PLEXTOR_PX_TV100U] = {
 474 		.name         = "Plextor ConvertX PX-TV100U",
 475 		.valid        = EM28XX_BOARD_NOT_VALIDATED,
 476 		.vchannels    = 3,
 477 		.tuner_type   = TUNER_TNF_5335MF,
 478 		.tda9887_conf = TDA9887_PRESENT,
 479 		.decoder      = EM28XX_TVP5150,
 480 		.input          = { {
 481 			.type     = EM28XX_VMUX_TELEVISION,
 482 			.vmux     = TVP5150_COMPOSITE0,
 483 			.amux     = 1,
 484 		}, {
 485 			.type     = EM28XX_VMUX_COMPOSITE1,
 486 			.vmux     = TVP5150_COMPOSITE1,
 487 			.amux     = 1,
 488 		}, {
 489 			.type     = EM28XX_VMUX_SVIDEO,
 490 			.vmux     = TVP5150_SVIDEO,
 491 			.amux     = 1,
 492 		} },
 493 	},
 494 	[EM2870_BOARD_TERRATEC_XS] = {
 495 		.name         = "Terratec Cinergy T XS",
 496 		.valid        = EM28XX_BOARD_NOT_VALIDATED,
 497 		.tuner_type   = TUNER_XC2028,
 498 	},
 499 	[EM2870_BOARD_TERRATEC_XS_MT2060] = {
 500 		.name         = "Terratec Cinergy T XS (MT2060)",
 501 		.valid        = EM28XX_BOARD_NOT_VALIDATED,
 502 		.tuner_type   = TUNER_ABSENT, /* MT2060 */
 503 	},
 504 	[EM2870_BOARD_KWORLD_350U] = {
 505 		.name         = "Kworld 350 U DVB-T",
 506 		.valid        = EM28XX_BOARD_NOT_VALIDATED,
 507 		.tuner_type   = TUNER_XC2028,
 508 	},
 509 	[EM2870_BOARD_KWORLD_355U] = {
 510 		.name         = "Kworld 355 U DVB-T",
 511 		.valid        = EM28XX_BOARD_NOT_VALIDATED,
 512 	},
 513 	[EM2870_BOARD_PINNACLE_PCTV_DVB] = {
 514 		.name         = "Pinnacle PCTV DVB-T",
 515 		.valid        = EM28XX_BOARD_NOT_VALIDATED,
 516 		.tuner_type   = TUNER_ABSENT, /* MT2060 */
 517 	},
 518 	[EM2870_BOARD_COMPRO_VIDEOMATE] = {
 519 		.name         = "Compro, VideoMate U3",
 520 		.valid        = EM28XX_BOARD_NOT_VALIDATED,
 521 		.tuner_type   = TUNER_ABSENT, /* MT2060 */
 522 	},
 523 	[EM2880_BOARD_TERRATEC_HYBRID_XS_FR] = {
 524 		.name         = "Terratec Hybrid XS Secam",
 525 		.valid        = EM28XX_BOARD_NOT_VALIDATED,
 526 		.vchannels    = 3,
 527 		.has_msp34xx  = 1,
 528 		.tuner_type   = TUNER_XC2028,
 529 		.decoder      = EM28XX_TVP5150,
 530 		.input          = { {
 531 			.type     = EM28XX_VMUX_TELEVISION,
 532 			.vmux     = TVP5150_COMPOSITE0,
 533 			.amux     = 0,
 534 		}, {
 535 			.type     = EM28XX_VMUX_COMPOSITE1,
 536 			.vmux     = TVP5150_COMPOSITE1,
 537 			.amux     = 1,
 538 		}, {
 539 			.type     = EM28XX_VMUX_SVIDEO,
 540 			.vmux     = TVP5150_SVIDEO,
 541 			.amux     = 1,
 542 		} },
 543 	},
 544 	[EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900] = {
 545 		.name         = "Hauppauge WinTV HVR 900",
 546 		.vchannels    = 3,
 547 		.tda9887_conf = TDA9887_PRESENT,
 548 		.tuner_type   = TUNER_XC2028,
 549 		.mts_firmware = 1,
 550 		.has_dvb        = 1,
 551 		.decoder      = EM28XX_TVP5150,
 552 		.input          = { {
 553 			.type     = EM28XX_VMUX_TELEVISION,
 554 			.vmux     = TVP5150_COMPOSITE0,
 555 			.amux     = 0,
 556 		}, {
 557 			.type     = EM28XX_VMUX_COMPOSITE1,
 558 			.vmux     = TVP5150_COMPOSITE1,
 559 			.amux     = 1,
 560 		}, {
 561 			.type     = EM28XX_VMUX_SVIDEO,
 562 			.vmux     = TVP5150_SVIDEO,
 563 			.amux     = 1,
 564 		} },
 565 	},
 566 	[EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900_R2] = {
 567 		.name         = "Hauppauge WinTV HVR 900 (R2)",
 568 		.vchannels    = 3,
 569 		.tda9887_conf = TDA9887_PRESENT,
 570 		.tuner_type   = TUNER_XC2028,
 571 		.mts_firmware = 1,
 572 		.decoder      = EM28XX_TVP5150,
 573 		.input          = { {
 574 			.type     = EM28XX_VMUX_TELEVISION,
 575 			.vmux     = TVP5150_COMPOSITE0,
 576 			.amux     = 0,
 577 		}, {
 578 			.type     = EM28XX_VMUX_COMPOSITE1,
 579 			.vmux     = TVP5150_COMPOSITE1,
 580 			.amux     = 3,
 581 		}, {
 582 			.type     = EM28XX_VMUX_SVIDEO,
 583 			.vmux     = TVP5150_SVIDEO,
 584 			.amux     = 1,
 585 		} },
 586 	},
 587 	[EM2883_BOARD_HAUPPAUGE_WINTV_HVR_950] = {
 588 		.name           = "Hauppauge WinTV HVR 950",
 589 		.vchannels      = 3,
 590 		.tda9887_conf   = TDA9887_PRESENT,
 591 		.tuner_type     = TUNER_XC2028,
 592 		.mts_firmware   = 1,
 593 		.has_12mhz_i2s  = 1,
 594 		.has_dvb        = 1,
 595 		.decoder        = EM28XX_TVP5150,
 596 		.input          = { {
 597 			.type     = EM28XX_VMUX_TELEVISION,
 598 			.vmux     = TVP5150_COMPOSITE0,
 599 			.amux     = 0,
 600 		}, {
 601 			.type     = EM28XX_VMUX_COMPOSITE1,
 602 			.vmux     = TVP5150_COMPOSITE1,
 603 			.amux     = 1,
 604 		}, {
 605 			.type     = EM28XX_VMUX_SVIDEO,
 606 			.vmux     = TVP5150_SVIDEO,
 607 			.amux     = 1,
 608 		} },
 609 	},
 610 	[EM2880_BOARD_PINNACLE_PCTV_HD_PRO] = {
 611 		.name           = "Pinnacle PCTV HD Pro Stick",
 612 		.vchannels      = 3,
 613 		.tda9887_conf   = TDA9887_PRESENT,
 614 		.tuner_type     = TUNER_XC2028,
 615 		.mts_firmware   = 1,
 616 		.has_12mhz_i2s  = 1,
 617 		.has_dvb        = 1,
 618 		.decoder        = EM28XX_TVP5150,
 619 		.input          = { {
 620 			.type     = EM28XX_VMUX_TELEVISION,
 621 			.vmux     = TVP5150_COMPOSITE0,
 622 			.amux     = 0,
 623 		}, {
 624 			.type     = EM28XX_VMUX_COMPOSITE1,
 625 			.vmux     = TVP5150_COMPOSITE1,
 626 			.amux     = 1,
 627 		}, {
 628 			.type     = EM28XX_VMUX_SVIDEO,
 629 			.vmux     = TVP5150_SVIDEO,
 630 			.amux     = 1,
 631 		} },
 632 	},
 633 	[EM2880_BOARD_AMD_ATI_TV_WONDER_HD_600] = {
 634 		.name           = "AMD ATI TV Wonder HD 600",
 635 		.vchannels      = 3,
 636 		.tda9887_conf   = TDA9887_PRESENT,
 637 		.tuner_type     = TUNER_XC2028,
 638 		.mts_firmware   = 1,
 639 		.has_12mhz_i2s  = 1,
 640 		.has_dvb        = 1,
 641 		.decoder        = EM28XX_TVP5150,
 642 		.input          = { {
 643 			.type     = EM28XX_VMUX_TELEVISION,
 644 			.vmux     = TVP5150_COMPOSITE0,
 645 			.amux     = 0,
 646 		}, {
 647 			.type     = EM28XX_VMUX_COMPOSITE1,
 648 			.vmux     = TVP5150_COMPOSITE1,
 649 			.amux     = 1,
 650 		}, {
 651 			.type     = EM28XX_VMUX_SVIDEO,
 652 			.vmux     = TVP5150_SVIDEO,
 653 			.amux     = 1,
 654 		} },
 655 	},
 656 	[EM2880_BOARD_TERRATEC_HYBRID_XS] = {
 657 		.name         = "Terratec Hybrid XS",
 658 		.vchannels    = 3,
 659 		.tda9887_conf = TDA9887_PRESENT,
 660 		.tuner_type   = TUNER_XC2028,
 661 		.decoder      = EM28XX_TVP5150,
 662 		.has_dvb        = 1,
 663 		.input          = { {
 664 			.type     = EM28XX_VMUX_TELEVISION,
 665 			.vmux     = TVP5150_COMPOSITE0,
 666 			.amux     = 0,
 667 		}, {
 668 			.type     = EM28XX_VMUX_COMPOSITE1,
 669 			.vmux     = TVP5150_COMPOSITE1,
 670 			.amux     = 1,
 671 		}, {
 672 			.type     = EM28XX_VMUX_SVIDEO,
 673 			.vmux     = TVP5150_SVIDEO,
 674 			.amux     = 1,
 675 		} },
 676 	},
 677 	/* maybe there's a reason behind it why Terratec sells the Hybrid XS
 678 	   as Prodigy XS with a different PID, let's keep it separated for now
 679 	   maybe we'll need it lateron */
 680 	[EM2880_BOARD_TERRATEC_PRODIGY_XS] = {
 681 		.name         = "Terratec Prodigy XS",
 682 		.vchannels    = 3,
 683 		.tda9887_conf = TDA9887_PRESENT,
 684 		.tuner_type   = TUNER_XC2028,
 685 		.decoder      = EM28XX_TVP5150,
 686 		.input          = { {
 687 			.type     = EM28XX_VMUX_TELEVISION,
 688 			.vmux     = TVP5150_COMPOSITE0,
 689 			.amux     = 0,
 690 		}, {
 691 			.type     = EM28XX_VMUX_COMPOSITE1,
 692 			.vmux     = TVP5150_COMPOSITE1,
 693 			.amux     = 1,
 694 		}, {
 695 			.type     = EM28XX_VMUX_SVIDEO,
 696 			.vmux     = TVP5150_SVIDEO,
 697 			.amux     = 1,
 698 		} },
 699 	},
 700 	[EM2820_BOARD_MSI_VOX_USB_2] = {
 701 		.name		   = "MSI VOX USB 2.0",
 702 		.vchannels	   = 3,
 703 		.tuner_type	   = TUNER_LG_PAL_NEW_TAPC,
 704 		.tda9887_conf	   = TDA9887_PRESENT      |
 705 				     TDA9887_PORT1_ACTIVE |
 706 				     TDA9887_PORT2_ACTIVE,
 707 		.max_range_640_480 = 1,
 708 
 709 		.decoder           = EM28XX_SAA7114,
 710 		.input             = { {
 711 			.type      = EM28XX_VMUX_TELEVISION,
 712 			.vmux      = SAA7115_COMPOSITE4,
 713 			.amux      = 0,
 714 		}, {
 715 			.type      = EM28XX_VMUX_COMPOSITE1,
 716 			.vmux      = SAA7115_COMPOSITE0,
 717 			.amux      = 1,
 718 		}, {
 719 			.type      = EM28XX_VMUX_SVIDEO,
 720 			.vmux      = SAA7115_SVIDEO3,
 721 			.amux      = 1,
 722 		} },
 723 	},
 724 	[EM2800_BOARD_TERRATEC_CINERGY_200] = {
 725 		.name         = "Terratec Cinergy 200 USB",
 726 		.is_em2800    = 1,
 727 		.vchannels    = 3,
 728 		.tuner_type   = TUNER_LG_PAL_NEW_TAPC,
 729 		.tda9887_conf = TDA9887_PRESENT,
 730 		.decoder      = EM28XX_SAA7113,
 731 		.input          = { {
 732 			.type     = EM28XX_VMUX_TELEVISION,
 733 			.vmux     = SAA7115_COMPOSITE2,
 734 			.amux     = 0,
 735 		}, {
 736 			.type     = EM28XX_VMUX_COMPOSITE1,
 737 			.vmux     = SAA7115_COMPOSITE0,
 738 			.amux     = 1,
 739 		}, {
 740 			.type     = EM28XX_VMUX_SVIDEO,
 741 			.vmux     = SAA7115_SVIDEO3,
 742 			.amux     = 1,
 743 		} },
 744 	},
 745 	[EM2800_BOARD_GRABBEEX_USB2800] = {
 746 		.name         = "eMPIA Technology, Inc. GrabBeeX+ Video Encoder",
 747 		.is_em2800    = 1,
 748 		.vchannels    = 2,
 749 		.decoder      = EM28XX_SAA7113,
 750 		.input          = { {
 751 			.type     = EM28XX_VMUX_COMPOSITE1,
 752 			.vmux     = SAA7115_COMPOSITE0,
 753 			.amux     = 1,
 754 		}, {
 755 			.type     = EM28XX_VMUX_SVIDEO,
 756 			.vmux     = SAA7115_SVIDEO3,
 757 			.amux     = 1,
 758 		} },
 759 	},
 760 	[EM2800_BOARD_LEADTEK_WINFAST_USBII] = {
 761 		.name         = "Leadtek Winfast USB II",
 762 		.is_em2800    = 1,
 763 		.vchannels    = 3,
 764 		.tuner_type   = TUNER_LG_PAL_NEW_TAPC,
 765 		.tda9887_conf = TDA9887_PRESENT,
 766 		.decoder      = EM28XX_SAA7113,
 767 		.input          = { {
 768 			.type     = EM28XX_VMUX_TELEVISION,
 769 			.vmux     = SAA7115_COMPOSITE2,
 770 			.amux     = 0,
 771 		}, {
 772 			.type     = EM28XX_VMUX_COMPOSITE1,
 773 			.vmux     = SAA7115_COMPOSITE0,
 774 			.amux     = 1,
 775 		}, {
 776 			.type     = EM28XX_VMUX_SVIDEO,
 777 			.vmux     = SAA7115_SVIDEO3,
 778 			.amux     = 1,
 779 		} },
 780 	},
 781 	[EM2800_BOARD_KWORLD_USB2800] = {
 782 		.name         = "Kworld USB2800",
 783 		.is_em2800    = 1,
 784 		.vchannels    = 3,
 785 		.tuner_type   = TUNER_PHILIPS_FCV1236D,
 786 		.tda9887_conf = TDA9887_PRESENT,
 787 		.decoder      = EM28XX_SAA7113,
 788 		.input          = { {
 789 			.type     = EM28XX_VMUX_TELEVISION,
 790 			.vmux     = SAA7115_COMPOSITE2,
 791 			.amux     = 0,
 792 		}, {
 793 			.type     = EM28XX_VMUX_COMPOSITE1,
 794 			.vmux     = SAA7115_COMPOSITE0,
 795 			.amux     = 1,
 796 		}, {
 797 			.type     = EM28XX_VMUX_SVIDEO,
 798 			.vmux     = SAA7115_SVIDEO3,
 799 			.amux     = 1,
 800 		} },
 801 	},
 802 	[EM2820_BOARD_PINNACLE_DVC_90] = {
 803 		.name         = "Pinnacle Dazzle DVC 90/DVC 100",
 804 		.vchannels    = 3,
 805 		.tuner_type   = TUNER_ABSENT,
 806 		.decoder      = EM28XX_SAA7113,
 807 		.input          = { {
 808 			.type     = EM28XX_VMUX_COMPOSITE1,
 809 			.vmux     = SAA7115_COMPOSITE0,
 810 			.amux     = 1,
 811 		}, {
 812 			.type     = EM28XX_VMUX_SVIDEO,
 813 			.vmux     = SAA7115_SVIDEO3,
 814 			.amux     = 1,
 815 		} },
 816 	},
 817 	[EM2800_BOARD_VGEAR_POCKETTV] = {
 818 		.name         = "V-Gear PocketTV",
 819 		.is_em2800    = 1,
 820 		.vchannels    = 3,
 821 		.tuner_type   = TUNER_LG_PAL_NEW_TAPC,
 822 		.tda9887_conf = TDA9887_PRESENT,
 823 		.decoder      = EM28XX_SAA7113,
 824 		.input          = { {
 825 			.type     = EM28XX_VMUX_TELEVISION,
 826 			.vmux     = SAA7115_COMPOSITE2,
 827 			.amux     = 0,
 828 		}, {
 829 			.type     = EM28XX_VMUX_COMPOSITE1,
 830 			.vmux     = SAA7115_COMPOSITE0,
 831 			.amux     = 1,
 832 		}, {
 833 			.type     = EM28XX_VMUX_SVIDEO,
 834 			.vmux     = SAA7115_SVIDEO3,
 835 			.amux     = 1,
 836 		} },
 837 	},
 838 	[EM2820_BOARD_PROLINK_PLAYTV_USB2] = {
 839 		.name         = "Pixelview Prolink PlayTV USB 2.0",
 840 		.vchannels    = 3,
 841 		.tda9887_conf = TDA9887_PRESENT,
 842 		.tuner_type   = TUNER_YMEC_TVF_5533MF,
 843 		.decoder      = EM28XX_SAA7113,
 844 		.input          = { {
 845 			.type     = EM28XX_VMUX_TELEVISION,
 846 			.vmux     = SAA7115_COMPOSITE2,
 847 			.amux     = EM28XX_AMUX_LINE_IN,
 848 		}, {
 849 			.type     = EM28XX_VMUX_COMPOSITE1,
 850 			.vmux     = SAA7115_COMPOSITE0,
 851 			.amux     = EM28XX_AMUX_LINE_IN,
 852 		}, {
 853 			.type     = EM28XX_VMUX_SVIDEO,
 854 			.vmux     = SAA7115_SVIDEO3,
 855 			.amux     = EM28XX_AMUX_LINE_IN,
 856 		} },
 857 	},
 858 	[EM2860_BOARD_POINTNIX_INTRAORAL_CAMERA] = {
 859 		.name         = "PointNix Intra-Oral Camera",
 860 		.has_snapshot_button = 1,
 861 		.vchannels    = 1,
 862 		.tda9887_conf = TDA9887_PRESENT,
 863 		.tuner_type   = TUNER_ABSENT,
 864 		.decoder      = EM28XX_SAA7113,
 865 		.input          = { {
 866 			.type     = EM28XX_VMUX_SVIDEO,
 867 			.vmux     = SAA7115_SVIDEO3,
 868 			.amux     = 0,
 869 		} },
 870 	},
 871 	[EM2880_BOARD_MSI_DIGIVOX_AD] = {
 872 		.name         = "MSI DigiVox A/D",
 873 		.valid        = EM28XX_BOARD_NOT_VALIDATED,
 874 		.vchannels    = 3,
 875 		.tuner_type   = TUNER_XC2028,
 876 		.decoder      = EM28XX_TVP5150,
 877 		.input          = { {
 878 			.type     = EM28XX_VMUX_TELEVISION,
 879 			.vmux     = TVP5150_COMPOSITE0,
 880 			.amux     = 0,
 881 		}, {
 882 			.type     = EM28XX_VMUX_COMPOSITE1,
 883 			.vmux     = TVP5150_COMPOSITE1,
 884 			.amux     = 1,
 885 		}, {
 886 			.type     = EM28XX_VMUX_SVIDEO,
 887 			.vmux     = TVP5150_SVIDEO,
 888 			.amux     = 1,
 889 		} },
 890 	},
 891 	[EM2880_BOARD_MSI_DIGIVOX_AD_II] = {
 892 		.name         = "MSI DigiVox A/D II",
 893 		.valid        = EM28XX_BOARD_NOT_VALIDATED,
 894 		.vchannels    = 3,
 895 		.tuner_type   = TUNER_XC2028,
 896 		.decoder      = EM28XX_TVP5150,
 897 		.input          = { {
 898 			.type     = EM28XX_VMUX_TELEVISION,
 899 			.vmux     = TVP5150_COMPOSITE0,
 900 			.amux     = 0,
 901 		}, {
 902 			.type     = EM28XX_VMUX_COMPOSITE1,
 903 			.vmux     = TVP5150_COMPOSITE1,
 904 			.amux     = 1,
 905 		}, {
 906 			.type     = EM28XX_VMUX_SVIDEO,
 907 			.vmux     = TVP5150_SVIDEO,
 908 			.amux     = 1,
 909 		} },
 910 	},
 911 	[EM2880_BOARD_KWORLD_DVB_305U] = {
 912 		.name	      = "KWorld DVB-T 305U",
 913 		.valid        = EM28XX_BOARD_NOT_VALIDATED,
 914 		.vchannels    = 3,
 915 		.tuner_type   = TUNER_XC2028,
 916 		.decoder      = EM28XX_TVP5150,
 917 		.input          = { {
 918 			.type     = EM28XX_VMUX_TELEVISION,
 919 			.vmux     = TVP5150_COMPOSITE0,
 920 			.amux     = 0,
 921 		}, {
 922 			.type     = EM28XX_VMUX_COMPOSITE1,
 923 			.vmux     = TVP5150_COMPOSITE1,
 924 			.amux     = 1,
 925 		}, {
 926 			.type     = EM28XX_VMUX_SVIDEO,
 927 			.vmux     = TVP5150_SVIDEO,
 928 			.amux     = 1,
 929 		} },
 930 	},
 931 	[EM2880_BOARD_KWORLD_DVB_310U] = {
 932 		.name	      = "KWorld DVB-T 310U",
 933 		.vchannels    = 3,
 934 		.tuner_type   = TUNER_XC2028,
 935 		.has_dvb      = 1,
 936 		.mts_firmware = 1,
 937 		.decoder      = EM28XX_TVP5150,
 938 		.input          = { {
 939 			.type     = EM28XX_VMUX_TELEVISION,
 940 			.vmux     = TVP5150_COMPOSITE0,
 941 			.amux     = EM28XX_AMUX_VIDEO,
 942 		}, {
 943 			.type     = EM28XX_VMUX_COMPOSITE1,
 944 			.vmux     = TVP5150_COMPOSITE1,
 945 			.amux     = EM28XX_AMUX_AC97_LINE_IN,
 946 		}, {	/* S-video has not been tested yet */
 947 			.type     = EM28XX_VMUX_SVIDEO,
 948 			.vmux     = TVP5150_SVIDEO,
 949 			.amux     = EM28XX_AMUX_AC97_LINE_IN,
 950 		} },
 951 	},
 952 	[EM2881_BOARD_DNT_DA2_HYBRID] = {
 953 		.name         = "DNT DA2 Hybrid",
 954 		.valid        = EM28XX_BOARD_NOT_VALIDATED,
 955 		.vchannels    = 3,
 956 		.tuner_type   = TUNER_XC2028,
 957 		.decoder      = EM28XX_TVP5150,
 958 		.input          = { {
 959 			.type     = EM28XX_VMUX_TELEVISION,
 960 			.vmux     = TVP5150_COMPOSITE0,
 961 			.amux     = 0,
 962 		}, {
 963 			.type     = EM28XX_VMUX_COMPOSITE1,
 964 			.vmux     = TVP5150_COMPOSITE1,
 965 			.amux     = 1,
 966 		}, {
 967 			.type     = EM28XX_VMUX_SVIDEO,
 968 			.vmux     = TVP5150_SVIDEO,
 969 			.amux     = 1,
 970 		} },
 971 	},
 972 	[EM2881_BOARD_PINNACLE_HYBRID_PRO] = {
 973 		.name         = "Pinnacle Hybrid Pro",
 974 		.valid        = EM28XX_BOARD_NOT_VALIDATED,
 975 		.vchannels    = 3,
 976 		.tuner_type   = TUNER_XC2028,
 977 		.decoder      = EM28XX_TVP5150,
 978 		.input          = { {
 979 			.type     = EM28XX_VMUX_TELEVISION,
 980 			.vmux     = TVP5150_COMPOSITE0,
 981 			.amux     = 0,
 982 		}, {
 983 			.type     = EM28XX_VMUX_COMPOSITE1,
 984 			.vmux     = TVP5150_COMPOSITE1,
 985 			.amux     = 1,
 986 		}, {
 987 			.type     = EM28XX_VMUX_SVIDEO,
 988 			.vmux     = TVP5150_SVIDEO,
 989 			.amux     = 1,
 990 		} },
 991 	},
 992 	[EM2882_BOARD_PINNACLE_HYBRID_PRO] = {
 993 		.name         = "Pinnacle Hybrid Pro (2)",
 994 		.valid        = EM28XX_BOARD_NOT_VALIDATED,
 995 		.vchannels    = 3,
 996 		.tuner_type   = TUNER_XC2028,
 997 		.mts_firmware = 1,
 998 		.decoder      = EM28XX_TVP5150,
 999 		.input          = { {
1000 			.type     = EM28XX_VMUX_TELEVISION,
1001 			.vmux     = TVP5150_COMPOSITE0,
1002 			.amux     = 0,
1003 		}, {
1004 			.type     = EM28XX_VMUX_COMPOSITE1,
1005 			.vmux     = TVP5150_COMPOSITE1,
1006 			.amux     = 1,
1007 		}, {
1008 			.type     = EM28XX_VMUX_SVIDEO,
1009 			.vmux     = TVP5150_SVIDEO,
1010 			.amux     = 1,
1011 		} },
1012 	},
1013 	[EM2882_BOARD_KWORLD_VS_DVBT] = {
1014 		.name         = "Kworld VS-DVB-T 323UR",
1015 		.valid        = EM28XX_BOARD_NOT_VALIDATED,
1016 		.vchannels    = 3,
1017 		.tuner_type   = TUNER_XC2028,
1018 		.decoder      = EM28XX_TVP5150,
1019 		.input          = { {
1020 			.type     = EM28XX_VMUX_TELEVISION,
1021 			.vmux     = TVP5150_COMPOSITE0,
1022 			.amux     = 0,
1023 		}, {
1024 			.type     = EM28XX_VMUX_COMPOSITE1,
1025 			.vmux     = TVP5150_COMPOSITE1,
1026 			.amux     = 1,
1027 		}, {
1028 			.type     = EM28XX_VMUX_SVIDEO,
1029 			.vmux     = TVP5150_SVIDEO,
1030 			.amux     = 1,
1031 		} },
1032 	},
1033 	[EM2882_BOARD_TERRATEC_HYBRID_XS] = {
1034 		.name         = "Terratec Hybrid XS (em2882)",
1035 		.valid        = EM28XX_BOARD_NOT_VALIDATED,
1036 		.vchannels    = 3,
1037 		.tuner_type   = TUNER_XC2028,
1038 		.decoder      = EM28XX_TVP5150,
1039 		.input          = { {
1040 			.type     = EM28XX_VMUX_TELEVISION,
1041 			.vmux     = TVP5150_COMPOSITE0,
1042 			.amux     = 0,
1043 		}, {
1044 			.type     = EM28XX_VMUX_COMPOSITE1,
1045 			.vmux     = TVP5150_COMPOSITE1,
1046 			.amux     = 1,
1047 		}, {
1048 			.type     = EM28XX_VMUX_SVIDEO,
1049 			.vmux     = TVP5150_SVIDEO,
1050 			.amux     = 1,
1051 		} },
1052 	},
1053 	[EM2883_BOARD_KWORLD_HYBRID_A316] = {
1054 		.name         = "Kworld PlusTV HD Hybrid 330",
1055 		.valid        = EM28XX_BOARD_NOT_VALIDATED,
1056 		.vchannels    = 3,
1057 		.is_em2800    = 0,
1058 		.tuner_type   = TUNER_XC2028,
1059 		.decoder      = EM28XX_TVP5150,
1060 		.input          = { {
1061 			.type     = EM28XX_VMUX_TELEVISION,
1062 			.vmux     = TVP5150_COMPOSITE0,
1063 			.amux     = 0,
1064 		}, {
1065 			.type     = EM28XX_VMUX_COMPOSITE1,
1066 			.vmux     = TVP5150_COMPOSITE1,
1067 			.amux     = 1,
1068 		}, {
1069 			.type     = EM28XX_VMUX_SVIDEO,
1070 			.vmux     = TVP5150_SVIDEO,
1071 			.amux     = 1,
1072 		} },
1073 	},
1074 	[EM2820_BOARD_COMPRO_VIDEOMATE_FORYOU] = {
1075 		.name         = "Compro VideoMate ForYou/Stereo",
1076 		.vchannels    = 2,
1077 		.tuner_type   = TUNER_LG_PAL_NEW_TAPC,
1078 		.tda9887_conf = TDA9887_PRESENT,
1079 		.decoder      = EM28XX_TVP5150,
1080 		.input          = { {
1081 			.type     = EM28XX_VMUX_TELEVISION,
1082 			.vmux     = TVP5150_COMPOSITE0,
1083 			.amux     = EM28XX_AMUX_LINE_IN,
1084 		}, {
1085 			.type     = EM28XX_VMUX_SVIDEO,
1086 			.vmux     = TVP5150_SVIDEO,
1087 			.amux     = EM28XX_AMUX_LINE_IN,
1088 		} },
1089 	},
1090 	[EM2820_BOARD_POLLIN_USB_R1] = {
1091 		.name         = "Pollin USB R1",
1092 		.vchannels    = 1,
1093 		.tuner_type   = TUNER_ABSENT,
1094 		.decoder      = EM28XX_SAA7113,
1095 		.input          = { {
1096 			.type     = EM28XX_VMUX_COMPOSITE1,
1097 			.vmux     = TVP5150_COMPOSITE0,
1098 			.amux     = EM28XX_AMUX_LINE_IN,
1099 		} },
1100 	},
1101 };
1102 const unsigned int em28xx_bcount = ARRAY_SIZE(em28xx_boards);
1103 
1104 /* table of devices that work with this driver */
1105 struct usb_device_id em28xx_id_table [] = {
1106 	{ USB_DEVICE(0xeb1a, 0x2750),
1107 			.driver_info = EM2750_BOARD_UNKNOWN },
1108 	{ USB_DEVICE(0xeb1a, 0x2751),
1109 			.driver_info = EM2750_BOARD_UNKNOWN },
1110 	{ USB_DEVICE(0xeb1a, 0x2800),
1111 			.driver_info = EM2800_BOARD_UNKNOWN },
1112 	{ USB_DEVICE(0xeb1a, 0x2820),
1113 			.driver_info = EM2820_BOARD_UNKNOWN },
1114 	{ USB_DEVICE(0xeb1a, 0x2821),
1115 			.driver_info = EM2820_BOARD_UNKNOWN },
1116 	{ USB_DEVICE(0xeb1a, 0x2860),
1117 			.driver_info = EM2820_BOARD_UNKNOWN },
1118 	{ USB_DEVICE(0xeb1a, 0x2861),
1119 			.driver_info = EM2820_BOARD_POLLIN_USB_R1 },
1120 	{ USB_DEVICE(0xeb1a, 0x2870),
1121 			.driver_info = EM2820_BOARD_UNKNOWN },
1122 	{ USB_DEVICE(0xeb1a, 0x2881),
1123 			.driver_info = EM2820_BOARD_UNKNOWN },
1124 	{ USB_DEVICE(0xeb1a, 0x2883),
1125 			.driver_info = EM2820_BOARD_UNKNOWN },
1126 	{ USB_DEVICE(0xeb1a, 0xe300),
1127 			.driver_info = EM2861_BOARD_KWORLD_PVRTV_300U },
1128 	{ USB_DEVICE(0xeb1a, 0xe305),
1129 			.driver_info = EM2880_BOARD_KWORLD_DVB_305U },
1130 	{ USB_DEVICE(0xeb1a, 0xe310),
1131 			.driver_info = EM2880_BOARD_MSI_DIGIVOX_AD },
1132 	{ USB_DEVICE(0xeb1a, 0xa316),
1133 			.driver_info = EM2883_BOARD_KWORLD_HYBRID_A316 },
1134 	{ USB_DEVICE(0xeb1a, 0xe320),
1135 			.driver_info = EM2880_BOARD_MSI_DIGIVOX_AD_II },
1136 	{ USB_DEVICE(0xeb1a, 0xe323),
1137 			.driver_info = EM2882_BOARD_KWORLD_VS_DVBT },
1138 	{ USB_DEVICE(0xeb1a, 0xe350),
1139 			.driver_info = EM2870_BOARD_KWORLD_350U },
1140 	{ USB_DEVICE(0xeb1a, 0xe355),
1141 			.driver_info = EM2870_BOARD_KWORLD_355U },
1142 	{ USB_DEVICE(0xeb1a, 0x2801),
1143 			.driver_info = EM2800_BOARD_GRABBEEX_USB2800 },
1144 	{ USB_DEVICE(0xeb1a, 0xe357),
1145 			.driver_info = EM2870_BOARD_KWORLD_355U },
1146 	{ USB_DEVICE(0x0ccd, 0x0036),
1147 			.driver_info = EM2820_BOARD_TERRATEC_CINERGY_250 },
1148 	{ USB_DEVICE(0x0ccd, 0x004c),
1149 			.driver_info = EM2880_BOARD_TERRATEC_HYBRID_XS_FR },
1150 	{ USB_DEVICE(0x0ccd, 0x004f),
1151 			.driver_info = EM2860_BOARD_TERRATEC_HYBRID_XS },
1152 	{ USB_DEVICE(0x0ccd, 0x005e),
1153 			.driver_info = EM2882_BOARD_TERRATEC_HYBRID_XS },
1154 	{ USB_DEVICE(0x0ccd, 0x0042),
1155 			.driver_info = EM2880_BOARD_TERRATEC_HYBRID_XS },
1156 	{ USB_DEVICE(0x0ccd, 0x0043),
1157 			.driver_info = EM2870_BOARD_TERRATEC_XS },
1158 	{ USB_DEVICE(0x0ccd, 0x0047),
1159 			.driver_info = EM2880_BOARD_TERRATEC_PRODIGY_XS },
1160 	{ USB_DEVICE(0x185b, 0x2870),
1161 			.driver_info = EM2870_BOARD_COMPRO_VIDEOMATE },
1162 	{ USB_DEVICE(0x185b, 0x2041),
1163 			.driver_info = EM2820_BOARD_COMPRO_VIDEOMATE_FORYOU },
1164 	{ USB_DEVICE(0x2040, 0x4200),
1165 			.driver_info = EM2820_BOARD_HAUPPAUGE_WINTV_USB_2 },
1166 	{ USB_DEVICE(0x2040, 0x4201),
1167 			.driver_info = EM2820_BOARD_HAUPPAUGE_WINTV_USB_2 },
1168 	{ USB_DEVICE(0x2040, 0x6500),
1169 			.driver_info = EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900 },
1170 	{ USB_DEVICE(0x2040, 0x6502),
1171 			.driver_info = EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900_R2 },
1172 	{ USB_DEVICE(0x2040, 0x6513), /* HCW HVR-980 */
1173 			.driver_info = EM2883_BOARD_HAUPPAUGE_WINTV_HVR_950 },
1174 	{ USB_DEVICE(0x2040, 0x6517), /* HP  HVR-950 */
1175 			.driver_info = EM2883_BOARD_HAUPPAUGE_WINTV_HVR_950 },
1176 	{ USB_DEVICE(0x2040, 0x651b), /* RP  HVR-950 */
1177 			.driver_info = EM2883_BOARD_HAUPPAUGE_WINTV_HVR_950 },
1178 	{ USB_DEVICE(0x2040, 0x651f), /* HCW HVR-850 */
1179 			.driver_info = EM2883_BOARD_HAUPPAUGE_WINTV_HVR_950 },
1180 	{ USB_DEVICE(0x0438, 0xb002),
1181 			.driver_info = EM2880_BOARD_AMD_ATI_TV_WONDER_HD_600 },
1182 	{ USB_DEVICE(0x2001, 0xf112),
1183 			.driver_info = EM2820_BOARD_DLINK_USB_TV },
1184 	{ USB_DEVICE(0x2304, 0x0207),
1185 			.driver_info = EM2820_BOARD_PINNACLE_DVC_90 },
1186 	{ USB_DEVICE(0x2304, 0x0208),
1187 			.driver_info = EM2820_BOARD_PINNACLE_USB_2 },
1188 	{ USB_DEVICE(0x2304, 0x021a),
1189 			.driver_info = EM2820_BOARD_PINNACLE_DVC_90 },
1190 	{ USB_DEVICE(0x2304, 0x0226),
1191 			.driver_info = EM2882_BOARD_PINNACLE_HYBRID_PRO },
1192 	{ USB_DEVICE(0x2304, 0x0227),
1193 			.driver_info = EM2880_BOARD_PINNACLE_PCTV_HD_PRO },
1194 	{ USB_DEVICE(0x0413, 0x6023),
1195 			.driver_info = EM2800_BOARD_LEADTEK_WINFAST_USBII },
1196 	{ USB_DEVICE(0x093b, 0xa005),
1197 			.driver_info = EM2861_BOARD_PLEXTOR_PX_TV100U },
1198 	{ },
1199 };
1200 MODULE_DEVICE_TABLE(usb, em28xx_id_table);
1201 
1202 /*
1203  *  Reset sequences for analog/digital modes
1204  */
1205 
1206 /* Reset for the most [analog] boards */
1207 static struct em28xx_reg_seq default_analog[] = {
1208 	{EM28XX_R08_GPIO,	0x6d,   ~EM_GPIO_4,	10},
1209 	{	-1,		-1,	-1,		-1},
1210 };
1211 
1212 /* Reset for the most [digital] boards */
1213 static struct em28xx_reg_seq default_digital[] = {
1214 	{EM28XX_R08_GPIO,	0x6e,	~EM_GPIO_4,	10},
1215 	{	-1,		-1,	-1,		-1},
1216 };
1217 
1218 /* Board Hauppauge WinTV HVR 900 analog */
1219 static struct em28xx_reg_seq hauppauge_wintv_hvr_900_analog[] = {
1220 	{EM28XX_R08_GPIO,	0x2d,	~EM_GPIO_4,	10},
1221 	{0x05,			0xff,	0x10,		10},
1222 	{  -1,			-1,	-1,		-1},
1223 };
1224 
1225 /* Board Hauppauge WinTV HVR 900 digital */
1226 static struct em28xx_reg_seq hauppauge_wintv_hvr_900_digital[] = {
1227 	{EM28XX_R08_GPIO,	0x2e,	~EM_GPIO_4,	10},
1228 	{EM2880_R04_GPO,	0x04,	0x0f,		10},
1229 	{EM2880_R04_GPO,	0x0c,	0x0f,		10},
1230 	{ -1,			-1,	-1,		-1},
1231 };
1232 
1233 /* Boards - EM2880 MSI DIGIVOX AD and EM2880_BOARD_MSI_DIGIVOX_AD_II */
1234 static struct em28xx_reg_seq em2880_msi_digivox_ad_analog[] = {
1235 	{EM28XX_R08_GPIO,       0x69,   ~EM_GPIO_4,	 10},
1236 	{	-1,		-1,	-1,		 -1},
1237 };
1238 
1239 /* Boards - EM2880 MSI DIGIVOX AD and EM2880_BOARD_MSI_DIGIVOX_AD_II */
1240 static struct em28xx_reg_seq em2880_msi_digivox_ad_digital[] = {
1241 	{EM28XX_R08_GPIO,	0x6a,	~EM_GPIO_4,	10},
1242 	{	-1,		-1,	-1,		-1},
1243 };
1244 
1245 /* Board  - EM2870 Kworld 355u
1246    Analog - No input analog */
1247 static struct em28xx_reg_seq em2870_kworld_355u_digital[] = {
1248 	{EM2880_R04_GPO,	0x01,	0xff,		10},
1249 	{  -1,			-1,	-1,		-1},
1250 };
1251 
1252 /* Callback for the most boards */
1253 static struct em28xx_reg_seq default_callback[] = {
1254 	{EM28XX_R08_GPIO,	EM_GPIO_4,	EM_GPIO_4,	10},
1255 	{EM28XX_R08_GPIO,	0,		EM_GPIO_4,	10},
1256 	{EM28XX_R08_GPIO,	EM_GPIO_4,	EM_GPIO_4,	10},
1257 	{  -1,			-1,		-1,		-1},
1258 };
1259 
1260 /* Callback for EM2882 TERRATEC HYBRID XS */
1261 static struct em28xx_reg_seq em2882_terratec_hybrid_xs_digital[] = {
1262 	{EM28XX_R08_GPIO,       0x2e,   0xff,		   6},
1263 	{EM28XX_R08_GPIO,       0x3e,   ~EM_GPIO_4,	   6},
1264 	{EM2880_R04_GPO,        0x04,   0xff,		  10},
1265 	{EM2880_R04_GPO,        0x0c,   0xff,		  10},
1266 	{  -1,			-1,	-1,		  -1},
1267 };
1268 
1269 /*
1270  * EEPROM hash table for devices with generic USB IDs
1271  */
1272 static struct em28xx_hash_table em28xx_eeprom_hash [] = {
1273 	/* P/N: SA 60002070465 Tuner: TVF7533-MF */
1274 	{0x6ce05a8f, EM2820_BOARD_PROLINK_PLAYTV_USB2, TUNER_YMEC_TVF_5533MF},
1275 	{0x966a0441, EM2880_BOARD_KWORLD_DVB_310U, TUNER_XC2028},
1276 };
1277 
1278 /* I2C devicelist hash table for devices with generic USB IDs */
1279 static struct em28xx_hash_table em28xx_i2c_hash[] = {
1280 	{0xb06a32c3, EM2800_BOARD_TERRATEC_CINERGY_200, TUNER_LG_PAL_NEW_TAPC},
1281 	{0xf51200e3, EM2800_BOARD_VGEAR_POCKETTV, TUNER_LG_PAL_NEW_TAPC},
1282 	{0x1ba50080, EM2860_BOARD_POINTNIX_INTRAORAL_CAMERA, TUNER_ABSENT},
1283 };
1284 
1285 int em28xx_tuner_callback(void *ptr, int command, int arg)
1286 {
1287 	int rc = 0;
1288 	struct em28xx *dev = ptr;
1289 
1290 	if (dev->tuner_type != TUNER_XC2028)
1291 		return 0;
1292 
1293 	if (command != XC2028_TUNER_RESET)
1294 		return 0;
1295 
1296 	if (dev->mode == EM28XX_ANALOG_MODE)
1297 		rc = em28xx_gpio_set(dev, dev->tun_analog_gpio);
1298 	else
1299 		rc = em28xx_gpio_set(dev, dev->tun_digital_gpio);
1300 
1301 	return rc;
1302 }
1303 EXPORT_SYMBOL_GPL(em28xx_tuner_callback);
1304 
1305 static void em28xx_set_model(struct em28xx *dev)
1306 {
1307 	dev->is_em2800 = em28xx_boards[dev->model].is_em2800;
1308 	dev->has_msp34xx = em28xx_boards[dev->model].has_msp34xx;
1309 	dev->tda9887_conf = em28xx_boards[dev->model].tda9887_conf;
1310 	dev->decoder = em28xx_boards[dev->model].decoder;
1311 	dev->video_inputs = em28xx_boards[dev->model].vchannels;
1312 	dev->has_12mhz_i2s = em28xx_boards[dev->model].has_12mhz_i2s;
1313 	dev->max_range_640_480 = em28xx_boards[dev->model].max_range_640_480;
1314 	dev->has_dvb = em28xx_boards[dev->model].has_dvb;
1315 	dev->has_snapshot_button = em28xx_boards[dev->model].has_snapshot_button;
1316 	dev->valid = em28xx_boards[dev->model].valid;
1317 }
1318 
1319 /* Since em28xx_pre_card_setup() requires a proper dev->model,
1320  * this won't work for boards with generic PCI IDs
1321  */
1322 void em28xx_pre_card_setup(struct em28xx *dev)
1323 {
1324 	int rc;
1325 
1326 	rc = em28xx_read_reg(dev, EM2880_R04_GPO);
1327 	if (rc >= 0)
1328 		dev->reg_gpo = rc;
1329 
1330 	dev->wait_after_write = 5;
1331 	rc = em28xx_read_reg(dev, EM28XX_R0A_CHIPID);
1332 	if (rc > 0) {
1333 		switch (rc) {
1334 		case CHIP_ID_EM2860:
1335 			em28xx_info("chip ID is em2860\n");
1336 			break;
1337 		case CHIP_ID_EM2883:
1338 			em28xx_info("chip ID is em2882/em2883\n");
1339 			dev->wait_after_write = 0;
1340 			break;
1341 		default:
1342 			em28xx_info("em28xx chip ID = %d\n", rc);
1343 		}
1344 	}
1345 	em28xx_set_model(dev);
1346 
1347 	/* request some modules */
1348 	switch (dev->model) {
1349 	case EM2880_BOARD_TERRATEC_PRODIGY_XS:
1350 	case EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900:
1351 	case EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900_R2:
1352 	case EM2860_BOARD_TERRATEC_HYBRID_XS:
1353 	case EM2883_BOARD_HAUPPAUGE_WINTV_HVR_950:
1354 	case EM2880_BOARD_PINNACLE_PCTV_HD_PRO:
1355 	case EM2882_BOARD_PINNACLE_HYBRID_PRO:
1356 	case EM2883_BOARD_KWORLD_HYBRID_A316:
1357 	case EM2880_BOARD_AMD_ATI_TV_WONDER_HD_600:
1358 		em28xx_write_regs(dev, EM28XX_R0F_XCLK,    "\x27", 1);
1359 		em28xx_write_regs(dev, EM28XX_R06_I2C_CLK, "\x40", 1);
1360 		msleep(50);
1361 
1362 		/* Sets GPO/GPIO sequences for this device */
1363 		dev->analog_gpio      = hauppauge_wintv_hvr_900_analog;
1364 		dev->digital_gpio     = hauppauge_wintv_hvr_900_digital;
1365 		dev->tun_analog_gpio  = default_callback;
1366 		dev->tun_digital_gpio = default_callback;
1367 		break;
1368 
1369 	case EM2882_BOARD_TERRATEC_HYBRID_XS:
1370 		em28xx_write_regs(dev, EM28XX_R0F_XCLK,    "\x27", 1);
1371 		em28xx_write_regs(dev, EM28XX_R06_I2C_CLK, "\x40", 1);
1372 		msleep(50);
1373 
1374 		/* should be added ir_codes here */
1375 
1376 		/* Sets GPO/GPIO sequences for this device */
1377 		dev->analog_gpio      = hauppauge_wintv_hvr_900_analog;
1378 		dev->digital_gpio     = hauppauge_wintv_hvr_900_digital;
1379 		dev->tun_analog_gpio  = default_callback;
1380 		dev->tun_digital_gpio = em2882_terratec_hybrid_xs_digital;
1381 		break;
1382 
1383 	case EM2880_BOARD_TERRATEC_HYBRID_XS_FR:
1384 	case EM2880_BOARD_TERRATEC_HYBRID_XS:
1385 	case EM2870_BOARD_TERRATEC_XS:
1386 	case EM2881_BOARD_PINNACLE_HYBRID_PRO:
1387 	case EM2880_BOARD_KWORLD_DVB_310U:
1388 	case EM2870_BOARD_KWORLD_350U:
1389 	case EM2881_BOARD_DNT_DA2_HYBRID:
1390 		em28xx_write_regs(dev, EM28XX_R0F_XCLK,    "\x27", 1);
1391 		em28xx_write_regs(dev, EM28XX_R06_I2C_CLK, "\x40", 1);
1392 		msleep(50);
1393 
1394 		/* NOTE: EM2881_DNT_DA2_HYBRID spend 140 msleep for digital
1395 			 and analog commands. If this commands doesn't work,
1396 			 add this timer. */
1397 
1398 		/* Sets GPO/GPIO sequences for this device */
1399 		dev->analog_gpio      = default_analog;
1400 		dev->digital_gpio     = default_digital;
1401 		dev->tun_analog_gpio  = default_callback;
1402 		dev->tun_digital_gpio = default_callback;
1403 		break;
1404 
1405 	case EM2880_BOARD_MSI_DIGIVOX_AD:
1406 	case EM2880_BOARD_MSI_DIGIVOX_AD_II:
1407 		em28xx_write_regs(dev, EM28XX_R0F_XCLK,    "\x27", 1);
1408 		em28xx_write_regs(dev, EM28XX_R06_I2C_CLK, "\x40", 1);
1409 		msleep(50);
1410 
1411 		/* Sets GPO/GPIO sequences for this device */
1412 		dev->analog_gpio      = em2880_msi_digivox_ad_analog;
1413 		dev->digital_gpio     = em2880_msi_digivox_ad_digital;
1414 		dev->tun_analog_gpio  = default_callback;
1415 		dev->tun_digital_gpio = default_callback;
1416 		break;
1417 
1418 	case EM2750_BOARD_UNKNOWN:
1419 	case EM2750_BOARD_DLCW_130:
1420 		em28xx_write_regs(dev, EM28XX_R0F_XCLK, "\x0a", 1);
1421 		break;
1422 
1423 	case EM2861_BOARD_PLEXTOR_PX_TV100U:
1424 		em28xx_write_regs(dev, EM28XX_R0F_XCLK, "\x27", 1);
1425 		em28xx_write_regs(dev, EM28XX_R06_I2C_CLK, "\x40", 1);
1426 		/* FIXME guess */
1427 		/* Turn on analog audio output */
1428 		em28xx_write_regs_req(dev, 0x00, 0x08, "\xfd", 1);
1429 		break;
1430 
1431 	case EM2861_BOARD_KWORLD_PVRTV_300U:
1432 	case EM2880_BOARD_KWORLD_DVB_305U:
1433 		em28xx_write_regs(dev, EM28XX_R0F_XCLK, "\x27", 1);
1434 		em28xx_write_regs(dev, EM28XX_R06_I2C_CLK, "\x4c", 1);
1435 		msleep(10);
1436 		em28xx_write_regs(dev, 0x08, "\x6d", 1);
1437 		msleep(10);
1438 		em28xx_write_regs(dev, 0x08, "\x7d", 1);
1439 		msleep(10);
1440 		break;
1441 
1442 	case EM2870_BOARD_KWORLD_355U:
1443 		em28xx_write_regs(dev, EM28XX_R0F_XCLK, "\x27", 1);
1444 		em28xx_write_regs(dev, EM28XX_R06_I2C_CLK, "\x40", 1);
1445 		msleep(50);
1446 
1447 		/* Sets GPO/GPIO sequences for this device */
1448 		dev->digital_gpio     = em2870_kworld_355u_digital;
1449 		break;
1450 
1451 	case EM2870_BOARD_COMPRO_VIDEOMATE:
1452 		em28xx_write_regs(dev, EM28XX_R0F_XCLK, "\x27", 1);
1453 		em28xx_write_regs(dev, EM28XX_R06_I2C_CLK, "\x40", 1);
1454 		/* TODO: someone can do some cleanup here...
1455 			 not everything's needed */
1456 		em28xx_write_regs(dev, 0x04, "\x00", 1);
1457 		msleep(10);
1458 		em28xx_write_regs(dev, 0x04, "\x01", 1);
1459 		msleep(10);
1460 		em28xx_write_regs(dev, 0x08, "\xfd", 1);
1461 		mdelay(70);
1462 		em28xx_write_regs(dev, 0x08, "\xfc", 1);
1463 		mdelay(70);
1464 		em28xx_write_regs(dev, 0x08, "\xdc", 1);
1465 		mdelay(70);
1466 		em28xx_write_regs(dev, 0x08, "\xfc", 1);
1467 		mdelay(70);
1468 		break;
1469 
1470 	case EM2870_BOARD_TERRATEC_XS_MT2060:
1471 		em28xx_write_regs(dev, EM28XX_R0F_XCLK, "\x27", 1);
1472 		em28xx_write_regs(dev, EM28XX_R06_I2C_CLK, "\x40", 1);
1473 		/* this device needs some gpio writes to get the DVB-T
1474 		   demod work */
1475 		em28xx_write_regs(dev, 0x08, "\xfe", 1);
1476 		mdelay(70);
1477 		em28xx_write_regs(dev, 0x08, "\xde", 1);
1478 		mdelay(70);
1479 		dev->em28xx_write_regs(dev, 0x08, "\xfe", 1);
1480 		mdelay(70);
1481 		break;
1482 
1483 	case EM2870_BOARD_PINNACLE_PCTV_DVB:
1484 		em28xx_write_regs(dev, EM28XX_R06_I2C_CLK, "\x40", 1);
1485 		/* this device needs some gpio writes to get the
1486 		   DVB-T demod work */
1487 		em28xx_write_regs(dev, 0x08, "\xfe", 1);
1488 		mdelay(70);
1489 		em28xx_write_regs(dev, 0x08, "\xde", 1);
1490 		mdelay(70);
1491 		em28xx_write_regs(dev, 0x08, "\xfe", 1);
1492 		mdelay(70);
1493 		/* switch em2880 rc protocol */
1494 		em28xx_write_regs(dev, EM28XX_R0F_XCLK, "\x22", 1);
1495 		/* should be added ir_codes here */
1496 		break;
1497 
1498 	case EM2820_BOARD_GADMEI_UTV310:
1499 		em28xx_write_regs(dev, EM28XX_R0F_XCLK, "\x27", 1);
1500 		em28xx_write_regs(dev, EM28XX_R06_I2C_CLK, "\x40", 1);
1501 		/* Turn on analog audio output */
1502 		em28xx_write_regs_req(dev, 0x00, 0x08, "\xfd", 1);
1503 		break;
1504 
1505 	case EM2860_BOARD_GADMEI_UTV330:
1506 		/* Turn on IR */
1507 		em28xx_write_regs(dev, EM28XX_R0F_XCLK, "\x07", 1);
1508 		em28xx_write_regs(dev, EM28XX_R06_I2C_CLK, "\x40", 1);
1509 		/* should be added ir_codes here */
1510 		break;
1511 
1512 	case EM2820_BOARD_MSI_VOX_USB_2:
1513 		em28xx_write_regs(dev, EM28XX_R0F_XCLK, "\x27", 1);
1514 		em28xx_write_regs(dev, EM28XX_R06_I2C_CLK, "\x40", 1);
1515 		/* enables audio for that device */
1516 		em28xx_write_regs_req(dev, 0x00, 0x08, "\xfd", 1);
1517 		break;
1518 	}
1519 
1520 	em28xx_gpio_set(dev, dev->tun_analog_gpio);
1521 	em28xx_set_mode(dev, EM28XX_ANALOG_MODE);
1522 
1523 	/* Unlock device */
1524 	em28xx_set_mode(dev, EM28XX_MODE_UNDEFINED);
1525 }
1526 
1527 static void em28xx_setup_xc3028(struct em28xx *dev, struct xc2028_ctrl *ctl)
1528 {
1529 	memset(ctl, 0, sizeof(*ctl));
1530 
1531 	ctl->fname   = XC2028_DEFAULT_FIRMWARE;
1532 	ctl->max_len = 64;
1533 	ctl->mts = em28xx_boards[dev->model].mts_firmware;
1534 
1535 	switch (dev->model) {
1536 	case EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900:
1537 		ctl->demod = XC3028_FE_ZARLINK456;
1538 		break;
1539 	case EM2880_BOARD_TERRATEC_HYBRID_XS:
1540 		ctl->demod = XC3028_FE_ZARLINK456;
1541 		break;
1542 	case EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900_R2:
1543 		/* djh - Not sure which demod we need here */
1544 		ctl->demod = XC3028_FE_DEFAULT;
1545 		break;
1546 	case EM2880_BOARD_AMD_ATI_TV_WONDER_HD_600:
1547 		ctl->demod = XC3028_FE_DEFAULT;
1548 		ctl->fname = XC3028L_DEFAULT_FIRMWARE;
1549 		break;
1550 	case EM2883_BOARD_HAUPPAUGE_WINTV_HVR_950:
1551 	case EM2880_BOARD_PINNACLE_PCTV_HD_PRO:
1552 		/* FIXME: Better to specify the needed IF */
1553 		ctl->demod = XC3028_FE_DEFAULT;
1554 		break;
1555 	default:
1556 		ctl->demod = XC3028_FE_OREN538;
1557 	}
1558 }
1559 
1560 static void em28xx_config_tuner(struct em28xx *dev)
1561 {
1562 	struct v4l2_priv_tun_config  xc2028_cfg;
1563 	struct tuner_setup           tun_setup;
1564 	struct v4l2_frequency        f;
1565 
1566 	if (dev->tuner_type == TUNER_ABSENT)
1567 		return;
1568 
1569 	tun_setup.mode_mask = T_ANALOG_TV | T_RADIO;
1570 	tun_setup.type = dev->tuner_type;
1571 	tun_setup.addr = dev->tuner_addr;
1572 	tun_setup.tuner_callback = em28xx_tuner_callback;
1573 
1574 	em28xx_i2c_call_clients(dev, TUNER_SET_TYPE_ADDR, &tun_setup);
1575 
1576 	if (dev->tuner_type == TUNER_XC2028) {
1577 		struct xc2028_ctrl           ctl;
1578 
1579 		em28xx_setup_xc3028(dev, &ctl);
1580 
1581 		xc2028_cfg.tuner = TUNER_XC2028;
1582 		xc2028_cfg.priv  = &ctl;
1583 
1584 		em28xx_i2c_call_clients(dev, TUNER_SET_CONFIG, &xc2028_cfg);
1585 	}
1586 
1587 	/* configure tuner */
1588 	f.tuner = 0;
1589 	f.type = V4L2_TUNER_ANALOG_TV;
1590 	f.frequency = 9076;     /* just a magic number */
1591 	dev->ctl_freq = f.frequency;
1592 	em28xx_i2c_call_clients(dev, VIDIOC_S_FREQUENCY, &f);
1593 }
1594 
1595 static int em28xx_hint_board(struct em28xx *dev)
1596 {
1597 	int i;
1598 
1599 	/* HINT method: EEPROM
1600 	 *
1601 	 * This method works only for boards with eeprom.
1602 	 * Uses a hash of all eeprom bytes. The hash should be
1603 	 * unique for a vendor/tuner pair.
1604 	 * There are a high chance that tuners for different
1605 	 * video standards produce different hashes.
1606 	 */
1607 	for (i = 0; i < ARRAY_SIZE(em28xx_eeprom_hash); i++) {
1608 		if (dev->hash == em28xx_eeprom_hash[i].hash) {
1609 			dev->model = em28xx_eeprom_hash[i].model;
1610 			dev->tuner_type = em28xx_eeprom_hash[i].tuner;
1611 
1612 			em28xx_errdev("Your board has no unique USB ID.\n");
1613 			em28xx_errdev("A hint were successfully done, "
1614 				      "based on eeprom hash.\n");
1615 			em28xx_errdev("This method is not 100%% failproof.\n");
1616 			em28xx_errdev("If the board were missdetected, "
1617 				      "please email this log to:\n");
1618 			em28xx_errdev("\tV4L Mailing List "
1619 				      " <video4linux-list@redhat.com>\n");
1620 			em28xx_errdev("Board detected as %s\n",
1621 				      em28xx_boards[dev->model].name);
1622 
1623 			return 0;
1624 		}
1625 	}
1626 
1627 	/* HINT method: I2C attached devices
1628 	 *
1629 	 * This method works for all boards.
1630 	 * Uses a hash of i2c scanned devices.
1631 	 * Devices with the same i2c attached chips will
1632 	 * be considered equal.
1633 	 * This method is less precise than the eeprom one.
1634 	 */
1635 
1636 	/* user did not request i2c scanning => do it now */
1637 	if (!dev->i2c_hash)
1638 		em28xx_do_i2c_scan(dev);
1639 
1640 	for (i = 0; i < ARRAY_SIZE(em28xx_i2c_hash); i++) {
1641 		if (dev->i2c_hash == em28xx_i2c_hash[i].hash) {
1642 			dev->model = em28xx_i2c_hash[i].model;
1643 			dev->tuner_type = em28xx_i2c_hash[i].tuner;
1644 			em28xx_errdev("Your board has no unique USB ID.\n");
1645 			em28xx_errdev("A hint were successfully done, "
1646 				      "based on i2c devicelist hash.\n");
1647 			em28xx_errdev("This method is not 100%% failproof.\n");
1648 			em28xx_errdev("If the board were missdetected, "
1649 				      "please email this log to:\n");
1650 			em28xx_errdev("\tV4L Mailing List "
1651 				      " <video4linux-list@redhat.com>\n");
1652 			em28xx_errdev("Board detected as %s\n",
1653 				      em28xx_boards[dev->model].name);
1654 
1655 			return 0;
1656 		}
1657 	}
1658 
1659 	em28xx_errdev("Your board has no unique USB ID and thus need a "
1660 		      "hint to be detected.\n");
1661 	em28xx_errdev("You may try to use card=<n> insmod option to "
1662 		      "workaround that.\n");
1663 	em28xx_errdev("Please send an email with this log to:\n");
1664 	em28xx_errdev("\tV4L Mailing List <video4linux-list@redhat.com>\n");
1665 	em28xx_errdev("Board eeprom hash is 0x%08lx\n", dev->hash);
1666 	em28xx_errdev("Board i2c devicelist hash is 0x%08lx\n", dev->i2c_hash);
1667 
1668 	em28xx_errdev("Here is a list of valid choices for the card=<n>"
1669 		      " insmod option:\n");
1670 	for (i = 0; i < em28xx_bcount; i++) {
1671 		em28xx_errdev("    card=%d -> %s\n",
1672 				i, em28xx_boards[i].name);
1673 	}
1674 	return -1;
1675 }
1676 
1677 /* ----------------------------------------------------------------------- */
1678 void em28xx_set_ir(struct em28xx *dev, struct IR_i2c *ir)
1679 {
1680 	if (disable_ir) {
1681 		ir->get_key = NULL;
1682 		return ;
1683 	}
1684 
1685 	/* detect & configure */
1686 	switch (dev->model) {
1687 	case (EM2800_BOARD_UNKNOWN):
1688 		break;
1689 	case (EM2820_BOARD_UNKNOWN):
1690 		break;
1691 	case (EM2800_BOARD_TERRATEC_CINERGY_200):
1692 	case (EM2820_BOARD_TERRATEC_CINERGY_250):
1693 		ir->ir_codes = ir_codes_em_terratec;
1694 		ir->get_key = em28xx_get_key_terratec;
1695 		snprintf(ir->c.name, sizeof(ir->c.name),
1696 			 "i2c IR (EM28XX Terratec)");
1697 		break;
1698 	case (EM2820_BOARD_PINNACLE_USB_2):
1699 		ir->ir_codes = ir_codes_pinnacle_grey;
1700 		ir->get_key = em28xx_get_key_pinnacle_usb_grey;
1701 		snprintf(ir->c.name, sizeof(ir->c.name),
1702 			 "i2c IR (EM28XX Pinnacle PCTV)");
1703 		break;
1704 	case (EM2820_BOARD_HAUPPAUGE_WINTV_USB_2):
1705 		ir->ir_codes = ir_codes_hauppauge_new;
1706 		ir->get_key = em28xx_get_key_em_haup;
1707 		snprintf(ir->c.name, sizeof(ir->c.name),
1708 			 "i2c IR (EM2840 Hauppauge)");
1709 		break;
1710 	case (EM2820_BOARD_MSI_VOX_USB_2):
1711 		break;
1712 	case (EM2800_BOARD_LEADTEK_WINFAST_USBII):
1713 		break;
1714 	case (EM2800_BOARD_KWORLD_USB2800):
1715 		break;
1716 	case (EM2800_BOARD_GRABBEEX_USB2800):
1717 		break;
1718 	}
1719 }
1720 
1721 void em28xx_card_setup(struct em28xx *dev)
1722 {
1723 	em28xx_set_model(dev);
1724 
1725 	dev->tuner_type = em28xx_boards[dev->model].tuner_type;
1726 
1727 	/* request some modules */
1728 	switch (dev->model) {
1729 	case EM2820_BOARD_HAUPPAUGE_WINTV_USB_2:
1730 	case EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900:
1731 	case EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900_R2:
1732 	case EM2883_BOARD_HAUPPAUGE_WINTV_HVR_950:
1733 	{
1734 		struct tveeprom tv;
1735 #ifdef CONFIG_MODULES
1736 		request_module("tveeprom");
1737 #endif
1738 		/* Call first TVeeprom */
1739 
1740 		dev->i2c_client.addr = 0xa0 >> 1;
1741 		tveeprom_hauppauge_analog(&dev->i2c_client, &tv, dev->eedata);
1742 
1743 		dev->tuner_type = tv.tuner_type;
1744 
1745 		if (tv.audio_processor == V4L2_IDENT_MSPX4XX) {
1746 			dev->i2s_speed = 2048000;
1747 			dev->has_msp34xx = 1;
1748 		}
1749 #ifdef CONFIG_MODULES
1750 		if (tv.has_ir)
1751 			request_module("ir-kbd-i2c");
1752 #endif
1753 		break;
1754 	}
1755 	case EM2820_BOARD_KWORLD_PVRTV2800RF:
1756 		/* GPIO enables sound on KWORLD PVR TV 2800RF */
1757 		em28xx_write_regs_req(dev, 0x00, 0x08, "\xf9", 1);
1758 		break;
1759 	case EM2820_BOARD_UNKNOWN:
1760 	case EM2800_BOARD_UNKNOWN:
1761 		/*
1762 		 * The K-WORLD DVB-T 310U is detected as an MSI Digivox AD.
1763 		 *
1764 		 * This occurs because they share identical USB vendor and
1765 		 * product IDs.
1766 		 *
1767 		 * What we do here is look up the EEPROM hash of the K-WORLD
1768 		 * and if it is found then we decide that we do not have
1769 		 * a DIGIVOX and reset the device to the K-WORLD instead.
1770 		 *
1771 		 * This solution is only valid if they do not share eeprom
1772 		 * hash identities which has not been determined as yet.
1773 		 */
1774 	case EM2880_BOARD_MSI_DIGIVOX_AD:
1775 		if (!em28xx_hint_board(dev))
1776 			em28xx_set_model(dev);
1777 		break;
1778 	}
1779 
1780 	if (dev->has_snapshot_button)
1781 		em28xx_register_snapshot_button(dev);
1782 
1783 	if (dev->valid == EM28XX_BOARD_NOT_VALIDATED) {
1784 		em28xx_errdev("\n\n");
1785 		em28xx_errdev("The support for this board weren't "
1786 			      "valid yet.\n");
1787 		em28xx_errdev("Please send a report of having this working\n");
1788 		em28xx_errdev("not to V4L mailing list (and/or to other "
1789 				"addresses)\n\n");
1790 	}
1791 
1792 	/* Allow override tuner type by a module parameter */
1793 	if (tuner >= 0)
1794 		dev->tuner_type = tuner;
1795 
1796 #ifdef CONFIG_MODULES
1797 	/* request some modules */
1798 	if (dev->has_msp34xx)
1799 		request_module("msp3400");
1800 	if (dev->decoder == EM28XX_SAA7113 || dev->decoder == EM28XX_SAA7114)
1801 		request_module("saa7115");
1802 	if (dev->decoder == EM28XX_TVP5150)
1803 		request_module("tvp5150");
1804 	if (dev->tuner_type != TUNER_ABSENT)
1805 		request_module("tuner");
1806 #endif
1807 
1808 	em28xx_config_tuner(dev);
1809 }

Attached Files

To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.
  • [get | view] (16.09.2014 11:33, 49.7 KB) [[attachment:IMGP0335.jpg]]
  • [get | view] (16.09.2014 11:33, 199.0 KB) [[attachment:MKFR.jpg]]
  • [get | view] (16.09.2014 11:33, 51.3 KB) [[attachment:em28xx-cards.c]]
  • [get | view] (16.09.2014 11:33, 17.8 KB) [[attachment:em28xx.h]]
 All files | Selected Files: delete move to page

You are not allowed to attach a file to this page.