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