blob: f808fb6fc1c12c1e4bc9cb320e881dfa66fba0c2 [file] [log] [blame]
Hans Verkuil1c1e45d2008-04-28 20:24:33 -03001/*
2 * cx18 functions to query card hardware
3 *
4 * Derived from ivtv-cards.c
5 *
6 * Copyright (C) 2007 Hans Verkuil <hverkuil@xs4all.nl>
Andy Walls1ed9dcc2008-11-22 01:37:34 -03007 * Copyright (C) 2008 Andy Walls <awalls@radix.net>
Hans Verkuil1c1e45d2008-04-28 20:24:33 -03008 *
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"
Hans Verkuild3d9b802008-06-08 06:05:18 -030027#include "cx18-av-core.h"
Hans Verkuil1c1e45d2008-04-28 20:24:33 -030028#include "cx18-i2c.h"
29#include <media/cs5345.h>
30
Hans Verkuil156f1942008-06-22 12:08:16 -030031#define V4L2_STD_PAL_SECAM (V4L2_STD_PAL|V4L2_STD_SECAM)
Sri Deevi03c28082008-06-21 11:06:44 -030032
Hans Verkuil1c1e45d2008-04-28 20:24:33 -030033/********************** 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",
Andy Walls302df972009-01-31 00:33:02 -030054 .comment = "Simultaneous Digital and Analog TV capture supported\n",
Hans Verkuil1c1e45d2008-04-28 20:24:33 -030055 .v4l2_capabilities = CX18_CAP_ENCODER,
Andy Wallsff2a2002009-02-20 23:52:13 -030056 .hw_audio_ctrl = CX18_HW_418_AV,
Hans Verkuil1c1e45d2008-04-28 20:24:33 -030057 .hw_muxer = CX18_HW_CS5345,
Andy Wallsff2a2002009-02-20 23:52:13 -030058 .hw_all = CX18_HW_TVEEPROM | CX18_HW_418_AV | CX18_HW_TUNER |
Andy Walls8ca95562009-07-28 11:48:18 -030059 CX18_HW_CS5345 | CX18_HW_DVB | CX18_HW_GPIO_RESET_CTRL |
60 CX18_HW_Z8F0811_IR_HAUP,
Hans Verkuil1c1e45d2008-04-28 20:24:33 -030061 .video_inputs = {
Hans Verkuild3d9b802008-06-08 06:05:18 -030062 { CX18_CARD_INPUT_VID_TUNER, 0, CX18_AV_COMPOSITE7 },
63 { CX18_CARD_INPUT_SVIDEO1, 1, CX18_AV_SVIDEO1 },
64 { CX18_CARD_INPUT_COMPOSITE1, 1, CX18_AV_COMPOSITE3 },
65 { CX18_CARD_INPUT_SVIDEO2, 2, CX18_AV_SVIDEO2 },
66 { CX18_CARD_INPUT_COMPOSITE2, 2, CX18_AV_COMPOSITE4 },
Hans Verkuil1c1e45d2008-04-28 20:24:33 -030067 },
68 .audio_inputs = {
69 { CX18_CARD_INPUT_AUD_TUNER,
Hans Verkuild3d9b802008-06-08 06:05:18 -030070 CX18_AV_AUDIO8, CS5345_IN_1 | CS5345_MCLK_1_5 },
Hans Verkuil1c1e45d2008-04-28 20:24:33 -030071 { CX18_CARD_INPUT_LINE_IN1,
Hans Verkuil81cb727d2008-06-28 12:49:20 -030072 CX18_AV_AUDIO_SERIAL1, CS5345_IN_2 },
Hans Verkuil1c1e45d2008-04-28 20:24:33 -030073 { CX18_CARD_INPUT_LINE_IN2,
Hans Verkuil81cb727d2008-06-28 12:49:20 -030074 CX18_AV_AUDIO_SERIAL1, CS5345_IN_3 },
Hans Verkuil1c1e45d2008-04-28 20:24:33 -030075 },
76 .radio_input = { CX18_CARD_INPUT_AUD_TUNER,
Hans Verkuil81cb727d2008-06-28 12:49:20 -030077 CX18_AV_AUDIO_SERIAL1, CS5345_IN_4 },
Hans Verkuil1c1e45d2008-04-28 20:24:33 -030078 .ddr = {
79 /* ESMT M13S128324A-5B memory */
80 .chip_config = 0x003,
81 .refresh = 0x30c,
82 .timing1 = 0x44220e82,
83 .timing2 = 0x08,
84 .tune_lane = 0,
85 .initial_emrs = 0,
86 },
87 .gpio_init.initial_value = 0x3001,
88 .gpio_init.direction = 0x3001,
Andy Walls1f09e8a2008-06-22 01:27:00 -030089 .gpio_i2c_slave_reset = {
90 .active_lo_mask = 0x3001,
91 .msecs_asserted = 10,
92 .msecs_recovery = 40,
Andy Walls02fa2722008-07-13 19:30:15 -030093 .ir_reset_mask = 0x0001,
Andy Walls1f09e8a2008-06-22 01:27:00 -030094 },
Hans Verkuil1c1e45d2008-04-28 20:24:33 -030095 .i2c = &cx18_i2c_std,
96};
97
98static const struct cx18_card cx18_card_hvr1600_samsung = {
99 .type = CX18_CARD_HVR_1600_SAMSUNG,
100 .name = "Hauppauge HVR-1600 (Preproduction)",
Andy Walls302df972009-01-31 00:33:02 -0300101 .comment = "Simultaneous Digital and Analog TV capture supported\n",
Hans Verkuil1c1e45d2008-04-28 20:24:33 -0300102 .v4l2_capabilities = CX18_CAP_ENCODER,
Andy Wallsff2a2002009-02-20 23:52:13 -0300103 .hw_audio_ctrl = CX18_HW_418_AV,
Hans Verkuil1c1e45d2008-04-28 20:24:33 -0300104 .hw_muxer = CX18_HW_CS5345,
Andy Wallsff2a2002009-02-20 23:52:13 -0300105 .hw_all = CX18_HW_TVEEPROM | CX18_HW_418_AV | CX18_HW_TUNER |
Andy Walls8ca95562009-07-28 11:48:18 -0300106 CX18_HW_CS5345 | CX18_HW_DVB | CX18_HW_GPIO_RESET_CTRL |
107 CX18_HW_Z8F0811_IR_HAUP,
Hans Verkuil1c1e45d2008-04-28 20:24:33 -0300108 .video_inputs = {
Hans Verkuild3d9b802008-06-08 06:05:18 -0300109 { CX18_CARD_INPUT_VID_TUNER, 0, CX18_AV_COMPOSITE7 },
110 { CX18_CARD_INPUT_SVIDEO1, 1, CX18_AV_SVIDEO1 },
111 { CX18_CARD_INPUT_COMPOSITE1, 1, CX18_AV_COMPOSITE3 },
112 { CX18_CARD_INPUT_SVIDEO2, 2, CX18_AV_SVIDEO2 },
113 { CX18_CARD_INPUT_COMPOSITE2, 2, CX18_AV_COMPOSITE4 },
Hans Verkuil1c1e45d2008-04-28 20:24:33 -0300114 },
115 .audio_inputs = {
116 { CX18_CARD_INPUT_AUD_TUNER,
Hans Verkuild3d9b802008-06-08 06:05:18 -0300117 CX18_AV_AUDIO8, CS5345_IN_1 | CS5345_MCLK_1_5 },
Hans Verkuil1c1e45d2008-04-28 20:24:33 -0300118 { CX18_CARD_INPUT_LINE_IN1,
Hans Verkuil81cb727d2008-06-28 12:49:20 -0300119 CX18_AV_AUDIO_SERIAL1, CS5345_IN_2 },
Hans Verkuil1c1e45d2008-04-28 20:24:33 -0300120 { CX18_CARD_INPUT_LINE_IN2,
Hans Verkuil81cb727d2008-06-28 12:49:20 -0300121 CX18_AV_AUDIO_SERIAL1, CS5345_IN_3 },
Hans Verkuil1c1e45d2008-04-28 20:24:33 -0300122 },
123 .radio_input = { CX18_CARD_INPUT_AUD_TUNER,
Hans Verkuil81cb727d2008-06-28 12:49:20 -0300124 CX18_AV_AUDIO_SERIAL1, CS5345_IN_4 },
Hans Verkuil1c1e45d2008-04-28 20:24:33 -0300125 .ddr = {
126 /* Samsung K4D263238G-VC33 memory */
127 .chip_config = 0x003,
128 .refresh = 0x30c,
129 .timing1 = 0x23230b73,
130 .timing2 = 0x08,
131 .tune_lane = 0,
132 .initial_emrs = 2,
133 },
134 .gpio_init.initial_value = 0x3001,
135 .gpio_init.direction = 0x3001,
Andy Walls1f09e8a2008-06-22 01:27:00 -0300136 .gpio_i2c_slave_reset = {
137 .active_lo_mask = 0x3001,
138 .msecs_asserted = 10,
139 .msecs_recovery = 40,
Andy Walls02fa2722008-07-13 19:30:15 -0300140 .ir_reset_mask = 0x0001,
Andy Walls1f09e8a2008-06-22 01:27:00 -0300141 },
Hans Verkuil1c1e45d2008-04-28 20:24:33 -0300142 .i2c = &cx18_i2c_std,
143};
144
145/* ------------------------------------------------------------------------- */
146
Hans Verkuil8f993572008-05-25 11:45:53 -0300147/* Compro VideoMate H900: note that this card is analog only! */
Hans Verkuil1c1e45d2008-04-28 20:24:33 -0300148
149static const struct cx18_card_pci_info cx18_pci_h900[] = {
150 { PCI_DEVICE_ID_CX23418, CX18_PCI_ID_COMPRO, 0xe100 },
151 { 0, 0, 0 }
152};
153
154static const struct cx18_card cx18_card_h900 = {
155 .type = CX18_CARD_COMPRO_H900,
156 .name = "Compro VideoMate H900",
Andy Walls302df972009-01-31 00:33:02 -0300157 .comment = "Analog TV capture supported\n",
Hans Verkuil9dcbf352008-05-12 13:57:18 -0300158 .v4l2_capabilities = CX18_CAP_ENCODER,
Andy Wallsff2a2002009-02-20 23:52:13 -0300159 .hw_audio_ctrl = CX18_HW_418_AV,
Andy Wallseefe1012009-02-21 18:42:49 -0300160 .hw_all = CX18_HW_418_AV | CX18_HW_TUNER | CX18_HW_GPIO_RESET_CTRL,
Hans Verkuil1c1e45d2008-04-28 20:24:33 -0300161 .video_inputs = {
Hans Verkuild3d9b802008-06-08 06:05:18 -0300162 { CX18_CARD_INPUT_VID_TUNER, 0, CX18_AV_COMPOSITE2 },
Hans Verkuil9dcbf352008-05-12 13:57:18 -0300163 { CX18_CARD_INPUT_SVIDEO1, 1,
Hans Verkuild3d9b802008-06-08 06:05:18 -0300164 CX18_AV_SVIDEO_LUMA3 | CX18_AV_SVIDEO_CHROMA4 },
165 { CX18_CARD_INPUT_COMPOSITE1, 1, CX18_AV_COMPOSITE1 },
Hans Verkuil1c1e45d2008-04-28 20:24:33 -0300166 },
167 .audio_inputs = {
168 { CX18_CARD_INPUT_AUD_TUNER,
Hans Verkuil1167b2e2008-09-06 07:22:13 -0300169 CX18_AV_AUDIO5, 0 },
Hans Verkuil1c1e45d2008-04-28 20:24:33 -0300170 { CX18_CARD_INPUT_LINE_IN1,
Hans Verkuil81cb727d2008-06-28 12:49:20 -0300171 CX18_AV_AUDIO_SERIAL1, 0 },
Hans Verkuil1c1e45d2008-04-28 20:24:33 -0300172 },
173 .radio_input = { CX18_CARD_INPUT_AUD_TUNER,
Hans Verkuil81cb727d2008-06-28 12:49:20 -0300174 CX18_AV_AUDIO_SERIAL1, 0 },
Hans Verkuil1c1e45d2008-04-28 20:24:33 -0300175 .tuners = {
176 { .std = V4L2_STD_ALL, .tuner = TUNER_XC2028 },
177 },
178 .ddr = {
179 /* EtronTech EM6A9160TS-5G memory */
180 .chip_config = 0x50003,
181 .refresh = 0x753,
182 .timing1 = 0x24330e84,
183 .timing2 = 0x1f,
184 .tune_lane = 0,
185 .initial_emrs = 0,
186 },
Hans Verkuil9dcbf352008-05-12 13:57:18 -0300187 .xceive_pin = 15,
Hans Verkuil1c1e45d2008-04-28 20:24:33 -0300188 .pci_list = cx18_pci_h900,
189 .i2c = &cx18_i2c_std,
190};
191
192/* ------------------------------------------------------------------------- */
193
194/* Yuan MPC718: not working at the moment! */
195
196static const struct cx18_card_pci_info cx18_pci_mpc718[] = {
197 { PCI_DEVICE_ID_CX23418, CX18_PCI_ID_YUAN, 0x0718 },
198 { 0, 0, 0 }
199};
200
201static const struct cx18_card cx18_card_mpc718 = {
202 .type = CX18_CARD_YUAN_MPC718,
Andy Walls637fb3d2009-07-03 11:30:27 -0300203 .name = "Yuan MPC718 MiniPCI DVB-T/Analog",
204 .comment = "Experimenters needed for device to work well.\n"
205 "\tTo help, mail the ivtv-devel list (www.ivtvdriver.org).\n",
Andy Wallsad907fa2008-06-22 02:00:09 -0300206 .v4l2_capabilities = CX18_CAP_ENCODER,
Andy Wallsff2a2002009-02-20 23:52:13 -0300207 .hw_audio_ctrl = CX18_HW_418_AV,
Andy Walls637fb3d2009-07-03 11:30:27 -0300208 .hw_muxer = CX18_HW_GPIO_MUX,
Andy Walls25a42e42009-07-05 17:09:28 -0300209 .hw_all = CX18_HW_TVEEPROM | CX18_HW_418_AV | CX18_HW_TUNER |
Andy Wallsff861fb2009-07-03 11:54:40 -0300210 CX18_HW_GPIO_MUX | CX18_HW_DVB | CX18_HW_GPIO_RESET_CTRL,
Hans Verkuil1c1e45d2008-04-28 20:24:33 -0300211 .video_inputs = {
Andy Wallsad907fa2008-06-22 02:00:09 -0300212 { CX18_CARD_INPUT_VID_TUNER, 0, CX18_AV_COMPOSITE2 },
213 { CX18_CARD_INPUT_SVIDEO1, 1,
214 CX18_AV_SVIDEO_LUMA3 | CX18_AV_SVIDEO_CHROMA4 },
215 { CX18_CARD_INPUT_COMPOSITE1, 1, CX18_AV_COMPOSITE1 },
216 { CX18_CARD_INPUT_SVIDEO2, 2,
217 CX18_AV_SVIDEO_LUMA7 | CX18_AV_SVIDEO_CHROMA8 },
218 { CX18_CARD_INPUT_COMPOSITE2, 2, CX18_AV_COMPOSITE6 },
Hans Verkuil1c1e45d2008-04-28 20:24:33 -0300219 },
220 .audio_inputs = {
Hans Verkuil81cb727d2008-06-28 12:49:20 -0300221 { CX18_CARD_INPUT_AUD_TUNER, CX18_AV_AUDIO5, 0 },
Andy Walls637fb3d2009-07-03 11:30:27 -0300222 { CX18_CARD_INPUT_LINE_IN1, CX18_AV_AUDIO_SERIAL1, 1 },
223 { CX18_CARD_INPUT_LINE_IN2, CX18_AV_AUDIO_SERIAL2, 1 },
Hans Verkuil1c1e45d2008-04-28 20:24:33 -0300224 },
Hans Verkuil1c1e45d2008-04-28 20:24:33 -0300225 .tuners = {
226 /* XC3028 tuner */
227 { .std = V4L2_STD_ALL, .tuner = TUNER_XC2028 },
228 },
Andy Walls637fb3d2009-07-03 11:30:27 -0300229 /* FIXME - the FM radio is just a guess and driver doesn't use SIF */
230 .radio_input = { CX18_CARD_INPUT_AUD_TUNER, CX18_AV_AUDIO5, 2 },
Hans Verkuil1c1e45d2008-04-28 20:24:33 -0300231 .ddr = {
Andy Walls637fb3d2009-07-03 11:30:27 -0300232 /* Hynix HY5DU283222B DDR RAM */
233 .chip_config = 0x303,
234 .refresh = 0x3bd,
235 .timing1 = 0x36320966,
236 .timing2 = 0x1f,
Hans Verkuil1c1e45d2008-04-28 20:24:33 -0300237 .tune_lane = 0,
238 .initial_emrs = 2,
239 },
Andy Walls637fb3d2009-07-03 11:30:27 -0300240 .gpio_init.initial_value = 0x1,
241 .gpio_init.direction = 0x3,
242 /* FIXME - these GPIO's are just guesses */
243 .gpio_audio_input = { .mask = 0x3,
244 .tuner = 0x1,
245 .linein = 0x3,
246 .radio = 0x1 },
Andy Walls0c616212008-07-07 10:36:16 -0300247 .xceive_pin = 0,
Hans Verkuil1c1e45d2008-04-28 20:24:33 -0300248 .pci_list = cx18_pci_mpc718,
249 .i2c = &cx18_i2c_std,
250};
251
Sri Deevi03c28082008-06-21 11:06:44 -0300252/* ------------------------------------------------------------------------- */
253
254/* Conexant Raptor PAL/SECAM: note that this card is analog only! */
255
256static const struct cx18_card_pci_info cx18_pci_cnxt_raptor_pal[] = {
257 { PCI_DEVICE_ID_CX23418, CX18_PCI_ID_CONEXANT, 0x0009 },
258 { 0, 0, 0 }
259};
260
261static const struct cx18_card cx18_card_cnxt_raptor_pal = {
262 .type = CX18_CARD_CNXT_RAPTOR_PAL,
263 .name = "Conexant Raptor PAL/SECAM",
Andy Walls302df972009-01-31 00:33:02 -0300264 .comment = "Analog TV capture supported\n",
Sri Deevi03c28082008-06-21 11:06:44 -0300265 .v4l2_capabilities = CX18_CAP_ENCODER,
Andy Wallsff2a2002009-02-20 23:52:13 -0300266 .hw_audio_ctrl = CX18_HW_418_AV,
Andy Wallseefe1012009-02-21 18:42:49 -0300267 .hw_muxer = CX18_HW_GPIO_MUX,
268 .hw_all = CX18_HW_418_AV | CX18_HW_TUNER | CX18_HW_GPIO_MUX,
Sri Deevi03c28082008-06-21 11:06:44 -0300269 .video_inputs = {
270 { CX18_CARD_INPUT_VID_TUNER, 0, CX18_AV_COMPOSITE2 },
271 { CX18_CARD_INPUT_SVIDEO1, 1,
272 CX18_AV_SVIDEO_LUMA3 | CX18_AV_SVIDEO_CHROMA4 },
273 { CX18_CARD_INPUT_COMPOSITE1, 1, CX18_AV_COMPOSITE1 },
274 { CX18_CARD_INPUT_SVIDEO2, 2,
275 CX18_AV_SVIDEO_LUMA7 | CX18_AV_SVIDEO_CHROMA8 },
276 { CX18_CARD_INPUT_COMPOSITE2, 2, CX18_AV_COMPOSITE6 },
277 },
278 .audio_inputs = {
Hans Verkuil81cb727d2008-06-28 12:49:20 -0300279 { CX18_CARD_INPUT_AUD_TUNER, CX18_AV_AUDIO5, 0 },
280 { CX18_CARD_INPUT_LINE_IN1, CX18_AV_AUDIO_SERIAL1, 1 },
281 { CX18_CARD_INPUT_LINE_IN2, CX18_AV_AUDIO_SERIAL2, 1 },
Sri Deevi03c28082008-06-21 11:06:44 -0300282 },
283 .tuners = {
Hans Verkuil156f1942008-06-22 12:08:16 -0300284 { .std = V4L2_STD_PAL_SECAM, .tuner = TUNER_PHILIPS_FM1216ME_MK3 },
Sri Deevi03c28082008-06-21 11:06:44 -0300285 },
Hans Verkuil81cb727d2008-06-28 12:49:20 -0300286 .radio_input = { CX18_CARD_INPUT_AUD_TUNER, CX18_AV_AUDIO_SERIAL1, 2 },
Sri Deevi03c28082008-06-21 11:06:44 -0300287 .ddr = {
288 /* MT 46V16M16 memory */
289 .chip_config = 0x50306,
290 .refresh = 0x753,
291 .timing1 = 0x33220953,
292 .timing2 = 0x09,
293 .tune_lane = 0,
294 .initial_emrs = 0,
295 },
Andy Wallsc5588b52008-06-25 00:24:21 -0300296 .gpio_init.initial_value = 0x1002,
297 .gpio_init.direction = 0xf002,
298 .gpio_audio_input = { .mask = 0xf002,
299 .tuner = 0x1002, /* LED D1 Tuner AF */
300 .linein = 0x2000, /* LED D2 Line In 1 */
301 .radio = 0x4002 }, /* LED D3 Tuner AF */
Sri Deevi03c28082008-06-21 11:06:44 -0300302 .pci_list = cx18_pci_cnxt_raptor_pal,
303 .i2c = &cx18_i2c_std,
304};
305
306/* ------------------------------------------------------------------------- */
307
Andy Walls9eee4fb2008-10-04 20:28:40 -0300308/* Toshiba Qosmio laptop internal DVB-T/Analog Hybrid Tuner */
309
310static const struct cx18_card_pci_info cx18_pci_toshiba_qosmio_dvbt[] = {
311 { PCI_DEVICE_ID_CX23418, CX18_PCI_ID_TOSHIBA, 0x0110 },
312 { 0, 0, 0 }
313};
314
315static const struct cx18_card cx18_card_toshiba_qosmio_dvbt = {
316 .type = CX18_CARD_TOSHIBA_QOSMIO_DVBT,
317 .name = "Toshiba Qosmio DVB-T/Analog",
318 .comment = "Experimenters and photos needed for device to work well.\n"
319 "\tTo help, mail the ivtv-devel list (www.ivtvdriver.org).\n",
320 .v4l2_capabilities = CX18_CAP_ENCODER,
Andy Wallsff2a2002009-02-20 23:52:13 -0300321 .hw_audio_ctrl = CX18_HW_418_AV,
Andy Wallseefe1012009-02-21 18:42:49 -0300322 .hw_all = CX18_HW_418_AV | CX18_HW_TUNER | CX18_HW_GPIO_RESET_CTRL,
Andy Walls9eee4fb2008-10-04 20:28:40 -0300323 .video_inputs = {
324 { CX18_CARD_INPUT_VID_TUNER, 0, CX18_AV_COMPOSITE6 },
325 { CX18_CARD_INPUT_SVIDEO1, 1,
326 CX18_AV_SVIDEO_LUMA3 | CX18_AV_SVIDEO_CHROMA4 },
327 { CX18_CARD_INPUT_COMPOSITE1, 1, CX18_AV_COMPOSITE1 },
328 },
329 .audio_inputs = {
330 { CX18_CARD_INPUT_AUD_TUNER, CX18_AV_AUDIO5, 0 },
331 { CX18_CARD_INPUT_LINE_IN1, CX18_AV_AUDIO_SERIAL1, 1 },
332 },
333 .tuners = {
334 { .std = V4L2_STD_ALL, .tuner = TUNER_XC2028 },
335 },
336 .ddr = {
337 .chip_config = 0x202,
338 .refresh = 0x3bb,
339 .timing1 = 0x33320a63,
340 .timing2 = 0x0a,
341 .tune_lane = 0,
342 .initial_emrs = 0x42,
343 },
344 .xceive_pin = 15,
345 .pci_list = cx18_pci_toshiba_qosmio_dvbt,
346 .i2c = &cx18_i2c_std,
347};
348
349/* ------------------------------------------------------------------------- */
350
351/* Leadtek WinFast PVR2100 */
352
353static const struct cx18_card_pci_info cx18_pci_leadtek_pvr2100[] = {
Andy Walls6ce9ee52009-01-19 18:31:22 -0300354 { PCI_DEVICE_ID_CX23418, CX18_PCI_ID_LEADTEK, 0x6f27 }, /* PVR2100 */
Andy Walls9eee4fb2008-10-04 20:28:40 -0300355 { 0, 0, 0 }
356};
357
358static const struct cx18_card cx18_card_leadtek_pvr2100 = {
359 .type = CX18_CARD_LEADTEK_PVR2100,
Andy Walls9d5af862009-06-09 20:37:24 -0300360 .name = "Leadtek WinFast PVR2100",
361 .comment = "Experimenters and photos needed for device to work well.\n"
362 "\tTo help, mail the ivtv-devel list (www.ivtvdriver.org).\n",
363 .v4l2_capabilities = CX18_CAP_ENCODER,
364 .hw_audio_ctrl = CX18_HW_418_AV,
365 .hw_muxer = CX18_HW_GPIO_MUX,
366 .hw_all = CX18_HW_418_AV | CX18_HW_TUNER | CX18_HW_GPIO_MUX |
367 CX18_HW_GPIO_RESET_CTRL,
368 .video_inputs = {
369 { CX18_CARD_INPUT_VID_TUNER, 0, CX18_AV_COMPOSITE2 },
370 { CX18_CARD_INPUT_SVIDEO1, 1,
371 CX18_AV_SVIDEO_LUMA3 | CX18_AV_SVIDEO_CHROMA4 },
372 { CX18_CARD_INPUT_COMPOSITE1, 1, CX18_AV_COMPOSITE7 },
373 },
374 .audio_inputs = {
375 { CX18_CARD_INPUT_AUD_TUNER, CX18_AV_AUDIO5, 0 },
376 { CX18_CARD_INPUT_LINE_IN1, CX18_AV_AUDIO_SERIAL1, 1 },
377 },
378 .tuners = {
379 /* XC2028 tuner */
380 { .std = V4L2_STD_ALL, .tuner = TUNER_XC2028 },
381 },
382 .radio_input = { CX18_CARD_INPUT_AUD_TUNER, CX18_AV_AUDIO5, 2 },
383 .ddr = {
Andy Walls8bb09db2009-06-09 20:47:21 -0300384 /* Pointer to proper DDR config values provided by Terry Wu */
Andy Walls9d5af862009-06-09 20:37:24 -0300385 .chip_config = 0x303,
386 .refresh = 0x3bb,
387 .timing1 = 0x24220e83,
388 .timing2 = 0x1f,
389 .tune_lane = 0,
390 .initial_emrs = 0x2,
391 },
392 .gpio_init.initial_value = 0x6,
393 .gpio_init.direction = 0x7,
394 .gpio_audio_input = { .mask = 0x7,
395 .tuner = 0x6, .linein = 0x2, .radio = 0x2 },
Sergey Bolshakova8073112010-01-02 21:56:42 -0300396 .xceive_pin = 1,
Andy Walls9d5af862009-06-09 20:37:24 -0300397 .pci_list = cx18_pci_leadtek_pvr2100,
398 .i2c = &cx18_i2c_std,
399};
400
401/* ------------------------------------------------------------------------- */
402
403/* Leadtek WinFast DVR3100 H */
404
405static const struct cx18_card_pci_info cx18_pci_leadtek_dvr3100h[] = {
406 { PCI_DEVICE_ID_CX23418, CX18_PCI_ID_LEADTEK, 0x6690 }, /* DVR3100 H */
407 { 0, 0, 0 }
408};
409
410static const struct cx18_card cx18_card_leadtek_dvr3100h = {
411 .type = CX18_CARD_LEADTEK_DVR3100H,
412 .name = "Leadtek WinFast DVR3100 H",
Andy Walls8bb09db2009-06-09 20:47:21 -0300413 .comment = "Simultaneous DVB-T and Analog capture supported,\n"
414 "\texcept when capturing Analog from the antenna input.\n",
Andy Walls9eee4fb2008-10-04 20:28:40 -0300415 .v4l2_capabilities = CX18_CAP_ENCODER,
Andy Wallsff2a2002009-02-20 23:52:13 -0300416 .hw_audio_ctrl = CX18_HW_418_AV,
Andy Wallseefe1012009-02-21 18:42:49 -0300417 .hw_muxer = CX18_HW_GPIO_MUX,
418 .hw_all = CX18_HW_418_AV | CX18_HW_TUNER | CX18_HW_GPIO_MUX |
Andy Walls8bb09db2009-06-09 20:47:21 -0300419 CX18_HW_DVB | CX18_HW_GPIO_RESET_CTRL,
Andy Walls9eee4fb2008-10-04 20:28:40 -0300420 .video_inputs = {
421 { CX18_CARD_INPUT_VID_TUNER, 0, CX18_AV_COMPOSITE2 },
422 { CX18_CARD_INPUT_SVIDEO1, 1,
423 CX18_AV_SVIDEO_LUMA3 | CX18_AV_SVIDEO_CHROMA4 },
424 { CX18_CARD_INPUT_COMPOSITE1, 1, CX18_AV_COMPOSITE7 },
425 },
426 .audio_inputs = {
427 { CX18_CARD_INPUT_AUD_TUNER, CX18_AV_AUDIO5, 0 },
428 { CX18_CARD_INPUT_LINE_IN1, CX18_AV_AUDIO_SERIAL1, 1 },
429 },
430 .tuners = {
431 /* XC3028 tuner */
432 { .std = V4L2_STD_ALL, .tuner = TUNER_XC2028 },
433 },
434 .radio_input = { CX18_CARD_INPUT_AUD_TUNER, CX18_AV_AUDIO5, 2 },
435 .ddr = {
Andy Walls8bb09db2009-06-09 20:47:21 -0300436 /* Pointer to proper DDR config values provided by Terry Wu */
Andy Walls9eee4fb2008-10-04 20:28:40 -0300437 .chip_config = 0x303,
438 .refresh = 0x3bb,
439 .timing1 = 0x24220e83,
440 .timing2 = 0x1f,
441 .tune_lane = 0,
442 .initial_emrs = 0x2,
443 },
444 .gpio_init.initial_value = 0x6,
445 .gpio_init.direction = 0x7,
446 .gpio_audio_input = { .mask = 0x7,
447 .tuner = 0x6, .linein = 0x2, .radio = 0x2 },
Andy Walls8bb09db2009-06-09 20:47:21 -0300448 .xceive_pin = 1,
Andy Walls9d5af862009-06-09 20:37:24 -0300449 .pci_list = cx18_pci_leadtek_dvr3100h,
Andy Walls9eee4fb2008-10-04 20:28:40 -0300450 .i2c = &cx18_i2c_std,
451};
452
453/* ------------------------------------------------------------------------- */
454
Hans Verkuil1c1e45d2008-04-28 20:24:33 -0300455static const struct cx18_card *cx18_card_list[] = {
456 &cx18_card_hvr1600_esmt,
457 &cx18_card_hvr1600_samsung,
458 &cx18_card_h900,
459 &cx18_card_mpc718,
Sri Deevi03c28082008-06-21 11:06:44 -0300460 &cx18_card_cnxt_raptor_pal,
Andy Walls9eee4fb2008-10-04 20:28:40 -0300461 &cx18_card_toshiba_qosmio_dvbt,
462 &cx18_card_leadtek_pvr2100,
Andy Walls9d5af862009-06-09 20:37:24 -0300463 &cx18_card_leadtek_dvr3100h,
Hans Verkuil1c1e45d2008-04-28 20:24:33 -0300464};
465
466const struct cx18_card *cx18_get_card(u16 index)
467{
468 if (index >= ARRAY_SIZE(cx18_card_list))
469 return NULL;
470 return cx18_card_list[index];
471}
472
473int cx18_get_input(struct cx18 *cx, u16 index, struct v4l2_input *input)
474{
475 const struct cx18_card_video_input *card_input =
476 cx->card->video_inputs + index;
477 static const char * const input_strs[] = {
478 "Tuner 1",
479 "S-Video 1",
480 "S-Video 2",
481 "Composite 1",
482 "Composite 2",
483 "Composite 3"
484 };
485
486 memset(input, 0, sizeof(*input));
487 if (index >= cx->nof_inputs)
488 return -EINVAL;
489 input->index = index;
490 strlcpy(input->name, input_strs[card_input->video_type - 1],
491 sizeof(input->name));
492 input->type = (card_input->video_type == CX18_CARD_INPUT_VID_TUNER ?
493 V4L2_INPUT_TYPE_TUNER : V4L2_INPUT_TYPE_CAMERA);
494 input->audioset = (1 << cx->nof_audio_inputs) - 1;
495 input->std = (input->type == V4L2_INPUT_TYPE_TUNER) ?
496 cx->tuner_std : V4L2_STD_ALL;
497 return 0;
498}
499
500int cx18_get_audio_input(struct cx18 *cx, u16 index, struct v4l2_audio *audio)
501{
502 const struct cx18_card_audio_input *aud_input =
503 cx->card->audio_inputs + index;
504 static const char * const input_strs[] = {
505 "Tuner 1",
506 "Line In 1",
507 "Line In 2"
508 };
509
510 memset(audio, 0, sizeof(*audio));
511 if (index >= cx->nof_audio_inputs)
512 return -EINVAL;
513 strlcpy(audio->name, input_strs[aud_input->audio_type - 1],
514 sizeof(audio->name));
515 audio->index = index;
516 audio->capability = V4L2_AUDCAP_STEREO;
517 return 0;
518}