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 [EM2820_BOARD_MSI_VOX_USB_2
] = {
160 .name
= "MSI VOX USB 2.0",
162 .norm
= VIDEO_MODE_PAL
,
163 .tuner_type
= TUNER_LG_PAL_NEW_TAPC
,
164 .tda9887_conf
= TDA9887_PRESENT
|TDA9887_PORT1_ACTIVE
|TDA9887_PORT2_ACTIVE
,
166 .decoder
= EM28XX_SAA7114
,
168 .type
= EM28XX_VMUX_TELEVISION
,
169 .vmux
= SAA7115_COMPOSITE4
,
172 .type
= EM28XX_VMUX_COMPOSITE1
,
173 .vmux
= SAA7115_COMPOSITE0
,
176 .type
= EM28XX_VMUX_SVIDEO
,
177 .vmux
= SAA7115_SVIDEO3
,
181 [EM2800_BOARD_TERRATEC_CINERGY_200
] = {
182 .name
= "Terratec Cinergy 200 USB",
185 .norm
= VIDEO_MODE_PAL
,
186 .tuner_type
= TUNER_LG_PAL_NEW_TAPC
,
187 .tda9887_conf
= TDA9887_PRESENT
,
189 .decoder
= EM28XX_SAA7113
,
191 .type
= EM28XX_VMUX_TELEVISION
,
192 .vmux
= SAA7115_COMPOSITE2
,
195 .type
= EM28XX_VMUX_COMPOSITE1
,
196 .vmux
= SAA7115_COMPOSITE0
,
199 .type
= EM28XX_VMUX_SVIDEO
,
200 .vmux
= SAA7115_SVIDEO3
,
204 [EM2800_BOARD_LEADTEK_WINFAST_USBII
] = {
205 .name
= "Leadtek Winfast USB II",
208 .norm
= VIDEO_MODE_PAL
,
209 .tuner_type
= TUNER_LG_PAL_NEW_TAPC
,
210 .tda9887_conf
= TDA9887_PRESENT
,
212 .decoder
= EM28XX_SAA7113
,
214 .type
= EM28XX_VMUX_TELEVISION
,
215 .vmux
= SAA7115_COMPOSITE2
,
218 .type
= EM28XX_VMUX_COMPOSITE1
,
219 .vmux
= SAA7115_COMPOSITE0
,
222 .type
= EM28XX_VMUX_SVIDEO
,
223 .vmux
= SAA7115_SVIDEO3
,
227 [EM2800_BOARD_KWORLD_USB2800
] = {
228 .name
= "Kworld USB2800",
231 .norm
= VIDEO_MODE_PAL
,
232 .tuner_type
= TUNER_PHILIPS_ATSC
,
233 .tda9887_conf
= TDA9887_PRESENT
,
235 .decoder
= EM28XX_SAA7113
,
237 .type
= EM28XX_VMUX_TELEVISION
,
238 .vmux
= SAA7115_COMPOSITE2
,
241 .type
= EM28XX_VMUX_COMPOSITE1
,
242 .vmux
= SAA7115_COMPOSITE0
,
245 .type
= EM28XX_VMUX_SVIDEO
,
246 .vmux
= SAA7115_SVIDEO3
,
250 [EM2820_BOARD_PINNACLE_DVC_90
] = {
251 .name
= "Pinnacle Dazzle DVC 90",
253 .norm
= VIDEO_MODE_PAL
,
255 .decoder
= EM28XX_SAA7113
,
257 .type
= EM28XX_VMUX_COMPOSITE1
,
258 .vmux
= SAA7115_COMPOSITE0
,
261 .type
= EM28XX_VMUX_SVIDEO
,
262 .vmux
= SAA7115_SVIDEO3
,
267 const unsigned int em28xx_bcount
= ARRAY_SIZE(em28xx_boards
);
269 /* table of devices that work with this driver */
270 struct usb_device_id em28xx_id_table
[] = {
271 { USB_DEVICE(0xeb1a, 0x2800), .driver_info
= EM2800_BOARD_UNKNOWN
},
272 { USB_DEVICE(0xeb1a, 0x2820), .driver_info
= EM2820_BOARD_MSI_VOX_USB_2
},
273 { USB_DEVICE(0x0ccd, 0x0036), .driver_info
= EM2820_BOARD_TERRATEC_CINERGY_250
},
274 { USB_DEVICE(0x2304, 0x0208), .driver_info
= EM2820_BOARD_PINNACLE_USB_2
},
275 { USB_DEVICE(0x2040, 0x4200), .driver_info
= EM2820_BOARD_HAUPPAUGE_WINTV_USB_2
},
276 { USB_DEVICE(0x2304, 0x0207), .driver_info
= EM2820_BOARD_PINNACLE_DVC_90
},
280 void em28xx_pre_card_setup(struct em28xx
*dev
)
282 /* request some modules */
284 case EM2880_BOARD_TERRATEC_PRODIGY_XS
:
285 case EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900
:
286 case EM2880_BOARD_TERRATEC_HYBRID_XS
:
288 em28xx_write_regs_req(dev
, 0x00, 0x08, "\x7d", 1); // reset through GPIO?
294 void em28xx_card_setup(struct em28xx
*dev
)
296 /* request some modules */
298 case EM2820_BOARD_HAUPPAUGE_WINTV_USB_2
:
301 #ifdef CONFIG_MODULES
302 request_module("tveeprom");
303 request_module("ir-kbd-i2c");
304 request_module("msp3400");
306 /* Call first TVeeprom */
308 dev
->i2c_client
.addr
= 0xa0 >> 1;
309 tveeprom_hauppauge_analog(&dev
->i2c_client
, &tv
, dev
->eedata
);
311 dev
->tuner_type
= tv
.tuner_type
;
312 if (tv
.audio_processor
== AUDIO_CHIP_MSP34XX
) {
313 dev
->i2s_speed
=2048000;
319 case EM2820_BOARD_KWORLD_PVRTV2800RF
:
321 em28xx_write_regs_req(dev
,0x00,0x08, "\xf9", 1); // GPIO enables sound on KWORLD PVR TV 2800RF
328 MODULE_DEVICE_TABLE (usb
, em28xx_id_table
);