pvrusb2-devattr.c 15.1 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
/*
 *
 *
 *  Copyright (C) 2007 Mike Isely <isely@pobox.com>
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 */

/*

This source file should encompass ALL per-device type information for the
driver.  To define a new device, add elements to the pvr2_device_table and
pvr2_device_desc structures.

*/

#include "pvrusb2-devattr.h"
#include <linux/usb.h>
31
/* This is needed in order to pull in tuner type ids... */
32 33
#include <linux/i2c.h>
#include <media/tuner.h>
34 35 36
#ifdef CONFIG_VIDEO_PVRUSB2_DVB
#include "pvrusb2-hdw-internal.h"
#include "lgdt330x.h"
37
#include "s5h1409.h"
38
#include "s5h1411.h"
39
#include "tda10048.h"
40 41
#include "tda18271.h"
#include "tda8290.h"
42 43
#include "tuner-simple.h"
#endif
44

45

46 47
/*------------------------------------------------------------------------*/
/* Hauppauge PVR-USB2 Model 29xxx */
48

49 50 51 52
static const struct pvr2_device_client_desc pvr2_cli_29xxx[] = {
	{ .module_id = PVR2_CLIENT_ID_SAA7115 },
	{ .module_id = PVR2_CLIENT_ID_MSP3400 },
	{ .module_id = PVR2_CLIENT_ID_TUNER },
53
	{ .module_id = PVR2_CLIENT_ID_DEMOD },
54 55 56 57 58 59
};

static const char *pvr2_fw1_names_29xxx[] = {
		"v4l-pvrusb2-29xxx-01.fw",
};

60
static const struct pvr2_device_desc pvr2_device_29xxx = {
61
		.description = "WinTV PVR USB2 Model Category 29xxx",
62
		.shortname = "29xxx",
63 64
		.client_table.lst = pvr2_cli_29xxx,
		.client_table.cnt = ARRAY_SIZE(pvr2_cli_29xxx),
65 66
		.fx2_firmware.lst = pvr2_fw1_names_29xxx,
		.fx2_firmware.cnt = ARRAY_SIZE(pvr2_fw1_names_29xxx),
67
		.flag_has_hauppauge_rom = !0,
68
		.flag_has_analogtuner = !0,
69
		.flag_has_fmradio = !0,
70 71
		.flag_has_composite = !0,
		.flag_has_svideo = !0,
72
		.signal_routing_scheme = PVR2_ROUTING_SCHEME_HAUPPAUGE,
73
		.led_scheme = PVR2_LED_SCHEME_HAUPPAUGE,
74 75 76 77 78 79 80
};



/*------------------------------------------------------------------------*/
/* Hauppauge PVR-USB2 Model 24xxx */

81 82 83 84
static const struct pvr2_device_client_desc pvr2_cli_24xxx[] = {
	{ .module_id = PVR2_CLIENT_ID_CX25840 },
	{ .module_id = PVR2_CLIENT_ID_TUNER },
	{ .module_id = PVR2_CLIENT_ID_WM8775 },
85
	{ .module_id = PVR2_CLIENT_ID_DEMOD },
86 87 88 89 90 91 92
};

static const char *pvr2_fw1_names_24xxx[] = {
		"v4l-pvrusb2-24xxx-01.fw",
};

static const struct pvr2_device_desc pvr2_device_24xxx = {
93
		.description = "WinTV PVR USB2 Model Category 24xxx",
94
		.shortname = "24xxx",
95 96
		.client_table.lst = pvr2_cli_24xxx,
		.client_table.cnt = ARRAY_SIZE(pvr2_cli_24xxx),
97 98 99 100
		.fx2_firmware.lst = pvr2_fw1_names_24xxx,
		.fx2_firmware.cnt = ARRAY_SIZE(pvr2_fw1_names_24xxx),
		.flag_has_cx25840 = !0,
		.flag_has_wm8775 = !0,
101
		.flag_has_hauppauge_rom = !0,
102
		.flag_has_analogtuner = !0,
103
		.flag_has_fmradio = !0,
104 105
		.flag_has_composite = !0,
		.flag_has_svideo = !0,
106
		.signal_routing_scheme = PVR2_ROUTING_SCHEME_HAUPPAUGE,
107
		.led_scheme = PVR2_LED_SCHEME_HAUPPAUGE,
108
		.ir_scheme = PVR2_IR_SCHEME_24XXX,
109 110 111 112 113 114 115
};



/*------------------------------------------------------------------------*/
/* GOTVIEW USB2.0 DVD2 */

116 117 118
static const struct pvr2_device_client_desc pvr2_cli_gotview_2[] = {
	{ .module_id = PVR2_CLIENT_ID_CX25840 },
	{ .module_id = PVR2_CLIENT_ID_TUNER },
119 120 121
};

static const struct pvr2_device_desc pvr2_device_gotview_2 = {
122 123
		.description = "Gotview USB 2.0 DVD 2",
		.shortname = "gv2",
124 125
		.client_table.lst = pvr2_cli_gotview_2,
		.client_table.cnt = ARRAY_SIZE(pvr2_cli_gotview_2),
126
		.flag_has_cx25840 = !0,
127
		.default_tuner_type = TUNER_PHILIPS_FM1216ME_MK3,
128
		.flag_has_analogtuner = !0,
129
		.flag_has_fmradio = !0,
130 131
		.flag_has_composite = !0,
		.flag_has_svideo = !0,
132
		.signal_routing_scheme = PVR2_ROUTING_SCHEME_GOTVIEW,
133 134 135 136
};



137 138 139 140 141 142 143 144
/*------------------------------------------------------------------------*/
/* GOTVIEW USB2.0 DVD Deluxe */

/* (same module list as gotview_2) */

static const struct pvr2_device_desc pvr2_device_gotview_2d = {
		.description = "Gotview USB 2.0 DVD Deluxe",
		.shortname = "gv2d",
145 146
		.client_table.lst = pvr2_cli_gotview_2,
		.client_table.cnt = ARRAY_SIZE(pvr2_cli_gotview_2),
147 148 149 150 151 152 153 154 155 156
		.flag_has_cx25840 = !0,
		.default_tuner_type = TUNER_PHILIPS_FM1216ME_MK3,
		.flag_has_analogtuner = !0,
		.flag_has_composite = !0,
		.flag_has_svideo = !0,
		.signal_routing_scheme = PVR2_ROUTING_SCHEME_GOTVIEW,
};



157 158 159
/*------------------------------------------------------------------------*/
/* OnAir Creator */

160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185
#ifdef CONFIG_VIDEO_PVRUSB2_DVB
static struct lgdt330x_config pvr2_lgdt3303_config = {
	.demod_address       = 0x0e,
	.demod_chip          = LGDT3303,
	.clock_polarity_flip = 1,
};

static int pvr2_lgdt3303_attach(struct pvr2_dvb_adapter *adap)
{
	adap->fe = dvb_attach(lgdt330x_attach, &pvr2_lgdt3303_config,
			      &adap->channel.hdw->i2c_adap);
	if (adap->fe)
		return 0;

	return -EIO;
}

static int pvr2_lgh06xf_attach(struct pvr2_dvb_adapter *adap)
{
	dvb_attach(simple_tuner_attach, adap->fe,
		   &adap->channel.hdw->i2c_adap, 0x61,
		   TUNER_LG_TDVS_H06XF);

	return 0;
}

186
static const struct pvr2_dvb_props pvr2_onair_creator_fe_props = {
187 188 189 190 191
	.frontend_attach = pvr2_lgdt3303_attach,
	.tuner_attach    = pvr2_lgh06xf_attach,
};
#endif

192 193 194 195
static const struct pvr2_device_client_desc pvr2_cli_onair_creator[] = {
	{ .module_id = PVR2_CLIENT_ID_SAA7115 },
	{ .module_id = PVR2_CLIENT_ID_CS53L32A },
	{ .module_id = PVR2_CLIENT_ID_TUNER },
196 197 198
};

static const struct pvr2_device_desc pvr2_device_onair_creator = {
199 200
		.description = "OnAir Creator Hybrid USB tuner",
		.shortname = "oac",
201 202
		.client_table.lst = pvr2_cli_onair_creator,
		.client_table.cnt = ARRAY_SIZE(pvr2_cli_onair_creator),
203
		.default_tuner_type = TUNER_LG_TDVS_H06XF,
204 205 206
		.flag_has_analogtuner = !0,
		.flag_has_composite = !0,
		.flag_has_svideo = !0,
207
		.flag_digital_requires_cx23416 = !0,
208
		.signal_routing_scheme = PVR2_ROUTING_SCHEME_HAUPPAUGE,
209
		.digital_control_scheme = PVR2_DIGITAL_SCHEME_ONAIR,
210
		.default_std_mask = V4L2_STD_NTSC_M,
211 212 213
#ifdef CONFIG_VIDEO_PVRUSB2_DVB
		.dvb_props = &pvr2_onair_creator_fe_props,
#endif
214 215 216 217 218 219 220
};



/*------------------------------------------------------------------------*/
/* OnAir USB 2.0 */

221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245
#ifdef CONFIG_VIDEO_PVRUSB2_DVB
static struct lgdt330x_config pvr2_lgdt3302_config = {
	.demod_address       = 0x0e,
	.demod_chip          = LGDT3302,
};

static int pvr2_lgdt3302_attach(struct pvr2_dvb_adapter *adap)
{
	adap->fe = dvb_attach(lgdt330x_attach, &pvr2_lgdt3302_config,
			      &adap->channel.hdw->i2c_adap);
	if (adap->fe)
		return 0;

	return -EIO;
}

static int pvr2_fcv1236d_attach(struct pvr2_dvb_adapter *adap)
{
	dvb_attach(simple_tuner_attach, adap->fe,
		   &adap->channel.hdw->i2c_adap, 0x61,
		   TUNER_PHILIPS_FCV1236D);

	return 0;
}

246
static const struct pvr2_dvb_props pvr2_onair_usb2_fe_props = {
247 248 249 250 251
	.frontend_attach = pvr2_lgdt3302_attach,
	.tuner_attach    = pvr2_fcv1236d_attach,
};
#endif

252 253 254 255
static const struct pvr2_device_client_desc pvr2_cli_onair_usb2[] = {
	{ .module_id = PVR2_CLIENT_ID_SAA7115 },
	{ .module_id = PVR2_CLIENT_ID_CS53L32A },
	{ .module_id = PVR2_CLIENT_ID_TUNER },
256 257 258
};

static const struct pvr2_device_desc pvr2_device_onair_usb2 = {
259 260
		.description = "OnAir USB2 Hybrid USB tuner",
		.shortname = "oa2",
261 262
		.client_table.lst = pvr2_cli_onair_usb2,
		.client_table.cnt = ARRAY_SIZE(pvr2_cli_onair_usb2),
263
		.default_tuner_type = TUNER_PHILIPS_FCV1236D,
264 265 266
		.flag_has_analogtuner = !0,
		.flag_has_composite = !0,
		.flag_has_svideo = !0,
267
		.flag_digital_requires_cx23416 = !0,
268
		.signal_routing_scheme = PVR2_ROUTING_SCHEME_HAUPPAUGE,
269
		.digital_control_scheme = PVR2_DIGITAL_SCHEME_ONAIR,
270
		.default_std_mask = V4L2_STD_NTSC_M,
271 272 273
#ifdef CONFIG_VIDEO_PVRUSB2_DVB
		.dvb_props = &pvr2_onair_usb2_fe_props,
#endif
274
};
275 276


277

278 279 280
/*------------------------------------------------------------------------*/
/* Hauppauge PVR-USB2 Model 73xxx */

281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318
#ifdef CONFIG_VIDEO_PVRUSB2_DVB
static struct tda10048_config hauppauge_tda10048_config = {
	.demod_address  = 0x10 >> 1,
	.output_mode    = TDA10048_PARALLEL_OUTPUT,
	.fwbulkwritelen = TDA10048_BULKWRITE_50,
	.inversion      = TDA10048_INVERSION_ON,
};

static struct tda829x_config tda829x_no_probe = {
	.probe_tuner = TDA829X_DONT_PROBE,
};

static struct tda18271_config hauppauge_tda18271_dvb_config = {
	.gate    = TDA18271_GATE_ANALOG,
};

static int pvr2_tda10048_attach(struct pvr2_dvb_adapter *adap)
{
	adap->fe = dvb_attach(tda10048_attach, &hauppauge_tda10048_config,
			      &adap->channel.hdw->i2c_adap);
	if (adap->fe)
		return 0;

	return -EIO;
}

static int pvr2_73xxx_tda18271_8295_attach(struct pvr2_dvb_adapter *adap)
{
	dvb_attach(tda829x_attach, adap->fe,
		   &adap->channel.hdw->i2c_adap, 0x42,
		   &tda829x_no_probe);
	dvb_attach(tda18271_attach, adap->fe, 0x60,
		   &adap->channel.hdw->i2c_adap,
		   &hauppauge_tda18271_dvb_config);

	return 0;
}

319
static const struct pvr2_dvb_props pvr2_73xxx_dvb_props = {
320 321 322 323 324
	.frontend_attach = pvr2_tda10048_attach,
	.tuner_attach    = pvr2_73xxx_tda18271_8295_attach,
};
#endif

325 326 327 328
static const struct pvr2_device_client_desc pvr2_cli_73xxx[] = {
	{ .module_id = PVR2_CLIENT_ID_CX25840 },
	{ .module_id = PVR2_CLIENT_ID_TUNER,
	  .i2c_address_list = "\x42"},
329 330 331 332 333 334 335
};

static const char *pvr2_fw1_names_73xxx[] = {
		"v4l-pvrusb2-73xxx-01.fw",
};

static const struct pvr2_device_desc pvr2_device_73xxx = {
336
		.description = "WinTV HVR-1900 Model Category 73xxx",
337
		.shortname = "73xxx",
338 339
		.client_table.lst = pvr2_cli_73xxx,
		.client_table.cnt = ARRAY_SIZE(pvr2_cli_73xxx),
340 341 342 343 344 345 346 347 348 349
		.fx2_firmware.lst = pvr2_fw1_names_73xxx,
		.fx2_firmware.cnt = ARRAY_SIZE(pvr2_fw1_names_73xxx),
		.flag_has_cx25840 = !0,
		.flag_has_hauppauge_rom = !0,
		.flag_has_analogtuner = !0,
		.flag_has_composite = !0,
		.flag_has_svideo = !0,
		.signal_routing_scheme = PVR2_ROUTING_SCHEME_HAUPPAUGE,
		.digital_control_scheme = PVR2_DIGITAL_SCHEME_HAUPPAUGE,
		.led_scheme = PVR2_LED_SCHEME_HAUPPAUGE,
350
		.ir_scheme = PVR2_IR_SCHEME_ZILOG,
351 352 353
#ifdef CONFIG_VIDEO_PVRUSB2_DVB
		.dvb_props = &pvr2_73xxx_dvb_props,
#endif
354 355 356 357
};



358 359 360
/*------------------------------------------------------------------------*/
/* Hauppauge PVR-USB2 Model 75xxx */

361 362 363 364 365 366 367 368 369 370
#ifdef CONFIG_VIDEO_PVRUSB2_DVB
static struct s5h1409_config pvr2_s5h1409_config = {
	.demod_address = 0x32 >> 1,
	.output_mode   = S5H1409_PARALLEL_OUTPUT,
	.gpio          = S5H1409_GPIO_OFF,
	.qam_if        = 4000,
	.inversion     = S5H1409_INVERSION_ON,
	.status_mode   = S5H1409_DEMODLOCKING,
};

371 372 373 374 375 376 377 378 379
static struct s5h1411_config pvr2_s5h1411_config = {
	.output_mode   = S5H1411_PARALLEL_OUTPUT,
	.gpio          = S5H1411_GPIO_OFF,
	.vsb_if        = S5H1411_IF_44000,
	.qam_if        = S5H1411_IF_4000,
	.inversion     = S5H1411_INVERSION_ON,
	.status_mode   = S5H1411_DEMODLOCKING,
};

380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401
static struct tda18271_std_map hauppauge_tda18271_std_map = {
	.atsc_6   = { .if_freq = 5380, .agc_mode = 3, .std = 3,
		      .if_lvl = 6, .rfagc_top = 0x37, },
	.qam_6    = { .if_freq = 4000, .agc_mode = 3, .std = 0,
		      .if_lvl = 6, .rfagc_top = 0x37, },
};

static struct tda18271_config hauppauge_tda18271_config = {
	.std_map = &hauppauge_tda18271_std_map,
	.gate    = TDA18271_GATE_ANALOG,
};

static int pvr2_s5h1409_attach(struct pvr2_dvb_adapter *adap)
{
	adap->fe = dvb_attach(s5h1409_attach, &pvr2_s5h1409_config,
			      &adap->channel.hdw->i2c_adap);
	if (adap->fe)
		return 0;

	return -EIO;
}

402 403 404 405 406 407 408 409 410 411
static int pvr2_s5h1411_attach(struct pvr2_dvb_adapter *adap)
{
	adap->fe = dvb_attach(s5h1411_attach, &pvr2_s5h1411_config,
			      &adap->channel.hdw->i2c_adap);
	if (adap->fe)
		return 0;

	return -EIO;
}

412 413 414 415 416 417 418 419 420 421 422 423
static int pvr2_tda18271_8295_attach(struct pvr2_dvb_adapter *adap)
{
	dvb_attach(tda829x_attach, adap->fe,
		   &adap->channel.hdw->i2c_adap, 0x42,
		   &tda829x_no_probe);
	dvb_attach(tda18271_attach, adap->fe, 0x60,
		   &adap->channel.hdw->i2c_adap,
		   &hauppauge_tda18271_config);

	return 0;
}

424
static const struct pvr2_dvb_props pvr2_750xx_dvb_props = {
425 426 427
	.frontend_attach = pvr2_s5h1409_attach,
	.tuner_attach    = pvr2_tda18271_8295_attach,
};
428

429
static const struct pvr2_dvb_props pvr2_751xx_dvb_props = {
430 431 432
	.frontend_attach = pvr2_s5h1411_attach,
	.tuner_attach    = pvr2_tda18271_8295_attach,
};
433 434
#endif

435 436 437 438
static const char *pvr2_fw1_names_75xxx[] = {
		"v4l-pvrusb2-73xxx-01.fw",
};

439
static const struct pvr2_device_desc pvr2_device_750xx = {
440
		.description = "WinTV HVR-1950 Model Category 750xx",
441
		.shortname = "750xx",
442 443
		.client_table.lst = pvr2_cli_73xxx,
		.client_table.cnt = ARRAY_SIZE(pvr2_cli_73xxx),
444 445 446 447 448 449 450 451 452 453 454
		.fx2_firmware.lst = pvr2_fw1_names_75xxx,
		.fx2_firmware.cnt = ARRAY_SIZE(pvr2_fw1_names_75xxx),
		.flag_has_cx25840 = !0,
		.flag_has_hauppauge_rom = !0,
		.flag_has_analogtuner = !0,
		.flag_has_composite = !0,
		.flag_has_svideo = !0,
		.signal_routing_scheme = PVR2_ROUTING_SCHEME_HAUPPAUGE,
		.digital_control_scheme = PVR2_DIGITAL_SCHEME_HAUPPAUGE,
		.default_std_mask = V4L2_STD_NTSC_M,
		.led_scheme = PVR2_LED_SCHEME_HAUPPAUGE,
455
		.ir_scheme = PVR2_IR_SCHEME_ZILOG,
456 457 458
#ifdef CONFIG_VIDEO_PVRUSB2_DVB
		.dvb_props = &pvr2_750xx_dvb_props,
#endif
459 460 461
};

static const struct pvr2_device_desc pvr2_device_751xx = {
462
		.description = "WinTV HVR-1950 Model Category 751xx",
463
		.shortname = "751xx",
464 465
		.client_table.lst = pvr2_cli_73xxx,
		.client_table.cnt = ARRAY_SIZE(pvr2_cli_73xxx),
466 467 468 469
		.fx2_firmware.lst = pvr2_fw1_names_75xxx,
		.fx2_firmware.cnt = ARRAY_SIZE(pvr2_fw1_names_75xxx),
		.flag_has_cx25840 = !0,
		.flag_has_hauppauge_rom = !0,
470 471 472
		.flag_has_analogtuner = !0,
		.flag_has_composite = !0,
		.flag_has_svideo = !0,
473
		.signal_routing_scheme = PVR2_ROUTING_SCHEME_HAUPPAUGE,
474
		.digital_control_scheme = PVR2_DIGITAL_SCHEME_HAUPPAUGE,
475
		.default_std_mask = V4L2_STD_NTSC_M,
476
		.led_scheme = PVR2_LED_SCHEME_HAUPPAUGE,
477
		.ir_scheme = PVR2_IR_SCHEME_ZILOG,
478 479 480
#ifdef CONFIG_VIDEO_PVRUSB2_DVB
		.dvb_props = &pvr2_751xx_dvb_props,
#endif
481 482 483 484
};



485 486 487 488 489
/*------------------------------------------------------------------------*/

struct usb_device_id pvr2_device_table[] = {
	{ USB_DEVICE(0x2040, 0x2900),
	  .driver_info = (kernel_ulong_t)&pvr2_device_29xxx},
490 491
	{ USB_DEVICE(0x2040, 0x2950), /* Logically identical to 2900 */
	  .driver_info = (kernel_ulong_t)&pvr2_device_29xxx},
492 493 494 495
	{ USB_DEVICE(0x2040, 0x2400),
	  .driver_info = (kernel_ulong_t)&pvr2_device_24xxx},
	{ USB_DEVICE(0x1164, 0x0622),
	  .driver_info = (kernel_ulong_t)&pvr2_device_gotview_2},
496 497
	{ USB_DEVICE(0x1164, 0x0602),
	  .driver_info = (kernel_ulong_t)&pvr2_device_gotview_2d},
498 499 500 501
	{ USB_DEVICE(0x11ba, 0x1003),
	  .driver_info = (kernel_ulong_t)&pvr2_device_onair_creator},
	{ USB_DEVICE(0x11ba, 0x1001),
	  .driver_info = (kernel_ulong_t)&pvr2_device_onair_usb2},
502 503
	{ USB_DEVICE(0x2040, 0x7300),
	  .driver_info = (kernel_ulong_t)&pvr2_device_73xxx},
504
	{ USB_DEVICE(0x2040, 0x7500),
505
	  .driver_info = (kernel_ulong_t)&pvr2_device_750xx},
506
	{ USB_DEVICE(0x2040, 0x7501),
507
	  .driver_info = (kernel_ulong_t)&pvr2_device_751xx},
508 509
	{ }
};
510 511 512 513 514 515 516 517 518 519 520 521 522

MODULE_DEVICE_TABLE(usb, pvr2_device_table);


/*
  Stuff for Emacs to see, in order to encourage consistent editing style:
  *** Local Variables: ***
  *** mode: c ***
  *** fill-column: 75 ***
  *** tab-width: 8 ***
  *** c-basic-offset: 8 ***
  *** End: ***
  */