]> bbs.cooldavid.org Git - net-next-2.6.git/blob - drivers/media/video/pvrusb2/pvrusb2-devattr.c
sh: Make intc messages consistent via pr_fmt.
[net-next-2.6.git] / drivers / media / video / pvrusb2 / pvrusb2-devattr.c
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  *  You should have received a copy of the GNU General Public License
16  *  along with this program; if not, write to the Free Software
17  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18  *
19  */
20
21 /*
22
23 This source file should encompass ALL per-device type information for the
24 driver.  To define a new device, add elements to the pvr2_device_table and
25 pvr2_device_desc structures.
26
27 */
28
29 #include "pvrusb2-devattr.h"
30 #include <linux/usb.h>
31 /* This is needed in order to pull in tuner type ids... */
32 #include <linux/i2c.h>
33 #include <media/tuner.h>
34 #ifdef CONFIG_VIDEO_PVRUSB2_DVB
35 #include "pvrusb2-hdw-internal.h"
36 #include "lgdt330x.h"
37 #include "s5h1409.h"
38 #include "s5h1411.h"
39 #include "tda10048.h"
40 #include "tda18271.h"
41 #include "tda8290.h"
42 #include "tuner-simple.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 static const char *pvr2_fw1_names_29xxx[] = {
57                 "v4l-pvrusb2-29xxx-01.fw",
58 };
59
60 static const struct pvr2_device_desc pvr2_device_29xxx = {
61                 .description = "WinTV PVR USB2 Model 29xxx",
62                 .shortname = "29xxx",
63                 .client_table.lst = pvr2_cli_29xxx,
64                 .client_table.cnt = ARRAY_SIZE(pvr2_cli_29xxx),
65                 .fx2_firmware.lst = pvr2_fw1_names_29xxx,
66                 .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                 .flag_has_composite = !0,
71                 .flag_has_svideo = !0,
72                 .signal_routing_scheme = PVR2_ROUTING_SCHEME_HAUPPAUGE,
73                 .led_scheme = PVR2_LED_SCHEME_HAUPPAUGE,
74                 .ir_scheme = PVR2_IR_SCHEME_29XXX,
75 };
76
77
78
79 /*------------------------------------------------------------------------*/
80 /* Hauppauge PVR-USB2 Model 24xxx */
81
82 static const struct pvr2_device_client_desc pvr2_cli_24xxx[] = {
83         { .module_id = PVR2_CLIENT_ID_CX25840 },
84         { .module_id = PVR2_CLIENT_ID_TUNER },
85         { .module_id = PVR2_CLIENT_ID_WM8775 },
86         { .module_id = PVR2_CLIENT_ID_DEMOD },
87 };
88
89 static const char *pvr2_fw1_names_24xxx[] = {
90                 "v4l-pvrusb2-24xxx-01.fw",
91 };
92
93 static const struct pvr2_device_desc pvr2_device_24xxx = {
94                 .description = "WinTV PVR USB2 Model 24xxx",
95                 .shortname = "24xxx",
96                 .client_table.lst = pvr2_cli_24xxx,
97                 .client_table.cnt = ARRAY_SIZE(pvr2_cli_24xxx),
98                 .fx2_firmware.lst = pvr2_fw1_names_24xxx,
99                 .fx2_firmware.cnt = ARRAY_SIZE(pvr2_fw1_names_24xxx),
100                 .flag_has_cx25840 = !0,
101                 .flag_has_wm8775 = !0,
102                 .flag_has_hauppauge_rom = !0,
103                 .flag_has_analogtuner = !0,
104                 .flag_has_fmradio = !0,
105                 .flag_has_composite = !0,
106                 .flag_has_svideo = !0,
107                 .signal_routing_scheme = PVR2_ROUTING_SCHEME_HAUPPAUGE,
108                 .led_scheme = PVR2_LED_SCHEME_HAUPPAUGE,
109                 .ir_scheme = PVR2_IR_SCHEME_24XXX,
110 };
111
112
113
114 /*------------------------------------------------------------------------*/
115 /* GOTVIEW USB2.0 DVD2 */
116
117 static const struct pvr2_device_client_desc pvr2_cli_gotview_2[] = {
118         { .module_id = PVR2_CLIENT_ID_CX25840 },
119         { .module_id = PVR2_CLIENT_ID_TUNER },
120 };
121
122 static const struct pvr2_device_desc pvr2_device_gotview_2 = {
123                 .description = "Gotview USB 2.0 DVD 2",
124                 .shortname = "gv2",
125                 .client_table.lst = pvr2_cli_gotview_2,
126                 .client_table.cnt = ARRAY_SIZE(pvr2_cli_gotview_2),
127                 .flag_has_cx25840 = !0,
128                 .default_tuner_type = TUNER_PHILIPS_FM1216ME_MK3,
129                 .flag_has_analogtuner = !0,
130                 .flag_has_fmradio = !0,
131                 .flag_has_composite = !0,
132                 .flag_has_svideo = !0,
133                 .signal_routing_scheme = PVR2_ROUTING_SCHEME_GOTVIEW,
134 };
135
136
137
138 /*------------------------------------------------------------------------*/
139 /* GOTVIEW USB2.0 DVD Deluxe */
140
141 /* (same module list as gotview_2) */
142
143 static const struct pvr2_device_desc pvr2_device_gotview_2d = {
144                 .description = "Gotview USB 2.0 DVD Deluxe",
145                 .shortname = "gv2d",
146                 .client_table.lst = pvr2_cli_gotview_2,
147                 .client_table.cnt = ARRAY_SIZE(pvr2_cli_gotview_2),
148                 .flag_has_cx25840 = !0,
149                 .default_tuner_type = TUNER_PHILIPS_FM1216ME_MK3,
150                 .flag_has_analogtuner = !0,
151                 .flag_has_composite = !0,
152                 .flag_has_svideo = !0,
153                 .signal_routing_scheme = PVR2_ROUTING_SCHEME_GOTVIEW,
154 };
155
156
157
158 /*------------------------------------------------------------------------*/
159 /* OnAir Creator */
160
161 #ifdef CONFIG_VIDEO_PVRUSB2_DVB
162 static struct lgdt330x_config pvr2_lgdt3303_config = {
163         .demod_address       = 0x0e,
164         .demod_chip          = LGDT3303,
165         .clock_polarity_flip = 1,
166 };
167
168 static int pvr2_lgdt3303_attach(struct pvr2_dvb_adapter *adap)
169 {
170         adap->fe = dvb_attach(lgdt330x_attach, &pvr2_lgdt3303_config,
171                               &adap->channel.hdw->i2c_adap);
172         if (adap->fe)
173                 return 0;
174
175         return -EIO;
176 }
177
178 static int pvr2_lgh06xf_attach(struct pvr2_dvb_adapter *adap)
179 {
180         dvb_attach(simple_tuner_attach, adap->fe,
181                    &adap->channel.hdw->i2c_adap, 0x61,
182                    TUNER_LG_TDVS_H06XF);
183
184         return 0;
185 }
186
187 static const struct pvr2_dvb_props pvr2_onair_creator_fe_props = {
188         .frontend_attach = pvr2_lgdt3303_attach,
189         .tuner_attach    = pvr2_lgh06xf_attach,
190 };
191 #endif
192
193 static const struct pvr2_device_client_desc pvr2_cli_onair_creator[] = {
194         { .module_id = PVR2_CLIENT_ID_SAA7115 },
195         { .module_id = PVR2_CLIENT_ID_CS53L32A },
196         { .module_id = PVR2_CLIENT_ID_TUNER },
197 };
198
199 static const struct pvr2_device_desc pvr2_device_onair_creator = {
200                 .description = "OnAir Creator Hybrid USB tuner",
201                 .shortname = "oac",
202                 .client_table.lst = pvr2_cli_onair_creator,
203                 .client_table.cnt = ARRAY_SIZE(pvr2_cli_onair_creator),
204                 .default_tuner_type = TUNER_LG_TDVS_H06XF,
205                 .flag_has_analogtuner = !0,
206                 .flag_has_composite = !0,
207                 .flag_has_svideo = !0,
208                 .flag_digital_requires_cx23416 = !0,
209                 .signal_routing_scheme = PVR2_ROUTING_SCHEME_ONAIR,
210                 .digital_control_scheme = PVR2_DIGITAL_SCHEME_ONAIR,
211                 .default_std_mask = V4L2_STD_NTSC_M,
212 #ifdef CONFIG_VIDEO_PVRUSB2_DVB
213                 .dvb_props = &pvr2_onair_creator_fe_props,
214 #endif
215 };
216
217
218
219 /*------------------------------------------------------------------------*/
220 /* OnAir USB 2.0 */
221
222 #ifdef CONFIG_VIDEO_PVRUSB2_DVB
223 static struct lgdt330x_config pvr2_lgdt3302_config = {
224         .demod_address       = 0x0e,
225         .demod_chip          = LGDT3302,
226 };
227
228 static int pvr2_lgdt3302_attach(struct pvr2_dvb_adapter *adap)
229 {
230         adap->fe = dvb_attach(lgdt330x_attach, &pvr2_lgdt3302_config,
231                               &adap->channel.hdw->i2c_adap);
232         if (adap->fe)
233                 return 0;
234
235         return -EIO;
236 }
237
238 static int pvr2_fcv1236d_attach(struct pvr2_dvb_adapter *adap)
239 {
240         dvb_attach(simple_tuner_attach, adap->fe,
241                    &adap->channel.hdw->i2c_adap, 0x61,
242                    TUNER_PHILIPS_FCV1236D);
243
244         return 0;
245 }
246
247 static const struct pvr2_dvb_props pvr2_onair_usb2_fe_props = {
248         .frontend_attach = pvr2_lgdt3302_attach,
249         .tuner_attach    = pvr2_fcv1236d_attach,
250 };
251 #endif
252
253 static const struct pvr2_device_client_desc pvr2_cli_onair_usb2[] = {
254         { .module_id = PVR2_CLIENT_ID_SAA7115 },
255         { .module_id = PVR2_CLIENT_ID_CS53L32A },
256         { .module_id = PVR2_CLIENT_ID_TUNER },
257 };
258
259 static const struct pvr2_device_desc pvr2_device_onair_usb2 = {
260                 .description = "OnAir USB2 Hybrid USB tuner",
261                 .shortname = "oa2",
262                 .client_table.lst = pvr2_cli_onair_usb2,
263                 .client_table.cnt = ARRAY_SIZE(pvr2_cli_onair_usb2),
264                 .default_tuner_type = TUNER_PHILIPS_FCV1236D,
265                 .flag_has_analogtuner = !0,
266                 .flag_has_composite = !0,
267                 .flag_has_svideo = !0,
268                 .flag_digital_requires_cx23416 = !0,
269                 .signal_routing_scheme = PVR2_ROUTING_SCHEME_ONAIR,
270                 .digital_control_scheme = PVR2_DIGITAL_SCHEME_ONAIR,
271                 .default_std_mask = V4L2_STD_NTSC_M,
272 #ifdef CONFIG_VIDEO_PVRUSB2_DVB
273                 .dvb_props = &pvr2_onair_usb2_fe_props,
274 #endif
275 };
276
277
278
279 /*------------------------------------------------------------------------*/
280 /* Hauppauge PVR-USB2 Model 73xxx */
281
282 #ifdef CONFIG_VIDEO_PVRUSB2_DVB
283 static struct tda10048_config hauppauge_tda10048_config = {
284         .demod_address  = 0x10 >> 1,
285         .output_mode    = TDA10048_PARALLEL_OUTPUT,
286         .fwbulkwritelen = TDA10048_BULKWRITE_50,
287         .inversion      = TDA10048_INVERSION_ON,
288         .dtv6_if_freq_khz = TDA10048_IF_3300,
289         .dtv7_if_freq_khz = TDA10048_IF_3800,
290         .dtv8_if_freq_khz = TDA10048_IF_4300,
291         .clk_freq_khz   = TDA10048_CLK_16000,
292         .disable_gate_access = 1,
293 };
294
295 static struct tda829x_config tda829x_no_probe = {
296         .probe_tuner = TDA829X_DONT_PROBE,
297 };
298
299 static struct tda18271_config hauppauge_tda18271_dvb_config = {
300         .gate    = TDA18271_GATE_ANALOG,
301         .output_opt = TDA18271_OUTPUT_LT_OFF,
302 };
303
304 static int pvr2_tda10048_attach(struct pvr2_dvb_adapter *adap)
305 {
306         adap->fe = dvb_attach(tda10048_attach, &hauppauge_tda10048_config,
307                               &adap->channel.hdw->i2c_adap);
308         if (adap->fe)
309                 return 0;
310
311         return -EIO;
312 }
313
314 static int pvr2_73xxx_tda18271_8295_attach(struct pvr2_dvb_adapter *adap)
315 {
316         dvb_attach(tda829x_attach, adap->fe,
317                    &adap->channel.hdw->i2c_adap, 0x42,
318                    &tda829x_no_probe);
319         dvb_attach(tda18271_attach, adap->fe, 0x60,
320                    &adap->channel.hdw->i2c_adap,
321                    &hauppauge_tda18271_dvb_config);
322
323         return 0;
324 }
325
326 static const struct pvr2_dvb_props pvr2_73xxx_dvb_props = {
327         .frontend_attach = pvr2_tda10048_attach,
328         .tuner_attach    = pvr2_73xxx_tda18271_8295_attach,
329 };
330 #endif
331
332 static const struct pvr2_device_client_desc pvr2_cli_73xxx[] = {
333         { .module_id = PVR2_CLIENT_ID_CX25840 },
334         { .module_id = PVR2_CLIENT_ID_TUNER,
335           .i2c_address_list = "\x42"},
336 };
337
338 static const char *pvr2_fw1_names_73xxx[] = {
339                 "v4l-pvrusb2-73xxx-01.fw",
340 };
341
342 static const struct pvr2_device_desc pvr2_device_73xxx = {
343                 .description = "WinTV HVR-1900 Model 73xxx",
344                 .shortname = "73xxx",
345                 .client_table.lst = pvr2_cli_73xxx,
346                 .client_table.cnt = ARRAY_SIZE(pvr2_cli_73xxx),
347                 .fx2_firmware.lst = pvr2_fw1_names_73xxx,
348                 .fx2_firmware.cnt = ARRAY_SIZE(pvr2_fw1_names_73xxx),
349                 .flag_has_cx25840 = !0,
350                 .flag_has_hauppauge_rom = !0,
351                 .flag_has_analogtuner = !0,
352                 .flag_has_composite = !0,
353                 .flag_has_svideo = !0,
354                 .flag_fx2_16kb = !0,
355                 .signal_routing_scheme = PVR2_ROUTING_SCHEME_HAUPPAUGE,
356                 .digital_control_scheme = PVR2_DIGITAL_SCHEME_HAUPPAUGE,
357                 .led_scheme = PVR2_LED_SCHEME_HAUPPAUGE,
358                 .ir_scheme = PVR2_IR_SCHEME_ZILOG,
359 #ifdef CONFIG_VIDEO_PVRUSB2_DVB
360                 .dvb_props = &pvr2_73xxx_dvb_props,
361 #endif
362 };
363
364
365
366 /*------------------------------------------------------------------------*/
367 /* Hauppauge PVR-USB2 Model 75xxx */
368
369 #ifdef CONFIG_VIDEO_PVRUSB2_DVB
370 static struct s5h1409_config pvr2_s5h1409_config = {
371         .demod_address = 0x32 >> 1,
372         .output_mode   = S5H1409_PARALLEL_OUTPUT,
373         .gpio          = S5H1409_GPIO_OFF,
374         .qam_if        = 4000,
375         .inversion     = S5H1409_INVERSION_ON,
376         .status_mode   = S5H1409_DEMODLOCKING,
377 };
378
379 static struct s5h1411_config pvr2_s5h1411_config = {
380         .output_mode   = S5H1411_PARALLEL_OUTPUT,
381         .gpio          = S5H1411_GPIO_OFF,
382         .vsb_if        = S5H1411_IF_44000,
383         .qam_if        = S5H1411_IF_4000,
384         .inversion     = S5H1411_INVERSION_ON,
385         .status_mode   = S5H1411_DEMODLOCKING,
386 };
387
388 static struct tda18271_std_map hauppauge_tda18271_std_map = {
389         .atsc_6   = { .if_freq = 5380, .agc_mode = 3, .std = 3,
390                       .if_lvl = 6, .rfagc_top = 0x37, },
391         .qam_6    = { .if_freq = 4000, .agc_mode = 3, .std = 0,
392                       .if_lvl = 6, .rfagc_top = 0x37, },
393 };
394
395 static struct tda18271_config hauppauge_tda18271_config = {
396         .std_map = &hauppauge_tda18271_std_map,
397         .gate    = TDA18271_GATE_ANALOG,
398         .output_opt = TDA18271_OUTPUT_LT_OFF,
399 };
400
401 static int pvr2_s5h1409_attach(struct pvr2_dvb_adapter *adap)
402 {
403         adap->fe = dvb_attach(s5h1409_attach, &pvr2_s5h1409_config,
404                               &adap->channel.hdw->i2c_adap);
405         if (adap->fe)
406                 return 0;
407
408         return -EIO;
409 }
410
411 static int pvr2_s5h1411_attach(struct pvr2_dvb_adapter *adap)
412 {
413         adap->fe = dvb_attach(s5h1411_attach, &pvr2_s5h1411_config,
414                               &adap->channel.hdw->i2c_adap);
415         if (adap->fe)
416                 return 0;
417
418         return -EIO;
419 }
420
421 static int pvr2_tda18271_8295_attach(struct pvr2_dvb_adapter *adap)
422 {
423         dvb_attach(tda829x_attach, adap->fe,
424                    &adap->channel.hdw->i2c_adap, 0x42,
425                    &tda829x_no_probe);
426         dvb_attach(tda18271_attach, adap->fe, 0x60,
427                    &adap->channel.hdw->i2c_adap,
428                    &hauppauge_tda18271_config);
429
430         return 0;
431 }
432
433 static const struct pvr2_dvb_props pvr2_750xx_dvb_props = {
434         .frontend_attach = pvr2_s5h1409_attach,
435         .tuner_attach    = pvr2_tda18271_8295_attach,
436 };
437
438 static const struct pvr2_dvb_props pvr2_751xx_dvb_props = {
439         .frontend_attach = pvr2_s5h1411_attach,
440         .tuner_attach    = pvr2_tda18271_8295_attach,
441 };
442 #endif
443
444 static const char *pvr2_fw1_names_75xxx[] = {
445                 "v4l-pvrusb2-73xxx-01.fw",
446 };
447
448 static const struct pvr2_device_desc pvr2_device_750xx = {
449                 .description = "WinTV HVR-1950 Model 750xx",
450                 .shortname = "750xx",
451                 .client_table.lst = pvr2_cli_73xxx,
452                 .client_table.cnt = ARRAY_SIZE(pvr2_cli_73xxx),
453                 .fx2_firmware.lst = pvr2_fw1_names_75xxx,
454                 .fx2_firmware.cnt = ARRAY_SIZE(pvr2_fw1_names_75xxx),
455                 .flag_has_cx25840 = !0,
456                 .flag_has_hauppauge_rom = !0,
457                 .flag_has_analogtuner = !0,
458                 .flag_has_composite = !0,
459                 .flag_has_svideo = !0,
460                 .flag_fx2_16kb = !0,
461                 .signal_routing_scheme = PVR2_ROUTING_SCHEME_HAUPPAUGE,
462                 .digital_control_scheme = PVR2_DIGITAL_SCHEME_HAUPPAUGE,
463                 .default_std_mask = V4L2_STD_NTSC_M,
464                 .led_scheme = PVR2_LED_SCHEME_HAUPPAUGE,
465                 .ir_scheme = PVR2_IR_SCHEME_ZILOG,
466 #ifdef CONFIG_VIDEO_PVRUSB2_DVB
467                 .dvb_props = &pvr2_750xx_dvb_props,
468 #endif
469 };
470
471 static const struct pvr2_device_desc pvr2_device_751xx = {
472                 .description = "WinTV HVR-1950 Model 751xx",
473                 .shortname = "751xx",
474                 .client_table.lst = pvr2_cli_73xxx,
475                 .client_table.cnt = ARRAY_SIZE(pvr2_cli_73xxx),
476                 .fx2_firmware.lst = pvr2_fw1_names_75xxx,
477                 .fx2_firmware.cnt = ARRAY_SIZE(pvr2_fw1_names_75xxx),
478                 .flag_has_cx25840 = !0,
479                 .flag_has_hauppauge_rom = !0,
480                 .flag_has_analogtuner = !0,
481                 .flag_has_composite = !0,
482                 .flag_has_svideo = !0,
483                 .flag_fx2_16kb = !0,
484                 .signal_routing_scheme = PVR2_ROUTING_SCHEME_HAUPPAUGE,
485                 .digital_control_scheme = PVR2_DIGITAL_SCHEME_HAUPPAUGE,
486                 .default_std_mask = V4L2_STD_NTSC_M,
487                 .led_scheme = PVR2_LED_SCHEME_HAUPPAUGE,
488                 .ir_scheme = PVR2_IR_SCHEME_ZILOG,
489 #ifdef CONFIG_VIDEO_PVRUSB2_DVB
490                 .dvb_props = &pvr2_751xx_dvb_props,
491 #endif
492 };
493
494
495
496 /*------------------------------------------------------------------------*/
497
498 struct usb_device_id pvr2_device_table[] = {
499         { USB_DEVICE(0x2040, 0x2900),
500           .driver_info = (kernel_ulong_t)&pvr2_device_29xxx},
501         { USB_DEVICE(0x2040, 0x2950), /* Logically identical to 2900 */
502           .driver_info = (kernel_ulong_t)&pvr2_device_29xxx},
503         { USB_DEVICE(0x2040, 0x2400),
504           .driver_info = (kernel_ulong_t)&pvr2_device_24xxx},
505         { USB_DEVICE(0x1164, 0x0622),
506           .driver_info = (kernel_ulong_t)&pvr2_device_gotview_2},
507         { USB_DEVICE(0x1164, 0x0602),
508           .driver_info = (kernel_ulong_t)&pvr2_device_gotview_2d},
509         { USB_DEVICE(0x11ba, 0x1003),
510           .driver_info = (kernel_ulong_t)&pvr2_device_onair_creator},
511         { USB_DEVICE(0x11ba, 0x1001),
512           .driver_info = (kernel_ulong_t)&pvr2_device_onair_usb2},
513         { USB_DEVICE(0x2040, 0x7300),
514           .driver_info = (kernel_ulong_t)&pvr2_device_73xxx},
515         { USB_DEVICE(0x2040, 0x7500),
516           .driver_info = (kernel_ulong_t)&pvr2_device_750xx},
517         { USB_DEVICE(0x2040, 0x7501),
518           .driver_info = (kernel_ulong_t)&pvr2_device_751xx},
519         { }
520 };
521
522 MODULE_DEVICE_TABLE(usb, pvr2_device_table);
523
524
525 /*
526   Stuff for Emacs to see, in order to encourage consistent editing style:
527   *** Local Variables: ***
528   *** mode: c ***
529   *** fill-column: 75 ***
530   *** tab-width: 8 ***
531   *** c-basic-offset: 8 ***
532   *** End: ***
533   */