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