2 * cx18 functions to query card hardware
4 * Derived from ivtv-cards.c
6 * Copyright (C) 2007 Hans Verkuil <hverkuil@xs4all.nl>
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
24 #include "cx18-driver.h"
25 #include "cx18-cards.h"
26 #include "cx18-av-core.h"
28 #include <media/cs5345.h>
30 /********************** card configuration *******************************/
32 /* usual i2c tuner addresses to probe */
33 static struct cx18_card_tuner_i2c cx18_i2c_std = {
34 .radio = { I2C_CLIENT_END },
35 .demod = { 0x43, I2C_CLIENT_END },
36 .tv = { 0x61, 0x60, I2C_CLIENT_END },
39 /* Please add new PCI IDs to: http://pci-ids.ucw.cz/iii
40 This keeps the PCI ID database up to date. Note that the entries
41 must be added under vendor 0x4444 (Conexant) as subsystem IDs.
42 New vendor IDs should still be added to the vendor ID list. */
44 /* Hauppauge HVR-1600 cards */
46 /* Note: for Hauppauge cards the tveeprom information is used instead
48 static const struct cx18_card cx18_card_hvr1600_esmt = {
49 .type = CX18_CARD_HVR_1600_ESMT,
50 .name = "Hauppauge HVR-1600",
51 .comment = "VBI is not yet supported\n",
52 .v4l2_capabilities = CX18_CAP_ENCODER,
53 .hw_audio_ctrl = CX18_HW_CX23418,
54 .hw_muxer = CX18_HW_CS5345,
55 .hw_all = CX18_HW_TVEEPROM | CX18_HW_TUNER |
56 CX18_HW_CS5345 | CX18_HW_DVB,
58 { CX18_CARD_INPUT_VID_TUNER, 0, CX18_AV_COMPOSITE7 },
59 { CX18_CARD_INPUT_SVIDEO1, 1, CX18_AV_SVIDEO1 },
60 { CX18_CARD_INPUT_COMPOSITE1, 1, CX18_AV_COMPOSITE3 },
61 { CX18_CARD_INPUT_SVIDEO2, 2, CX18_AV_SVIDEO2 },
62 { CX18_CARD_INPUT_COMPOSITE2, 2, CX18_AV_COMPOSITE4 },
65 { CX18_CARD_INPUT_AUD_TUNER,
66 CX18_AV_AUDIO8, CS5345_IN_1 | CS5345_MCLK_1_5 },
67 { CX18_CARD_INPUT_LINE_IN1,
68 CX18_AV_AUDIO_SERIAL, CS5345_IN_2 },
69 { CX18_CARD_INPUT_LINE_IN2,
70 CX18_AV_AUDIO_SERIAL, CS5345_IN_3 },
72 .radio_input = { CX18_CARD_INPUT_AUD_TUNER,
73 CX18_AV_AUDIO_SERIAL, CS5345_IN_4 },
75 /* ESMT M13S128324A-5B memory */
78 .timing1 = 0x44220e82,
83 .gpio_init.initial_value = 0x3001,
84 .gpio_init.direction = 0x3001,
85 .gpio_i2c_slave_reset = {
86 .active_lo_mask = 0x3001,
93 static const struct cx18_card cx18_card_hvr1600_samsung = {
94 .type = CX18_CARD_HVR_1600_SAMSUNG,
95 .name = "Hauppauge HVR-1600 (Preproduction)",
96 .comment = "VBI is not yet supported\n",
97 .v4l2_capabilities = CX18_CAP_ENCODER,
98 .hw_audio_ctrl = CX18_HW_CX23418,
99 .hw_muxer = CX18_HW_CS5345,
100 .hw_all = CX18_HW_TVEEPROM | CX18_HW_TUNER |
101 CX18_HW_CS5345 | CX18_HW_DVB,
103 { CX18_CARD_INPUT_VID_TUNER, 0, CX18_AV_COMPOSITE7 },
104 { CX18_CARD_INPUT_SVIDEO1, 1, CX18_AV_SVIDEO1 },
105 { CX18_CARD_INPUT_COMPOSITE1, 1, CX18_AV_COMPOSITE3 },
106 { CX18_CARD_INPUT_SVIDEO2, 2, CX18_AV_SVIDEO2 },
107 { CX18_CARD_INPUT_COMPOSITE2, 2, CX18_AV_COMPOSITE4 },
110 { CX18_CARD_INPUT_AUD_TUNER,
111 CX18_AV_AUDIO8, CS5345_IN_1 | CS5345_MCLK_1_5 },
112 { CX18_CARD_INPUT_LINE_IN1,
113 CX18_AV_AUDIO_SERIAL, CS5345_IN_2 },
114 { CX18_CARD_INPUT_LINE_IN2,
115 CX18_AV_AUDIO_SERIAL, CS5345_IN_3 },
117 .radio_input = { CX18_CARD_INPUT_AUD_TUNER,
118 CX18_AV_AUDIO_SERIAL, CS5345_IN_4 },
120 /* Samsung K4D263238G-VC33 memory */
121 .chip_config = 0x003,
123 .timing1 = 0x23230b73,
128 .gpio_init.initial_value = 0x3001,
129 .gpio_init.direction = 0x3001,
130 .gpio_i2c_slave_reset = {
131 .active_lo_mask = 0x3001,
132 .msecs_asserted = 10,
133 .msecs_recovery = 40,
135 .i2c = &cx18_i2c_std,
138 /* ------------------------------------------------------------------------- */
140 /* Compro VideoMate H900: note that this card is analog only! */
142 static const struct cx18_card_pci_info cx18_pci_h900[] = {
143 { PCI_DEVICE_ID_CX23418, CX18_PCI_ID_COMPRO, 0xe100 },
147 static const struct cx18_card cx18_card_h900 = {
148 .type = CX18_CARD_COMPRO_H900,
149 .name = "Compro VideoMate H900",
150 .comment = "VBI is not yet supported\n",
151 .v4l2_capabilities = CX18_CAP_ENCODER,
152 .hw_audio_ctrl = CX18_HW_CX23418,
153 .hw_all = CX18_HW_TUNER,
155 { CX18_CARD_INPUT_VID_TUNER, 0, CX18_AV_COMPOSITE2 },
156 { CX18_CARD_INPUT_SVIDEO1, 1,
157 CX18_AV_SVIDEO_LUMA3 | CX18_AV_SVIDEO_CHROMA4 },
158 { CX18_CARD_INPUT_COMPOSITE1, 1, CX18_AV_COMPOSITE1 },
161 { CX18_CARD_INPUT_AUD_TUNER,
163 { CX18_CARD_INPUT_LINE_IN1,
164 CX18_AV_AUDIO_SERIAL, 0 },
166 .radio_input = { CX18_CARD_INPUT_AUD_TUNER,
167 CX18_AV_AUDIO_SERIAL, 0 },
169 { .std = V4L2_STD_ALL, .tuner = TUNER_XC2028 },
172 /* EtronTech EM6A9160TS-5G memory */
173 .chip_config = 0x50003,
175 .timing1 = 0x24330e84,
181 .pci_list = cx18_pci_h900,
182 .i2c = &cx18_i2c_std,
185 /* ------------------------------------------------------------------------- */
187 /* Yuan MPC718: not working at the moment! */
189 static const struct cx18_card_pci_info cx18_pci_mpc718[] = {
190 { PCI_DEVICE_ID_CX23418, CX18_PCI_ID_YUAN, 0x0718 },
194 static const struct cx18_card cx18_card_mpc718 = {
195 .type = CX18_CARD_YUAN_MPC718,
196 .name = "Yuan MPC718",
197 .comment = "Some Composite and S-Video inputs are currently working.\n",
198 .v4l2_capabilities = CX18_CAP_ENCODER,
199 .hw_audio_ctrl = CX18_HW_CX23418,
200 .hw_all = CX18_HW_TUNER,
202 { CX18_CARD_INPUT_VID_TUNER, 0, CX18_AV_COMPOSITE2 },
203 { CX18_CARD_INPUT_SVIDEO1, 1,
204 CX18_AV_SVIDEO_LUMA3 | CX18_AV_SVIDEO_CHROMA4 },
205 { CX18_CARD_INPUT_COMPOSITE1, 1, CX18_AV_COMPOSITE1 },
206 { CX18_CARD_INPUT_SVIDEO2, 2,
207 CX18_AV_SVIDEO_LUMA7 | CX18_AV_SVIDEO_CHROMA8 },
208 { CX18_CARD_INPUT_COMPOSITE2, 2, CX18_AV_COMPOSITE6 },
209 { CX18_CARD_INPUT_COMPOSITE3, 2, CX18_AV_COMPOSITE3 },
212 { CX18_CARD_INPUT_AUD_TUNER, CX18_AV_AUDIO5, 0 },
213 { CX18_CARD_INPUT_LINE_IN1, CX18_AV_AUDIO_SERIAL, 0 },
214 { CX18_CARD_INPUT_LINE_IN2, CX18_AV_AUDIO_SERIAL, 0 },
216 .radio_input = { CX18_CARD_INPUT_AUD_TUNER, CX18_AV_AUDIO_SERIAL, 0 },
219 { .std = V4L2_STD_ALL, .tuner = TUNER_XC2028 },
222 /* Probably Samsung K4D263238G-VC33 memory */
223 .chip_config = 0x003,
225 .timing1 = 0x23230b73,
231 .pci_list = cx18_pci_mpc718,
232 .i2c = &cx18_i2c_std,
235 static const struct cx18_card *cx18_card_list[] = {
236 &cx18_card_hvr1600_esmt,
237 &cx18_card_hvr1600_samsung,
242 const struct cx18_card *cx18_get_card(u16 index)
244 if (index >= ARRAY_SIZE(cx18_card_list))
246 return cx18_card_list[index];
249 int cx18_get_input(struct cx18 *cx, u16 index, struct v4l2_input *input)
251 const struct cx18_card_video_input *card_input =
252 cx->card->video_inputs + index;
253 static const char * const input_strs[] = {
262 memset(input, 0, sizeof(*input));
263 if (index >= cx->nof_inputs)
265 input->index = index;
266 strlcpy(input->name, input_strs[card_input->video_type - 1],
267 sizeof(input->name));
268 input->type = (card_input->video_type == CX18_CARD_INPUT_VID_TUNER ?
269 V4L2_INPUT_TYPE_TUNER : V4L2_INPUT_TYPE_CAMERA);
270 input->audioset = (1 << cx->nof_audio_inputs) - 1;
271 input->std = (input->type == V4L2_INPUT_TYPE_TUNER) ?
272 cx->tuner_std : V4L2_STD_ALL;
276 int cx18_get_audio_input(struct cx18 *cx, u16 index, struct v4l2_audio *audio)
278 const struct cx18_card_audio_input *aud_input =
279 cx->card->audio_inputs + index;
280 static const char * const input_strs[] = {
286 memset(audio, 0, sizeof(*audio));
287 if (index >= cx->nof_audio_inputs)
289 strlcpy(audio->name, input_strs[aud_input->audio_type - 1],
290 sizeof(audio->name));
291 audio->index = index;
292 audio->capability = V4L2_AUDCAP_STEREO;