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>
38 #include "tuner-xc2028.h"
40 struct em28xx_board em28xx_boards
[] = {
41 [EM2800_BOARD_UNKNOWN
] = {
42 .name
= "Unknown EM2800 video grabber",
45 .norm
= VIDEO_MODE_PAL
,
46 .tda9887_conf
= TDA9887_PRESENT
,
48 .decoder
= EM28XX_SAA7113
,
50 .type
= EM28XX_VMUX_COMPOSITE1
,
51 .vmux
= SAA7115_COMPOSITE0
,
54 .type
= EM28XX_VMUX_SVIDEO
,
55 .vmux
= SAA7115_SVIDEO3
,
59 [EM2820_BOARD_UNKNOWN
] = {
60 .name
= "Unknown EM2820/2840 video grabber",
63 .norm
= VIDEO_MODE_PAL
,
64 .tda9887_conf
= TDA9887_PRESENT
,
66 .decoder
= EM28XX_SAA7113
,
68 .type
= EM28XX_VMUX_COMPOSITE1
,
69 .vmux
= SAA7115_COMPOSITE0
,
72 .type
= EM28XX_VMUX_SVIDEO
,
73 .vmux
= SAA7115_SVIDEO3
,
77 [EM2820_BOARD_KWORLD_PVRTV2800RF
] = {
78 .name
= "Kworld PVR TV 2800 RF",
81 .norm
= VIDEO_MODE_PAL
,
82 .tda9887_conf
= TDA9887_PRESENT
,
84 .decoder
= EM28XX_SAA7113
,
86 .type
= EM28XX_VMUX_COMPOSITE1
,
87 .vmux
= SAA7115_COMPOSITE0
,
90 .type
= EM28XX_VMUX_SVIDEO
,
91 .vmux
= SAA7115_SVIDEO3
,
95 [EM2820_BOARD_TERRATEC_CINERGY_250
] = {
96 .name
= "Terratec Cinergy 250 USB",
98 .norm
= VIDEO_MODE_PAL
,
99 .tuner_type
= TUNER_LG_PAL_NEW_TAPC
,
100 .tda9887_conf
= TDA9887_PRESENT
,
102 .decoder
= EM28XX_SAA7113
,
104 .type
= EM28XX_VMUX_TELEVISION
,
105 .vmux
= SAA7115_COMPOSITE2
,
108 .type
= EM28XX_VMUX_COMPOSITE1
,
109 .vmux
= SAA7115_COMPOSITE0
,
112 .type
= EM28XX_VMUX_SVIDEO
,
113 .vmux
= SAA7115_SVIDEO3
,
117 [EM2820_BOARD_PINNACLE_USB_2
] = {
118 .name
= "Pinnacle PCTV USB 2",
120 .norm
= VIDEO_MODE_PAL
,
121 .tuner_type
= TUNER_LG_PAL_NEW_TAPC
,
122 .tda9887_conf
= TDA9887_PRESENT
,
124 .decoder
= EM28XX_SAA7113
,
126 .type
= EM28XX_VMUX_TELEVISION
,
127 .vmux
= SAA7115_COMPOSITE2
,
130 .type
= EM28XX_VMUX_COMPOSITE1
,
131 .vmux
= SAA7115_COMPOSITE0
,
134 .type
= EM28XX_VMUX_SVIDEO
,
135 .vmux
= SAA7115_SVIDEO3
,
139 [EM2820_BOARD_HAUPPAUGE_WINTV_USB_2
] = {
140 .name
= "Hauppauge WinTV USB 2",
142 .norm
= VIDEO_MODE_NTSC
,
143 .tuner_type
= TUNER_PHILIPS_FM1236_MK3
,
144 .tda9887_conf
= TDA9887_PRESENT
|TDA9887_PORT1_ACTIVE
|TDA9887_PORT2_ACTIVE
,
146 .decoder
= EM28XX_TVP5150
,
148 /*FIXME: S-Video not tested */
150 .type
= EM28XX_VMUX_TELEVISION
,
151 .vmux
= TVP5150_COMPOSITE0
,
152 .amux
= MSP_INPUT_DEFAULT
,
154 .type
= EM28XX_VMUX_SVIDEO
,
155 .vmux
= TVP5150_SVIDEO
,
156 .amux
= MSP_INPUT(MSP_IN_SCART1
, MSP_IN_TUNER1
,
157 MSP_DSP_IN_SCART
, MSP_DSP_IN_SCART
),
160 [EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900
] = {
161 .name
= "Hauppauge WinTV HVR 900",
163 .norm
= VIDEO_MODE_PAL
,
164 .tda9887_conf
= TDA9887_PRESENT
,
165 .tuner_type
= TUNER_XC2028
,
167 .decoder
= EM28XX_TVP5150
,
169 .type
= EM28XX_VMUX_COMPOSITE1
,
170 .vmux
= TVP5150_COMPOSITE1
,
173 .type
= EM28XX_VMUX_TELEVISION
,
174 .vmux
= TVP5150_COMPOSITE0
,
177 .type
= EM28XX_VMUX_SVIDEO
,
178 .vmux
= TVP5150_SVIDEO
,
182 [EM2880_BOARD_TERRATEC_HYBRID_XS
] = {
183 .name
= "Terratec Hybrid XS",
185 .norm
= VIDEO_MODE_PAL
,
186 .tda9887_conf
= TDA9887_PRESENT
,
188 .tuner_type
= TUNER_XC2028
,
189 .decoder
= EM28XX_TVP5150
,
191 .type
= EM28XX_VMUX_TELEVISION
,
192 .vmux
= TVP5150_COMPOSITE0
,
195 .type
= EM28XX_VMUX_COMPOSITE1
,
196 .vmux
= TVP5150_COMPOSITE1
,
199 .type
= EM28XX_VMUX_SVIDEO
,
200 .vmux
= TVP5150_SVIDEO
,
204 /* maybe there's a reason behind it why Terratec sells the Hybrid XS as Prodigy XS with a
205 * different PID, let's keep it separated for now maybe we'll need it lateron */
206 [EM2880_BOARD_TERRATEC_PRODIGY_XS
] = {
207 .name
= "Terratec Prodigy XS",
209 .norm
= VIDEO_MODE_PAL
,
210 .tda9887_conf
= TDA9887_PRESENT
,
212 .tuner_type
= TUNER_XC2028
,
213 .decoder
= EM28XX_TVP5150
,
215 .type
= EM28XX_VMUX_TELEVISION
,
216 .vmux
= TVP5150_COMPOSITE0
,
219 .type
= EM28XX_VMUX_COMPOSITE1
,
220 .vmux
= TVP5150_COMPOSITE1
,
223 .type
= EM28XX_VMUX_SVIDEO
,
224 .vmux
= TVP5150_SVIDEO
,
228 [EM2820_BOARD_MSI_VOX_USB_2
] = {
229 .name
= "MSI VOX USB 2.0",
231 .norm
= VIDEO_MODE_PAL
,
232 .tuner_type
= TUNER_LG_PAL_NEW_TAPC
,
233 .tda9887_conf
= TDA9887_PRESENT
|TDA9887_PORT1_ACTIVE
|TDA9887_PORT2_ACTIVE
,
235 .decoder
= EM28XX_SAA7114
,
237 .type
= EM28XX_VMUX_TELEVISION
,
238 .vmux
= SAA7115_COMPOSITE4
,
241 .type
= EM28XX_VMUX_COMPOSITE1
,
242 .vmux
= SAA7115_COMPOSITE0
,
245 .type
= EM28XX_VMUX_SVIDEO
,
246 .vmux
= SAA7115_SVIDEO3
,
250 [EM2800_BOARD_TERRATEC_CINERGY_200
] = {
251 .name
= "Terratec Cinergy 200 USB",
254 .norm
= VIDEO_MODE_PAL
,
255 .tuner_type
= TUNER_LG_PAL_NEW_TAPC
,
256 .tda9887_conf
= TDA9887_PRESENT
,
258 .decoder
= EM28XX_SAA7113
,
260 .type
= EM28XX_VMUX_TELEVISION
,
261 .vmux
= SAA7115_COMPOSITE2
,
264 .type
= EM28XX_VMUX_COMPOSITE1
,
265 .vmux
= SAA7115_COMPOSITE0
,
268 .type
= EM28XX_VMUX_SVIDEO
,
269 .vmux
= SAA7115_SVIDEO3
,
273 [EM2800_BOARD_LEADTEK_WINFAST_USBII
] = {
274 .name
= "Leadtek Winfast USB II",
277 .norm
= VIDEO_MODE_PAL
,
278 .tuner_type
= TUNER_LG_PAL_NEW_TAPC
,
279 .tda9887_conf
= TDA9887_PRESENT
,
281 .decoder
= EM28XX_SAA7113
,
283 .type
= EM28XX_VMUX_TELEVISION
,
284 .vmux
= SAA7115_COMPOSITE2
,
287 .type
= EM28XX_VMUX_COMPOSITE1
,
288 .vmux
= SAA7115_COMPOSITE0
,
291 .type
= EM28XX_VMUX_SVIDEO
,
292 .vmux
= SAA7115_SVIDEO3
,
296 [EM2800_BOARD_KWORLD_USB2800
] = {
297 .name
= "Kworld USB2800",
300 .norm
= VIDEO_MODE_PAL
,
301 .tuner_type
= TUNER_PHILIPS_ATSC
,
302 .tda9887_conf
= TDA9887_PRESENT
,
304 .decoder
= EM28XX_SAA7113
,
306 .type
= EM28XX_VMUX_TELEVISION
,
307 .vmux
= SAA7115_COMPOSITE2
,
310 .type
= EM28XX_VMUX_COMPOSITE1
,
311 .vmux
= SAA7115_COMPOSITE0
,
314 .type
= EM28XX_VMUX_SVIDEO
,
315 .vmux
= SAA7115_SVIDEO3
,
319 [EM2820_BOARD_PINNACLE_DVC_90
] = {
320 .name
= "Pinnacle Dazzle DVC 90",
322 .norm
= VIDEO_MODE_PAL
,
324 .decoder
= EM28XX_SAA7113
,
326 .type
= EM28XX_VMUX_COMPOSITE1
,
327 .vmux
= SAA7115_COMPOSITE0
,
330 .type
= EM28XX_VMUX_SVIDEO
,
331 .vmux
= SAA7115_SVIDEO3
,
336 const unsigned int em28xx_bcount
= ARRAY_SIZE(em28xx_boards
);
338 /* table of devices that work with this driver */
339 struct usb_device_id em28xx_id_table
[] = {
340 { USB_DEVICE(0xeb1a, 0x2800), .driver_info
= EM2800_BOARD_UNKNOWN
},
341 { USB_DEVICE(0xeb1a, 0x2820), .driver_info
= EM2820_BOARD_MSI_VOX_USB_2
},
342 { USB_DEVICE(0x0ccd, 0x0036), .driver_info
= EM2820_BOARD_TERRATEC_CINERGY_250
},
343 { USB_DEVICE(0x2304, 0x0208), .driver_info
= EM2820_BOARD_PINNACLE_USB_2
},
344 { USB_DEVICE(0x2040, 0x4200), .driver_info
= EM2820_BOARD_HAUPPAUGE_WINTV_USB_2
},
345 { USB_DEVICE(0x2304, 0x0207), .driver_info
= EM2820_BOARD_PINNACLE_DVC_90
},
346 { USB_DEVICE(0x2040, 0x6500), .driver_info
= EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900
},
347 { USB_DEVICE(0x2040, 0x6513), .driver_info
= EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900
},
348 { USB_DEVICE(0x0ccd, 0x0042), .driver_info
= EM2880_BOARD_TERRATEC_HYBRID_XS
},
349 { USB_DEVICE(0x0ccd, 0x0047), .driver_info
= EM2880_BOARD_TERRATEC_PRODIGY_XS
},
353 void em28xx_pre_card_setup(struct em28xx
*dev
)
355 /* request some modules */
357 case EM2880_BOARD_TERRATEC_PRODIGY_XS
:
358 case EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900
:
359 case EM2880_BOARD_TERRATEC_HYBRID_XS
:
361 em28xx_write_regs_req(dev
, 0x00, 0x08, "\x7d", 1); // reset through GPIO?
367 static void em28xx_config_tuner (struct em28xx
*dev
)
369 struct v4l2_priv_tun_config xc2028_cfg
;
370 struct xc2028_ctrl ctl
;
372 memset (&ctl
,0,sizeof(ctl
));
374 ctl
.fname
= XC2028_DEFAULT_FIRMWARE
;
377 xc2028_cfg
.tuner
= TUNER_XC2028
;
378 xc2028_cfg
.priv
= &ctl
;
380 em28xx_i2c_call_clients(dev
, TUNER_SET_CONFIG
, &xc2028_cfg
);
383 void em28xx_card_setup(struct em28xx
*dev
)
385 /* request some modules */
387 case EM2820_BOARD_HAUPPAUGE_WINTV_USB_2
:
390 #ifdef CONFIG_MODULES
391 request_module("tveeprom");
392 request_module("ir-kbd-i2c");
393 request_module("msp3400");
395 /* Call first TVeeprom */
397 dev
->i2c_client
.addr
= 0xa0 >> 1;
398 tveeprom_hauppauge_analog(&dev
->i2c_client
, &tv
, dev
->eedata
);
400 dev
->tuner_type
= tv
.tuner_type
;
401 if (tv
.audio_processor
== AUDIO_CHIP_MSP34XX
) {
402 dev
->i2s_speed
=2048000;
408 case EM2820_BOARD_KWORLD_PVRTV2800RF
:
410 em28xx_write_regs_req(dev
,0x00,0x08, "\xf9", 1); // GPIO enables sound on KWORLD PVR TV 2800RF
415 em28xx_config_tuner (dev
);
418 MODULE_DEVICE_TABLE (usb
, em28xx_id_table
);