]> bbs.cooldavid.org Git - net-next-2.6.git/blame - drivers/media/video/cx18/cx18-cards.c
V4L/DVB (11951): cx18: Add DVB-T support for the Leadtek WinFast DVR3100 H
[net-next-2.6.git] / drivers / media / video / cx18 / cx18-cards.c
CommitLineData
1c1e45d1
HV
1/*
2 * cx18 functions to query card hardware
3 *
4 * Derived from ivtv-cards.c
5 *
6 * Copyright (C) 2007 Hans Verkuil <hverkuil@xs4all.nl>
1ed9dcc8 7 * Copyright (C) 2008 Andy Walls <awalls@radix.net>
1c1e45d1
HV
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
22 * 02111-1307 USA
23 */
24
25#include "cx18-driver.h"
26#include "cx18-cards.h"
d3d9b803 27#include "cx18-av-core.h"
1c1e45d1
HV
28#include "cx18-i2c.h"
29#include <media/cs5345.h>
30
156f194b 31#define V4L2_STD_PAL_SECAM (V4L2_STD_PAL|V4L2_STD_SECAM)
03c28085 32
1c1e45d1
HV
33/********************** card configuration *******************************/
34
35/* usual i2c tuner addresses to probe */
36static struct cx18_card_tuner_i2c cx18_i2c_std = {
37 .radio = { I2C_CLIENT_END },
38 .demod = { 0x43, I2C_CLIENT_END },
39 .tv = { 0x61, 0x60, I2C_CLIENT_END },
40};
41
42/* Please add new PCI IDs to: http://pci-ids.ucw.cz/iii
43 This keeps the PCI ID database up to date. Note that the entries
44 must be added under vendor 0x4444 (Conexant) as subsystem IDs.
45 New vendor IDs should still be added to the vendor ID list. */
46
47/* Hauppauge HVR-1600 cards */
48
49/* Note: for Hauppauge cards the tveeprom information is used instead
50 of PCI IDs */
51static const struct cx18_card cx18_card_hvr1600_esmt = {
52 .type = CX18_CARD_HVR_1600_ESMT,
53 .name = "Hauppauge HVR-1600",
302df970 54 .comment = "Simultaneous Digital and Analog TV capture supported\n",
1c1e45d1 55 .v4l2_capabilities = CX18_CAP_ENCODER,
ff2a2001 56 .hw_audio_ctrl = CX18_HW_418_AV,
1c1e45d1 57 .hw_muxer = CX18_HW_CS5345,
ff2a2001 58 .hw_all = CX18_HW_TVEEPROM | CX18_HW_418_AV | CX18_HW_TUNER |
eefe1010 59 CX18_HW_CS5345 | CX18_HW_DVB | CX18_HW_GPIO_RESET_CTRL,
1c1e45d1 60 .video_inputs = {
d3d9b803
HV
61 { CX18_CARD_INPUT_VID_TUNER, 0, CX18_AV_COMPOSITE7 },
62 { CX18_CARD_INPUT_SVIDEO1, 1, CX18_AV_SVIDEO1 },
63 { CX18_CARD_INPUT_COMPOSITE1, 1, CX18_AV_COMPOSITE3 },
64 { CX18_CARD_INPUT_SVIDEO2, 2, CX18_AV_SVIDEO2 },
65 { CX18_CARD_INPUT_COMPOSITE2, 2, CX18_AV_COMPOSITE4 },
1c1e45d1
HV
66 },
67 .audio_inputs = {
68 { CX18_CARD_INPUT_AUD_TUNER,
d3d9b803 69 CX18_AV_AUDIO8, CS5345_IN_1 | CS5345_MCLK_1_5 },
1c1e45d1 70 { CX18_CARD_INPUT_LINE_IN1,
81cb727d 71 CX18_AV_AUDIO_SERIAL1, CS5345_IN_2 },
1c1e45d1 72 { CX18_CARD_INPUT_LINE_IN2,
81cb727d 73 CX18_AV_AUDIO_SERIAL1, CS5345_IN_3 },
1c1e45d1
HV
74 },
75 .radio_input = { CX18_CARD_INPUT_AUD_TUNER,
81cb727d 76 CX18_AV_AUDIO_SERIAL1, CS5345_IN_4 },
1c1e45d1
HV
77 .ddr = {
78 /* ESMT M13S128324A-5B memory */
79 .chip_config = 0x003,
80 .refresh = 0x30c,
81 .timing1 = 0x44220e82,
82 .timing2 = 0x08,
83 .tune_lane = 0,
84 .initial_emrs = 0,
85 },
86 .gpio_init.initial_value = 0x3001,
87 .gpio_init.direction = 0x3001,
1f09e8a2
AW
88 .gpio_i2c_slave_reset = {
89 .active_lo_mask = 0x3001,
90 .msecs_asserted = 10,
91 .msecs_recovery = 40,
02fa272f 92 .ir_reset_mask = 0x0001,
1f09e8a2 93 },
1c1e45d1
HV
94 .i2c = &cx18_i2c_std,
95};
96
97static const struct cx18_card cx18_card_hvr1600_samsung = {
98 .type = CX18_CARD_HVR_1600_SAMSUNG,
99 .name = "Hauppauge HVR-1600 (Preproduction)",
302df970 100 .comment = "Simultaneous Digital and Analog TV capture supported\n",
1c1e45d1 101 .v4l2_capabilities = CX18_CAP_ENCODER,
ff2a2001 102 .hw_audio_ctrl = CX18_HW_418_AV,
1c1e45d1 103 .hw_muxer = CX18_HW_CS5345,
ff2a2001 104 .hw_all = CX18_HW_TVEEPROM | CX18_HW_418_AV | CX18_HW_TUNER |
eefe1010 105 CX18_HW_CS5345 | CX18_HW_DVB | CX18_HW_GPIO_RESET_CTRL,
1c1e45d1 106 .video_inputs = {
d3d9b803
HV
107 { CX18_CARD_INPUT_VID_TUNER, 0, CX18_AV_COMPOSITE7 },
108 { CX18_CARD_INPUT_SVIDEO1, 1, CX18_AV_SVIDEO1 },
109 { CX18_CARD_INPUT_COMPOSITE1, 1, CX18_AV_COMPOSITE3 },
110 { CX18_CARD_INPUT_SVIDEO2, 2, CX18_AV_SVIDEO2 },
111 { CX18_CARD_INPUT_COMPOSITE2, 2, CX18_AV_COMPOSITE4 },
1c1e45d1
HV
112 },
113 .audio_inputs = {
114 { CX18_CARD_INPUT_AUD_TUNER,
d3d9b803 115 CX18_AV_AUDIO8, CS5345_IN_1 | CS5345_MCLK_1_5 },
1c1e45d1 116 { CX18_CARD_INPUT_LINE_IN1,
81cb727d 117 CX18_AV_AUDIO_SERIAL1, CS5345_IN_2 },
1c1e45d1 118 { CX18_CARD_INPUT_LINE_IN2,
81cb727d 119 CX18_AV_AUDIO_SERIAL1, CS5345_IN_3 },
1c1e45d1
HV
120 },
121 .radio_input = { CX18_CARD_INPUT_AUD_TUNER,
81cb727d 122 CX18_AV_AUDIO_SERIAL1, CS5345_IN_4 },
1c1e45d1
HV
123 .ddr = {
124 /* Samsung K4D263238G-VC33 memory */
125 .chip_config = 0x003,
126 .refresh = 0x30c,
127 .timing1 = 0x23230b73,
128 .timing2 = 0x08,
129 .tune_lane = 0,
130 .initial_emrs = 2,
131 },
132 .gpio_init.initial_value = 0x3001,
133 .gpio_init.direction = 0x3001,
1f09e8a2
AW
134 .gpio_i2c_slave_reset = {
135 .active_lo_mask = 0x3001,
136 .msecs_asserted = 10,
137 .msecs_recovery = 40,
02fa272f 138 .ir_reset_mask = 0x0001,
1f09e8a2 139 },
1c1e45d1
HV
140 .i2c = &cx18_i2c_std,
141};
142
143/* ------------------------------------------------------------------------- */
144
8f993573 145/* Compro VideoMate H900: note that this card is analog only! */
1c1e45d1
HV
146
147static const struct cx18_card_pci_info cx18_pci_h900[] = {
148 { PCI_DEVICE_ID_CX23418, CX18_PCI_ID_COMPRO, 0xe100 },
149 { 0, 0, 0 }
150};
151
152static const struct cx18_card cx18_card_h900 = {
153 .type = CX18_CARD_COMPRO_H900,
154 .name = "Compro VideoMate H900",
302df970 155 .comment = "Analog TV capture supported\n",
9dcbf35a 156 .v4l2_capabilities = CX18_CAP_ENCODER,
ff2a2001 157 .hw_audio_ctrl = CX18_HW_418_AV,
eefe1010 158 .hw_all = CX18_HW_418_AV | CX18_HW_TUNER | CX18_HW_GPIO_RESET_CTRL,
1c1e45d1 159 .video_inputs = {
d3d9b803 160 { CX18_CARD_INPUT_VID_TUNER, 0, CX18_AV_COMPOSITE2 },
9dcbf35a 161 { CX18_CARD_INPUT_SVIDEO1, 1,
d3d9b803
HV
162 CX18_AV_SVIDEO_LUMA3 | CX18_AV_SVIDEO_CHROMA4 },
163 { CX18_CARD_INPUT_COMPOSITE1, 1, CX18_AV_COMPOSITE1 },
1c1e45d1
HV
164 },
165 .audio_inputs = {
166 { CX18_CARD_INPUT_AUD_TUNER,
1167b2e4 167 CX18_AV_AUDIO5, 0 },
1c1e45d1 168 { CX18_CARD_INPUT_LINE_IN1,
81cb727d 169 CX18_AV_AUDIO_SERIAL1, 0 },
1c1e45d1
HV
170 },
171 .radio_input = { CX18_CARD_INPUT_AUD_TUNER,
81cb727d 172 CX18_AV_AUDIO_SERIAL1, 0 },
1c1e45d1
HV
173 .tuners = {
174 { .std = V4L2_STD_ALL, .tuner = TUNER_XC2028 },
175 },
176 .ddr = {
177 /* EtronTech EM6A9160TS-5G memory */
178 .chip_config = 0x50003,
179 .refresh = 0x753,
180 .timing1 = 0x24330e84,
181 .timing2 = 0x1f,
182 .tune_lane = 0,
183 .initial_emrs = 0,
184 },
9dcbf35a 185 .xceive_pin = 15,
1c1e45d1
HV
186 .pci_list = cx18_pci_h900,
187 .i2c = &cx18_i2c_std,
188};
189
190/* ------------------------------------------------------------------------- */
191
192/* Yuan MPC718: not working at the moment! */
193
194static const struct cx18_card_pci_info cx18_pci_mpc718[] = {
195 { PCI_DEVICE_ID_CX23418, CX18_PCI_ID_YUAN, 0x0718 },
196 { 0, 0, 0 }
197};
198
199static const struct cx18_card cx18_card_mpc718 = {
200 .type = CX18_CARD_YUAN_MPC718,
201 .name = "Yuan MPC718",
0c616214 202 .comment = "Analog video capture works; some audio line in may not.\n",
ad907fa3 203 .v4l2_capabilities = CX18_CAP_ENCODER,
ff2a2001 204 .hw_audio_ctrl = CX18_HW_418_AV,
eefe1010 205 .hw_all = CX18_HW_418_AV | CX18_HW_TUNER | CX18_HW_GPIO_RESET_CTRL,
1c1e45d1 206 .video_inputs = {
ad907fa3
AW
207 { CX18_CARD_INPUT_VID_TUNER, 0, CX18_AV_COMPOSITE2 },
208 { CX18_CARD_INPUT_SVIDEO1, 1,
209 CX18_AV_SVIDEO_LUMA3 | CX18_AV_SVIDEO_CHROMA4 },
210 { CX18_CARD_INPUT_COMPOSITE1, 1, CX18_AV_COMPOSITE1 },
211 { CX18_CARD_INPUT_SVIDEO2, 2,
212 CX18_AV_SVIDEO_LUMA7 | CX18_AV_SVIDEO_CHROMA8 },
213 { CX18_CARD_INPUT_COMPOSITE2, 2, CX18_AV_COMPOSITE6 },
214 { CX18_CARD_INPUT_COMPOSITE3, 2, CX18_AV_COMPOSITE3 },
1c1e45d1
HV
215 },
216 .audio_inputs = {
81cb727d
HV
217 { CX18_CARD_INPUT_AUD_TUNER, CX18_AV_AUDIO5, 0 },
218 { CX18_CARD_INPUT_LINE_IN1, CX18_AV_AUDIO_SERIAL1, 0 },
219 { CX18_CARD_INPUT_LINE_IN2, CX18_AV_AUDIO_SERIAL1, 0 },
1c1e45d1 220 },
81cb727d 221 .radio_input = { CX18_CARD_INPUT_AUD_TUNER, CX18_AV_AUDIO_SERIAL1, 0 },
1c1e45d1
HV
222 .tuners = {
223 /* XC3028 tuner */
224 { .std = V4L2_STD_ALL, .tuner = TUNER_XC2028 },
225 },
1c1e45d1
HV
226 .ddr = {
227 /* Probably Samsung K4D263238G-VC33 memory */
228 .chip_config = 0x003,
229 .refresh = 0x30c,
230 .timing1 = 0x23230b73,
231 .timing2 = 0x08,
232 .tune_lane = 0,
233 .initial_emrs = 2,
234 },
0c616214 235 .xceive_pin = 0,
1c1e45d1
HV
236 .pci_list = cx18_pci_mpc718,
237 .i2c = &cx18_i2c_std,
238};
239
03c28085
SD
240/* ------------------------------------------------------------------------- */
241
242/* Conexant Raptor PAL/SECAM: note that this card is analog only! */
243
244static const struct cx18_card_pci_info cx18_pci_cnxt_raptor_pal[] = {
245 { PCI_DEVICE_ID_CX23418, CX18_PCI_ID_CONEXANT, 0x0009 },
246 { 0, 0, 0 }
247};
248
249static const struct cx18_card cx18_card_cnxt_raptor_pal = {
250 .type = CX18_CARD_CNXT_RAPTOR_PAL,
251 .name = "Conexant Raptor PAL/SECAM",
302df970 252 .comment = "Analog TV capture supported\n",
03c28085 253 .v4l2_capabilities = CX18_CAP_ENCODER,
ff2a2001 254 .hw_audio_ctrl = CX18_HW_418_AV,
eefe1010
AW
255 .hw_muxer = CX18_HW_GPIO_MUX,
256 .hw_all = CX18_HW_418_AV | CX18_HW_TUNER | CX18_HW_GPIO_MUX,
03c28085
SD
257 .video_inputs = {
258 { CX18_CARD_INPUT_VID_TUNER, 0, CX18_AV_COMPOSITE2 },
259 { CX18_CARD_INPUT_SVIDEO1, 1,
260 CX18_AV_SVIDEO_LUMA3 | CX18_AV_SVIDEO_CHROMA4 },
261 { CX18_CARD_INPUT_COMPOSITE1, 1, CX18_AV_COMPOSITE1 },
262 { CX18_CARD_INPUT_SVIDEO2, 2,
263 CX18_AV_SVIDEO_LUMA7 | CX18_AV_SVIDEO_CHROMA8 },
264 { CX18_CARD_INPUT_COMPOSITE2, 2, CX18_AV_COMPOSITE6 },
265 },
266 .audio_inputs = {
81cb727d
HV
267 { CX18_CARD_INPUT_AUD_TUNER, CX18_AV_AUDIO5, 0 },
268 { CX18_CARD_INPUT_LINE_IN1, CX18_AV_AUDIO_SERIAL1, 1 },
269 { CX18_CARD_INPUT_LINE_IN2, CX18_AV_AUDIO_SERIAL2, 1 },
03c28085
SD
270 },
271 .tuners = {
156f194b 272 { .std = V4L2_STD_PAL_SECAM, .tuner = TUNER_PHILIPS_FM1216ME_MK3 },
03c28085 273 },
81cb727d 274 .radio_input = { CX18_CARD_INPUT_AUD_TUNER, CX18_AV_AUDIO_SERIAL1, 2 },
03c28085
SD
275 .ddr = {
276 /* MT 46V16M16 memory */
277 .chip_config = 0x50306,
278 .refresh = 0x753,
279 .timing1 = 0x33220953,
280 .timing2 = 0x09,
281 .tune_lane = 0,
282 .initial_emrs = 0,
283 },
c5588b5c
AW
284 .gpio_init.initial_value = 0x1002,
285 .gpio_init.direction = 0xf002,
286 .gpio_audio_input = { .mask = 0xf002,
287 .tuner = 0x1002, /* LED D1 Tuner AF */
288 .linein = 0x2000, /* LED D2 Line In 1 */
289 .radio = 0x4002 }, /* LED D3 Tuner AF */
03c28085
SD
290 .pci_list = cx18_pci_cnxt_raptor_pal,
291 .i2c = &cx18_i2c_std,
292};
293
294/* ------------------------------------------------------------------------- */
295
9eee4fb6
AW
296/* Toshiba Qosmio laptop internal DVB-T/Analog Hybrid Tuner */
297
298static const struct cx18_card_pci_info cx18_pci_toshiba_qosmio_dvbt[] = {
299 { PCI_DEVICE_ID_CX23418, CX18_PCI_ID_TOSHIBA, 0x0110 },
300 { 0, 0, 0 }
301};
302
303static const struct cx18_card cx18_card_toshiba_qosmio_dvbt = {
304 .type = CX18_CARD_TOSHIBA_QOSMIO_DVBT,
305 .name = "Toshiba Qosmio DVB-T/Analog",
306 .comment = "Experimenters and photos needed for device to work well.\n"
307 "\tTo help, mail the ivtv-devel list (www.ivtvdriver.org).\n",
308 .v4l2_capabilities = CX18_CAP_ENCODER,
ff2a2001 309 .hw_audio_ctrl = CX18_HW_418_AV,
eefe1010 310 .hw_all = CX18_HW_418_AV | CX18_HW_TUNER | CX18_HW_GPIO_RESET_CTRL,
9eee4fb6
AW
311 .video_inputs = {
312 { CX18_CARD_INPUT_VID_TUNER, 0, CX18_AV_COMPOSITE6 },
313 { CX18_CARD_INPUT_SVIDEO1, 1,
314 CX18_AV_SVIDEO_LUMA3 | CX18_AV_SVIDEO_CHROMA4 },
315 { CX18_CARD_INPUT_COMPOSITE1, 1, CX18_AV_COMPOSITE1 },
316 },
317 .audio_inputs = {
318 { CX18_CARD_INPUT_AUD_TUNER, CX18_AV_AUDIO5, 0 },
319 { CX18_CARD_INPUT_LINE_IN1, CX18_AV_AUDIO_SERIAL1, 1 },
320 },
321 .tuners = {
322 { .std = V4L2_STD_ALL, .tuner = TUNER_XC2028 },
323 },
324 .ddr = {
325 .chip_config = 0x202,
326 .refresh = 0x3bb,
327 .timing1 = 0x33320a63,
328 .timing2 = 0x0a,
329 .tune_lane = 0,
330 .initial_emrs = 0x42,
331 },
332 .xceive_pin = 15,
333 .pci_list = cx18_pci_toshiba_qosmio_dvbt,
334 .i2c = &cx18_i2c_std,
335};
336
337/* ------------------------------------------------------------------------- */
338
339/* Leadtek WinFast PVR2100 */
340
341static const struct cx18_card_pci_info cx18_pci_leadtek_pvr2100[] = {
6ce9ee53 342 { PCI_DEVICE_ID_CX23418, CX18_PCI_ID_LEADTEK, 0x6f27 }, /* PVR2100 */
9eee4fb6
AW
343 { 0, 0, 0 }
344};
345
346static const struct cx18_card cx18_card_leadtek_pvr2100 = {
347 .type = CX18_CARD_LEADTEK_PVR2100,
9d5af862 348 .name = "Leadtek WinFast PVR2100",
9eee4fb6
AW
349 .comment = "Experimenters and photos needed for device to work well.\n"
350 "\tTo help, mail the ivtv-devel list (www.ivtvdriver.org).\n",
351 .v4l2_capabilities = CX18_CAP_ENCODER,
ff2a2001 352 .hw_audio_ctrl = CX18_HW_418_AV,
eefe1010
AW
353 .hw_muxer = CX18_HW_GPIO_MUX,
354 .hw_all = CX18_HW_418_AV | CX18_HW_TUNER | CX18_HW_GPIO_MUX |
355 CX18_HW_GPIO_RESET_CTRL,
9eee4fb6
AW
356 .video_inputs = {
357 { CX18_CARD_INPUT_VID_TUNER, 0, CX18_AV_COMPOSITE2 },
358 { CX18_CARD_INPUT_SVIDEO1, 1,
359 CX18_AV_SVIDEO_LUMA3 | CX18_AV_SVIDEO_CHROMA4 },
360 { CX18_CARD_INPUT_COMPOSITE1, 1, CX18_AV_COMPOSITE7 },
361 },
362 .audio_inputs = {
363 { CX18_CARD_INPUT_AUD_TUNER, CX18_AV_AUDIO5, 0 },
364 { CX18_CARD_INPUT_LINE_IN1, CX18_AV_AUDIO_SERIAL1, 1 },
365 },
366 .tuners = {
9d5af862 367 /* XC2028 tuner */
9eee4fb6
AW
368 { .std = V4L2_STD_ALL, .tuner = TUNER_XC2028 },
369 },
370 .radio_input = { CX18_CARD_INPUT_AUD_TUNER, CX18_AV_AUDIO5, 2 },
371 .ddr = {
8bb09db3 372 /* Pointer to proper DDR config values provided by Terry Wu */
9eee4fb6
AW
373 .chip_config = 0x303,
374 .refresh = 0x3bb,
375 .timing1 = 0x24220e83,
376 .timing2 = 0x1f,
377 .tune_lane = 0,
378 .initial_emrs = 0x2,
379 },
380 .gpio_init.initial_value = 0x6,
381 .gpio_init.direction = 0x7,
382 .gpio_audio_input = { .mask = 0x7,
383 .tuner = 0x6, .linein = 0x2, .radio = 0x2 },
384 .xceive_pin = 15,
385 .pci_list = cx18_pci_leadtek_pvr2100,
386 .i2c = &cx18_i2c_std,
387};
388
389/* ------------------------------------------------------------------------- */
390
9d5af862
AW
391/* Leadtek WinFast DVR3100 H */
392
393static const struct cx18_card_pci_info cx18_pci_leadtek_dvr3100h[] = {
394 { PCI_DEVICE_ID_CX23418, CX18_PCI_ID_LEADTEK, 0x6690 }, /* DVR3100 H */
395 { 0, 0, 0 }
396};
397
398static const struct cx18_card cx18_card_leadtek_dvr3100h = {
399 .type = CX18_CARD_LEADTEK_DVR3100H,
400 .name = "Leadtek WinFast DVR3100 H",
8bb09db3
AW
401 .comment = "Simultaneous DVB-T and Analog capture supported,\n"
402 "\texcept when capturing Analog from the antenna input.\n",
9d5af862
AW
403 .v4l2_capabilities = CX18_CAP_ENCODER,
404 .hw_audio_ctrl = CX18_HW_418_AV,
405 .hw_muxer = CX18_HW_GPIO_MUX,
406 .hw_all = CX18_HW_418_AV | CX18_HW_TUNER | CX18_HW_GPIO_MUX |
8bb09db3 407 CX18_HW_DVB | CX18_HW_GPIO_RESET_CTRL,
9d5af862
AW
408 .video_inputs = {
409 { CX18_CARD_INPUT_VID_TUNER, 0, CX18_AV_COMPOSITE2 },
410 { CX18_CARD_INPUT_SVIDEO1, 1,
411 CX18_AV_SVIDEO_LUMA3 | CX18_AV_SVIDEO_CHROMA4 },
412 { CX18_CARD_INPUT_COMPOSITE1, 1, CX18_AV_COMPOSITE7 },
413 },
414 .audio_inputs = {
415 { CX18_CARD_INPUT_AUD_TUNER, CX18_AV_AUDIO5, 0 },
416 { CX18_CARD_INPUT_LINE_IN1, CX18_AV_AUDIO_SERIAL1, 1 },
417 },
418 .tuners = {
419 /* XC3028 tuner */
420 { .std = V4L2_STD_ALL, .tuner = TUNER_XC2028 },
421 },
422 .radio_input = { CX18_CARD_INPUT_AUD_TUNER, CX18_AV_AUDIO5, 2 },
423 .ddr = {
8bb09db3 424 /* Pointer to proper DDR config values provided by Terry Wu */
9d5af862
AW
425 .chip_config = 0x303,
426 .refresh = 0x3bb,
427 .timing1 = 0x24220e83,
428 .timing2 = 0x1f,
429 .tune_lane = 0,
430 .initial_emrs = 0x2,
431 },
432 .gpio_init.initial_value = 0x6,
433 .gpio_init.direction = 0x7,
434 .gpio_audio_input = { .mask = 0x7,
435 .tuner = 0x6, .linein = 0x2, .radio = 0x2 },
8bb09db3 436 .xceive_pin = 1,
9d5af862
AW
437 .pci_list = cx18_pci_leadtek_dvr3100h,
438 .i2c = &cx18_i2c_std,
439};
440
441/* ------------------------------------------------------------------------- */
442
1c1e45d1
HV
443static const struct cx18_card *cx18_card_list[] = {
444 &cx18_card_hvr1600_esmt,
445 &cx18_card_hvr1600_samsung,
446 &cx18_card_h900,
447 &cx18_card_mpc718,
03c28085 448 &cx18_card_cnxt_raptor_pal,
9eee4fb6
AW
449 &cx18_card_toshiba_qosmio_dvbt,
450 &cx18_card_leadtek_pvr2100,
9d5af862 451 &cx18_card_leadtek_dvr3100h,
1c1e45d1
HV
452};
453
454const struct cx18_card *cx18_get_card(u16 index)
455{
456 if (index >= ARRAY_SIZE(cx18_card_list))
457 return NULL;
458 return cx18_card_list[index];
459}
460
461int cx18_get_input(struct cx18 *cx, u16 index, struct v4l2_input *input)
462{
463 const struct cx18_card_video_input *card_input =
464 cx->card->video_inputs + index;
465 static const char * const input_strs[] = {
466 "Tuner 1",
467 "S-Video 1",
468 "S-Video 2",
469 "Composite 1",
470 "Composite 2",
471 "Composite 3"
472 };
473
474 memset(input, 0, sizeof(*input));
475 if (index >= cx->nof_inputs)
476 return -EINVAL;
477 input->index = index;
478 strlcpy(input->name, input_strs[card_input->video_type - 1],
479 sizeof(input->name));
480 input->type = (card_input->video_type == CX18_CARD_INPUT_VID_TUNER ?
481 V4L2_INPUT_TYPE_TUNER : V4L2_INPUT_TYPE_CAMERA);
482 input->audioset = (1 << cx->nof_audio_inputs) - 1;
483 input->std = (input->type == V4L2_INPUT_TYPE_TUNER) ?
484 cx->tuner_std : V4L2_STD_ALL;
485 return 0;
486}
487
488int cx18_get_audio_input(struct cx18 *cx, u16 index, struct v4l2_audio *audio)
489{
490 const struct cx18_card_audio_input *aud_input =
491 cx->card->audio_inputs + index;
492 static const char * const input_strs[] = {
493 "Tuner 1",
494 "Line In 1",
495 "Line In 2"
496 };
497
498 memset(audio, 0, sizeof(*audio));
499 if (index >= cx->nof_audio_inputs)
500 return -EINVAL;
501 strlcpy(audio->name, input_strs[aud_input->audio_type - 1],
502 sizeof(audio->name));
503 audio->index = index;
504 audio->capability = V4L2_AUDCAP_STEREO;
505 return 0;
506}