blob: 81707bbb60dccd879f39005ef9c40d851b7e9511 [file] [log] [blame]
Hans Verkuil1a0adaf2007-04-27 12:31:25 -03001/*
2 Functions to query card hardware
3 Copyright (C) 2003-2004 Kevin Thayer <nufan_wfk at yahoo.com>
4 Copyright (C) 2005-2007 Hans Verkuil <hverkuil@xs4all.nl>
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20
Hans Verkuil612570f2007-08-23 05:42:59 -030021#ifndef IVTV_CARDS_H
22#define IVTV_CARDS_H
23
24/* Supported cards */
25#define IVTV_CARD_PVR_250 0 /* WinTV PVR 250 */
26#define IVTV_CARD_PVR_350 1 /* encoder, decoder, tv-out */
27#define IVTV_CARD_PVR_150 2 /* WinTV PVR 150 and PVR 500 (really just two
28 PVR150s on one PCI board) */
29#define IVTV_CARD_M179 3 /* AVerMedia M179 (encoder only) */
30#define IVTV_CARD_MPG600 4 /* Kuroutoshikou ITVC16-STVLP/YUAN MPG600, encoder only */
31#define IVTV_CARD_MPG160 5 /* Kuroutoshikou ITVC15-STVLP/YUAN MPG160
32 cx23415 based, but does not have tv-out */
33#define IVTV_CARD_PG600 6 /* YUAN PG600/DIAMONDMM PVR-550 based on the CX Falcon 2 */
34#define IVTV_CARD_AVC2410 7 /* Adaptec AVC-2410 */
35#define IVTV_CARD_AVC2010 8 /* Adaptec AVD-2010 (No Tuner) */
36#define IVTV_CARD_TG5000TV 9 /* NAGASE TRANSGEAR 5000TV, encoder only */
37#define IVTV_CARD_VA2000MAX_SNT6 10 /* VA2000MAX-STN6 */
38#define IVTV_CARD_CX23416GYC 11 /* Kuroutoshikou CX23416GYC-STVLP (Yuan MPG600GR OEM) */
39#define IVTV_CARD_GV_MVPRX 12 /* I/O Data GV-MVP/RX, RX2, RX2W */
40#define IVTV_CARD_GV_MVPRX2E 13 /* I/O Data GV-MVP/RX2E */
41#define IVTV_CARD_GOTVIEW_PCI_DVD 14 /* GotView PCI DVD */
42#define IVTV_CARD_GOTVIEW_PCI_DVD2 15 /* GotView PCI DVD2 */
43#define IVTV_CARD_YUAN_MPC622 16 /* Yuan MPC622 miniPCI */
44#define IVTV_CARD_DCTMTVP1 17 /* DIGITAL COWBOY DCT-MTVP1 */
45#define IVTV_CARD_PG600V2 18 /* Yuan PG600V2/GotView PCI DVD Lite */
46#define IVTV_CARD_CLUB3D 19 /* Club3D ZAP-TV1x01 */
47#define IVTV_CARD_AVERTV_MCE116 20 /* AVerTV MCE 116 Plus */
Hans Verkuile2a17742007-10-30 05:50:03 -030048#define IVTV_CARD_ASUS_FALCON2 21 /* ASUS Falcon2 */
49#define IVTV_CARD_LAST 21
Hans Verkuil612570f2007-08-23 05:42:59 -030050
51/* Variants of existing cards but with the same PCI IDs. The driver
52 detects these based on other device information.
53 These cards must always come last.
54 New cards must be inserted above, and the indices of the cards below
55 must be adjusted accordingly. */
56
57/* PVR-350 V1 (uses saa7114) */
58#define IVTV_CARD_PVR_350_V1 (IVTV_CARD_LAST+1)
59/* 2 variants of Kuroutoshikou CX23416GYC-STVLP (Yuan MPG600GR OEM) */
60#define IVTV_CARD_CX23416GYC_NOGR (IVTV_CARD_LAST+2)
61#define IVTV_CARD_CX23416GYC_NOGRYCS (IVTV_CARD_LAST+3)
62
63/* system vendor and device IDs */
64#define PCI_VENDOR_ID_ICOMP 0x4444
65#define PCI_DEVICE_ID_IVTV15 0x0803
66#define PCI_DEVICE_ID_IVTV16 0x0016
67
68/* subsystem vendor ID */
69#define IVTV_PCI_ID_HAUPPAUGE 0x0070
70#define IVTV_PCI_ID_HAUPPAUGE_ALT1 0x0270
71#define IVTV_PCI_ID_HAUPPAUGE_ALT2 0x4070
72#define IVTV_PCI_ID_ADAPTEC 0x9005
Hans Verkuile2a17742007-10-30 05:50:03 -030073#define IVTV_PCI_ID_ASUSTEK 0x1043
Hans Verkuil612570f2007-08-23 05:42:59 -030074#define IVTV_PCI_ID_AVERMEDIA 0x1461
75#define IVTV_PCI_ID_YUAN1 0x12ab
76#define IVTV_PCI_ID_YUAN2 0xff01
77#define IVTV_PCI_ID_YUAN3 0xffab
78#define IVTV_PCI_ID_YUAN4 0xfbab
79#define IVTV_PCI_ID_DIAMONDMM 0xff92
80#define IVTV_PCI_ID_IODATA 0x10fc
81#define IVTV_PCI_ID_MELCO 0x1154
82#define IVTV_PCI_ID_GOTVIEW1 0xffac
83#define IVTV_PCI_ID_GOTVIEW2 0xffad
84
Hans Verkuil1a0adaf2007-04-27 12:31:25 -030085/* hardware flags */
86#define IVTV_HW_CX25840 (1 << 0)
87#define IVTV_HW_SAA7115 (1 << 1)
88#define IVTV_HW_SAA7127 (1 << 2)
89#define IVTV_HW_MSP34XX (1 << 3)
90#define IVTV_HW_TUNER (1 << 4)
91#define IVTV_HW_WM8775 (1 << 5)
92#define IVTV_HW_CS53L32A (1 << 6)
93#define IVTV_HW_TVEEPROM (1 << 7)
94#define IVTV_HW_SAA7114 (1 << 8)
95#define IVTV_HW_TVAUDIO (1 << 9)
96#define IVTV_HW_UPD64031A (1 << 10)
97#define IVTV_HW_UPD6408X (1 << 11)
98#define IVTV_HW_SAA717X (1 << 12)
99#define IVTV_HW_WM8739 (1 << 13)
Hans Verkuilac247432007-07-27 06:56:50 -0300100#define IVTV_HW_VP27SMPX (1 << 14)
Hans Verkuile2a17742007-10-30 05:50:03 -0300101#define IVTV_HW_M52790 (1 << 15)
102#define IVTV_HW_GPIO (1 << 16)
Hans Verkuil1a0adaf2007-04-27 12:31:25 -0300103
104#define IVTV_HW_SAA711X (IVTV_HW_SAA7115 | IVTV_HW_SAA7114)
105
106/* video inputs */
107#define IVTV_CARD_INPUT_VID_TUNER 1
108#define IVTV_CARD_INPUT_SVIDEO1 2
109#define IVTV_CARD_INPUT_SVIDEO2 3
110#define IVTV_CARD_INPUT_COMPOSITE1 4
111#define IVTV_CARD_INPUT_COMPOSITE2 5
112#define IVTV_CARD_INPUT_COMPOSITE3 6
113
114/* audio inputs */
115#define IVTV_CARD_INPUT_AUD_TUNER 1
116#define IVTV_CARD_INPUT_LINE_IN1 2
117#define IVTV_CARD_INPUT_LINE_IN2 3
118
119#define IVTV_CARD_MAX_VIDEO_INPUTS 6
120#define IVTV_CARD_MAX_AUDIO_INPUTS 3
121#define IVTV_CARD_MAX_TUNERS 2
122
123/* SAA71XX HW inputs */
124#define IVTV_SAA71XX_COMPOSITE0 0
125#define IVTV_SAA71XX_COMPOSITE1 1
126#define IVTV_SAA71XX_COMPOSITE2 2
127#define IVTV_SAA71XX_COMPOSITE3 3
128#define IVTV_SAA71XX_COMPOSITE4 4
129#define IVTV_SAA71XX_COMPOSITE5 5
130#define IVTV_SAA71XX_SVIDEO0 6
131#define IVTV_SAA71XX_SVIDEO1 7
132#define IVTV_SAA71XX_SVIDEO2 8
133#define IVTV_SAA71XX_SVIDEO3 9
134
135/* SAA717X needs to mark the tuner input by ORing with this flag */
136#define IVTV_SAA717X_TUNER_FLAG 0x80
137
138/* Dummy HW input */
139#define IVTV_DUMMY_AUDIO 0
140
141/* GPIO HW inputs */
142#define IVTV_GPIO_TUNER 0
143#define IVTV_GPIO_LINE_IN 1
144
145/* SAA717X HW inputs */
146#define IVTV_SAA717X_IN0 0
147#define IVTV_SAA717X_IN1 1
148#define IVTV_SAA717X_IN2 2
149
150/* V4L2 capability aliases */
151#define IVTV_CAP_ENCODER (V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_TUNER | \
152 V4L2_CAP_AUDIO | V4L2_CAP_READWRITE | V4L2_CAP_VBI_CAPTURE | \
153 V4L2_CAP_SLICED_VBI_CAPTURE)
154#define IVTV_CAP_DECODER (V4L2_CAP_VBI_OUTPUT | V4L2_CAP_VIDEO_OUTPUT | \
Hans Verkuil1f137602007-05-29 08:18:37 -0300155 V4L2_CAP_SLICED_VBI_OUTPUT | V4L2_CAP_VIDEO_OUTPUT_OVERLAY)
Hans Verkuil1a0adaf2007-04-27 12:31:25 -0300156
157struct ivtv_card_video_input {
158 u8 video_type; /* video input type */
159 u8 audio_index; /* index in ivtv_card_audio_input array */
160 u16 video_input; /* hardware video input */
161};
162
163struct ivtv_card_audio_input {
164 u8 audio_type; /* audio input type */
165 u32 audio_input; /* hardware audio input */
166 u16 muxer_input; /* hardware muxer input for boards with a
167 multiplexer chip */
168};
169
170struct ivtv_card_output {
171 u8 name[32];
172 u16 video_output; /* hardware video output */
173};
174
175struct ivtv_card_pci_info {
176 u16 device;
177 u16 subsystem_vendor;
178 u16 subsystem_device;
179};
180
181/* GPIO definitions */
182
183/* The mask is the set of bits used by the operation */
184
185struct ivtv_gpio_init { /* set initial GPIO DIR and OUT values */
186 u16 direction; /* DIR setting. Leave to 0 if no init is needed */
187 u16 initial_value;
188};
189
190struct ivtv_gpio_video_input { /* select tuner/line in input */
191 u16 mask; /* leave to 0 if not supported */
192 u16 tuner;
193 u16 composite;
194 u16 svideo;
195};
196
197struct ivtv_gpio_audio_input { /* select tuner/line in input */
198 u16 mask; /* leave to 0 if not supported */
199 u16 tuner;
200 u16 linein;
201 u16 radio;
202};
203
204struct ivtv_gpio_audio_mute {
205 u16 mask; /* leave to 0 if not supported */
206 u16 mute; /* set this value to mute, 0 to unmute */
207};
208
209struct ivtv_gpio_audio_mode {
210 u16 mask; /* leave to 0 if not supported */
211 u16 mono; /* set audio to mono */
212 u16 stereo; /* set audio to stereo */
213 u16 lang1; /* set audio to the first language */
214 u16 lang2; /* set audio to the second language */
215 u16 both; /* both languages are output */
216};
217
218struct ivtv_gpio_audio_freq {
219 u16 mask; /* leave to 0 if not supported */
220 u16 f32000;
221 u16 f44100;
222 u16 f48000;
223};
224
225struct ivtv_gpio_audio_detect {
226 u16 mask; /* leave to 0 if not supported */
227 u16 stereo; /* if the input matches this value then
228 stereo is detected */
229};
230
231struct ivtv_card_tuner {
232 v4l2_std_id std; /* standard for which the tuner is suitable */
233 int tuner; /* tuner ID (from tuner.h) */
234};
235
236/* for card information/parameters */
237struct ivtv_card {
238 int type;
239 char *name;
240 u32 v4l2_capabilities;
241 u32 hw_video; /* hardware used to process video */
242 u32 hw_audio; /* hardware used to process audio */
243 u32 hw_audio_ctrl; /* hardware used for the V4L2 controls (only 1 dev allowed) */
244 u32 hw_muxer; /* hardware used to multiplex audio input */
245 u32 hw_all; /* all hardware used by the board */
246 struct ivtv_card_video_input video_inputs[IVTV_CARD_MAX_VIDEO_INPUTS];
247 struct ivtv_card_audio_input audio_inputs[IVTV_CARD_MAX_AUDIO_INPUTS];
248 struct ivtv_card_audio_input radio_input;
249 int nof_outputs;
250 const struct ivtv_card_output *video_outputs;
251 u8 gr_config; /* config byte for the ghost reduction device */
252
253 /* GPIO card-specific settings */
254 struct ivtv_gpio_init gpio_init;
255 struct ivtv_gpio_video_input gpio_video_input;
256 struct ivtv_gpio_audio_input gpio_audio_input;
257 struct ivtv_gpio_audio_mute gpio_audio_mute;
258 struct ivtv_gpio_audio_mode gpio_audio_mode;
259 struct ivtv_gpio_audio_freq gpio_audio_freq;
260 struct ivtv_gpio_audio_detect gpio_audio_detect;
261
262 struct ivtv_card_tuner tuners[IVTV_CARD_MAX_TUNERS];
263
264 /* list of device and subsystem vendor/devices that
265 correspond to this card type. */
266 const struct ivtv_card_pci_info *pci_list;
267};
268
269int ivtv_get_input(struct ivtv *itv, u16 index, struct v4l2_input *input);
270int ivtv_get_output(struct ivtv *itv, u16 index, struct v4l2_output *output);
271int ivtv_get_audio_input(struct ivtv *itv, u16 index, struct v4l2_audio *input);
272int ivtv_get_audio_output(struct ivtv *itv, u16 index, struct v4l2_audioout *output);
273const struct ivtv_card *ivtv_get_card(u16 index);
Hans Verkuil612570f2007-08-23 05:42:59 -0300274
275#endif