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/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/msp3400.h>
32 #include <media/saa7115.h>
33 #include <media/tvp5150.h>
34 #include <media/tveeprom.h>
35 #include <media/audiochip.h>
36 #include <media/v4l2-common.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 [EM2820_BOARD_MSI_VOX_USB_2
] = {
161 .name
= "MSI VOX USB 2.0",
163 .norm
= VIDEO_MODE_PAL
,
164 .tuner_type
= TUNER_LG_PAL_NEW_TAPC
,
165 .tda9887_conf
= TDA9887_PRESENT
|TDA9887_PORT1_ACTIVE
|TDA9887_PORT2_ACTIVE
,
167 .decoder
= EM28XX_SAA7114
,
169 .type
= EM28XX_VMUX_TELEVISION
,
170 .vmux
= SAA7115_COMPOSITE4
,
173 .type
= EM28XX_VMUX_COMPOSITE1
,
174 .vmux
= SAA7115_COMPOSITE0
,
177 .type
= EM28XX_VMUX_SVIDEO
,
178 .vmux
= SAA7115_SVIDEO3
,
182 [EM2800_BOARD_TERRATEC_CINERGY_200
] = {
183 .name
= "Terratec Cinergy 200 USB",
186 .norm
= VIDEO_MODE_PAL
,
187 .tuner_type
= TUNER_LG_PAL_NEW_TAPC
,
188 .tda9887_conf
= TDA9887_PRESENT
,
190 .decoder
= EM28XX_SAA7113
,
192 .type
= EM28XX_VMUX_TELEVISION
,
193 .vmux
= SAA7115_COMPOSITE2
,
196 .type
= EM28XX_VMUX_COMPOSITE1
,
197 .vmux
= SAA7115_COMPOSITE0
,
200 .type
= EM28XX_VMUX_SVIDEO
,
201 .vmux
= SAA7115_SVIDEO3
,
205 [EM2800_BOARD_LEADTEK_WINFAST_USBII
] = {
206 .name
= "Leadtek Winfast USB II",
209 .norm
= VIDEO_MODE_PAL
,
210 .tuner_type
= TUNER_LG_PAL_NEW_TAPC
,
211 .tda9887_conf
= TDA9887_PRESENT
,
213 .decoder
= EM28XX_SAA7113
,
215 .type
= EM28XX_VMUX_TELEVISION
,
216 .vmux
= SAA7115_COMPOSITE2
,
219 .type
= EM28XX_VMUX_COMPOSITE1
,
220 .vmux
= SAA7115_COMPOSITE0
,
223 .type
= EM28XX_VMUX_SVIDEO
,
224 .vmux
= SAA7115_SVIDEO3
,
228 [EM2800_BOARD_KWORLD_USB2800
] = {
229 .name
= "Kworld USB2800",
232 .norm
= VIDEO_MODE_PAL
,
233 .tuner_type
= TUNER_PHILIPS_ATSC
,
234 .tda9887_conf
= TDA9887_PRESENT
,
236 .decoder
= EM28XX_SAA7113
,
238 .type
= EM28XX_VMUX_TELEVISION
,
239 .vmux
= SAA7115_COMPOSITE2
,
242 .type
= EM28XX_VMUX_COMPOSITE1
,
243 .vmux
= SAA7115_COMPOSITE0
,
246 .type
= EM28XX_VMUX_SVIDEO
,
247 .vmux
= SAA7115_SVIDEO3
,
251 [EM2820_BOARD_PINNACLE_DVC_90
] = {
252 .name
= "Pinnacle Dazzle DVC 90",
254 .norm
= VIDEO_MODE_PAL
,
256 .decoder
= EM28XX_SAA7113
,
258 .type
= EM28XX_VMUX_COMPOSITE1
,
259 .vmux
= SAA7115_COMPOSITE0
,
262 .type
= EM28XX_VMUX_SVIDEO
,
263 .vmux
= SAA7115_SVIDEO3
,
268 const unsigned int em28xx_bcount
= ARRAY_SIZE(em28xx_boards
);
270 /* table of devices that work with this driver */
271 struct usb_device_id em28xx_id_table
[] = {
272 { USB_DEVICE(0xeb1a, 0x2800), .driver_info
= EM2800_BOARD_UNKNOWN
},
273 { USB_DEVICE(0xeb1a, 0x2820), .driver_info
= EM2820_BOARD_MSI_VOX_USB_2
},
274 { USB_DEVICE(0x0ccd, 0x0036), .driver_info
= EM2820_BOARD_TERRATEC_CINERGY_250
},
275 { USB_DEVICE(0x2304, 0x0208), .driver_info
= EM2820_BOARD_PINNACLE_USB_2
},
276 { USB_DEVICE(0x2040, 0x4200), .driver_info
= EM2820_BOARD_HAUPPAUGE_WINTV_USB_2
},
277 { USB_DEVICE(0x2304, 0x0207), .driver_info
= EM2820_BOARD_PINNACLE_DVC_90
},
281 void em28xx_pre_card_setup(struct em28xx
*dev
)
283 /* request some modules */
285 case EM2880_BOARD_TERRATEC_PRODIGY_XS
:
286 case EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900
:
287 case EM2880_BOARD_TERRATEC_HYBRID_XS
:
289 em28xx_write_regs_req(dev
, 0x00, 0x08, "\x7d", 1); // reset through GPIO?
295 void em28xx_card_setup(struct em28xx
*dev
)
297 /* request some modules */
299 case EM2820_BOARD_HAUPPAUGE_WINTV_USB_2
:
302 #ifdef CONFIG_MODULES
303 request_module("tveeprom");
304 request_module("ir-kbd-i2c");
305 request_module("msp3400");
307 /* Call first TVeeprom */
309 dev
->i2c_client
.addr
= 0xa0 >> 1;
310 tveeprom_hauppauge_analog(&dev
->i2c_client
, &tv
, dev
->eedata
);
312 dev
->tuner_type
= tv
.tuner_type
;
313 if (tv
.audio_processor
== AUDIO_CHIP_MSP34XX
) {
314 dev
->i2s_speed
=2048000;
320 case EM2820_BOARD_KWORLD_PVRTV2800RF
:
322 em28xx_write_regs_req(dev
,0x00,0x08, "\xf9", 1); // GPIO enables sound on KWORLD PVR TV 2800RF
329 MODULE_DEVICE_TABLE (usb
, em28xx_id_table
);