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"
27 #include <media/cs5345.h>
29 /********************** card configuration *******************************/
31 /* usual i2c tuner addresses to probe */
32 static struct cx18_card_tuner_i2c cx18_i2c_std = {
33 .radio = { I2C_CLIENT_END },
34 .demod = { 0x43, I2C_CLIENT_END },
35 .tv = { 0x61, 0x60, I2C_CLIENT_END },
38 /* Please add new PCI IDs to: http://pci-ids.ucw.cz/iii
39 This keeps the PCI ID database up to date. Note that the entries
40 must be added under vendor 0x4444 (Conexant) as subsystem IDs.
41 New vendor IDs should still be added to the vendor ID list. */
43 /* Hauppauge HVR-1600 cards */
45 /* Note: for Hauppauge cards the tveeprom information is used instead
47 static const struct cx18_card cx18_card_hvr1600_esmt = {
48 .type = CX18_CARD_HVR_1600_ESMT,
49 .name = "Hauppauge HVR-1600",
50 .comment = "VBI is not yet supported\n",
51 .v4l2_capabilities = CX18_CAP_ENCODER,
52 .hw_audio_ctrl = CX18_HW_CX23418,
53 .hw_muxer = CX18_HW_CS5345,
54 .hw_all = CX18_HW_TVEEPROM | CX18_HW_TUNER |
55 CX18_HW_CS5345 | CX18_HW_DVB,
57 { CX18_CARD_INPUT_VID_TUNER, 0, CX23418_COMPOSITE7 },
58 { CX18_CARD_INPUT_SVIDEO1, 1, CX23418_SVIDEO1 },
59 { CX18_CARD_INPUT_COMPOSITE1, 1, CX23418_COMPOSITE3 },
60 { CX18_CARD_INPUT_SVIDEO2, 2, CX23418_SVIDEO2 },
61 { CX18_CARD_INPUT_COMPOSITE2, 2, CX23418_COMPOSITE4 },
64 { CX18_CARD_INPUT_AUD_TUNER,
65 CX23418_AUDIO8, CS5345_IN_1 | CS5345_MCLK_1_5 },
66 { CX18_CARD_INPUT_LINE_IN1,
67 CX23418_AUDIO_SERIAL, CS5345_IN_2 },
68 { CX18_CARD_INPUT_LINE_IN2,
69 CX23418_AUDIO_SERIAL, CS5345_IN_2 },
71 .radio_input = { CX18_CARD_INPUT_AUD_TUNER,
72 CX23418_AUDIO_SERIAL, 0 },
74 /* ESMT M13S128324A-5B memory */
77 .timing1 = 0x44220e82,
82 .gpio_init.initial_value = 0x3001,
83 .gpio_init.direction = 0x3001,
87 static const struct cx18_card cx18_card_hvr1600_samsung = {
88 .type = CX18_CARD_HVR_1600_SAMSUNG,
89 .name = "Hauppauge HVR-1600 (Preproduction)",
90 .comment = "VBI is not yet supported\n",
91 .v4l2_capabilities = CX18_CAP_ENCODER,
92 .hw_audio_ctrl = CX18_HW_CX23418,
93 .hw_muxer = CX18_HW_CS5345,
94 .hw_all = CX18_HW_TVEEPROM | CX18_HW_TUNER |
95 CX18_HW_CS5345 | CX18_HW_DVB,
97 { CX18_CARD_INPUT_VID_TUNER, 0, CX23418_COMPOSITE7 },
98 { CX18_CARD_INPUT_SVIDEO1, 1, CX23418_SVIDEO1 },
99 { CX18_CARD_INPUT_COMPOSITE1, 1, CX23418_COMPOSITE3 },
100 { CX18_CARD_INPUT_SVIDEO2, 2, CX23418_SVIDEO2 },
101 { CX18_CARD_INPUT_COMPOSITE2, 2, CX23418_COMPOSITE4 },
104 { CX18_CARD_INPUT_AUD_TUNER,
105 CX23418_AUDIO8, CS5345_IN_1 | CS5345_MCLK_1_5 },
106 { CX18_CARD_INPUT_LINE_IN1,
107 CX23418_AUDIO_SERIAL, CS5345_IN_2 },
108 { CX18_CARD_INPUT_LINE_IN2,
109 CX23418_AUDIO_SERIAL, CS5345_IN_2 },
111 .radio_input = { CX18_CARD_INPUT_AUD_TUNER,
112 CX23418_AUDIO_SERIAL, 0 },
114 /* Samsung K4D263238G-VC33 memory */
115 .chip_config = 0x003,
117 .timing1 = 0x23230b73,
122 .gpio_init.initial_value = 0x3001,
123 .gpio_init.direction = 0x3001,
124 .i2c = &cx18_i2c_std,
127 /* ------------------------------------------------------------------------- */
129 /* Compro VideoMate H900: not working at the moment! */
131 static const struct cx18_card_pci_info cx18_pci_h900[] = {
132 { PCI_DEVICE_ID_CX23418, CX18_PCI_ID_COMPRO, 0xe100 },
136 static const struct cx18_card cx18_card_h900 = {
137 .type = CX18_CARD_COMPRO_H900,
138 .name = "Compro VideoMate H900",
139 .comment = "DVB & VBI are not yet supported\n",
140 .v4l2_capabilities = CX18_CAP_ENCODER,
141 .hw_audio_ctrl = CX18_HW_CX23418,
142 .hw_all = CX18_HW_TUNER,
144 { CX18_CARD_INPUT_VID_TUNER, 0, CX23418_COMPOSITE2 },
145 { CX18_CARD_INPUT_SVIDEO1, 1,
146 CX23418_SVIDEO_LUMA3 | CX23418_SVIDEO_CHROMA4 },
147 { CX18_CARD_INPUT_COMPOSITE1, 1, CX23418_COMPOSITE1 },
150 { CX18_CARD_INPUT_AUD_TUNER,
152 { CX18_CARD_INPUT_LINE_IN1,
153 CX23418_AUDIO_SERIAL, 0 },
155 .radio_input = { CX18_CARD_INPUT_AUD_TUNER,
156 CX23418_AUDIO_SERIAL, 0 },
158 { .std = V4L2_STD_ALL, .tuner = TUNER_XC2028 },
161 /* EtronTech EM6A9160TS-5G memory */
162 .chip_config = 0x50003,
164 .timing1 = 0x24330e84,
170 .pci_list = cx18_pci_h900,
171 .i2c = &cx18_i2c_std,
174 /* ------------------------------------------------------------------------- */
176 /* Yuan MPC718: not working at the moment! */
178 static const struct cx18_card_pci_info cx18_pci_mpc718[] = {
179 { PCI_DEVICE_ID_CX23418, CX18_PCI_ID_YUAN, 0x0718 },
183 static const struct cx18_card cx18_card_mpc718 = {
184 .type = CX18_CARD_YUAN_MPC718,
185 .name = "Yuan MPC718",
186 .comment = "Not yet supported!\n",
187 .v4l2_capabilities = 0,
188 .hw_audio_ctrl = CX18_HW_CX23418,
189 .hw_all = CX18_HW_TUNER,
191 { CX18_CARD_INPUT_VID_TUNER, 0, CX23418_COMPOSITE7 },
192 { CX18_CARD_INPUT_SVIDEO1, 1, CX23418_SVIDEO1 },
193 { CX18_CARD_INPUT_COMPOSITE1, 1, CX23418_COMPOSITE3 },
196 { CX18_CARD_INPUT_AUD_TUNER,
198 { CX18_CARD_INPUT_LINE_IN1,
199 CX23418_AUDIO_SERIAL, 0 },
201 .radio_input = { CX18_CARD_INPUT_AUD_TUNER,
202 CX23418_AUDIO_SERIAL, 0 },
205 { .std = V4L2_STD_ALL, .tuner = TUNER_XC2028 },
208 /* Probably Samsung K4D263238G-VC33 memory */
209 .chip_config = 0x003,
211 .timing1 = 0x23230b73,
217 .pci_list = cx18_pci_mpc718,
218 .i2c = &cx18_i2c_std,
221 static const struct cx18_card *cx18_card_list[] = {
222 &cx18_card_hvr1600_esmt,
223 &cx18_card_hvr1600_samsung,
228 const struct cx18_card *cx18_get_card(u16 index)
230 if (index >= ARRAY_SIZE(cx18_card_list))
232 return cx18_card_list[index];
235 int cx18_get_input(struct cx18 *cx, u16 index, struct v4l2_input *input)
237 const struct cx18_card_video_input *card_input =
238 cx->card->video_inputs + index;
239 static const char * const input_strs[] = {
248 memset(input, 0, sizeof(*input));
249 if (index >= cx->nof_inputs)
251 input->index = index;
252 strlcpy(input->name, input_strs[card_input->video_type - 1],
253 sizeof(input->name));
254 input->type = (card_input->video_type == CX18_CARD_INPUT_VID_TUNER ?
255 V4L2_INPUT_TYPE_TUNER : V4L2_INPUT_TYPE_CAMERA);
256 input->audioset = (1 << cx->nof_audio_inputs) - 1;
257 input->std = (input->type == V4L2_INPUT_TYPE_TUNER) ?
258 cx->tuner_std : V4L2_STD_ALL;
262 int cx18_get_audio_input(struct cx18 *cx, u16 index, struct v4l2_audio *audio)
264 const struct cx18_card_audio_input *aud_input =
265 cx->card->audio_inputs + index;
266 static const char * const input_strs[] = {
272 memset(audio, 0, sizeof(*audio));
273 if (index >= cx->nof_audio_inputs)
275 strlcpy(audio->name, input_strs[aud_input->audio_type - 1],
276 sizeof(audio->name));
277 audio->index = index;
278 audio->capability = V4L2_AUDCAP_STEREO;