V4L/DVB (3711): Add support for VIDIOC_INT_S_CRYSTAL_FREQ internal command.
[deliverable/linux.git] / drivers / media / video / em28xx / em28xx-cards.c
CommitLineData
a6c2ba28 1/*
f7abcd38 2 em28xx-cards.c - driver for Empia EM2800/EM2820/2840 USB video capture devices
a6c2ba28 3
f7abcd38
MCC
4 Copyright (C) 2005 Ludovico Cavedon <cavedon@sssup.it>
5 Markus Rechberger <mrechberger@gmail.com>
4ac97914 6 Mauro Carvalho Chehab <mchehab@brturbo.com.br>
f7abcd38 7 Sascha Sommer <saschasommer@freenet.de>
a6c2ba28 8
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.
13
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.
18
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.
22 */
23
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>
2474ed44 31#include <media/msp3400.h>
1f6173ed 32#include <media/tveeprom.h>
2474ed44 33#include <media/audiochip.h>
9bb13a6d 34#include <media/v4l2-common.h>
a6c2ba28 35
f7abcd38 36#include "em28xx.h"
a6c2ba28 37
3acf2809 38struct em28xx_board em28xx_boards[] = {
596d92d5
MCC
39 [EM2800_BOARD_UNKNOWN] = {
40 .name = "Unknown EM2800 video grabber",
41 .is_em2800 = 1,
42 .vchannels = 2,
43 .norm = VIDEO_MODE_PAL,
44 .tda9887_conf = TDA9887_PRESENT,
45 .has_tuner = 1,
3acf2809 46 .decoder = EM28XX_SAA7113,
596d92d5 47 .input = {{
3acf2809 48 .type = EM28XX_VMUX_COMPOSITE1,
596d92d5
MCC
49 .vmux = 0,
50 .amux = 1,
51 },{
3acf2809 52 .type = EM28XX_VMUX_SVIDEO,
596d92d5
MCC
53 .vmux = 9,
54 .amux = 1,
55 }},
56 },
57 [EM2820_BOARD_UNKNOWN] = {
58 .name = "Unknown EM2820/2840 video grabber",
59 .is_em2800 = 0,
60 .vchannels = 2,
61 .norm = VIDEO_MODE_PAL,
62 .tda9887_conf = TDA9887_PRESENT,
63 .has_tuner = 1,
3acf2809 64 .decoder = EM28XX_SAA7113,
596d92d5 65 .input = {{
3acf2809 66 .type = EM28XX_VMUX_COMPOSITE1,
596d92d5
MCC
67 .vmux = 0,
68 .amux = 1,
69 },{
3acf2809 70 .type = EM28XX_VMUX_SVIDEO,
596d92d5
MCC
71 .vmux = 9,
72 .amux = 1,
73 }},
74 },
4d17d083 75 [EM2820_BOARD_KWORLD_PVRTV2800RF] = {
33ccaa3f 76 .name = "Kworld PVR TV 2800 RF",
4d17d083
MR
77 .is_em2800 = 0,
78 .vchannels = 2,
79 .norm = VIDEO_MODE_PAL,
80 .tda9887_conf = TDA9887_PRESENT,
81 .has_tuner = 1,
82 .decoder = EM28XX_SAA7113,
83 .input = {{
84 .type = EM28XX_VMUX_COMPOSITE1,
85 .vmux = 0,
86 .amux = 1,
87 },{
88 .type = EM28XX_VMUX_SVIDEO,
89 .vmux = 9,
90 .amux = 1,
91 }},
92 },
a6c2ba28 93 [EM2820_BOARD_TERRATEC_CINERGY_250] = {
94 .name = "Terratec Cinergy 250 USB",
95 .vchannels = 3,
96 .norm = VIDEO_MODE_PAL,
97 .tuner_type = TUNER_LG_PAL_NEW_TAPC,
98 .tda9887_conf = TDA9887_PRESENT,
99 .has_tuner = 1,
3acf2809 100 .decoder = EM28XX_SAA7113,
a6c2ba28 101 .input = {{
3acf2809 102 .type = EM28XX_VMUX_TELEVISION,
a6c2ba28 103 .vmux = 2,
9475fb1c 104 .amux = 1,
a6c2ba28 105 },{
3acf2809 106 .type = EM28XX_VMUX_COMPOSITE1,
a6c2ba28 107 .vmux = 0,
108 .amux = 1,
109 },{
3acf2809 110 .type = EM28XX_VMUX_SVIDEO,
a6c2ba28 111 .vmux = 9,
112 .amux = 1,
113 }},
114 },
115 [EM2820_BOARD_PINNACLE_USB_2] = {
116 .name = "Pinnacle PCTV USB 2",
117 .vchannels = 3,
118 .norm = VIDEO_MODE_PAL,
119 .tuner_type = TUNER_LG_PAL_NEW_TAPC,
120 .tda9887_conf = TDA9887_PRESENT,
121 .has_tuner = 1,
3acf2809 122 .decoder = EM28XX_SAA7113,
a6c2ba28 123 .input = {{
3acf2809 124 .type = EM28XX_VMUX_TELEVISION,
a6c2ba28 125 .vmux = 2,
126 .amux = 0,
127 },{
3acf2809 128 .type = EM28XX_VMUX_COMPOSITE1,
a6c2ba28 129 .vmux = 0,
130 .amux = 1,
131 },{
3acf2809 132 .type = EM28XX_VMUX_SVIDEO,
a6c2ba28 133 .vmux = 9,
134 .amux = 1,
135 }},
136 },
137 [EM2820_BOARD_HAUPPAUGE_WINTV_USB_2] = {
138 .name = "Hauppauge WinTV USB 2",
139 .vchannels = 3,
140 .norm = VIDEO_MODE_NTSC,
141 .tuner_type = TUNER_PHILIPS_FM1236_MK3,
142 .tda9887_conf = TDA9887_PRESENT|TDA9887_PORT1_ACTIVE|TDA9887_PORT2_ACTIVE,
143 .has_tuner = 1,
3acf2809 144 .decoder = EM28XX_TVP5150,
a6c2ba28 145 .has_msp34xx = 1,
146 /*FIXME: S-Video not tested */
147 .input = {{
3acf2809 148 .type = EM28XX_VMUX_TELEVISION,
a6c2ba28 149 .vmux = 0,
2474ed44 150 .amux = MSP_INPUT_DEFAULT,
a6c2ba28 151 },{
3acf2809 152 .type = EM28XX_VMUX_SVIDEO,
a6c2ba28 153 .vmux = 2,
07151724
HV
154 .amux = MSP_INPUT(MSP_IN_SCART1, MSP_IN_TUNER1,
155 MSP_DSP_IN_SCART, MSP_DSP_IN_SCART),
a6c2ba28 156 }},
157 },
158 [EM2820_BOARD_MSI_VOX_USB_2] = {
159 .name = "MSI VOX USB 2.0",
160 .vchannels = 3,
161 .norm = VIDEO_MODE_PAL,
08eca13d 162 .tuner_type = TUNER_LG_PAL_NEW_TAPC,
a6c2ba28 163 .tda9887_conf = TDA9887_PRESENT|TDA9887_PORT1_ACTIVE|TDA9887_PORT2_ACTIVE,
164 .has_tuner = 1,
3acf2809 165 .decoder = EM28XX_SAA7114,
a6c2ba28 166 .input = {{
3acf2809 167 .type = EM28XX_VMUX_TELEVISION,
30556b23 168 .vmux = 4,
a6c2ba28 169 .amux = 0,
170 },{
3acf2809 171 .type = EM28XX_VMUX_COMPOSITE1,
a6c2ba28 172 .vmux = 0,
173 .amux = 1,
174 },{
3acf2809 175 .type = EM28XX_VMUX_SVIDEO,
a6c2ba28 176 .vmux = 9,
177 .amux = 1,
178 }},
179 },
596d92d5
MCC
180 [EM2800_BOARD_TERRATEC_CINERGY_200] = {
181 .name = "Terratec Cinergy 200 USB",
596d92d5
MCC
182 .is_em2800 = 1,
183 .vchannels = 3,
184 .norm = VIDEO_MODE_PAL,
185 .tuner_type = TUNER_LG_PAL_NEW_TAPC,
186 .tda9887_conf = TDA9887_PRESENT,
187 .has_tuner = 1,
3acf2809 188 .decoder = EM28XX_SAA7113,
596d92d5 189 .input = {{
3acf2809 190 .type = EM28XX_VMUX_TELEVISION,
596d92d5
MCC
191 .vmux = 2,
192 .amux = 0,
193 },{
3acf2809 194 .type = EM28XX_VMUX_COMPOSITE1,
596d92d5
MCC
195 .vmux = 0,
196 .amux = 1,
197 },{
3acf2809 198 .type = EM28XX_VMUX_SVIDEO,
596d92d5
MCC
199 .vmux = 9,
200 .amux = 1,
201 }},
202 },
203 [EM2800_BOARD_LEADTEK_WINFAST_USBII] = {
204 .name = "Leadtek Winfast USB II",
596d92d5
MCC
205 .is_em2800 = 1,
206 .vchannels = 3,
207 .norm = VIDEO_MODE_PAL,
208 .tuner_type = TUNER_LG_PAL_NEW_TAPC,
209 .tda9887_conf = TDA9887_PRESENT,
210 .has_tuner = 1,
3acf2809 211 .decoder = EM28XX_SAA7113,
596d92d5 212 .input = {{
3acf2809 213 .type = EM28XX_VMUX_TELEVISION,
596d92d5
MCC
214 .vmux = 2,
215 .amux = 0,
216 },{
3acf2809 217 .type = EM28XX_VMUX_COMPOSITE1,
596d92d5
MCC
218 .vmux = 0,
219 .amux = 1,
220 },{
3acf2809 221 .type = EM28XX_VMUX_SVIDEO,
596d92d5
MCC
222 .vmux = 9,
223 .amux = 1,
224 }},
225 },
226 [EM2800_BOARD_KWORLD_USB2800] = {
227 .name = "Kworld USB2800",
596d92d5
MCC
228 .is_em2800 = 1,
229 .vchannels = 3,
230 .norm = VIDEO_MODE_PAL,
231 .tuner_type = TUNER_PHILIPS_ATSC,
232 .tda9887_conf = TDA9887_PRESENT,
233 .has_tuner = 1,
3acf2809 234 .decoder = EM28XX_SAA7113,
596d92d5 235 .input = {{
3acf2809 236 .type = EM28XX_VMUX_TELEVISION,
596d92d5
MCC
237 .vmux = 2,
238 .amux = 0,
239 },{
3acf2809 240 .type = EM28XX_VMUX_COMPOSITE1,
596d92d5
MCC
241 .vmux = 0,
242 .amux = 1,
243 },{
3acf2809 244 .type = EM28XX_VMUX_SVIDEO,
596d92d5
MCC
245 .vmux = 9,
246 .amux = 1,
247 }},
248 },
45632c4f
MCC
249 [EM2820_BOARD_PINNACLE_DVC_90] = {
250 .name = "Pinnacle Dazzle DVC 90",
251 .vchannels = 3,
252 .norm = VIDEO_MODE_PAL,
253 .has_tuner = 0,
3acf2809 254 .decoder = EM28XX_SAA7113,
45632c4f 255 .input = {{
3acf2809 256 .type = EM28XX_VMUX_COMPOSITE1,
45632c4f
MCC
257 .vmux = 0,
258 .amux = 1,
259 },{
3acf2809 260 .type = EM28XX_VMUX_SVIDEO,
45632c4f
MCC
261 .vmux = 9,
262 .amux = 1,
263 }},
264 },
a6c2ba28 265};
3acf2809 266const unsigned int em28xx_bcount = ARRAY_SIZE(em28xx_boards);
a6c2ba28 267
268/* table of devices that work with this driver */
3acf2809 269struct usb_device_id em28xx_id_table [] = {
596d92d5 270 { USB_DEVICE(0xeb1a, 0x2800), .driver_info = EM2800_BOARD_UNKNOWN },
08eca13d 271 { USB_DEVICE(0xeb1a, 0x2820), .driver_info = EM2820_BOARD_MSI_VOX_USB_2 },
a6c2ba28 272 { USB_DEVICE(0x0ccd, 0x0036), .driver_info = EM2820_BOARD_TERRATEC_CINERGY_250 },
273 { USB_DEVICE(0x2304, 0x0208), .driver_info = EM2820_BOARD_PINNACLE_USB_2 },
274 { USB_DEVICE(0x2040, 0x4200), .driver_info = EM2820_BOARD_HAUPPAUGE_WINTV_USB_2 },
45632c4f 275 { USB_DEVICE(0x2304, 0x0207), .driver_info = EM2820_BOARD_PINNACLE_DVC_90 },
a6c2ba28 276 { },
277};
278
a94e95b4
MR
279void em28xx_pre_card_setup(struct em28xx *dev)
280{
281 /* request some modules */
282 switch(dev->model){
282b7cb3 283 case EM2880_BOARD_TERRATEC_PRODIGY_XS:
4d17d083
MR
284 case EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900:
285 case EM2880_BOARD_TERRATEC_HYBRID_XS:
a94e95b4
MR
286 {
287 em28xx_write_regs_req(dev, 0x00, 0x08, "\x7d", 1); // reset through GPIO?
288 break;
289 }
290 }
291}
292
3acf2809 293void em28xx_card_setup(struct em28xx *dev)
a6c2ba28 294{
295 /* request some modules */
a94e95b4
MR
296 switch(dev->model){
297 case EM2820_BOARD_HAUPPAUGE_WINTV_USB_2:
298 {
299 struct tveeprom tv;
a6c2ba28 300#ifdef CONFIG_MODULES
a94e95b4
MR
301 request_module("tveeprom");
302 request_module("ir-kbd-i2c");
303 request_module("msp3400");
a6c2ba28 304#endif
a94e95b4 305 /* Call first TVeeprom */
a6c2ba28 306
a94e95b4
MR
307 dev->i2c_client.addr = 0xa0 >> 1;
308 tveeprom_hauppauge_analog(&dev->i2c_client, &tv, dev->eedata);
a6c2ba28 309
a94e95b4
MR
310 dev->tuner_type= tv.tuner_type;
311 if (tv.audio_processor == AUDIO_CHIP_MSP34XX) {
312 dev->i2s_speed=2048000;
313 dev->has_msp34xx=1;
314 } else
315 dev->has_msp34xx=0;
316 break;
317 }
4d17d083
MR
318 case EM2820_BOARD_KWORLD_PVRTV2800RF:
319 {
320 em28xx_write_regs_req(dev,0x00,0x08, "\xf9", 1); // GPIO enables sound on KWORLD PVR TV 2800RF
321 break;
322 }
323
a6c2ba28 324 }
325}
326
3acf2809
MCC
327EXPORT_SYMBOL(em28xx_boards);
328EXPORT_SYMBOL(em28xx_bcount);
329EXPORT_SYMBOL(em28xx_id_table);
a6c2ba28 330
3acf2809 331MODULE_DEVICE_TABLE (usb, em28xx_id_table);
This page took 0.117486 seconds and 5 git commands to generate.