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@infradead.org>
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/delay.h>
27 #include <linux/i2c.h>
28 #include <linux/usb.h>
29 #include <media/tuner.h>
30 #include <media/msp3400.h>
31 #include <media/saa7115.h>
32 #include <media/tvp5150.h>
33 #include <media/tveeprom.h>
34 #include <media/audiochip.h>
35 #include <media/v4l2-common.h>
39 struct em28xx_board em28xx_boards[] = {
40 [EM2800_BOARD_UNKNOWN] = {
41 .name = "Unknown EM2800 video grabber",
44 .norm = VIDEO_MODE_PAL,
45 .tda9887_conf = TDA9887_PRESENT,
47 .decoder = EM28XX_SAA7113,
49 .type = EM28XX_VMUX_COMPOSITE1,
50 .vmux = SAA7115_COMPOSITE0,
53 .type = EM28XX_VMUX_SVIDEO,
54 .vmux = SAA7115_SVIDEO3,
58 [EM2820_BOARD_UNKNOWN] = {
59 .name = "Unknown EM2820/2840 video grabber",
62 .norm = VIDEO_MODE_PAL,
63 .tda9887_conf = TDA9887_PRESENT,
65 .decoder = EM28XX_SAA7113,
67 .type = EM28XX_VMUX_COMPOSITE1,
68 .vmux = SAA7115_COMPOSITE0,
71 .type = EM28XX_VMUX_SVIDEO,
72 .vmux = SAA7115_SVIDEO3,
76 [EM2820_BOARD_KWORLD_PVRTV2800RF] = {
77 .name = "Kworld PVR TV 2800 RF",
80 .norm = VIDEO_MODE_PAL,
81 .tda9887_conf = TDA9887_PRESENT,
83 .decoder = EM28XX_SAA7113,
85 .type = EM28XX_VMUX_COMPOSITE1,
86 .vmux = SAA7115_COMPOSITE0,
89 .type = EM28XX_VMUX_SVIDEO,
90 .vmux = SAA7115_SVIDEO3,
94 [EM2820_BOARD_TERRATEC_CINERGY_250] = {
95 .name = "Terratec Cinergy 250 USB",
97 .norm = VIDEO_MODE_PAL,
98 .tuner_type = TUNER_LG_PAL_NEW_TAPC,
99 .tda9887_conf = TDA9887_PRESENT,
101 .decoder = EM28XX_SAA7113,
103 .type = EM28XX_VMUX_TELEVISION,
104 .vmux = SAA7115_COMPOSITE2,
107 .type = EM28XX_VMUX_COMPOSITE1,
108 .vmux = SAA7115_COMPOSITE0,
111 .type = EM28XX_VMUX_SVIDEO,
112 .vmux = SAA7115_SVIDEO3,
116 [EM2820_BOARD_PINNACLE_USB_2] = {
117 .name = "Pinnacle PCTV USB 2",
119 .norm = VIDEO_MODE_PAL,
120 .tuner_type = TUNER_LG_PAL_NEW_TAPC,
121 .tda9887_conf = TDA9887_PRESENT,
123 .decoder = EM28XX_SAA7113,
125 .type = EM28XX_VMUX_TELEVISION,
126 .vmux = SAA7115_COMPOSITE2,
129 .type = EM28XX_VMUX_COMPOSITE1,
130 .vmux = SAA7115_COMPOSITE0,
133 .type = EM28XX_VMUX_SVIDEO,
134 .vmux = SAA7115_SVIDEO3,
138 [EM2820_BOARD_HAUPPAUGE_WINTV_USB_2] = {
139 .name = "Hauppauge WinTV USB 2",
141 .norm = VIDEO_MODE_NTSC,
142 .tuner_type = TUNER_PHILIPS_FM1236_MK3,
143 .tda9887_conf = TDA9887_PRESENT|TDA9887_PORT1_ACTIVE|TDA9887_PORT2_ACTIVE,
145 .decoder = EM28XX_TVP5150,
147 /*FIXME: S-Video not tested */
149 .type = EM28XX_VMUX_TELEVISION,
150 .vmux = TVP5150_COMPOSITE0,
151 .amux = MSP_INPUT_DEFAULT,
153 .type = EM28XX_VMUX_SVIDEO,
154 .vmux = TVP5150_SVIDEO,
155 .amux = MSP_INPUT(MSP_IN_SCART1, MSP_IN_TUNER1,
156 MSP_DSP_IN_SCART, MSP_DSP_IN_SCART),
159 [EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900] = {
160 .name = "Hauppauge WinTV HVR 900",
162 .norm = VIDEO_MODE_PAL,
163 .tda9887_conf = TDA9887_PRESENT,
164 .tuner_type = TUNER_XC2028,
166 .decoder = EM28XX_TVP5150,
168 .type = EM28XX_VMUX_COMPOSITE1,
169 .vmux = TVP5150_COMPOSITE1,
172 .type = EM28XX_VMUX_TELEVISION,
173 .vmux = TVP5150_COMPOSITE0,
176 .type = EM28XX_VMUX_SVIDEO,
177 .vmux = TVP5150_SVIDEO,
181 [EM2880_BOARD_TERRATEC_HYBRID_XS] = {
182 .name = "Terratec Hybrid XS",
184 .norm = VIDEO_MODE_PAL,
185 .tda9887_conf = TDA9887_PRESENT,
187 .tuner_type = TUNER_XC2028,
188 .decoder = EM28XX_TVP5150,
190 .type = EM28XX_VMUX_TELEVISION,
191 .vmux = TVP5150_COMPOSITE0,
194 .type = EM28XX_VMUX_COMPOSITE1,
195 .vmux = TVP5150_COMPOSITE1,
198 .type = EM28XX_VMUX_SVIDEO,
199 .vmux = TVP5150_SVIDEO,
203 /* maybe there's a reason behind it why Terratec sells the Hybrid XS as Prodigy XS with a
204 * different PID, let's keep it separated for now maybe we'll need it lateron */
205 [EM2880_BOARD_TERRATEC_PRODIGY_XS] = {
206 .name = "Terratec Prodigy XS",
208 .norm = VIDEO_MODE_PAL,
209 .tda9887_conf = TDA9887_PRESENT,
211 .tuner_type = TUNER_XC2028,
212 .decoder = EM28XX_TVP5150,
214 .type = EM28XX_VMUX_TELEVISION,
215 .vmux = TVP5150_COMPOSITE0,
218 .type = EM28XX_VMUX_COMPOSITE1,
219 .vmux = TVP5150_COMPOSITE1,
222 .type = EM28XX_VMUX_SVIDEO,
223 .vmux = TVP5150_SVIDEO,
227 [EM2820_BOARD_MSI_VOX_USB_2] = {
228 .name = "MSI VOX USB 2.0",
230 .norm = VIDEO_MODE_PAL,
231 .tuner_type = TUNER_LG_PAL_NEW_TAPC,
232 .tda9887_conf = TDA9887_PRESENT|TDA9887_PORT1_ACTIVE|TDA9887_PORT2_ACTIVE,
234 .decoder = EM28XX_SAA7114,
236 .type = EM28XX_VMUX_TELEVISION,
237 .vmux = SAA7115_COMPOSITE4,
240 .type = EM28XX_VMUX_COMPOSITE1,
241 .vmux = SAA7115_COMPOSITE0,
244 .type = EM28XX_VMUX_SVIDEO,
245 .vmux = SAA7115_SVIDEO3,
249 [EM2800_BOARD_TERRATEC_CINERGY_200] = {
250 .name = "Terratec Cinergy 200 USB",
253 .norm = VIDEO_MODE_PAL,
254 .tuner_type = TUNER_LG_PAL_NEW_TAPC,
255 .tda9887_conf = TDA9887_PRESENT,
257 .decoder = EM28XX_SAA7113,
259 .type = EM28XX_VMUX_TELEVISION,
260 .vmux = SAA7115_COMPOSITE2,
263 .type = EM28XX_VMUX_COMPOSITE1,
264 .vmux = SAA7115_COMPOSITE0,
267 .type = EM28XX_VMUX_SVIDEO,
268 .vmux = SAA7115_SVIDEO3,
272 [EM2800_BOARD_LEADTEK_WINFAST_USBII] = {
273 .name = "Leadtek Winfast USB II",
276 .norm = VIDEO_MODE_PAL,
277 .tuner_type = TUNER_LG_PAL_NEW_TAPC,
278 .tda9887_conf = TDA9887_PRESENT,
280 .decoder = EM28XX_SAA7113,
282 .type = EM28XX_VMUX_TELEVISION,
283 .vmux = SAA7115_COMPOSITE2,
286 .type = EM28XX_VMUX_COMPOSITE1,
287 .vmux = SAA7115_COMPOSITE0,
290 .type = EM28XX_VMUX_SVIDEO,
291 .vmux = SAA7115_SVIDEO3,
295 [EM2800_BOARD_KWORLD_USB2800] = {
296 .name = "Kworld USB2800",
299 .norm = VIDEO_MODE_PAL,
300 .tuner_type = TUNER_PHILIPS_ATSC,
301 .tda9887_conf = TDA9887_PRESENT,
303 .decoder = EM28XX_SAA7113,
305 .type = EM28XX_VMUX_TELEVISION,
306 .vmux = SAA7115_COMPOSITE2,
309 .type = EM28XX_VMUX_COMPOSITE1,
310 .vmux = SAA7115_COMPOSITE0,
313 .type = EM28XX_VMUX_SVIDEO,
314 .vmux = SAA7115_SVIDEO3,
318 [EM2820_BOARD_PINNACLE_DVC_90] = {
319 .name = "Pinnacle Dazzle DVC 90",
321 .norm = VIDEO_MODE_PAL,
323 .decoder = EM28XX_SAA7113,
325 .type = EM28XX_VMUX_COMPOSITE1,
326 .vmux = SAA7115_COMPOSITE0,
329 .type = EM28XX_VMUX_SVIDEO,
330 .vmux = SAA7115_SVIDEO3,
335 const unsigned int em28xx_bcount = ARRAY_SIZE(em28xx_boards);
337 /* table of devices that work with this driver */
338 struct usb_device_id em28xx_id_table [] = {
339 { USB_DEVICE(0xeb1a, 0x2800), .driver_info = EM2800_BOARD_UNKNOWN },
340 { USB_DEVICE(0xeb1a, 0x2820), .driver_info = EM2820_BOARD_MSI_VOX_USB_2 },
341 { USB_DEVICE(0x0ccd, 0x0036), .driver_info = EM2820_BOARD_TERRATEC_CINERGY_250 },
342 { USB_DEVICE(0x2304, 0x0208), .driver_info = EM2820_BOARD_PINNACLE_USB_2 },
343 { USB_DEVICE(0x2040, 0x4200), .driver_info = EM2820_BOARD_HAUPPAUGE_WINTV_USB_2 },
344 { USB_DEVICE(0x2304, 0x0207), .driver_info = EM2820_BOARD_PINNACLE_DVC_90 },
345 { USB_DEVICE(0x2040, 0x6500), .driver_info = EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900 },
346 { USB_DEVICE(0x0ccd, 0x0042), .driver_info = EM2880_BOARD_TERRATEC_HYBRID_XS },
347 { USB_DEVICE(0x0ccd, 0x0047), .driver_info = EM2880_BOARD_TERRATEC_PRODIGY_XS },
351 void em28xx_pre_card_setup(struct em28xx *dev)
353 /* request some modules */
355 case EM2880_BOARD_TERRATEC_PRODIGY_XS:
356 case EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900:
357 case EM2880_BOARD_TERRATEC_HYBRID_XS:
359 em28xx_write_regs_req(dev, 0x00, 0x08, "\x7d", 1); // reset through GPIO?
365 void em28xx_card_setup(struct em28xx *dev)
367 /* request some modules */
369 case EM2820_BOARD_HAUPPAUGE_WINTV_USB_2:
372 #ifdef CONFIG_MODULES
373 request_module("tveeprom");
374 request_module("ir-kbd-i2c");
375 request_module("msp3400");
377 /* Call first TVeeprom */
379 dev->i2c_client.addr = 0xa0 >> 1;
380 tveeprom_hauppauge_analog(&dev->i2c_client, &tv, dev->eedata);
382 dev->tuner_type= tv.tuner_type;
383 if (tv.audio_processor == AUDIO_CHIP_MSP34XX) {
384 dev->i2s_speed=2048000;
390 case EM2820_BOARD_KWORLD_PVRTV2800RF:
392 em28xx_write_regs_req(dev,0x00,0x08, "\xf9", 1); // GPIO enables sound on KWORLD PVR TV 2800RF
399 MODULE_DEVICE_TABLE (usb, em28xx_id_table);