blob: b6d89decfbd87a338ec99b27fb8311ef48936e51 [file] [log] [blame]
akpm@osdl.orga6c2ba22005-11-08 21:37:07 -08001/*
2 em2820-cards.c - driver for Empia EM2820/2840 USB video capture devices
3
4 Copyright (C) 2005 Markus Rechberger <mrechberger@gmail.com>
5 Ludovico Cavedon <cavedon@sssup.it>
6 Mauro Carvalho Chehab <mchehab@brturbo.com.br>
7
8 Based on the em2800 driver from Sascha Sommer <saschasommer@freenet.de>
9
10 This program is free software; you can redistribute it and/or modify
11 it under the terms of the GNU General Public License as published by
12 the Free Software Foundation; either version 2 of the License, or
13 (at your option) any later version.
14
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details.
19
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 */
24
25#include <linux/init.h>
26#include <linux/module.h>
27#include <linux/pci.h>
28#include <linux/delay.h>
29#include <linux/i2c.h>
30#include <linux/usb.h>
31#include <media/tuner.h>
32#include "audiochip.h"
33#include "tveeprom.h"
34#include "msp3400.h"
35
36#include "em2820.h"
37
38enum em2820_board_entry {
39 EM2820_BOARD_TERRATEC_CINERGY_250,
40 EM2820_BOARD_PINNACLE_USB_2,
41 EM2820_BOARD_HAUPPAUGE_WINTV_USB_2,
42 EM2820_BOARD_MSI_VOX_USB_2
43};
44
45struct em2820_board em2820_boards[] = {
46 [EM2820_BOARD_TERRATEC_CINERGY_250] = {
47 .name = "Terratec Cinergy 250 USB",
48 .vchannels = 3,
49 .norm = VIDEO_MODE_PAL,
50 .tuner_type = TUNER_LG_PAL_NEW_TAPC,
51 .tda9887_conf = TDA9887_PRESENT,
52 .has_tuner = 1,
53 .decoder = EM2820_SAA7113,
54 .input = {{
55 .type = EM2820_VMUX_TELEVISION,
56 .vmux = 2,
57 .amux = 0,
58 },{
59 .type = EM2820_VMUX_COMPOSITE1,
60 .vmux = 0,
61 .amux = 1,
62 },{
63 .type = EM2820_VMUX_SVIDEO,
64 .vmux = 9,
65 .amux = 1,
66 }},
67 },
68 [EM2820_BOARD_PINNACLE_USB_2] = {
69 .name = "Pinnacle PCTV USB 2",
70 .vchannels = 3,
71 .norm = VIDEO_MODE_PAL,
72 .tuner_type = TUNER_LG_PAL_NEW_TAPC,
73 .tda9887_conf = TDA9887_PRESENT,
74 .has_tuner = 1,
75 .decoder = EM2820_SAA7113,
76 .input = {{
77 .type = EM2820_VMUX_TELEVISION,
78 .vmux = 2,
79 .amux = 0,
80 },{
81 .type = EM2820_VMUX_COMPOSITE1,
82 .vmux = 0,
83 .amux = 1,
84 },{
85 .type = EM2820_VMUX_SVIDEO,
86 .vmux = 9,
87 .amux = 1,
88 }},
89 },
90 [EM2820_BOARD_HAUPPAUGE_WINTV_USB_2] = {
91 .name = "Hauppauge WinTV USB 2",
92 .vchannels = 3,
93 .norm = VIDEO_MODE_NTSC,
94 .tuner_type = TUNER_PHILIPS_FM1236_MK3,
95 .tda9887_conf = TDA9887_PRESENT|TDA9887_PORT1_ACTIVE|TDA9887_PORT2_ACTIVE,
96 .has_tuner = 1,
97 .decoder = EM2820_TVP5150,
98 .has_msp34xx = 1,
99 /*FIXME: S-Video not tested */
100 .input = {{
101 .type = EM2820_VMUX_TELEVISION,
102 .vmux = 0,
103 .amux = 0,
104 },{
105 .type = EM2820_VMUX_SVIDEO,
106 .vmux = 2,
107 .amux = 1,
108 }},
109 },
110 [EM2820_BOARD_MSI_VOX_USB_2] = {
111 .name = "MSI VOX USB 2.0",
112 .vchannels = 3,
113 .norm = VIDEO_MODE_PAL,
114 .tuner_type = TUNER_PHILIPS_PAL,
115 .tda9887_conf = TDA9887_PRESENT|TDA9887_PORT1_ACTIVE|TDA9887_PORT2_ACTIVE,
116 .has_tuner = 1,
117 .decoder = EM2820_SAA7114,
118 .input = {{
119 .type = EM2820_VMUX_TELEVISION,
120 .vmux = 2,
121 .amux = 0,
122 },{
123 .type = EM2820_VMUX_COMPOSITE1,
124 .vmux = 0,
125 .amux = 1,
126 },{
127 .type = EM2820_VMUX_SVIDEO,
128 .vmux = 9,
129 .amux = 1,
130 }},
131 },
132 { } /* Terminating entry */
133};
134
135/* table of devices that work with this driver */
136struct usb_device_id em2820_id_table [] = {
137 /* Terratec Cinerhy 200 USB: em2800 nor supported, at the moment */
138 /* { USB_DEVICE(0xeb1a, 0x2800), .driver_info = EM2800_BOARD_TERRATEC_CINERGY_200 }, */
139 { USB_DEVICE(0x0ccd, 0x0036), .driver_info = EM2820_BOARD_TERRATEC_CINERGY_250 },
140 { USB_DEVICE(0x2304, 0x0208), .driver_info = EM2820_BOARD_PINNACLE_USB_2 },
141 { USB_DEVICE(0x2040, 0x4200), .driver_info = EM2820_BOARD_HAUPPAUGE_WINTV_USB_2 },
142 { USB_DEVICE(0xeb1a, 0x2820), .driver_info = EM2820_BOARD_MSI_VOX_USB_2 },
143 { },
144};
145
146void em2820_card_setup(struct em2820 *dev)
147{
148 /* request some modules */
149 if (dev->model == EM2820_BOARD_HAUPPAUGE_WINTV_USB_2) {
150 struct tveeprom tv;
151#ifdef CONFIG_MODULES
152 request_module("tveeprom");
153#endif
154 /* Call first TVeeprom */
155
156 tveeprom_hauppauge_analog(&dev->i2c_client, &tv, dev->eedata);
157
158 dev->tuner_type= tv.tuner_type;
159 if (tv.audio_processor == AUDIO_CHIP_MSP34XX) {
160 dev->has_msp34xx=1;
161 } else dev->has_msp34xx=0;
162 }
163}
164
165EXPORT_SYMBOL(em2820_boards);
166EXPORT_SYMBOL(em2820_id_table);
167
168MODULE_DEVICE_TABLE (usb, em2820_id_table);