]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/blame - drivers/media/pci/cx18/cx18-cards.c
treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 157
[mirror_ubuntu-hirsute-kernel.git] / drivers / media / pci / cx18 / cx18-cards.c
CommitLineData
c942fddf 1// SPDX-License-Identifier: GPL-2.0-or-later
1c1e45d1
HV
2/*
3 * cx18 functions to query card hardware
4 *
5 * Derived from ivtv-cards.c
6 *
7 * Copyright (C) 2007 Hans Verkuil <hverkuil@xs4all.nl>
6afdeaf8 8 * Copyright (C) 2008 Andy Walls <awalls@md.metrocast.net>
1c1e45d1
HV
9 */
10
11#include "cx18-driver.h"
12#include "cx18-cards.h"
d3d9b803 13#include "cx18-av-core.h"
1c1e45d1 14#include "cx18-i2c.h"
b5dcee22 15#include <media/i2c/cs5345.h>
1c1e45d1 16
156f194b 17#define V4L2_STD_PAL_SECAM (V4L2_STD_PAL|V4L2_STD_SECAM)
03c28085 18
1c1e45d1
HV
19/********************** card configuration *******************************/
20
21/* usual i2c tuner addresses to probe */
22static struct cx18_card_tuner_i2c cx18_i2c_std = {
23 .radio = { I2C_CLIENT_END },
24 .demod = { 0x43, I2C_CLIENT_END },
25 .tv = { 0x61, 0x60, I2C_CLIENT_END },
26};
27
2bfe2fa4
AW
28/*
29 * usual i2c tuner addresses to probe with additional demod address for
30 * an NXP TDA8295 at 0x42 (N.B. it can possibly be at 0x4b or 0x4c too).
31 */
32static struct cx18_card_tuner_i2c cx18_i2c_nxp = {
33 .radio = { I2C_CLIENT_END },
34 .demod = { 0x42, 0x43, I2C_CLIENT_END },
35 .tv = { 0x61, 0x60, I2C_CLIENT_END },
36};
37
a3634363 38/* Please add new PCI IDs to: http://pci-ids.ucw.cz/
1c1e45d1
HV
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. */
42
43/* Hauppauge HVR-1600 cards */
44
45/* Note: for Hauppauge cards the tveeprom information is used instead
46 of PCI IDs */
47static const struct cx18_card cx18_card_hvr1600_esmt = {
48 .type = CX18_CARD_HVR_1600_ESMT,
49 .name = "Hauppauge HVR-1600",
302df970 50 .comment = "Simultaneous Digital and Analog TV capture supported\n",
1c1e45d1 51 .v4l2_capabilities = CX18_CAP_ENCODER,
ff2a2001 52 .hw_audio_ctrl = CX18_HW_418_AV,
1c1e45d1 53 .hw_muxer = CX18_HW_CS5345,
ff2a2001 54 .hw_all = CX18_HW_TVEEPROM | CX18_HW_418_AV | CX18_HW_TUNER |
8ca95568
AW
55 CX18_HW_CS5345 | CX18_HW_DVB | CX18_HW_GPIO_RESET_CTRL |
56 CX18_HW_Z8F0811_IR_HAUP,
1c1e45d1 57 .video_inputs = {
d3d9b803
HV
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 },
1c1e45d1
HV
63 },
64 .audio_inputs = {
65 { CX18_CARD_INPUT_AUD_TUNER,
d3d9b803 66 CX18_AV_AUDIO8, CS5345_IN_1 | CS5345_MCLK_1_5 },
1c1e45d1 67 { CX18_CARD_INPUT_LINE_IN1,
81cb727d 68 CX18_AV_AUDIO_SERIAL1, CS5345_IN_2 },
1c1e45d1 69 { CX18_CARD_INPUT_LINE_IN2,
81cb727d 70 CX18_AV_AUDIO_SERIAL1, CS5345_IN_3 },
1c1e45d1
HV
71 },
72 .radio_input = { CX18_CARD_INPUT_AUD_TUNER,
81cb727d 73 CX18_AV_AUDIO_SERIAL1, CS5345_IN_4 },
1c1e45d1
HV
74 .ddr = {
75 /* ESMT M13S128324A-5B memory */
76 .chip_config = 0x003,
77 .refresh = 0x30c,
78 .timing1 = 0x44220e82,
79 .timing2 = 0x08,
80 .tune_lane = 0,
81 .initial_emrs = 0,
82 },
83 .gpio_init.initial_value = 0x3001,
84 .gpio_init.direction = 0x3001,
1f09e8a2
AW
85 .gpio_i2c_slave_reset = {
86 .active_lo_mask = 0x3001,
87 .msecs_asserted = 10,
88 .msecs_recovery = 40,
02fa272f 89 .ir_reset_mask = 0x0001,
1f09e8a2 90 },
1c1e45d1
HV
91 .i2c = &cx18_i2c_std,
92};
93
e3bfeabb
DH
94static const struct cx18_card cx18_card_hvr1600_s5h1411 = {
95 .type = CX18_CARD_HVR_1600_S5H1411,
96 .name = "Hauppauge HVR-1600",
97 .comment = "Simultaneous Digital and Analog TV capture supported\n",
98 .v4l2_capabilities = CX18_CAP_ENCODER,
99 .hw_audio_ctrl = CX18_HW_418_AV,
100 .hw_muxer = CX18_HW_CS5345,
101 .hw_all = CX18_HW_TVEEPROM | CX18_HW_418_AV | CX18_HW_TUNER |
102 CX18_HW_CS5345 | CX18_HW_DVB | CX18_HW_GPIO_RESET_CTRL |
103 CX18_HW_Z8F0811_IR_HAUP,
104 .video_inputs = {
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 },
110 },
111 .audio_inputs = {
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_SERIAL1, CS5345_IN_2 },
116 { CX18_CARD_INPUT_LINE_IN2,
117 CX18_AV_AUDIO_SERIAL1, CS5345_IN_3 },
118 },
119 .radio_input = { CX18_CARD_INPUT_AUD_TUNER,
120 CX18_AV_AUDIO_SERIAL1, CS5345_IN_4 },
121 .ddr = {
122 /* ESMT M13S128324A-5B memory */
123 .chip_config = 0x003,
124 .refresh = 0x30c,
125 .timing1 = 0x44220e82,
126 .timing2 = 0x08,
127 .tune_lane = 0,
128 .initial_emrs = 0,
129 },
2bfe2fa4
AW
130 .gpio_init.initial_value = 0x3801,
131 .gpio_init.direction = 0x3801,
e3bfeabb 132 .gpio_i2c_slave_reset = {
2bfe2fa4 133 .active_lo_mask = 0x3801,
e3bfeabb
DH
134 .msecs_asserted = 10,
135 .msecs_recovery = 40,
136 .ir_reset_mask = 0x0001,
137 },
2bfe2fa4 138 .i2c = &cx18_i2c_nxp,
e3bfeabb
DH
139};
140
1c1e45d1
HV
141static const struct cx18_card cx18_card_hvr1600_samsung = {
142 .type = CX18_CARD_HVR_1600_SAMSUNG,
143 .name = "Hauppauge HVR-1600 (Preproduction)",
302df970 144 .comment = "Simultaneous Digital and Analog TV capture supported\n",
1c1e45d1 145 .v4l2_capabilities = CX18_CAP_ENCODER,
ff2a2001 146 .hw_audio_ctrl = CX18_HW_418_AV,
1c1e45d1 147 .hw_muxer = CX18_HW_CS5345,
ff2a2001 148 .hw_all = CX18_HW_TVEEPROM | CX18_HW_418_AV | CX18_HW_TUNER |
8ca95568
AW
149 CX18_HW_CS5345 | CX18_HW_DVB | CX18_HW_GPIO_RESET_CTRL |
150 CX18_HW_Z8F0811_IR_HAUP,
1c1e45d1 151 .video_inputs = {
d3d9b803
HV
152 { CX18_CARD_INPUT_VID_TUNER, 0, CX18_AV_COMPOSITE7 },
153 { CX18_CARD_INPUT_SVIDEO1, 1, CX18_AV_SVIDEO1 },
154 { CX18_CARD_INPUT_COMPOSITE1, 1, CX18_AV_COMPOSITE3 },
155 { CX18_CARD_INPUT_SVIDEO2, 2, CX18_AV_SVIDEO2 },
156 { CX18_CARD_INPUT_COMPOSITE2, 2, CX18_AV_COMPOSITE4 },
1c1e45d1
HV
157 },
158 .audio_inputs = {
159 { CX18_CARD_INPUT_AUD_TUNER,
d3d9b803 160 CX18_AV_AUDIO8, CS5345_IN_1 | CS5345_MCLK_1_5 },
1c1e45d1 161 { CX18_CARD_INPUT_LINE_IN1,
81cb727d 162 CX18_AV_AUDIO_SERIAL1, CS5345_IN_2 },
1c1e45d1 163 { CX18_CARD_INPUT_LINE_IN2,
81cb727d 164 CX18_AV_AUDIO_SERIAL1, CS5345_IN_3 },
1c1e45d1
HV
165 },
166 .radio_input = { CX18_CARD_INPUT_AUD_TUNER,
81cb727d 167 CX18_AV_AUDIO_SERIAL1, CS5345_IN_4 },
1c1e45d1
HV
168 .ddr = {
169 /* Samsung K4D263238G-VC33 memory */
170 .chip_config = 0x003,
171 .refresh = 0x30c,
172 .timing1 = 0x23230b73,
173 .timing2 = 0x08,
174 .tune_lane = 0,
175 .initial_emrs = 2,
176 },
177 .gpio_init.initial_value = 0x3001,
178 .gpio_init.direction = 0x3001,
1f09e8a2
AW
179 .gpio_i2c_slave_reset = {
180 .active_lo_mask = 0x3001,
181 .msecs_asserted = 10,
182 .msecs_recovery = 40,
02fa272f 183 .ir_reset_mask = 0x0001,
1f09e8a2 184 },
1c1e45d1
HV
185 .i2c = &cx18_i2c_std,
186};
187
188/* ------------------------------------------------------------------------- */
189
8f993573 190/* Compro VideoMate H900: note that this card is analog only! */
1c1e45d1
HV
191
192static const struct cx18_card_pci_info cx18_pci_h900[] = {
193 { PCI_DEVICE_ID_CX23418, CX18_PCI_ID_COMPRO, 0xe100 },
194 { 0, 0, 0 }
195};
196
197static const struct cx18_card cx18_card_h900 = {
198 .type = CX18_CARD_COMPRO_H900,
199 .name = "Compro VideoMate H900",
302df970 200 .comment = "Analog TV capture supported\n",
9dcbf35a 201 .v4l2_capabilities = CX18_CAP_ENCODER,
ff2a2001 202 .hw_audio_ctrl = CX18_HW_418_AV,
eefe1010 203 .hw_all = CX18_HW_418_AV | CX18_HW_TUNER | CX18_HW_GPIO_RESET_CTRL,
1c1e45d1 204 .video_inputs = {
d3d9b803 205 { CX18_CARD_INPUT_VID_TUNER, 0, CX18_AV_COMPOSITE2 },
9dcbf35a 206 { CX18_CARD_INPUT_SVIDEO1, 1,
d3d9b803
HV
207 CX18_AV_SVIDEO_LUMA3 | CX18_AV_SVIDEO_CHROMA4 },
208 { CX18_CARD_INPUT_COMPOSITE1, 1, CX18_AV_COMPOSITE1 },
1c1e45d1
HV
209 },
210 .audio_inputs = {
211 { CX18_CARD_INPUT_AUD_TUNER,
1167b2e4 212 CX18_AV_AUDIO5, 0 },
1c1e45d1 213 { CX18_CARD_INPUT_LINE_IN1,
81cb727d 214 CX18_AV_AUDIO_SERIAL1, 0 },
1c1e45d1
HV
215 },
216 .radio_input = { CX18_CARD_INPUT_AUD_TUNER,
81cb727d 217 CX18_AV_AUDIO_SERIAL1, 0 },
1c1e45d1
HV
218 .tuners = {
219 { .std = V4L2_STD_ALL, .tuner = TUNER_XC2028 },
220 },
221 .ddr = {
222 /* EtronTech EM6A9160TS-5G memory */
223 .chip_config = 0x50003,
224 .refresh = 0x753,
225 .timing1 = 0x24330e84,
226 .timing2 = 0x1f,
227 .tune_lane = 0,
228 .initial_emrs = 0,
229 },
9dcbf35a 230 .xceive_pin = 15,
1c1e45d1
HV
231 .pci_list = cx18_pci_h900,
232 .i2c = &cx18_i2c_std,
233};
234
235/* ------------------------------------------------------------------------- */
236
237/* Yuan MPC718: not working at the moment! */
238
239static const struct cx18_card_pci_info cx18_pci_mpc718[] = {
240 { PCI_DEVICE_ID_CX23418, CX18_PCI_ID_YUAN, 0x0718 },
241 { 0, 0, 0 }
242};
243
244static const struct cx18_card cx18_card_mpc718 = {
245 .type = CX18_CARD_YUAN_MPC718,
637fb3d7
AW
246 .name = "Yuan MPC718 MiniPCI DVB-T/Analog",
247 .comment = "Experimenters needed for device to work well.\n"
248 "\tTo help, mail the ivtv-devel list (www.ivtvdriver.org).\n",
ad907fa3 249 .v4l2_capabilities = CX18_CAP_ENCODER,
ff2a2001 250 .hw_audio_ctrl = CX18_HW_418_AV,
637fb3d7 251 .hw_muxer = CX18_HW_GPIO_MUX,
25a42e4d 252 .hw_all = CX18_HW_TVEEPROM | CX18_HW_418_AV | CX18_HW_TUNER |
ff861fb2 253 CX18_HW_GPIO_MUX | CX18_HW_DVB | CX18_HW_GPIO_RESET_CTRL,
1c1e45d1 254 .video_inputs = {
ad907fa3
AW
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 },
1c1e45d1
HV
262 },
263 .audio_inputs = {
81cb727d 264 { CX18_CARD_INPUT_AUD_TUNER, CX18_AV_AUDIO5, 0 },
637fb3d7
AW
265 { CX18_CARD_INPUT_LINE_IN1, CX18_AV_AUDIO_SERIAL1, 1 },
266 { CX18_CARD_INPUT_LINE_IN2, CX18_AV_AUDIO_SERIAL2, 1 },
1c1e45d1 267 },
1c1e45d1
HV
268 .tuners = {
269 /* XC3028 tuner */
270 { .std = V4L2_STD_ALL, .tuner = TUNER_XC2028 },
271 },
637fb3d7
AW
272 /* FIXME - the FM radio is just a guess and driver doesn't use SIF */
273 .radio_input = { CX18_CARD_INPUT_AUD_TUNER, CX18_AV_AUDIO5, 2 },
1c1e45d1 274 .ddr = {
637fb3d7
AW
275 /* Hynix HY5DU283222B DDR RAM */
276 .chip_config = 0x303,
277 .refresh = 0x3bd,
278 .timing1 = 0x36320966,
279 .timing2 = 0x1f,
1c1e45d1
HV
280 .tune_lane = 0,
281 .initial_emrs = 2,
282 },
637fb3d7
AW
283 .gpio_init.initial_value = 0x1,
284 .gpio_init.direction = 0x3,
285 /* FIXME - these GPIO's are just guesses */
286 .gpio_audio_input = { .mask = 0x3,
287 .tuner = 0x1,
288 .linein = 0x3,
289 .radio = 0x1 },
0c616214 290 .xceive_pin = 0,
1c1e45d1
HV
291 .pci_list = cx18_pci_mpc718,
292 .i2c = &cx18_i2c_std,
293};
294
03c28085
SD
295/* ------------------------------------------------------------------------- */
296
a3634363
AC
297/* GoTView PCI */
298
299static const struct cx18_card_pci_info cx18_pci_gotview_dvd3[] = {
300 { PCI_DEVICE_ID_CX23418, CX18_PCI_ID_GOTVIEW, 0x3343 },
301 { 0, 0, 0 }
302};
303
304static const struct cx18_card cx18_card_gotview_dvd3 = {
305 .type = CX18_CARD_GOTVIEW_PCI_DVD3,
306 .name = "GoTView PCI DVD3 Hybrid",
307 .comment = "Experimenters needed for device to work well.\n"
308 "\tTo help, mail the ivtv-devel list (www.ivtvdriver.org).\n",
309 .v4l2_capabilities = CX18_CAP_ENCODER,
310 .hw_audio_ctrl = CX18_HW_418_AV,
311 .hw_muxer = CX18_HW_GPIO_MUX,
312 .hw_all = CX18_HW_TVEEPROM | CX18_HW_418_AV | CX18_HW_TUNER |
313 CX18_HW_GPIO_MUX | CX18_HW_DVB | CX18_HW_GPIO_RESET_CTRL,
314 .video_inputs = {
315 { CX18_CARD_INPUT_VID_TUNER, 0, CX18_AV_COMPOSITE2 },
316 { CX18_CARD_INPUT_SVIDEO1, 1,
317 CX18_AV_SVIDEO_LUMA3 | CX18_AV_SVIDEO_CHROMA4 },
318 { CX18_CARD_INPUT_COMPOSITE1, 1, CX18_AV_COMPOSITE1 },
319 { CX18_CARD_INPUT_SVIDEO2, 2,
320 CX18_AV_SVIDEO_LUMA7 | CX18_AV_SVIDEO_CHROMA8 },
321 { CX18_CARD_INPUT_COMPOSITE2, 2, CX18_AV_COMPOSITE6 },
322 },
323 .audio_inputs = {
324 { CX18_CARD_INPUT_AUD_TUNER, CX18_AV_AUDIO5, 0 },
325 { CX18_CARD_INPUT_LINE_IN1, CX18_AV_AUDIO_SERIAL1, 1 },
326 { CX18_CARD_INPUT_LINE_IN2, CX18_AV_AUDIO_SERIAL2, 1 },
327 },
328 .tuners = {
329 /* XC3028 tuner */
330 { .std = V4L2_STD_ALL, .tuner = TUNER_XC2028 },
331 },
332 /* FIXME - the FM radio is just a guess and driver doesn't use SIF */
333 .radio_input = { CX18_CARD_INPUT_AUD_TUNER, CX18_AV_AUDIO5, 2 },
334 .ddr = {
335 /* Hynix HY5DU283222B DDR RAM */
336 .chip_config = 0x303,
337 .refresh = 0x3bd,
338 .timing1 = 0x36320966,
339 .timing2 = 0x1f,
340 .tune_lane = 0,
341 .initial_emrs = 2,
342 },
343 .gpio_init.initial_value = 0x1,
344 .gpio_init.direction = 0x3,
345
346 .gpio_audio_input = { .mask = 0x3,
347 .tuner = 0x1,
348 .linein = 0x2,
349 .radio = 0x1 },
350 .xceive_pin = 0,
351 .pci_list = cx18_pci_gotview_dvd3,
352 .i2c = &cx18_i2c_std,
353};
354
355/* ------------------------------------------------------------------------- */
356
03c28085
SD
357/* Conexant Raptor PAL/SECAM: note that this card is analog only! */
358
359static const struct cx18_card_pci_info cx18_pci_cnxt_raptor_pal[] = {
360 { PCI_DEVICE_ID_CX23418, CX18_PCI_ID_CONEXANT, 0x0009 },
361 { 0, 0, 0 }
362};
363
364static const struct cx18_card cx18_card_cnxt_raptor_pal = {
365 .type = CX18_CARD_CNXT_RAPTOR_PAL,
366 .name = "Conexant Raptor PAL/SECAM",
302df970 367 .comment = "Analog TV capture supported\n",
03c28085 368 .v4l2_capabilities = CX18_CAP_ENCODER,
ff2a2001 369 .hw_audio_ctrl = CX18_HW_418_AV,
eefe1010
AW
370 .hw_muxer = CX18_HW_GPIO_MUX,
371 .hw_all = CX18_HW_418_AV | CX18_HW_TUNER | CX18_HW_GPIO_MUX,
03c28085
SD
372 .video_inputs = {
373 { CX18_CARD_INPUT_VID_TUNER, 0, CX18_AV_COMPOSITE2 },
374 { CX18_CARD_INPUT_SVIDEO1, 1,
375 CX18_AV_SVIDEO_LUMA3 | CX18_AV_SVIDEO_CHROMA4 },
376 { CX18_CARD_INPUT_COMPOSITE1, 1, CX18_AV_COMPOSITE1 },
377 { CX18_CARD_INPUT_SVIDEO2, 2,
378 CX18_AV_SVIDEO_LUMA7 | CX18_AV_SVIDEO_CHROMA8 },
379 { CX18_CARD_INPUT_COMPOSITE2, 2, CX18_AV_COMPOSITE6 },
380 },
381 .audio_inputs = {
6e6a8b5a 382 { CX18_CARD_INPUT_AUD_TUNER, CX18_AV_AUDIO5, 0 },
81cb727d
HV
383 { CX18_CARD_INPUT_LINE_IN1, CX18_AV_AUDIO_SERIAL1, 1 },
384 { CX18_CARD_INPUT_LINE_IN2, CX18_AV_AUDIO_SERIAL2, 1 },
03c28085
SD
385 },
386 .tuners = {
156f194b 387 { .std = V4L2_STD_PAL_SECAM, .tuner = TUNER_PHILIPS_FM1216ME_MK3 },
03c28085 388 },
81cb727d 389 .radio_input = { CX18_CARD_INPUT_AUD_TUNER, CX18_AV_AUDIO_SERIAL1, 2 },
03c28085
SD
390 .ddr = {
391 /* MT 46V16M16 memory */
392 .chip_config = 0x50306,
393 .refresh = 0x753,
394 .timing1 = 0x33220953,
395 .timing2 = 0x09,
396 .tune_lane = 0,
397 .initial_emrs = 0,
398 },
c5588b5c
AW
399 .gpio_init.initial_value = 0x1002,
400 .gpio_init.direction = 0xf002,
401 .gpio_audio_input = { .mask = 0xf002,
402 .tuner = 0x1002, /* LED D1 Tuner AF */
403 .linein = 0x2000, /* LED D2 Line In 1 */
404 .radio = 0x4002 }, /* LED D3 Tuner AF */
03c28085
SD
405 .pci_list = cx18_pci_cnxt_raptor_pal,
406 .i2c = &cx18_i2c_std,
407};
408
409/* ------------------------------------------------------------------------- */
410
9eee4fb6
AW
411/* Toshiba Qosmio laptop internal DVB-T/Analog Hybrid Tuner */
412
413static const struct cx18_card_pci_info cx18_pci_toshiba_qosmio_dvbt[] = {
414 { PCI_DEVICE_ID_CX23418, CX18_PCI_ID_TOSHIBA, 0x0110 },
415 { 0, 0, 0 }
416};
417
418static const struct cx18_card cx18_card_toshiba_qosmio_dvbt = {
419 .type = CX18_CARD_TOSHIBA_QOSMIO_DVBT,
420 .name = "Toshiba Qosmio DVB-T/Analog",
421 .comment = "Experimenters and photos needed for device to work well.\n"
422 "\tTo help, mail the ivtv-devel list (www.ivtvdriver.org).\n",
423 .v4l2_capabilities = CX18_CAP_ENCODER,
ff2a2001 424 .hw_audio_ctrl = CX18_HW_418_AV,
eefe1010 425 .hw_all = CX18_HW_418_AV | CX18_HW_TUNER | CX18_HW_GPIO_RESET_CTRL,
9eee4fb6
AW
426 .video_inputs = {
427 { CX18_CARD_INPUT_VID_TUNER, 0, CX18_AV_COMPOSITE6 },
428 { CX18_CARD_INPUT_SVIDEO1, 1,
429 CX18_AV_SVIDEO_LUMA3 | CX18_AV_SVIDEO_CHROMA4 },
430 { CX18_CARD_INPUT_COMPOSITE1, 1, CX18_AV_COMPOSITE1 },
431 },
432 .audio_inputs = {
6e6a8b5a 433 { CX18_CARD_INPUT_AUD_TUNER, CX18_AV_AUDIO5, 0 },
9eee4fb6
AW
434 { CX18_CARD_INPUT_LINE_IN1, CX18_AV_AUDIO_SERIAL1, 1 },
435 },
436 .tuners = {
437 { .std = V4L2_STD_ALL, .tuner = TUNER_XC2028 },
438 },
439 .ddr = {
440 .chip_config = 0x202,
441 .refresh = 0x3bb,
442 .timing1 = 0x33320a63,
443 .timing2 = 0x0a,
444 .tune_lane = 0,
445 .initial_emrs = 0x42,
446 },
447 .xceive_pin = 15,
448 .pci_list = cx18_pci_toshiba_qosmio_dvbt,
449 .i2c = &cx18_i2c_std,
450};
451
452/* ------------------------------------------------------------------------- */
453
454/* Leadtek WinFast PVR2100 */
455
456static const struct cx18_card_pci_info cx18_pci_leadtek_pvr2100[] = {
6ce9ee53 457 { PCI_DEVICE_ID_CX23418, CX18_PCI_ID_LEADTEK, 0x6f27 }, /* PVR2100 */
9eee4fb6
AW
458 { 0, 0, 0 }
459};
460
461static const struct cx18_card cx18_card_leadtek_pvr2100 = {
462 .type = CX18_CARD_LEADTEK_PVR2100,
9d5af862 463 .name = "Leadtek WinFast PVR2100",
9eee4fb6
AW
464 .comment = "Experimenters and photos needed for device to work well.\n"
465 "\tTo help, mail the ivtv-devel list (www.ivtvdriver.org).\n",
466 .v4l2_capabilities = CX18_CAP_ENCODER,
ff2a2001 467 .hw_audio_ctrl = CX18_HW_418_AV,
eefe1010
AW
468 .hw_muxer = CX18_HW_GPIO_MUX,
469 .hw_all = CX18_HW_418_AV | CX18_HW_TUNER | CX18_HW_GPIO_MUX |
470 CX18_HW_GPIO_RESET_CTRL,
9eee4fb6
AW
471 .video_inputs = {
472 { CX18_CARD_INPUT_VID_TUNER, 0, CX18_AV_COMPOSITE2 },
473 { CX18_CARD_INPUT_SVIDEO1, 1,
474 CX18_AV_SVIDEO_LUMA3 | CX18_AV_SVIDEO_CHROMA4 },
475 { CX18_CARD_INPUT_COMPOSITE1, 1, CX18_AV_COMPOSITE7 },
f978ac90 476 { CX18_CARD_INPUT_COMPONENT1, 1, CX18_AV_COMPONENT1 },
9eee4fb6
AW
477 },
478 .audio_inputs = {
6e6a8b5a 479 { CX18_CARD_INPUT_AUD_TUNER, CX18_AV_AUDIO5, 0 },
9eee4fb6
AW
480 { CX18_CARD_INPUT_LINE_IN1, CX18_AV_AUDIO_SERIAL1, 1 },
481 },
482 .tuners = {
9d5af862 483 /* XC2028 tuner */
9eee4fb6
AW
484 { .std = V4L2_STD_ALL, .tuner = TUNER_XC2028 },
485 },
486 .radio_input = { CX18_CARD_INPUT_AUD_TUNER, CX18_AV_AUDIO5, 2 },
487 .ddr = {
8bb09db3 488 /* Pointer to proper DDR config values provided by Terry Wu */
9eee4fb6
AW
489 .chip_config = 0x303,
490 .refresh = 0x3bb,
491 .timing1 = 0x24220e83,
492 .timing2 = 0x1f,
493 .tune_lane = 0,
494 .initial_emrs = 0x2,
495 },
496 .gpio_init.initial_value = 0x6,
497 .gpio_init.direction = 0x7,
498 .gpio_audio_input = { .mask = 0x7,
499 .tuner = 0x6, .linein = 0x2, .radio = 0x2 },
a8073119 500 .xceive_pin = 1,
9eee4fb6
AW
501 .pci_list = cx18_pci_leadtek_pvr2100,
502 .i2c = &cx18_i2c_std,
503};
504
505/* ------------------------------------------------------------------------- */
506
9d5af862
AW
507/* Leadtek WinFast DVR3100 H */
508
509static const struct cx18_card_pci_info cx18_pci_leadtek_dvr3100h[] = {
510 { PCI_DEVICE_ID_CX23418, CX18_PCI_ID_LEADTEK, 0x6690 }, /* DVR3100 H */
511 { 0, 0, 0 }
512};
513
514static const struct cx18_card cx18_card_leadtek_dvr3100h = {
515 .type = CX18_CARD_LEADTEK_DVR3100H,
516 .name = "Leadtek WinFast DVR3100 H",
8bb09db3
AW
517 .comment = "Simultaneous DVB-T and Analog capture supported,\n"
518 "\texcept when capturing Analog from the antenna input.\n",
9d5af862
AW
519 .v4l2_capabilities = CX18_CAP_ENCODER,
520 .hw_audio_ctrl = CX18_HW_418_AV,
521 .hw_muxer = CX18_HW_GPIO_MUX,
522 .hw_all = CX18_HW_418_AV | CX18_HW_TUNER | CX18_HW_GPIO_MUX |
8bb09db3 523 CX18_HW_DVB | CX18_HW_GPIO_RESET_CTRL,
9d5af862
AW
524 .video_inputs = {
525 { CX18_CARD_INPUT_VID_TUNER, 0, CX18_AV_COMPOSITE2 },
526 { CX18_CARD_INPUT_SVIDEO1, 1,
527 CX18_AV_SVIDEO_LUMA3 | CX18_AV_SVIDEO_CHROMA4 },
528 { CX18_CARD_INPUT_COMPOSITE1, 1, CX18_AV_COMPOSITE7 },
f978ac90 529 { CX18_CARD_INPUT_COMPONENT1, 1, CX18_AV_COMPONENT1 },
9d5af862
AW
530 },
531 .audio_inputs = {
6e6a8b5a 532 { CX18_CARD_INPUT_AUD_TUNER, CX18_AV_AUDIO5, 0 },
9d5af862
AW
533 { CX18_CARD_INPUT_LINE_IN1, CX18_AV_AUDIO_SERIAL1, 1 },
534 },
535 .tuners = {
536 /* XC3028 tuner */
537 { .std = V4L2_STD_ALL, .tuner = TUNER_XC2028 },
538 },
539 .radio_input = { CX18_CARD_INPUT_AUD_TUNER, CX18_AV_AUDIO5, 2 },
540 .ddr = {
8bb09db3 541 /* Pointer to proper DDR config values provided by Terry Wu */
9d5af862
AW
542 .chip_config = 0x303,
543 .refresh = 0x3bb,
544 .timing1 = 0x24220e83,
545 .timing2 = 0x1f,
546 .tune_lane = 0,
547 .initial_emrs = 0x2,
548 },
549 .gpio_init.initial_value = 0x6,
550 .gpio_init.direction = 0x7,
551 .gpio_audio_input = { .mask = 0x7,
552 .tuner = 0x6, .linein = 0x2, .radio = 0x2 },
8bb09db3 553 .xceive_pin = 1,
9d5af862
AW
554 .pci_list = cx18_pci_leadtek_dvr3100h,
555 .i2c = &cx18_i2c_std,
556};
557
558/* ------------------------------------------------------------------------- */
559
1c1e45d1
HV
560static const struct cx18_card *cx18_card_list[] = {
561 &cx18_card_hvr1600_esmt,
562 &cx18_card_hvr1600_samsung,
563 &cx18_card_h900,
564 &cx18_card_mpc718,
03c28085 565 &cx18_card_cnxt_raptor_pal,
9eee4fb6
AW
566 &cx18_card_toshiba_qosmio_dvbt,
567 &cx18_card_leadtek_pvr2100,
9d5af862 568 &cx18_card_leadtek_dvr3100h,
e3bfeabb
DH
569 &cx18_card_gotview_dvd3,
570 &cx18_card_hvr1600_s5h1411
1c1e45d1
HV
571};
572
573const struct cx18_card *cx18_get_card(u16 index)
574{
575 if (index >= ARRAY_SIZE(cx18_card_list))
576 return NULL;
577 return cx18_card_list[index];
578}
579
580int cx18_get_input(struct cx18 *cx, u16 index, struct v4l2_input *input)
581{
582 const struct cx18_card_video_input *card_input =
583 cx->card->video_inputs + index;
584 static const char * const input_strs[] = {
585 "Tuner 1",
586 "S-Video 1",
587 "S-Video 2",
588 "Composite 1",
589 "Composite 2",
d9a325a8 590 "Component 1"
1c1e45d1
HV
591 };
592
1c1e45d1
HV
593 if (index >= cx->nof_inputs)
594 return -EINVAL;
595 input->index = index;
c0decac1
MCC
596 strscpy(input->name, input_strs[card_input->video_type - 1],
597 sizeof(input->name));
1c1e45d1
HV
598 input->type = (card_input->video_type == CX18_CARD_INPUT_VID_TUNER ?
599 V4L2_INPUT_TYPE_TUNER : V4L2_INPUT_TYPE_CAMERA);
600 input->audioset = (1 << cx->nof_audio_inputs) - 1;
601 input->std = (input->type == V4L2_INPUT_TYPE_TUNER) ?
602 cx->tuner_std : V4L2_STD_ALL;
603 return 0;
604}
605
606int cx18_get_audio_input(struct cx18 *cx, u16 index, struct v4l2_audio *audio)
607{
608 const struct cx18_card_audio_input *aud_input =
609 cx->card->audio_inputs + index;
610 static const char * const input_strs[] = {
611 "Tuner 1",
612 "Line In 1",
613 "Line In 2"
614 };
615
616 memset(audio, 0, sizeof(*audio));
617 if (index >= cx->nof_audio_inputs)
618 return -EINVAL;
c0decac1
MCC
619 strscpy(audio->name, input_strs[aud_input->audio_type - 1],
620 sizeof(audio->name));
1c1e45d1
HV
621 audio->index = index;
622 audio->capability = V4L2_AUDCAP_STEREO;
623 return 0;
624}