[PATCH] vfs: MS_VERBOSE should be MS_SILENT
[linux-2.6/verdex.git] / drivers / media / video / em28xx / em28xx-cards.c
blob4e22fc4889e14d3117f8aa2daf00cddf84309e23
1 /*
2 em28xx-cards.c - driver for Empia EM2800/EM2820/2840 USB video capture devices
4 Copyright (C) 2005 Ludovico Cavedon <cavedon@sssup.it>
5 Markus Rechberger <mrechberger@gmail.com>
6 Mauro Carvalho Chehab <mchehab@brturbo.com.br>
7 Sascha Sommer <saschasommer@freenet.de>
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2 of the License, or
12 (at your option) any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24 #include <linux/init.h>
25 #include <linux/module.h>
26 #include <linux/pci.h>
27 #include <linux/delay.h>
28 #include <linux/i2c.h>
29 #include <linux/usb.h>
30 #include <media/tuner.h>
31 #include <media/audiochip.h>
32 #include <media/tveeprom.h>
33 #include <media/v4l2-common.h>
34 #include "msp3400.h"
36 #include "em28xx.h"
38 struct em28xx_board em28xx_boards[] = {
39 [EM2800_BOARD_UNKNOWN] = {
40 .name = "Unknown EM2800 video grabber",
41 .is_em2800 = 1,
42 .vchannels = 2,
43 .norm = VIDEO_MODE_PAL,
44 .tda9887_conf = TDA9887_PRESENT,
45 .has_tuner = 1,
46 .decoder = EM28XX_SAA7113,
47 .input = {{
48 .type = EM28XX_VMUX_COMPOSITE1,
49 .vmux = 0,
50 .amux = 1,
51 },{
52 .type = EM28XX_VMUX_SVIDEO,
53 .vmux = 9,
54 .amux = 1,
55 }},
57 [EM2820_BOARD_UNKNOWN] = {
58 .name = "Unknown EM2820/2840 video grabber",
59 .is_em2800 = 0,
60 .vchannels = 2,
61 .norm = VIDEO_MODE_PAL,
62 .tda9887_conf = TDA9887_PRESENT,
63 .has_tuner = 1,
64 .decoder = EM28XX_SAA7113,
65 .input = {{
66 .type = EM28XX_VMUX_COMPOSITE1,
67 .vmux = 0,
68 .amux = 1,
69 },{
70 .type = EM28XX_VMUX_SVIDEO,
71 .vmux = 9,
72 .amux = 1,
73 }},
75 [EM2820_BOARD_KWORLD_PVRTV2800RF] = {
76 .name = "Kworld PVR TV 2800 RF",
77 .is_em2800 = 0,
78 .vchannels = 2,
79 .norm = VIDEO_MODE_PAL,
80 .tda9887_conf = TDA9887_PRESENT,
81 .has_tuner = 1,
82 .decoder = EM28XX_SAA7113,
83 .input = {{
84 .type = EM28XX_VMUX_COMPOSITE1,
85 .vmux = 0,
86 .amux = 1,
87 },{
88 .type = EM28XX_VMUX_SVIDEO,
89 .vmux = 9,
90 .amux = 1,
91 }},
93 [EM2820_BOARD_TERRATEC_CINERGY_250] = {
94 .name = "Terratec Cinergy 250 USB",
95 .vchannels = 3,
96 .norm = VIDEO_MODE_PAL,
97 .tuner_type = TUNER_LG_PAL_NEW_TAPC,
98 .tda9887_conf = TDA9887_PRESENT,
99 .has_tuner = 1,
100 .decoder = EM28XX_SAA7113,
101 .input = {{
102 .type = EM28XX_VMUX_TELEVISION,
103 .vmux = 2,
104 .amux = 1,
106 .type = EM28XX_VMUX_COMPOSITE1,
107 .vmux = 0,
108 .amux = 1,
110 .type = EM28XX_VMUX_SVIDEO,
111 .vmux = 9,
112 .amux = 1,
115 [EM2820_BOARD_PINNACLE_USB_2] = {
116 .name = "Pinnacle PCTV USB 2",
117 .vchannels = 3,
118 .norm = VIDEO_MODE_PAL,
119 .tuner_type = TUNER_LG_PAL_NEW_TAPC,
120 .tda9887_conf = TDA9887_PRESENT,
121 .has_tuner = 1,
122 .decoder = EM28XX_SAA7113,
123 .input = {{
124 .type = EM28XX_VMUX_TELEVISION,
125 .vmux = 2,
126 .amux = 0,
128 .type = EM28XX_VMUX_COMPOSITE1,
129 .vmux = 0,
130 .amux = 1,
132 .type = EM28XX_VMUX_SVIDEO,
133 .vmux = 9,
134 .amux = 1,
137 [EM2820_BOARD_HAUPPAUGE_WINTV_USB_2] = {
138 .name = "Hauppauge WinTV USB 2",
139 .vchannels = 3,
140 .norm = VIDEO_MODE_NTSC,
141 .tuner_type = TUNER_PHILIPS_FM1236_MK3,
142 .tda9887_conf = TDA9887_PRESENT|TDA9887_PORT1_ACTIVE|TDA9887_PORT2_ACTIVE,
143 .has_tuner = 1,
144 .decoder = EM28XX_TVP5150,
145 .has_msp34xx = 1,
146 /*FIXME: S-Video not tested */
147 .input = {{
148 .type = EM28XX_VMUX_TELEVISION,
149 .vmux = 0,
150 .amux = 6,
152 .type = EM28XX_VMUX_SVIDEO,
153 .vmux = 2,
154 .amux = 1,
157 [EM2820_BOARD_MSI_VOX_USB_2] = {
158 .name = "MSI VOX USB 2.0",
159 .vchannels = 3,
160 .norm = VIDEO_MODE_PAL,
161 .tuner_type = TUNER_LG_PAL_NEW_TAPC,
162 .tda9887_conf = TDA9887_PRESENT|TDA9887_PORT1_ACTIVE|TDA9887_PORT2_ACTIVE,
163 .has_tuner = 1,
164 .decoder = EM28XX_SAA7114,
165 .input = {{
166 .type = EM28XX_VMUX_TELEVISION,
167 .vmux = 4,
168 .amux = 0,
170 .type = EM28XX_VMUX_COMPOSITE1,
171 .vmux = 0,
172 .amux = 1,
174 .type = EM28XX_VMUX_SVIDEO,
175 .vmux = 9,
176 .amux = 1,
179 [EM2800_BOARD_TERRATEC_CINERGY_200] = {
180 .name = "Terratec Cinergy 200 USB",
181 .is_em2800 = 1,
182 .vchannels = 3,
183 .norm = VIDEO_MODE_PAL,
184 .tuner_type = TUNER_LG_PAL_NEW_TAPC,
185 .tda9887_conf = TDA9887_PRESENT,
186 .has_tuner = 1,
187 .decoder = EM28XX_SAA7113,
188 .input = {{
189 .type = EM28XX_VMUX_TELEVISION,
190 .vmux = 2,
191 .amux = 0,
193 .type = EM28XX_VMUX_COMPOSITE1,
194 .vmux = 0,
195 .amux = 1,
197 .type = EM28XX_VMUX_SVIDEO,
198 .vmux = 9,
199 .amux = 1,
202 [EM2800_BOARD_LEADTEK_WINFAST_USBII] = {
203 .name = "Leadtek Winfast USB II",
204 .is_em2800 = 1,
205 .vchannels = 3,
206 .norm = VIDEO_MODE_PAL,
207 .tuner_type = TUNER_LG_PAL_NEW_TAPC,
208 .tda9887_conf = TDA9887_PRESENT,
209 .has_tuner = 1,
210 .decoder = EM28XX_SAA7113,
211 .input = {{
212 .type = EM28XX_VMUX_TELEVISION,
213 .vmux = 2,
214 .amux = 0,
216 .type = EM28XX_VMUX_COMPOSITE1,
217 .vmux = 0,
218 .amux = 1,
220 .type = EM28XX_VMUX_SVIDEO,
221 .vmux = 9,
222 .amux = 1,
225 [EM2800_BOARD_KWORLD_USB2800] = {
226 .name = "Kworld USB2800",
227 .is_em2800 = 1,
228 .vchannels = 3,
229 .norm = VIDEO_MODE_PAL,
230 .tuner_type = TUNER_PHILIPS_ATSC,
231 .tda9887_conf = TDA9887_PRESENT,
232 .has_tuner = 1,
233 .decoder = EM28XX_SAA7113,
234 .input = {{
235 .type = EM28XX_VMUX_TELEVISION,
236 .vmux = 2,
237 .amux = 0,
239 .type = EM28XX_VMUX_COMPOSITE1,
240 .vmux = 0,
241 .amux = 1,
243 .type = EM28XX_VMUX_SVIDEO,
244 .vmux = 9,
245 .amux = 1,
248 [EM2820_BOARD_PINNACLE_DVC_90] = {
249 .name = "Pinnacle Dazzle DVC 90",
250 .vchannels = 3,
251 .norm = VIDEO_MODE_PAL,
252 .has_tuner = 0,
253 .decoder = EM28XX_SAA7113,
254 .input = {{
255 .type = EM28XX_VMUX_COMPOSITE1,
256 .vmux = 0,
257 .amux = 1,
259 .type = EM28XX_VMUX_SVIDEO,
260 .vmux = 9,
261 .amux = 1,
265 const unsigned int em28xx_bcount = ARRAY_SIZE(em28xx_boards);
267 /* table of devices that work with this driver */
268 struct usb_device_id em28xx_id_table [] = {
269 { USB_DEVICE(0xeb1a, 0x2800), .driver_info = EM2800_BOARD_UNKNOWN },
270 { USB_DEVICE(0xeb1a, 0x2820), .driver_info = EM2820_BOARD_MSI_VOX_USB_2 },
271 { USB_DEVICE(0x0ccd, 0x0036), .driver_info = EM2820_BOARD_TERRATEC_CINERGY_250 },
272 { USB_DEVICE(0x2304, 0x0208), .driver_info = EM2820_BOARD_PINNACLE_USB_2 },
273 { USB_DEVICE(0x2040, 0x4200), .driver_info = EM2820_BOARD_HAUPPAUGE_WINTV_USB_2 },
274 { USB_DEVICE(0x2304, 0x0207), .driver_info = EM2820_BOARD_PINNACLE_DVC_90 },
275 { },
278 void em28xx_pre_card_setup(struct em28xx *dev)
280 /* request some modules */
281 switch(dev->model){
282 case EM2880_BOARD_TERRATEC_PRODIGY_XS:
283 case EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900:
284 case EM2880_BOARD_TERRATEC_HYBRID_XS:
286 em28xx_write_regs_req(dev, 0x00, 0x08, "\x7d", 1); // reset through GPIO?
287 break;
292 void em28xx_card_setup(struct em28xx *dev)
294 /* request some modules */
295 switch(dev->model){
296 case EM2820_BOARD_HAUPPAUGE_WINTV_USB_2:
298 struct tveeprom tv;
299 #ifdef CONFIG_MODULES
300 request_module("tveeprom");
301 request_module("ir-kbd-i2c");
302 request_module("msp3400");
303 #endif
304 /* Call first TVeeprom */
306 dev->i2c_client.addr = 0xa0 >> 1;
307 tveeprom_hauppauge_analog(&dev->i2c_client, &tv, dev->eedata);
309 dev->tuner_type= tv.tuner_type;
310 if (tv.audio_processor == AUDIO_CHIP_MSP34XX) {
311 dev->i2s_speed=2048000;
312 dev->has_msp34xx=1;
313 } else
314 dev->has_msp34xx=0;
315 break;
317 case EM2820_BOARD_KWORLD_PVRTV2800RF:
319 em28xx_write_regs_req(dev,0x00,0x08, "\xf9", 1); // GPIO enables sound on KWORLD PVR TV 2800RF
320 break;
326 EXPORT_SYMBOL(em28xx_boards);
327 EXPORT_SYMBOL(em28xx_bcount);
328 EXPORT_SYMBOL(em28xx_id_table);
330 MODULE_DEVICE_TABLE (usb, em28xx_id_table);