Revert "[PATCH] paravirt: Add startup infrastructure for paravirtualization"
[pv_ops_mirror.git] / drivers / media / video / em28xx / em28xx-cards.c
blob418ea8b7f85a7f8c28b056f5e08a921c71745462
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@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>
37 #include "em28xx.h"
39 struct em28xx_board em28xx_boards[] = {
40 [EM2800_BOARD_UNKNOWN] = {
41 .name = "Unknown EM2800 video grabber",
42 .is_em2800 = 1,
43 .vchannels = 2,
44 .norm = VIDEO_MODE_PAL,
45 .tda9887_conf = TDA9887_PRESENT,
46 .has_tuner = 1,
47 .decoder = EM28XX_SAA7113,
48 .input = {{
49 .type = EM28XX_VMUX_COMPOSITE1,
50 .vmux = SAA7115_COMPOSITE0,
51 .amux = 1,
52 },{
53 .type = EM28XX_VMUX_SVIDEO,
54 .vmux = SAA7115_SVIDEO3,
55 .amux = 1,
56 }},
58 [EM2820_BOARD_UNKNOWN] = {
59 .name = "Unknown EM2820/2840 video grabber",
60 .is_em2800 = 0,
61 .vchannels = 2,
62 .norm = VIDEO_MODE_PAL,
63 .tda9887_conf = TDA9887_PRESENT,
64 .has_tuner = 1,
65 .decoder = EM28XX_SAA7113,
66 .input = {{
67 .type = EM28XX_VMUX_COMPOSITE1,
68 .vmux = SAA7115_COMPOSITE0,
69 .amux = 1,
70 },{
71 .type = EM28XX_VMUX_SVIDEO,
72 .vmux = SAA7115_SVIDEO3,
73 .amux = 1,
74 }},
76 [EM2820_BOARD_KWORLD_PVRTV2800RF] = {
77 .name = "Kworld PVR TV 2800 RF",
78 .is_em2800 = 0,
79 .vchannels = 2,
80 .norm = VIDEO_MODE_PAL,
81 .tda9887_conf = TDA9887_PRESENT,
82 .has_tuner = 1,
83 .decoder = EM28XX_SAA7113,
84 .input = {{
85 .type = EM28XX_VMUX_COMPOSITE1,
86 .vmux = SAA7115_COMPOSITE0,
87 .amux = 1,
88 },{
89 .type = EM28XX_VMUX_SVIDEO,
90 .vmux = SAA7115_SVIDEO3,
91 .amux = 1,
92 }},
94 [EM2820_BOARD_TERRATEC_CINERGY_250] = {
95 .name = "Terratec Cinergy 250 USB",
96 .vchannels = 3,
97 .norm = VIDEO_MODE_PAL,
98 .tuner_type = TUNER_LG_PAL_NEW_TAPC,
99 .tda9887_conf = TDA9887_PRESENT,
100 .has_tuner = 1,
101 .decoder = EM28XX_SAA7113,
102 .input = {{
103 .type = EM28XX_VMUX_TELEVISION,
104 .vmux = SAA7115_COMPOSITE2,
105 .amux = 1,
107 .type = EM28XX_VMUX_COMPOSITE1,
108 .vmux = SAA7115_COMPOSITE0,
109 .amux = 1,
111 .type = EM28XX_VMUX_SVIDEO,
112 .vmux = SAA7115_SVIDEO3,
113 .amux = 1,
116 [EM2820_BOARD_PINNACLE_USB_2] = {
117 .name = "Pinnacle PCTV USB 2",
118 .vchannels = 3,
119 .norm = VIDEO_MODE_PAL,
120 .tuner_type = TUNER_LG_PAL_NEW_TAPC,
121 .tda9887_conf = TDA9887_PRESENT,
122 .has_tuner = 1,
123 .decoder = EM28XX_SAA7113,
124 .input = {{
125 .type = EM28XX_VMUX_TELEVISION,
126 .vmux = SAA7115_COMPOSITE2,
127 .amux = 0,
129 .type = EM28XX_VMUX_COMPOSITE1,
130 .vmux = SAA7115_COMPOSITE0,
131 .amux = 1,
133 .type = EM28XX_VMUX_SVIDEO,
134 .vmux = SAA7115_SVIDEO3,
135 .amux = 1,
138 [EM2820_BOARD_HAUPPAUGE_WINTV_USB_2] = {
139 .name = "Hauppauge WinTV USB 2",
140 .vchannels = 3,
141 .norm = VIDEO_MODE_NTSC,
142 .tuner_type = TUNER_PHILIPS_FM1236_MK3,
143 .tda9887_conf = TDA9887_PRESENT|TDA9887_PORT1_ACTIVE|TDA9887_PORT2_ACTIVE,
144 .has_tuner = 1,
145 .decoder = EM28XX_TVP5150,
146 .has_msp34xx = 1,
147 /*FIXME: S-Video not tested */
148 .input = {{
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",
161 .vchannels = 3,
162 .norm = VIDEO_MODE_PAL,
163 .tuner_type = TUNER_LG_PAL_NEW_TAPC,
164 .tda9887_conf = TDA9887_PRESENT|TDA9887_PORT1_ACTIVE|TDA9887_PORT2_ACTIVE,
165 .has_tuner = 1,
166 .decoder = EM28XX_SAA7114,
167 .input = {{
168 .type = EM28XX_VMUX_TELEVISION,
169 .vmux = SAA7115_COMPOSITE4,
170 .amux = 0,
172 .type = EM28XX_VMUX_COMPOSITE1,
173 .vmux = SAA7115_COMPOSITE0,
174 .amux = 1,
176 .type = EM28XX_VMUX_SVIDEO,
177 .vmux = SAA7115_SVIDEO3,
178 .amux = 1,
181 [EM2800_BOARD_TERRATEC_CINERGY_200] = {
182 .name = "Terratec Cinergy 200 USB",
183 .is_em2800 = 1,
184 .vchannels = 3,
185 .norm = VIDEO_MODE_PAL,
186 .tuner_type = TUNER_LG_PAL_NEW_TAPC,
187 .tda9887_conf = TDA9887_PRESENT,
188 .has_tuner = 1,
189 .decoder = EM28XX_SAA7113,
190 .input = {{
191 .type = EM28XX_VMUX_TELEVISION,
192 .vmux = SAA7115_COMPOSITE2,
193 .amux = 0,
195 .type = EM28XX_VMUX_COMPOSITE1,
196 .vmux = SAA7115_COMPOSITE0,
197 .amux = 1,
199 .type = EM28XX_VMUX_SVIDEO,
200 .vmux = SAA7115_SVIDEO3,
201 .amux = 1,
204 [EM2800_BOARD_LEADTEK_WINFAST_USBII] = {
205 .name = "Leadtek Winfast USB II",
206 .is_em2800 = 1,
207 .vchannels = 3,
208 .norm = VIDEO_MODE_PAL,
209 .tuner_type = TUNER_LG_PAL_NEW_TAPC,
210 .tda9887_conf = TDA9887_PRESENT,
211 .has_tuner = 1,
212 .decoder = EM28XX_SAA7113,
213 .input = {{
214 .type = EM28XX_VMUX_TELEVISION,
215 .vmux = SAA7115_COMPOSITE2,
216 .amux = 0,
218 .type = EM28XX_VMUX_COMPOSITE1,
219 .vmux = SAA7115_COMPOSITE0,
220 .amux = 1,
222 .type = EM28XX_VMUX_SVIDEO,
223 .vmux = SAA7115_SVIDEO3,
224 .amux = 1,
227 [EM2800_BOARD_KWORLD_USB2800] = {
228 .name = "Kworld USB2800",
229 .is_em2800 = 1,
230 .vchannels = 3,
231 .norm = VIDEO_MODE_PAL,
232 .tuner_type = TUNER_PHILIPS_ATSC,
233 .tda9887_conf = TDA9887_PRESENT,
234 .has_tuner = 1,
235 .decoder = EM28XX_SAA7113,
236 .input = {{
237 .type = EM28XX_VMUX_TELEVISION,
238 .vmux = SAA7115_COMPOSITE2,
239 .amux = 0,
241 .type = EM28XX_VMUX_COMPOSITE1,
242 .vmux = SAA7115_COMPOSITE0,
243 .amux = 1,
245 .type = EM28XX_VMUX_SVIDEO,
246 .vmux = SAA7115_SVIDEO3,
247 .amux = 1,
250 [EM2820_BOARD_PINNACLE_DVC_90] = {
251 .name = "Pinnacle Dazzle DVC 90",
252 .vchannels = 3,
253 .norm = VIDEO_MODE_PAL,
254 .has_tuner = 0,
255 .decoder = EM28XX_SAA7113,
256 .input = {{
257 .type = EM28XX_VMUX_COMPOSITE1,
258 .vmux = SAA7115_COMPOSITE0,
259 .amux = 1,
261 .type = EM28XX_VMUX_SVIDEO,
262 .vmux = SAA7115_SVIDEO3,
263 .amux = 1,
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 },
277 { },
280 void em28xx_pre_card_setup(struct em28xx *dev)
282 /* request some modules */
283 switch(dev->model){
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?
289 break;
294 void em28xx_card_setup(struct em28xx *dev)
296 /* request some modules */
297 switch(dev->model){
298 case EM2820_BOARD_HAUPPAUGE_WINTV_USB_2:
300 struct tveeprom tv;
301 #ifdef CONFIG_MODULES
302 request_module("tveeprom");
303 request_module("ir-kbd-i2c");
304 request_module("msp3400");
305 #endif
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;
314 dev->has_msp34xx=1;
315 } else
316 dev->has_msp34xx=0;
317 break;
319 case EM2820_BOARD_KWORLD_PVRTV2800RF:
321 em28xx_write_regs_req(dev,0x00,0x08, "\xf9", 1); // GPIO enables sound on KWORLD PVR TV 2800RF
322 break;
328 MODULE_DEVICE_TABLE (usb, em28xx_id_table);