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