1 /*
2  *
3  *
4  *  Copyright (C) 2007 Mike Isely <isely@pobox.com>
5  *
6  *  This program is free software; you can redistribute it and/or modify
7  *  it under the terms of the GNU General Public License as published by
8  *  the Free Software Foundation; either version 2 of the License
9  *
10  *  This program is distributed in the hope that it will be useful,
11  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  *  GNU General Public License for more details.
14  *
15  */
16 
17 /*
18 
19 This source file should encompass ALL per-device type information for the
20 driver.  To define a new device, add elements to the pvr2_device_table and
21 pvr2_device_desc structures.
22 
23 */
24 
25 #include "pvrusb2-devattr.h"
26 #include <linux/usb.h>
27 #include <linux/module.h>
28 /* This is needed in order to pull in tuner type ids... */
29 #include <linux/i2c.h>
30 #include <media/tuner.h>
31 #ifdef CONFIG_VIDEO_PVRUSB2_DVB
32 #include "pvrusb2-hdw-internal.h"
33 #include "lgdt330x.h"
34 #include "s5h1409.h"
35 #include "s5h1411.h"
36 #include "tda10048.h"
37 #include "tda18271.h"
38 #include "tda8290.h"
39 #include "tuner-simple.h"
40 #include "si2157.h"
41 #include "lgdt3306a.h"
42 #include "si2168.h"
43 #endif
44 
45 
46 /*------------------------------------------------------------------------*/
47 /* Hauppauge PVR-USB2 Model 29xxx */
48 
49 static const struct pvr2_device_client_desc pvr2_cli_29xxx[] = {
50 	{ .module_id = PVR2_CLIENT_ID_SAA7115 },
51 	{ .module_id = PVR2_CLIENT_ID_MSP3400 },
52 	{ .module_id = PVR2_CLIENT_ID_TUNER },
53 	{ .module_id = PVR2_CLIENT_ID_DEMOD },
54 };
55 
56 #define PVR2_FIRMWARE_29xxx "v4l-pvrusb2-29xxx-01.fw"
57 static const char *pvr2_fw1_names_29xxx[] = {
58 		PVR2_FIRMWARE_29xxx,
59 };
60 
61 static const struct pvr2_device_desc pvr2_device_29xxx = {
62 		.description = "WinTV PVR USB2 Model 29xxx",
63 		.shortname = "29xxx",
64 		.client_table.lst = pvr2_cli_29xxx,
65 		.client_table.cnt = ARRAY_SIZE(pvr2_cli_29xxx),
66 		.fx2_firmware.lst = pvr2_fw1_names_29xxx,
67 		.fx2_firmware.cnt = ARRAY_SIZE(pvr2_fw1_names_29xxx),
68 		.flag_has_hauppauge_rom = !0,
69 		.flag_has_analogtuner = !0,
70 		.flag_has_fmradio = !0,
71 		.flag_has_composite = !0,
72 		.flag_has_svideo = !0,
73 		.signal_routing_scheme = PVR2_ROUTING_SCHEME_HAUPPAUGE,
74 		.led_scheme = PVR2_LED_SCHEME_HAUPPAUGE,
75 		.ir_scheme = PVR2_IR_SCHEME_29XXX,
76 };
77 
78 
79 
80 /*------------------------------------------------------------------------*/
81 /* Hauppauge PVR-USB2 Model 24xxx */
82 
83 static const struct pvr2_device_client_desc pvr2_cli_24xxx[] = {
84 	{ .module_id = PVR2_CLIENT_ID_CX25840 },
85 	{ .module_id = PVR2_CLIENT_ID_TUNER },
86 	{ .module_id = PVR2_CLIENT_ID_WM8775 },
87 	{ .module_id = PVR2_CLIENT_ID_DEMOD },
88 };
89 
90 #define PVR2_FIRMWARE_24xxx "v4l-pvrusb2-24xxx-01.fw"
91 static const char *pvr2_fw1_names_24xxx[] = {
92 		PVR2_FIRMWARE_24xxx,
93 };
94 
95 static const struct pvr2_device_desc pvr2_device_24xxx = {
96 		.description = "WinTV PVR USB2 Model 24xxx",
97 		.shortname = "24xxx",
98 		.client_table.lst = pvr2_cli_24xxx,
99 		.client_table.cnt = ARRAY_SIZE(pvr2_cli_24xxx),
100 		.fx2_firmware.lst = pvr2_fw1_names_24xxx,
101 		.fx2_firmware.cnt = ARRAY_SIZE(pvr2_fw1_names_24xxx),
102 		.flag_has_cx25840 = !0,
103 		.flag_has_wm8775 = !0,
104 		.flag_has_hauppauge_rom = !0,
105 		.flag_has_analogtuner = !0,
106 		.flag_has_fmradio = !0,
107 		.flag_has_composite = !0,
108 		.flag_has_svideo = !0,
109 		.signal_routing_scheme = PVR2_ROUTING_SCHEME_HAUPPAUGE,
110 		.led_scheme = PVR2_LED_SCHEME_HAUPPAUGE,
111 		.ir_scheme = PVR2_IR_SCHEME_24XXX,
112 };
113 
114 
115 
116 /*------------------------------------------------------------------------*/
117 /* GOTVIEW USB2.0 DVD2 */
118 
119 static const struct pvr2_device_client_desc pvr2_cli_gotview_2[] = {
120 	{ .module_id = PVR2_CLIENT_ID_CX25840 },
121 	{ .module_id = PVR2_CLIENT_ID_TUNER },
122 	{ .module_id = PVR2_CLIENT_ID_DEMOD },
123 };
124 
125 static const struct pvr2_device_desc pvr2_device_gotview_2 = {
126 		.description = "Gotview USB 2.0 DVD 2",
127 		.shortname = "gv2",
128 		.client_table.lst = pvr2_cli_gotview_2,
129 		.client_table.cnt = ARRAY_SIZE(pvr2_cli_gotview_2),
130 		.flag_has_cx25840 = !0,
131 		.default_tuner_type = TUNER_PHILIPS_FM1216ME_MK3,
132 		.flag_has_analogtuner = !0,
133 		.flag_has_fmradio = !0,
134 		.flag_has_composite = !0,
135 		.flag_has_svideo = !0,
136 		.signal_routing_scheme = PVR2_ROUTING_SCHEME_GOTVIEW,
137 };
138 
139 
140 
141 /*------------------------------------------------------------------------*/
142 /* GOTVIEW USB2.0 DVD Deluxe */
143 
144 /* (same module list as gotview_2) */
145 
146 static const struct pvr2_device_desc pvr2_device_gotview_2d = {
147 		.description = "Gotview USB 2.0 DVD Deluxe",
148 		.shortname = "gv2d",
149 		.client_table.lst = pvr2_cli_gotview_2,
150 		.client_table.cnt = ARRAY_SIZE(pvr2_cli_gotview_2),
151 		.flag_has_cx25840 = !0,
152 		.default_tuner_type = TUNER_PHILIPS_FM1216ME_MK3,
153 		.flag_has_analogtuner = !0,
154 		.flag_has_composite = !0,
155 		.flag_has_svideo = !0,
156 		.signal_routing_scheme = PVR2_ROUTING_SCHEME_GOTVIEW,
157 };
158 
159 
160 
161 /*------------------------------------------------------------------------*/
162 /* Terratec Grabster AV400 */
163 
164 static const struct pvr2_device_client_desc pvr2_cli_av400[] = {
165 	{ .module_id = PVR2_CLIENT_ID_CX25840 },
166 };
167 
168 static const struct pvr2_device_desc pvr2_device_av400 = {
169 		.description = "Terratec Grabster AV400",
170 		.shortname = "av400",
171 		.flag_is_experimental = 1,
172 		.client_table.lst = pvr2_cli_av400,
173 		.client_table.cnt = ARRAY_SIZE(pvr2_cli_av400),
174 		.flag_has_cx25840 = !0,
175 		.flag_has_analogtuner = 0,
176 		.flag_has_composite = !0,
177 		.flag_has_svideo = !0,
178 		.signal_routing_scheme = PVR2_ROUTING_SCHEME_AV400,
179 };
180 
181 
182 
183 /*------------------------------------------------------------------------*/
184 /* OnAir Creator */
185 
186 #ifdef CONFIG_VIDEO_PVRUSB2_DVB
187 static struct lgdt330x_config pvr2_lgdt3303_config = {
188 	.demod_chip          = LGDT3303,
189 	.clock_polarity_flip = 1,
190 };
191 
192 static int pvr2_lgdt3303_attach(struct pvr2_dvb_adapter *adap)
193 {
194 	adap->fe[0] = dvb_attach(lgdt330x_attach, &pvr2_lgdt3303_config,
195 				 0x0e,
196 				 &adap->channel.hdw->i2c_adap);
197 	if (adap->fe[0])
198 		return 0;
199 
200 	return -EIO;
201 }
202 
203 static int pvr2_lgh06xf_attach(struct pvr2_dvb_adapter *adap)
204 {
205 	dvb_attach(simple_tuner_attach, adap->fe[0],
206 		   &adap->channel.hdw->i2c_adap, 0x61,
207 		   TUNER_LG_TDVS_H06XF);
208 
209 	return 0;
210 }
211 
212 static const struct pvr2_dvb_props pvr2_onair_creator_fe_props = {
213 	.frontend_attach = pvr2_lgdt3303_attach,
214 	.tuner_attach    = pvr2_lgh06xf_attach,
215 };
216 #endif
217 
218 static const struct pvr2_device_client_desc pvr2_cli_onair_creator[] = {
219 	{ .module_id = PVR2_CLIENT_ID_SAA7115 },
220 	{ .module_id = PVR2_CLIENT_ID_CS53L32A },
221 	{ .module_id = PVR2_CLIENT_ID_TUNER },
222 };
223 
224 static const struct pvr2_device_desc pvr2_device_onair_creator = {
225 		.description = "OnAir Creator Hybrid USB tuner",
226 		.shortname = "oac",
227 		.client_table.lst = pvr2_cli_onair_creator,
228 		.client_table.cnt = ARRAY_SIZE(pvr2_cli_onair_creator),
229 		.default_tuner_type = TUNER_LG_TDVS_H06XF,
230 		.flag_has_analogtuner = !0,
231 		.flag_has_composite = !0,
232 		.flag_has_svideo = !0,
233 		.flag_digital_requires_cx23416 = !0,
234 		.signal_routing_scheme = PVR2_ROUTING_SCHEME_ONAIR,
235 		.digital_control_scheme = PVR2_DIGITAL_SCHEME_ONAIR,
236 		.default_std_mask = V4L2_STD_NTSC_M,
237 #ifdef CONFIG_VIDEO_PVRUSB2_DVB
238 		.dvb_props = &pvr2_onair_creator_fe_props,
239 #endif
240 };
241 
242 
243 
244 /*------------------------------------------------------------------------*/
245 /* OnAir USB 2.0 */
246 
247 #ifdef CONFIG_VIDEO_PVRUSB2_DVB
248 static struct lgdt330x_config pvr2_lgdt3302_config = {
249 	.demod_chip          = LGDT3302,
250 };
251 
252 static int pvr2_lgdt3302_attach(struct pvr2_dvb_adapter *adap)
253 {
254 	adap->fe[0] = dvb_attach(lgdt330x_attach, &pvr2_lgdt3302_config,
255 				 0x0e,
256 				 &adap->channel.hdw->i2c_adap);
257 	if (adap->fe[0])
258 		return 0;
259 
260 	return -EIO;
261 }
262 
263 static int pvr2_fcv1236d_attach(struct pvr2_dvb_adapter *adap)
264 {
265 	dvb_attach(simple_tuner_attach, adap->fe[0],
266 		   &adap->channel.hdw->i2c_adap, 0x61,
267 		   TUNER_PHILIPS_FCV1236D);
268 
269 	return 0;
270 }
271 
272 static const struct pvr2_dvb_props pvr2_onair_usb2_fe_props = {
273 	.frontend_attach = pvr2_lgdt3302_attach,
274 	.tuner_attach    = pvr2_fcv1236d_attach,
275 };
276 #endif
277 
278 static const struct pvr2_device_client_desc pvr2_cli_onair_usb2[] = {
279 	{ .module_id = PVR2_CLIENT_ID_SAA7115 },
280 	{ .module_id = PVR2_CLIENT_ID_CS53L32A },
281 	{ .module_id = PVR2_CLIENT_ID_TUNER },
282 };
283 
284 static const struct pvr2_device_desc pvr2_device_onair_usb2 = {
285 		.description = "OnAir USB2 Hybrid USB tuner",
286 		.shortname = "oa2",
287 		.client_table.lst = pvr2_cli_onair_usb2,
288 		.client_table.cnt = ARRAY_SIZE(pvr2_cli_onair_usb2),
289 		.default_tuner_type = TUNER_PHILIPS_FCV1236D,
290 		.flag_has_analogtuner = !0,
291 		.flag_has_composite = !0,
292 		.flag_has_svideo = !0,
293 		.flag_digital_requires_cx23416 = !0,
294 		.signal_routing_scheme = PVR2_ROUTING_SCHEME_ONAIR,
295 		.digital_control_scheme = PVR2_DIGITAL_SCHEME_ONAIR,
296 		.default_std_mask = V4L2_STD_NTSC_M,
297 #ifdef CONFIG_VIDEO_PVRUSB2_DVB
298 		.dvb_props = &pvr2_onair_usb2_fe_props,
299 #endif
300 };
301 
302 
303 
304 /*------------------------------------------------------------------------*/
305 /* Hauppauge PVR-USB2 Model 73xxx */
306 
307 #ifdef CONFIG_VIDEO_PVRUSB2_DVB
308 static struct tda10048_config hauppauge_tda10048_config = {
309 	.demod_address  = 0x10 >> 1,
310 	.output_mode    = TDA10048_PARALLEL_OUTPUT,
311 	.fwbulkwritelen = TDA10048_BULKWRITE_50,
312 	.inversion      = TDA10048_INVERSION_ON,
313 	.dtv6_if_freq_khz = TDA10048_IF_3300,
314 	.dtv7_if_freq_khz = TDA10048_IF_3800,
315 	.dtv8_if_freq_khz = TDA10048_IF_4300,
316 	.clk_freq_khz   = TDA10048_CLK_16000,
317 	.disable_gate_access = 1,
318 };
319 
320 static struct tda829x_config tda829x_no_probe = {
321 	.probe_tuner = TDA829X_DONT_PROBE,
322 };
323 
324 static struct tda18271_std_map hauppauge_tda18271_dvbt_std_map = {
325 	.dvbt_6   = { .if_freq = 3300, .agc_mode = 3, .std = 4,
326 		      .if_lvl = 1, .rfagc_top = 0x37, },
327 	.dvbt_7   = { .if_freq = 3800, .agc_mode = 3, .std = 5,
328 		      .if_lvl = 1, .rfagc_top = 0x37, },
329 	.dvbt_8   = { .if_freq = 4300, .agc_mode = 3, .std = 6,
330 		      .if_lvl = 1, .rfagc_top = 0x37, },
331 };
332 
333 static struct tda18271_config hauppauge_tda18271_dvb_config = {
334 	.std_map = &hauppauge_tda18271_dvbt_std_map,
335 	.gate    = TDA18271_GATE_ANALOG,
336 	.output_opt = TDA18271_OUTPUT_LT_OFF,
337 };
338 
339 static int pvr2_tda10048_attach(struct pvr2_dvb_adapter *adap)
340 {
341 	adap->fe[0] = dvb_attach(tda10048_attach, &hauppauge_tda10048_config,
342 				 &adap->channel.hdw->i2c_adap);
343 	if (adap->fe[0])
344 		return 0;
345 
346 	return -EIO;
347 }
348 
349 static int pvr2_73xxx_tda18271_8295_attach(struct pvr2_dvb_adapter *adap)
350 {
351 	dvb_attach(tda829x_attach, adap->fe[0],
352 		   &adap->channel.hdw->i2c_adap, 0x42,
353 		   &tda829x_no_probe);
354 	dvb_attach(tda18271_attach, adap->fe[0], 0x60,
355 		   &adap->channel.hdw->i2c_adap,
356 		   &hauppauge_tda18271_dvb_config);
357 
358 	return 0;
359 }
360 
361 static const struct pvr2_dvb_props pvr2_73xxx_dvb_props = {
362 	.frontend_attach = pvr2_tda10048_attach,
363 	.tuner_attach    = pvr2_73xxx_tda18271_8295_attach,
364 };
365 #endif
366 
367 static const struct pvr2_device_client_desc pvr2_cli_73xxx[] = {
368 	{ .module_id = PVR2_CLIENT_ID_CX25840 },
369 	{ .module_id = PVR2_CLIENT_ID_TUNER,
370 	  .i2c_address_list = "\x42"},
371 };
372 
373 #define PVR2_FIRMWARE_73xxx "v4l-pvrusb2-73xxx-01.fw"
374 static const char *pvr2_fw1_names_73xxx[] = {
375 		PVR2_FIRMWARE_73xxx,
376 };
377 
378 static const struct pvr2_device_desc pvr2_device_73xxx = {
379 		.description = "WinTV HVR-1900 Model 73xxx",
380 		.shortname = "73xxx",
381 		.client_table.lst = pvr2_cli_73xxx,
382 		.client_table.cnt = ARRAY_SIZE(pvr2_cli_73xxx),
383 		.fx2_firmware.lst = pvr2_fw1_names_73xxx,
384 		.fx2_firmware.cnt = ARRAY_SIZE(pvr2_fw1_names_73xxx),
385 		.flag_has_cx25840 = !0,
386 		.flag_has_hauppauge_rom = !0,
387 		.flag_has_analogtuner = !0,
388 		.flag_has_composite = !0,
389 		.flag_has_svideo = !0,
390 		.flag_fx2_16kb = !0,
391 		.signal_routing_scheme = PVR2_ROUTING_SCHEME_HAUPPAUGE,
392 		.digital_control_scheme = PVR2_DIGITAL_SCHEME_HAUPPAUGE,
393 		.led_scheme = PVR2_LED_SCHEME_HAUPPAUGE,
394 		.ir_scheme = PVR2_IR_SCHEME_ZILOG,
395 #ifdef CONFIG_VIDEO_PVRUSB2_DVB
396 		.dvb_props = &pvr2_73xxx_dvb_props,
397 #endif
398 };
399 
400 
401 
402 /*------------------------------------------------------------------------*/
403 /* Hauppauge PVR-USB2 Model 75xxx */
404 
405 #ifdef CONFIG_VIDEO_PVRUSB2_DVB
406 static struct s5h1409_config pvr2_s5h1409_config = {
407 	.demod_address = 0x32 >> 1,
408 	.output_mode   = S5H1409_PARALLEL_OUTPUT,
409 	.gpio          = S5H1409_GPIO_OFF,
410 	.qam_if        = 4000,
411 	.inversion     = S5H1409_INVERSION_ON,
412 	.status_mode   = S5H1409_DEMODLOCKING,
413 };
414 
415 static struct s5h1411_config pvr2_s5h1411_config = {
416 	.output_mode   = S5H1411_PARALLEL_OUTPUT,
417 	.gpio          = S5H1411_GPIO_OFF,
418 	.vsb_if        = S5H1411_IF_44000,
419 	.qam_if        = S5H1411_IF_4000,
420 	.inversion     = S5H1411_INVERSION_ON,
421 	.status_mode   = S5H1411_DEMODLOCKING,
422 };
423 
424 static struct tda18271_std_map hauppauge_tda18271_std_map = {
425 	.atsc_6   = { .if_freq = 5380, .agc_mode = 3, .std = 3,
426 		      .if_lvl = 6, .rfagc_top = 0x37, },
427 	.qam_6    = { .if_freq = 4000, .agc_mode = 3, .std = 0,
428 		      .if_lvl = 6, .rfagc_top = 0x37, },
429 };
430 
431 static struct tda18271_config hauppauge_tda18271_config = {
432 	.std_map = &hauppauge_tda18271_std_map,
433 	.gate    = TDA18271_GATE_ANALOG,
434 	.output_opt = TDA18271_OUTPUT_LT_OFF,
435 };
436 
437 static int pvr2_s5h1409_attach(struct pvr2_dvb_adapter *adap)
438 {
439 	adap->fe[0] = dvb_attach(s5h1409_attach, &pvr2_s5h1409_config,
440 				 &adap->channel.hdw->i2c_adap);
441 	if (adap->fe[0])
442 		return 0;
443 
444 	return -EIO;
445 }
446 
447 static int pvr2_s5h1411_attach(struct pvr2_dvb_adapter *adap)
448 {
449 	adap->fe[0] = dvb_attach(s5h1411_attach, &pvr2_s5h1411_config,
450 				 &adap->channel.hdw->i2c_adap);
451 	if (adap->fe[0])
452 		return 0;
453 
454 	return -EIO;
455 }
456 
457 static int pvr2_tda18271_8295_attach(struct pvr2_dvb_adapter *adap)
458 {
459 	dvb_attach(tda829x_attach, adap->fe[0],
460 		   &adap->channel.hdw->i2c_adap, 0x42,
461 		   &tda829x_no_probe);
462 	dvb_attach(tda18271_attach, adap->fe[0], 0x60,
463 		   &adap->channel.hdw->i2c_adap,
464 		   &hauppauge_tda18271_config);
465 
466 	return 0;
467 }
468 
469 static const struct pvr2_dvb_props pvr2_750xx_dvb_props = {
470 	.frontend_attach = pvr2_s5h1409_attach,
471 	.tuner_attach    = pvr2_tda18271_8295_attach,
472 };
473 
474 static const struct pvr2_dvb_props pvr2_751xx_dvb_props = {
475 	.frontend_attach = pvr2_s5h1411_attach,
476 	.tuner_attach    = pvr2_tda18271_8295_attach,
477 };
478 #endif
479 
480 #define PVR2_FIRMWARE_75xxx "v4l-pvrusb2-73xxx-01.fw"
481 static const char *pvr2_fw1_names_75xxx[] = {
482 		PVR2_FIRMWARE_75xxx,
483 };
484 
485 static const struct pvr2_device_desc pvr2_device_750xx = {
486 		.description = "WinTV HVR-1950 Model 750xx",
487 		.shortname = "750xx",
488 		.client_table.lst = pvr2_cli_73xxx,
489 		.client_table.cnt = ARRAY_SIZE(pvr2_cli_73xxx),
490 		.fx2_firmware.lst = pvr2_fw1_names_75xxx,
491 		.fx2_firmware.cnt = ARRAY_SIZE(pvr2_fw1_names_75xxx),
492 		.flag_has_cx25840 = !0,
493 		.flag_has_hauppauge_rom = !0,
494 		.flag_has_analogtuner = !0,
495 		.flag_has_composite = !0,
496 		.flag_has_svideo = !0,
497 		.flag_fx2_16kb = !0,
498 		.signal_routing_scheme = PVR2_ROUTING_SCHEME_HAUPPAUGE,
499 		.digital_control_scheme = PVR2_DIGITAL_SCHEME_HAUPPAUGE,
500 		.default_std_mask = V4L2_STD_NTSC_M,
501 		.led_scheme = PVR2_LED_SCHEME_HAUPPAUGE,
502 		.ir_scheme = PVR2_IR_SCHEME_ZILOG,
503 #ifdef CONFIG_VIDEO_PVRUSB2_DVB
504 		.dvb_props = &pvr2_750xx_dvb_props,
505 #endif
506 };
507 
508 static const struct pvr2_device_desc pvr2_device_751xx = {
509 		.description = "WinTV HVR-1950 Model 751xx",
510 		.shortname = "751xx",
511 		.client_table.lst = pvr2_cli_73xxx,
512 		.client_table.cnt = ARRAY_SIZE(pvr2_cli_73xxx),
513 		.fx2_firmware.lst = pvr2_fw1_names_75xxx,
514 		.fx2_firmware.cnt = ARRAY_SIZE(pvr2_fw1_names_75xxx),
515 		.flag_has_cx25840 = !0,
516 		.flag_has_hauppauge_rom = !0,
517 		.flag_has_analogtuner = !0,
518 		.flag_has_composite = !0,
519 		.flag_has_svideo = !0,
520 		.flag_fx2_16kb = !0,
521 		.signal_routing_scheme = PVR2_ROUTING_SCHEME_HAUPPAUGE,
522 		.digital_control_scheme = PVR2_DIGITAL_SCHEME_HAUPPAUGE,
523 		.default_std_mask = V4L2_STD_NTSC_M,
524 		.led_scheme = PVR2_LED_SCHEME_HAUPPAUGE,
525 		.ir_scheme = PVR2_IR_SCHEME_ZILOG,
526 #ifdef CONFIG_VIDEO_PVRUSB2_DVB
527 		.dvb_props = &pvr2_751xx_dvb_props,
528 #endif
529 };
530 
531 /*------------------------------------------------------------------------*/
532 /*    Hauppauge PVR-USB2 Model 160000 / 160111 -- HVR-1955 / HVR-1975     */
533 
534 #ifdef CONFIG_VIDEO_PVRUSB2_DVB
535 static int pvr2_si2157_attach(struct pvr2_dvb_adapter *adap);
536 static int pvr2_si2168_attach(struct pvr2_dvb_adapter *adap);
537 static int pvr2_dual_fe_attach(struct pvr2_dvb_adapter *adap);
538 static int pvr2_lgdt3306a_attach(struct pvr2_dvb_adapter *adap);
539 
540 static const struct pvr2_dvb_props pvr2_160000_dvb_props = {
541 	.frontend_attach = pvr2_dual_fe_attach,
542 	.tuner_attach    = pvr2_si2157_attach,
543 };
544 
545 static const struct pvr2_dvb_props pvr2_160111_dvb_props = {
546 	.frontend_attach = pvr2_lgdt3306a_attach,
547 	.tuner_attach    = pvr2_si2157_attach,
548 };
549 
550 static int pvr2_si2157_attach(struct pvr2_dvb_adapter *adap)
551 {
552 	struct si2157_config si2157_config = {};
553 
554 	si2157_config.inversion = 1;
555 	si2157_config.fe = adap->fe[0];
556 
557 	adap->i2c_client_tuner = dvb_module_probe("si2157", "si2177",
558 						  &adap->channel.hdw->i2c_adap,
559 						  0x60, &si2157_config);
560 
561 	if (!adap->i2c_client_tuner)
562 		return -ENODEV;
563 
564 	return 0;
565 }
566 
567 static int pvr2_si2168_attach(struct pvr2_dvb_adapter *adap)
568 {
569 	struct si2168_config si2168_config = {};
570 	struct i2c_adapter *adapter;
571 
572 	pr_debug("%s()\n", __func__);
573 
574 	si2168_config.fe = &adap->fe[1];
575 	si2168_config.i2c_adapter = &adapter;
576 	si2168_config.ts_mode = SI2168_TS_PARALLEL; /*2, 1-serial, 2-parallel.*/
577 	si2168_config.ts_clock_gapped = 1; /*0-disabled, 1-enabled.*/
578 	si2168_config.ts_clock_inv = 0; /*0-not-invert, 1-invert*/
579 	si2168_config.spectral_inversion = 1; /*0-not-invert, 1-invert*/
580 
581 	adap->i2c_client_demod[1] = dvb_module_probe("si2168", NULL,
582 						     &adap->channel.hdw->i2c_adap,
583 						     0x64, &si2168_config);
584 
585 	if (!adap->i2c_client_demod[1])
586 		return -ENODEV;
587 
588 	return 0;
589 }
590 
591 static int pvr2_lgdt3306a_attach(struct pvr2_dvb_adapter *adap)
592 {
593 	struct lgdt3306a_config lgdt3306a_config;
594 	struct i2c_adapter *adapter;
595 
596 	pr_debug("%s()\n", __func__);
597 
598 	lgdt3306a_config.fe = &adap->fe[0];
599 	lgdt3306a_config.i2c_adapter = &adapter;
600 	lgdt3306a_config.deny_i2c_rptr = 1;
601 	lgdt3306a_config.spectral_inversion = 1;
602 	lgdt3306a_config.qam_if_khz = 4000;
603 	lgdt3306a_config.vsb_if_khz = 3250;
604 	lgdt3306a_config.mpeg_mode = LGDT3306A_MPEG_PARALLEL;
605 	lgdt3306a_config.tpclk_edge = LGDT3306A_TPCLK_FALLING_EDGE;
606 	lgdt3306a_config.tpvalid_polarity = LGDT3306A_TP_VALID_LOW;
607 	lgdt3306a_config.xtalMHz = 25, /* demod clock MHz; 24/25 supported */
608 
609 	adap->i2c_client_demod[0] = dvb_module_probe("lgdt3306a", NULL,
610 						     &adap->channel.hdw->i2c_adap,
611 						     0x59, &lgdt3306a_config);
612 
613 	if (!adap->i2c_client_demod[0])
614 		return -ENODEV;
615 
616 	return 0;
617 }
618 
619 static int pvr2_dual_fe_attach(struct pvr2_dvb_adapter *adap)
620 {
621 	pr_debug("%s()\n", __func__);
622 
623 	if (pvr2_lgdt3306a_attach(adap) != 0)
624 		return -ENODEV;
625 
626 	if (pvr2_si2168_attach(adap) != 0) {
627 		dvb_module_release(adap->i2c_client_demod[0]);
628 		return -ENODEV;
629 	}
630 
631 	return 0;
632 }
633 #endif
634 
635 #define PVR2_FIRMWARE_160xxx "v4l-pvrusb2-160xxx-01.fw"
636 static const char *pvr2_fw1_names_160xxx[] = {
637 		PVR2_FIRMWARE_160xxx,
638 };
639 
640 static const struct pvr2_device_client_desc pvr2_cli_160xxx[] = {
641 	{ .module_id = PVR2_CLIENT_ID_CX25840 },
642 };
643 
644 static const struct pvr2_device_desc pvr2_device_160000 = {
645 		.description = "WinTV HVR-1975 Model 160000",
646 		.shortname = "160000",
647 		.client_table.lst = pvr2_cli_160xxx,
648 		.client_table.cnt = ARRAY_SIZE(pvr2_cli_160xxx),
649 		.fx2_firmware.lst = pvr2_fw1_names_160xxx,
650 		.fx2_firmware.cnt = ARRAY_SIZE(pvr2_fw1_names_160xxx),
651 		.default_tuner_type = TUNER_ABSENT,
652 		.flag_has_cx25840 = 1,
653 		.flag_has_hauppauge_rom = 1,
654 		.flag_has_analogtuner = 1,
655 		.flag_has_composite = 1,
656 		.flag_has_svideo = 1,
657 		.flag_fx2_16kb = 1,
658 		.signal_routing_scheme = PVR2_ROUTING_SCHEME_HAUPPAUGE,
659 		.digital_control_scheme = PVR2_DIGITAL_SCHEME_HAUPPAUGE,
660 		.default_std_mask = V4L2_STD_NTSC_M,
661 		.led_scheme = PVR2_LED_SCHEME_HAUPPAUGE,
662 		.ir_scheme = PVR2_IR_SCHEME_ZILOG,
663 #ifdef CONFIG_VIDEO_PVRUSB2_DVB
664 		.dvb_props = &pvr2_160000_dvb_props,
665 #endif
666 };
667 
668 static const struct pvr2_device_desc pvr2_device_160111 = {
669 		.description = "WinTV HVR-1955 Model 160111",
670 		.shortname = "160111",
671 		.client_table.lst = pvr2_cli_160xxx,
672 		.client_table.cnt = ARRAY_SIZE(pvr2_cli_160xxx),
673 		.fx2_firmware.lst = pvr2_fw1_names_160xxx,
674 		.fx2_firmware.cnt = ARRAY_SIZE(pvr2_fw1_names_160xxx),
675 		.default_tuner_type = TUNER_ABSENT,
676 		.flag_has_cx25840 = 1,
677 		.flag_has_hauppauge_rom = 1,
678 		.flag_has_analogtuner = 1,
679 		.flag_has_composite = 1,
680 		.flag_has_svideo = 1,
681 		.flag_fx2_16kb = 1,
682 		.signal_routing_scheme = PVR2_ROUTING_SCHEME_HAUPPAUGE,
683 		.digital_control_scheme = PVR2_DIGITAL_SCHEME_HAUPPAUGE,
684 		.default_std_mask = V4L2_STD_NTSC_M,
685 		.led_scheme = PVR2_LED_SCHEME_HAUPPAUGE,
686 		.ir_scheme = PVR2_IR_SCHEME_ZILOG,
687 #ifdef CONFIG_VIDEO_PVRUSB2_DVB
688 		.dvb_props = &pvr2_160111_dvb_props,
689 #endif
690 };
691 
692 /*------------------------------------------------------------------------*/
693 
694 struct usb_device_id pvr2_device_table[] = {
695 	{ USB_DEVICE(0x2040, 0x2900),
696 	  .driver_info = (kernel_ulong_t)&pvr2_device_29xxx},
697 	{ USB_DEVICE(0x2040, 0x2950), /* Logically identical to 2900 */
698 	  .driver_info = (kernel_ulong_t)&pvr2_device_29xxx},
699 	{ USB_DEVICE(0x2040, 0x2400),
700 	  .driver_info = (kernel_ulong_t)&pvr2_device_24xxx},
701 	{ USB_DEVICE(0x1164, 0x0622),
702 	  .driver_info = (kernel_ulong_t)&pvr2_device_gotview_2},
703 	{ USB_DEVICE(0x1164, 0x0602),
704 	  .driver_info = (kernel_ulong_t)&pvr2_device_gotview_2d},
705 	{ USB_DEVICE(0x11ba, 0x1003),
706 	  .driver_info = (kernel_ulong_t)&pvr2_device_onair_creator},
707 	{ USB_DEVICE(0x11ba, 0x1001),
708 	  .driver_info = (kernel_ulong_t)&pvr2_device_onair_usb2},
709 	{ USB_DEVICE(0x2040, 0x7300),
710 	  .driver_info = (kernel_ulong_t)&pvr2_device_73xxx},
711 	{ USB_DEVICE(0x2040, 0x7500),
712 	  .driver_info = (kernel_ulong_t)&pvr2_device_750xx},
713 	{ USB_DEVICE(0x2040, 0x7501),
714 	  .driver_info = (kernel_ulong_t)&pvr2_device_751xx},
715 	{ USB_DEVICE(0x0ccd, 0x0039),
716 	  .driver_info = (kernel_ulong_t)&pvr2_device_av400},
717 	{ USB_DEVICE(0x2040, 0x7502),
718 	  .driver_info = (kernel_ulong_t)&pvr2_device_160111},
719 	{ USB_DEVICE(0x2040, 0x7510),
720 	  .driver_info = (kernel_ulong_t)&pvr2_device_160000},
721 	{ }
722 };
723 
724 MODULE_DEVICE_TABLE(usb, pvr2_device_table);
725 MODULE_FIRMWARE(PVR2_FIRMWARE_29xxx);
726 MODULE_FIRMWARE(PVR2_FIRMWARE_24xxx);
727 MODULE_FIRMWARE(PVR2_FIRMWARE_73xxx);
728 MODULE_FIRMWARE(PVR2_FIRMWARE_75xxx);
729