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 #define V4L2_STD_PAL_SECAM (V4L2_STD_PAL|V4L2_STD_SECAM)
32 /********************** card configuration *******************************/
34 /* usual i2c tuner addresses to probe */
35 static struct cx18_card_tuner_i2c cx18_i2c_std = {
36 .radio = { I2C_CLIENT_END },
37 .demod = { 0x43, I2C_CLIENT_END },
38 .tv = { 0x61, 0x60, I2C_CLIENT_END },
41 /* Please add new PCI IDs to: http://pci-ids.ucw.cz/iii
42 This keeps the PCI ID database up to date. Note that the entries
43 must be added under vendor 0x4444 (Conexant) as subsystem IDs.
44 New vendor IDs should still be added to the vendor ID list. */
46 /* Hauppauge HVR-1600 cards */
48 /* Note: for Hauppauge cards the tveeprom information is used instead
50 static const struct cx18_card cx18_card_hvr1600_esmt = {
51 .type = CX18_CARD_HVR_1600_ESMT,
52 .name = "Hauppauge HVR-1600",
53 .comment = "VBI is not yet supported\n",
54 .v4l2_capabilities = CX18_CAP_ENCODER,
55 .hw_audio_ctrl = CX18_HW_CX23418,
56 .hw_muxer = CX18_HW_CS5345,
57 .hw_all = CX18_HW_TVEEPROM | CX18_HW_TUNER |
58 CX18_HW_CS5345 | CX18_HW_DVB,
60 { CX18_CARD_INPUT_VID_TUNER, 0, CX18_AV_COMPOSITE7 },
61 { CX18_CARD_INPUT_SVIDEO1, 1, CX18_AV_SVIDEO1 },
62 { CX18_CARD_INPUT_COMPOSITE1, 1, CX18_AV_COMPOSITE3 },
63 { CX18_CARD_INPUT_SVIDEO2, 2, CX18_AV_SVIDEO2 },
64 { CX18_CARD_INPUT_COMPOSITE2, 2, CX18_AV_COMPOSITE4 },
67 { CX18_CARD_INPUT_AUD_TUNER,
68 CX18_AV_AUDIO8, CS5345_IN_1 | CS5345_MCLK_1_5 },
69 { CX18_CARD_INPUT_LINE_IN1,
70 CX18_AV_AUDIO_SERIAL, CS5345_IN_2 },
71 { CX18_CARD_INPUT_LINE_IN2,
72 CX18_AV_AUDIO_SERIAL, CS5345_IN_3 },
74 .radio_input = { CX18_CARD_INPUT_AUD_TUNER,
75 CX18_AV_AUDIO_SERIAL, CS5345_IN_4 },
77 /* ESMT M13S128324A-5B memory */
80 .timing1 = 0x44220e82,
85 .gpio_init.initial_value = 0x3001,
86 .gpio_init.direction = 0x3001,
87 .gpio_i2c_slave_reset = {
88 .active_lo_mask = 0x3001,
95 static const struct cx18_card cx18_card_hvr1600_samsung = {
96 .type = CX18_CARD_HVR_1600_SAMSUNG,
97 .name = "Hauppauge HVR-1600 (Preproduction)",
98 .comment = "VBI is not yet supported\n",
99 .v4l2_capabilities = CX18_CAP_ENCODER,
100 .hw_audio_ctrl = CX18_HW_CX23418,
101 .hw_muxer = CX18_HW_CS5345,
102 .hw_all = CX18_HW_TVEEPROM | CX18_HW_TUNER |
103 CX18_HW_CS5345 | CX18_HW_DVB,
105 { CX18_CARD_INPUT_VID_TUNER, 0, CX18_AV_COMPOSITE7 },
106 { CX18_CARD_INPUT_SVIDEO1, 1, CX18_AV_SVIDEO1 },
107 { CX18_CARD_INPUT_COMPOSITE1, 1, CX18_AV_COMPOSITE3 },
108 { CX18_CARD_INPUT_SVIDEO2, 2, CX18_AV_SVIDEO2 },
109 { CX18_CARD_INPUT_COMPOSITE2, 2, CX18_AV_COMPOSITE4 },
112 { CX18_CARD_INPUT_AUD_TUNER,
113 CX18_AV_AUDIO8, CS5345_IN_1 | CS5345_MCLK_1_5 },
114 { CX18_CARD_INPUT_LINE_IN1,
115 CX18_AV_AUDIO_SERIAL, CS5345_IN_2 },
116 { CX18_CARD_INPUT_LINE_IN2,
117 CX18_AV_AUDIO_SERIAL, CS5345_IN_3 },
119 .radio_input = { CX18_CARD_INPUT_AUD_TUNER,
120 CX18_AV_AUDIO_SERIAL, CS5345_IN_4 },
122 /* Samsung K4D263238G-VC33 memory */
123 .chip_config = 0x003,
125 .timing1 = 0x23230b73,
130 .gpio_init.initial_value = 0x3001,
131 .gpio_init.direction = 0x3001,
132 .gpio_i2c_slave_reset = {
133 .active_lo_mask = 0x3001,
134 .msecs_asserted = 10,
135 .msecs_recovery = 40,
137 .i2c = &cx18_i2c_std,
140 /* ------------------------------------------------------------------------- */
142 /* Compro VideoMate H900: note that this card is analog only! */
144 static const struct cx18_card_pci_info cx18_pci_h900[] = {
145 { PCI_DEVICE_ID_CX23418, CX18_PCI_ID_COMPRO, 0xe100 },
149 static const struct cx18_card cx18_card_h900 = {
150 .type = CX18_CARD_COMPRO_H900,
151 .name = "Compro VideoMate H900",
152 .comment = "VBI is not yet supported\n",
153 .v4l2_capabilities = CX18_CAP_ENCODER,
154 .hw_audio_ctrl = CX18_HW_CX23418,
155 .hw_all = CX18_HW_TUNER,
157 { CX18_CARD_INPUT_VID_TUNER, 0, CX18_AV_COMPOSITE2 },
158 { CX18_CARD_INPUT_SVIDEO1, 1,
159 CX18_AV_SVIDEO_LUMA3 | CX18_AV_SVIDEO_CHROMA4 },
160 { CX18_CARD_INPUT_COMPOSITE1, 1, CX18_AV_COMPOSITE1 },
163 { CX18_CARD_INPUT_AUD_TUNER,
165 { CX18_CARD_INPUT_LINE_IN1,
166 CX18_AV_AUDIO_SERIAL, 0 },
168 .radio_input = { CX18_CARD_INPUT_AUD_TUNER,
169 CX18_AV_AUDIO_SERIAL, 0 },
171 { .std = V4L2_STD_ALL, .tuner = TUNER_XC2028 },
174 /* EtronTech EM6A9160TS-5G memory */
175 .chip_config = 0x50003,
177 .timing1 = 0x24330e84,
183 .pci_list = cx18_pci_h900,
184 .i2c = &cx18_i2c_std,
187 /* ------------------------------------------------------------------------- */
189 /* Yuan MPC718: not working at the moment! */
191 static const struct cx18_card_pci_info cx18_pci_mpc718[] = {
192 { PCI_DEVICE_ID_CX23418, CX18_PCI_ID_YUAN, 0x0718 },
196 static const struct cx18_card cx18_card_mpc718 = {
197 .type = CX18_CARD_YUAN_MPC718,
198 .name = "Yuan MPC718",
199 .comment = "Some Composite and S-Video inputs are currently working.\n",
200 .v4l2_capabilities = CX18_CAP_ENCODER,
201 .hw_audio_ctrl = CX18_HW_CX23418,
202 .hw_all = CX18_HW_TUNER,
204 { CX18_CARD_INPUT_VID_TUNER, 0, CX18_AV_COMPOSITE2 },
205 { CX18_CARD_INPUT_SVIDEO1, 1,
206 CX18_AV_SVIDEO_LUMA3 | CX18_AV_SVIDEO_CHROMA4 },
207 { CX18_CARD_INPUT_COMPOSITE1, 1, CX18_AV_COMPOSITE1 },
208 { CX18_CARD_INPUT_SVIDEO2, 2,
209 CX18_AV_SVIDEO_LUMA7 | CX18_AV_SVIDEO_CHROMA8 },
210 { CX18_CARD_INPUT_COMPOSITE2, 2, CX18_AV_COMPOSITE6 },
211 { CX18_CARD_INPUT_COMPOSITE3, 2, CX18_AV_COMPOSITE3 },
214 { CX18_CARD_INPUT_AUD_TUNER, CX18_AV_AUDIO5, 0 },
215 { CX18_CARD_INPUT_LINE_IN1, CX18_AV_AUDIO_SERIAL, 0 },
216 { CX18_CARD_INPUT_LINE_IN2, CX18_AV_AUDIO_SERIAL, 0 },
218 .radio_input = { CX18_CARD_INPUT_AUD_TUNER, CX18_AV_AUDIO_SERIAL, 0 },
221 { .std = V4L2_STD_ALL, .tuner = TUNER_XC2028 },
224 /* Probably Samsung K4D263238G-VC33 memory */
225 .chip_config = 0x003,
227 .timing1 = 0x23230b73,
233 .pci_list = cx18_pci_mpc718,
234 .i2c = &cx18_i2c_std,
237 /* ------------------------------------------------------------------------- */
239 /* Conexant Raptor PAL/SECAM: note that this card is analog only! */
241 static const struct cx18_card_pci_info cx18_pci_cnxt_raptor_pal[] = {
242 { PCI_DEVICE_ID_CX23418, CX18_PCI_ID_CONEXANT, 0x0009 },
246 static const struct cx18_card cx18_card_cnxt_raptor_pal = {
247 .type = CX18_CARD_CNXT_RAPTOR_PAL,
248 .name = "Conexant Raptor PAL/SECAM",
249 .comment = "VBI is not yet supported\n",
250 .v4l2_capabilities = CX18_CAP_ENCODER,
251 .hw_audio_ctrl = CX18_HW_CX23418,
252 .hw_muxer = CX18_HW_GPIO,
253 .hw_all = CX18_HW_TUNER | CX18_HW_GPIO,
255 { CX18_CARD_INPUT_VID_TUNER, 0, CX18_AV_COMPOSITE2 },
256 { CX18_CARD_INPUT_SVIDEO1, 1,
257 CX18_AV_SVIDEO_LUMA3 | CX18_AV_SVIDEO_CHROMA4 },
258 { CX18_CARD_INPUT_COMPOSITE1, 1, CX18_AV_COMPOSITE1 },
259 { CX18_CARD_INPUT_SVIDEO2, 2,
260 CX18_AV_SVIDEO_LUMA7 | CX18_AV_SVIDEO_CHROMA8 },
261 { CX18_CARD_INPUT_COMPOSITE2, 2, CX18_AV_COMPOSITE6 },
264 { CX18_CARD_INPUT_AUD_TUNER, CX18_AV_AUDIO_SERIAL, 1 },
265 { CX18_CARD_INPUT_LINE_IN1, CX18_AV_AUDIO_SERIAL, 0 },
266 { CX18_CARD_INPUT_LINE_IN2, CX18_AV_AUDIO_SERIAL, 0 },
269 { .std = V4L2_STD_PAL_SECAM, .tuner = TUNER_PHILIPS_FM1216ME_MK3 },
272 /* MT 46V16M16 memory */
273 .chip_config = 0x50306,
275 .timing1 = 0x33220953,
280 .gpio_init.initial_value = 0x02,
281 .gpio_init.direction = 0x02,
282 .gpio_audio_input = { .mask = 0x02, .tuner = 0x02, .linein = 0x00 },
283 .pci_list = cx18_pci_cnxt_raptor_pal,
284 .i2c = &cx18_i2c_std,
287 /* ------------------------------------------------------------------------- */
289 static const struct cx18_card *cx18_card_list[] = {
290 &cx18_card_hvr1600_esmt,
291 &cx18_card_hvr1600_samsung,
294 &cx18_card_cnxt_raptor_pal,
297 const struct cx18_card *cx18_get_card(u16 index)
299 if (index >= ARRAY_SIZE(cx18_card_list))
301 return cx18_card_list[index];
304 int cx18_get_input(struct cx18 *cx, u16 index, struct v4l2_input *input)
306 const struct cx18_card_video_input *card_input =
307 cx->card->video_inputs + index;
308 static const char * const input_strs[] = {
317 memset(input, 0, sizeof(*input));
318 if (index >= cx->nof_inputs)
320 input->index = index;
321 strlcpy(input->name, input_strs[card_input->video_type - 1],
322 sizeof(input->name));
323 input->type = (card_input->video_type == CX18_CARD_INPUT_VID_TUNER ?
324 V4L2_INPUT_TYPE_TUNER : V4L2_INPUT_TYPE_CAMERA);
325 input->audioset = (1 << cx->nof_audio_inputs) - 1;
326 input->std = (input->type == V4L2_INPUT_TYPE_TUNER) ?
327 cx->tuner_std : V4L2_STD_ALL;
331 int cx18_get_audio_input(struct cx18 *cx, u16 index, struct v4l2_audio *audio)
333 const struct cx18_card_audio_input *aud_input =
334 cx->card->audio_inputs + index;
335 static const char * const input_strs[] = {
341 memset(audio, 0, sizeof(*audio));
342 if (index >= cx->nof_audio_inputs)
344 strlcpy(audio->name, input_strs[aud_input->audio_type - 1],
345 sizeof(audio->name));
346 audio->index = index;
347 audio->capability = V4L2_AUDCAP_STEREO;