18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0-or-later
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci *  cx18 functions to query card hardware
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci *  Derived from ivtv-cards.c
68c2ecf20Sopenharmony_ci *
78c2ecf20Sopenharmony_ci *  Copyright (C) 2007  Hans Verkuil <hverkuil@xs4all.nl>
88c2ecf20Sopenharmony_ci *  Copyright (C) 2008  Andy Walls <awalls@md.metrocast.net>
98c2ecf20Sopenharmony_ci */
108c2ecf20Sopenharmony_ci
118c2ecf20Sopenharmony_ci#include "cx18-driver.h"
128c2ecf20Sopenharmony_ci#include "cx18-cards.h"
138c2ecf20Sopenharmony_ci#include "cx18-av-core.h"
148c2ecf20Sopenharmony_ci#include "cx18-i2c.h"
158c2ecf20Sopenharmony_ci#include <media/i2c/cs5345.h>
168c2ecf20Sopenharmony_ci
178c2ecf20Sopenharmony_ci#define V4L2_STD_PAL_SECAM (V4L2_STD_PAL|V4L2_STD_SECAM)
188c2ecf20Sopenharmony_ci
198c2ecf20Sopenharmony_ci/********************** card configuration *******************************/
208c2ecf20Sopenharmony_ci
218c2ecf20Sopenharmony_ci/* usual i2c tuner addresses to probe */
228c2ecf20Sopenharmony_cistatic struct cx18_card_tuner_i2c cx18_i2c_std = {
238c2ecf20Sopenharmony_ci	.radio = { I2C_CLIENT_END },
248c2ecf20Sopenharmony_ci	.demod = { 0x43, I2C_CLIENT_END },
258c2ecf20Sopenharmony_ci	.tv    = { 0x61, 0x60, I2C_CLIENT_END },
268c2ecf20Sopenharmony_ci};
278c2ecf20Sopenharmony_ci
288c2ecf20Sopenharmony_ci/*
298c2ecf20Sopenharmony_ci * usual i2c tuner addresses to probe with additional demod address for
308c2ecf20Sopenharmony_ci * an NXP TDA8295 at 0x42 (N.B. it can possibly be at 0x4b or 0x4c too).
318c2ecf20Sopenharmony_ci */
328c2ecf20Sopenharmony_cistatic struct cx18_card_tuner_i2c cx18_i2c_nxp = {
338c2ecf20Sopenharmony_ci	.radio = { I2C_CLIENT_END },
348c2ecf20Sopenharmony_ci	.demod = { 0x42, 0x43, I2C_CLIENT_END },
358c2ecf20Sopenharmony_ci	.tv    = { 0x61, 0x60, I2C_CLIENT_END },
368c2ecf20Sopenharmony_ci};
378c2ecf20Sopenharmony_ci
388c2ecf20Sopenharmony_ci/* Please add new PCI IDs to: https://pci-ids.ucw.cz/
398c2ecf20Sopenharmony_ci   This keeps the PCI ID database up to date. Note that the entries
408c2ecf20Sopenharmony_ci   must be added under vendor 0x4444 (Conexant) as subsystem IDs.
418c2ecf20Sopenharmony_ci   New vendor IDs should still be added to the vendor ID list. */
428c2ecf20Sopenharmony_ci
438c2ecf20Sopenharmony_ci/* Hauppauge HVR-1600 cards */
448c2ecf20Sopenharmony_ci
458c2ecf20Sopenharmony_ci/* Note: for Hauppauge cards the tveeprom information is used instead
468c2ecf20Sopenharmony_ci   of PCI IDs */
478c2ecf20Sopenharmony_cistatic const struct cx18_card cx18_card_hvr1600_esmt = {
488c2ecf20Sopenharmony_ci	.type = CX18_CARD_HVR_1600_ESMT,
498c2ecf20Sopenharmony_ci	.name = "Hauppauge HVR-1600",
508c2ecf20Sopenharmony_ci	.comment = "Simultaneous Digital and Analog TV capture supported\n",
518c2ecf20Sopenharmony_ci	.v4l2_capabilities = CX18_CAP_ENCODER,
528c2ecf20Sopenharmony_ci	.hw_audio_ctrl = CX18_HW_418_AV,
538c2ecf20Sopenharmony_ci	.hw_muxer = CX18_HW_CS5345,
548c2ecf20Sopenharmony_ci	.hw_all = CX18_HW_TVEEPROM | CX18_HW_418_AV | CX18_HW_TUNER |
558c2ecf20Sopenharmony_ci		  CX18_HW_CS5345 | CX18_HW_DVB | CX18_HW_GPIO_RESET_CTRL |
568c2ecf20Sopenharmony_ci		  CX18_HW_Z8F0811_IR_HAUP,
578c2ecf20Sopenharmony_ci	.video_inputs = {
588c2ecf20Sopenharmony_ci		{ CX18_CARD_INPUT_VID_TUNER,  0, CX18_AV_COMPOSITE7 },
598c2ecf20Sopenharmony_ci		{ CX18_CARD_INPUT_SVIDEO1,    1, CX18_AV_SVIDEO1    },
608c2ecf20Sopenharmony_ci		{ CX18_CARD_INPUT_COMPOSITE1, 1, CX18_AV_COMPOSITE3 },
618c2ecf20Sopenharmony_ci		{ CX18_CARD_INPUT_SVIDEO2,    2, CX18_AV_SVIDEO2    },
628c2ecf20Sopenharmony_ci		{ CX18_CARD_INPUT_COMPOSITE2, 2, CX18_AV_COMPOSITE4 },
638c2ecf20Sopenharmony_ci	},
648c2ecf20Sopenharmony_ci	.audio_inputs = {
658c2ecf20Sopenharmony_ci		{ CX18_CARD_INPUT_AUD_TUNER,
668c2ecf20Sopenharmony_ci		  CX18_AV_AUDIO8, CS5345_IN_1 | CS5345_MCLK_1_5 },
678c2ecf20Sopenharmony_ci		{ CX18_CARD_INPUT_LINE_IN1,
688c2ecf20Sopenharmony_ci		  CX18_AV_AUDIO_SERIAL1, CS5345_IN_2 },
698c2ecf20Sopenharmony_ci		{ CX18_CARD_INPUT_LINE_IN2,
708c2ecf20Sopenharmony_ci		  CX18_AV_AUDIO_SERIAL1, CS5345_IN_3 },
718c2ecf20Sopenharmony_ci	},
728c2ecf20Sopenharmony_ci	.radio_input = { CX18_CARD_INPUT_AUD_TUNER,
738c2ecf20Sopenharmony_ci			 CX18_AV_AUDIO_SERIAL1, CS5345_IN_4 },
748c2ecf20Sopenharmony_ci	.ddr = {
758c2ecf20Sopenharmony_ci		/* ESMT M13S128324A-5B memory */
768c2ecf20Sopenharmony_ci		.chip_config = 0x003,
778c2ecf20Sopenharmony_ci		.refresh = 0x30c,
788c2ecf20Sopenharmony_ci		.timing1 = 0x44220e82,
798c2ecf20Sopenharmony_ci		.timing2 = 0x08,
808c2ecf20Sopenharmony_ci		.tune_lane = 0,
818c2ecf20Sopenharmony_ci		.initial_emrs = 0,
828c2ecf20Sopenharmony_ci	},
838c2ecf20Sopenharmony_ci	.gpio_init.initial_value = 0x3001,
848c2ecf20Sopenharmony_ci	.gpio_init.direction = 0x3001,
858c2ecf20Sopenharmony_ci	.gpio_i2c_slave_reset = {
868c2ecf20Sopenharmony_ci		.active_lo_mask = 0x3001,
878c2ecf20Sopenharmony_ci		.msecs_asserted = 10,
888c2ecf20Sopenharmony_ci		.msecs_recovery = 40,
898c2ecf20Sopenharmony_ci		.ir_reset_mask  = 0x0001,
908c2ecf20Sopenharmony_ci	},
918c2ecf20Sopenharmony_ci	.i2c = &cx18_i2c_std,
928c2ecf20Sopenharmony_ci};
938c2ecf20Sopenharmony_ci
948c2ecf20Sopenharmony_cistatic const struct cx18_card cx18_card_hvr1600_s5h1411 = {
958c2ecf20Sopenharmony_ci	.type = CX18_CARD_HVR_1600_S5H1411,
968c2ecf20Sopenharmony_ci	.name = "Hauppauge HVR-1600",
978c2ecf20Sopenharmony_ci	.comment = "Simultaneous Digital and Analog TV capture supported\n",
988c2ecf20Sopenharmony_ci	.v4l2_capabilities = CX18_CAP_ENCODER,
998c2ecf20Sopenharmony_ci	.hw_audio_ctrl = CX18_HW_418_AV,
1008c2ecf20Sopenharmony_ci	.hw_muxer = CX18_HW_CS5345,
1018c2ecf20Sopenharmony_ci	.hw_all = CX18_HW_TVEEPROM | CX18_HW_418_AV | CX18_HW_TUNER |
1028c2ecf20Sopenharmony_ci		  CX18_HW_CS5345 | CX18_HW_DVB | CX18_HW_GPIO_RESET_CTRL |
1038c2ecf20Sopenharmony_ci		  CX18_HW_Z8F0811_IR_HAUP,
1048c2ecf20Sopenharmony_ci	.video_inputs = {
1058c2ecf20Sopenharmony_ci		{ CX18_CARD_INPUT_VID_TUNER,  0, CX18_AV_COMPOSITE7 },
1068c2ecf20Sopenharmony_ci		{ CX18_CARD_INPUT_SVIDEO1,    1, CX18_AV_SVIDEO1    },
1078c2ecf20Sopenharmony_ci		{ CX18_CARD_INPUT_COMPOSITE1, 1, CX18_AV_COMPOSITE3 },
1088c2ecf20Sopenharmony_ci		{ CX18_CARD_INPUT_SVIDEO2,    2, CX18_AV_SVIDEO2    },
1098c2ecf20Sopenharmony_ci		{ CX18_CARD_INPUT_COMPOSITE2, 2, CX18_AV_COMPOSITE4 },
1108c2ecf20Sopenharmony_ci	},
1118c2ecf20Sopenharmony_ci	.audio_inputs = {
1128c2ecf20Sopenharmony_ci		{ CX18_CARD_INPUT_AUD_TUNER,
1138c2ecf20Sopenharmony_ci		  CX18_AV_AUDIO8, CS5345_IN_1 | CS5345_MCLK_1_5 },
1148c2ecf20Sopenharmony_ci		{ CX18_CARD_INPUT_LINE_IN1,
1158c2ecf20Sopenharmony_ci		  CX18_AV_AUDIO_SERIAL1, CS5345_IN_2 },
1168c2ecf20Sopenharmony_ci		{ CX18_CARD_INPUT_LINE_IN2,
1178c2ecf20Sopenharmony_ci		  CX18_AV_AUDIO_SERIAL1, CS5345_IN_3 },
1188c2ecf20Sopenharmony_ci	},
1198c2ecf20Sopenharmony_ci	.radio_input = { CX18_CARD_INPUT_AUD_TUNER,
1208c2ecf20Sopenharmony_ci			 CX18_AV_AUDIO_SERIAL1, CS5345_IN_4 },
1218c2ecf20Sopenharmony_ci	.ddr = {
1228c2ecf20Sopenharmony_ci		/* ESMT M13S128324A-5B memory */
1238c2ecf20Sopenharmony_ci		.chip_config = 0x003,
1248c2ecf20Sopenharmony_ci		.refresh = 0x30c,
1258c2ecf20Sopenharmony_ci		.timing1 = 0x44220e82,
1268c2ecf20Sopenharmony_ci		.timing2 = 0x08,
1278c2ecf20Sopenharmony_ci		.tune_lane = 0,
1288c2ecf20Sopenharmony_ci		.initial_emrs = 0,
1298c2ecf20Sopenharmony_ci	},
1308c2ecf20Sopenharmony_ci	.gpio_init.initial_value = 0x3801,
1318c2ecf20Sopenharmony_ci	.gpio_init.direction = 0x3801,
1328c2ecf20Sopenharmony_ci	.gpio_i2c_slave_reset = {
1338c2ecf20Sopenharmony_ci		.active_lo_mask = 0x3801,
1348c2ecf20Sopenharmony_ci		.msecs_asserted = 10,
1358c2ecf20Sopenharmony_ci		.msecs_recovery = 40,
1368c2ecf20Sopenharmony_ci		.ir_reset_mask  = 0x0001,
1378c2ecf20Sopenharmony_ci	},
1388c2ecf20Sopenharmony_ci	.i2c = &cx18_i2c_nxp,
1398c2ecf20Sopenharmony_ci};
1408c2ecf20Sopenharmony_ci
1418c2ecf20Sopenharmony_cistatic const struct cx18_card cx18_card_hvr1600_samsung = {
1428c2ecf20Sopenharmony_ci	.type = CX18_CARD_HVR_1600_SAMSUNG,
1438c2ecf20Sopenharmony_ci	.name = "Hauppauge HVR-1600 (Preproduction)",
1448c2ecf20Sopenharmony_ci	.comment = "Simultaneous Digital and Analog TV capture supported\n",
1458c2ecf20Sopenharmony_ci	.v4l2_capabilities = CX18_CAP_ENCODER,
1468c2ecf20Sopenharmony_ci	.hw_audio_ctrl = CX18_HW_418_AV,
1478c2ecf20Sopenharmony_ci	.hw_muxer = CX18_HW_CS5345,
1488c2ecf20Sopenharmony_ci	.hw_all = CX18_HW_TVEEPROM | CX18_HW_418_AV | CX18_HW_TUNER |
1498c2ecf20Sopenharmony_ci		  CX18_HW_CS5345 | CX18_HW_DVB | CX18_HW_GPIO_RESET_CTRL |
1508c2ecf20Sopenharmony_ci		  CX18_HW_Z8F0811_IR_HAUP,
1518c2ecf20Sopenharmony_ci	.video_inputs = {
1528c2ecf20Sopenharmony_ci		{ CX18_CARD_INPUT_VID_TUNER,  0, CX18_AV_COMPOSITE7 },
1538c2ecf20Sopenharmony_ci		{ CX18_CARD_INPUT_SVIDEO1,    1, CX18_AV_SVIDEO1    },
1548c2ecf20Sopenharmony_ci		{ CX18_CARD_INPUT_COMPOSITE1, 1, CX18_AV_COMPOSITE3 },
1558c2ecf20Sopenharmony_ci		{ CX18_CARD_INPUT_SVIDEO2,    2, CX18_AV_SVIDEO2    },
1568c2ecf20Sopenharmony_ci		{ CX18_CARD_INPUT_COMPOSITE2, 2, CX18_AV_COMPOSITE4 },
1578c2ecf20Sopenharmony_ci	},
1588c2ecf20Sopenharmony_ci	.audio_inputs = {
1598c2ecf20Sopenharmony_ci		{ CX18_CARD_INPUT_AUD_TUNER,
1608c2ecf20Sopenharmony_ci		  CX18_AV_AUDIO8, CS5345_IN_1 | CS5345_MCLK_1_5 },
1618c2ecf20Sopenharmony_ci		{ CX18_CARD_INPUT_LINE_IN1,
1628c2ecf20Sopenharmony_ci		  CX18_AV_AUDIO_SERIAL1, CS5345_IN_2 },
1638c2ecf20Sopenharmony_ci		{ CX18_CARD_INPUT_LINE_IN2,
1648c2ecf20Sopenharmony_ci		  CX18_AV_AUDIO_SERIAL1, CS5345_IN_3 },
1658c2ecf20Sopenharmony_ci	},
1668c2ecf20Sopenharmony_ci	.radio_input = { CX18_CARD_INPUT_AUD_TUNER,
1678c2ecf20Sopenharmony_ci			 CX18_AV_AUDIO_SERIAL1, CS5345_IN_4 },
1688c2ecf20Sopenharmony_ci	.ddr = {
1698c2ecf20Sopenharmony_ci		/* Samsung K4D263238G-VC33 memory */
1708c2ecf20Sopenharmony_ci		.chip_config = 0x003,
1718c2ecf20Sopenharmony_ci		.refresh = 0x30c,
1728c2ecf20Sopenharmony_ci		.timing1 = 0x23230b73,
1738c2ecf20Sopenharmony_ci		.timing2 = 0x08,
1748c2ecf20Sopenharmony_ci		.tune_lane = 0,
1758c2ecf20Sopenharmony_ci		.initial_emrs = 2,
1768c2ecf20Sopenharmony_ci	},
1778c2ecf20Sopenharmony_ci	.gpio_init.initial_value = 0x3001,
1788c2ecf20Sopenharmony_ci	.gpio_init.direction = 0x3001,
1798c2ecf20Sopenharmony_ci	.gpio_i2c_slave_reset = {
1808c2ecf20Sopenharmony_ci		.active_lo_mask = 0x3001,
1818c2ecf20Sopenharmony_ci		.msecs_asserted = 10,
1828c2ecf20Sopenharmony_ci		.msecs_recovery = 40,
1838c2ecf20Sopenharmony_ci		.ir_reset_mask  = 0x0001,
1848c2ecf20Sopenharmony_ci	},
1858c2ecf20Sopenharmony_ci	.i2c = &cx18_i2c_std,
1868c2ecf20Sopenharmony_ci};
1878c2ecf20Sopenharmony_ci
1888c2ecf20Sopenharmony_ci/* ------------------------------------------------------------------------- */
1898c2ecf20Sopenharmony_ci
1908c2ecf20Sopenharmony_ci/* Compro VideoMate H900: note that this card is analog only! */
1918c2ecf20Sopenharmony_ci
1928c2ecf20Sopenharmony_cistatic const struct cx18_card_pci_info cx18_pci_h900[] = {
1938c2ecf20Sopenharmony_ci	{ PCI_DEVICE_ID_CX23418, CX18_PCI_ID_COMPRO, 0xe100 },
1948c2ecf20Sopenharmony_ci	{ 0, 0, 0 }
1958c2ecf20Sopenharmony_ci};
1968c2ecf20Sopenharmony_ci
1978c2ecf20Sopenharmony_cistatic const struct cx18_card cx18_card_h900 = {
1988c2ecf20Sopenharmony_ci	.type = CX18_CARD_COMPRO_H900,
1998c2ecf20Sopenharmony_ci	.name = "Compro VideoMate H900",
2008c2ecf20Sopenharmony_ci	.comment = "Analog TV capture supported\n",
2018c2ecf20Sopenharmony_ci	.v4l2_capabilities = CX18_CAP_ENCODER,
2028c2ecf20Sopenharmony_ci	.hw_audio_ctrl = CX18_HW_418_AV,
2038c2ecf20Sopenharmony_ci	.hw_all = CX18_HW_418_AV | CX18_HW_TUNER | CX18_HW_GPIO_RESET_CTRL,
2048c2ecf20Sopenharmony_ci	.video_inputs = {
2058c2ecf20Sopenharmony_ci		{ CX18_CARD_INPUT_VID_TUNER,  0, CX18_AV_COMPOSITE2 },
2068c2ecf20Sopenharmony_ci		{ CX18_CARD_INPUT_SVIDEO1,    1,
2078c2ecf20Sopenharmony_ci			CX18_AV_SVIDEO_LUMA3 | CX18_AV_SVIDEO_CHROMA4 },
2088c2ecf20Sopenharmony_ci		{ CX18_CARD_INPUT_COMPOSITE1, 1, CX18_AV_COMPOSITE1 },
2098c2ecf20Sopenharmony_ci	},
2108c2ecf20Sopenharmony_ci	.audio_inputs = {
2118c2ecf20Sopenharmony_ci		{ CX18_CARD_INPUT_AUD_TUNER,
2128c2ecf20Sopenharmony_ci		  CX18_AV_AUDIO5, 0 },
2138c2ecf20Sopenharmony_ci		{ CX18_CARD_INPUT_LINE_IN1,
2148c2ecf20Sopenharmony_ci		  CX18_AV_AUDIO_SERIAL1, 0 },
2158c2ecf20Sopenharmony_ci	},
2168c2ecf20Sopenharmony_ci	.radio_input = { CX18_CARD_INPUT_AUD_TUNER,
2178c2ecf20Sopenharmony_ci			 CX18_AV_AUDIO_SERIAL1, 0 },
2188c2ecf20Sopenharmony_ci	.tuners = {
2198c2ecf20Sopenharmony_ci		{ .std = V4L2_STD_ALL, .tuner = TUNER_XC2028 },
2208c2ecf20Sopenharmony_ci	},
2218c2ecf20Sopenharmony_ci	.ddr = {
2228c2ecf20Sopenharmony_ci		/* EtronTech EM6A9160TS-5G memory */
2238c2ecf20Sopenharmony_ci		.chip_config = 0x50003,
2248c2ecf20Sopenharmony_ci		.refresh = 0x753,
2258c2ecf20Sopenharmony_ci		.timing1 = 0x24330e84,
2268c2ecf20Sopenharmony_ci		.timing2 = 0x1f,
2278c2ecf20Sopenharmony_ci		.tune_lane = 0,
2288c2ecf20Sopenharmony_ci		.initial_emrs = 0,
2298c2ecf20Sopenharmony_ci	},
2308c2ecf20Sopenharmony_ci	.xceive_pin = 15,
2318c2ecf20Sopenharmony_ci	.pci_list = cx18_pci_h900,
2328c2ecf20Sopenharmony_ci	.i2c = &cx18_i2c_std,
2338c2ecf20Sopenharmony_ci};
2348c2ecf20Sopenharmony_ci
2358c2ecf20Sopenharmony_ci/* ------------------------------------------------------------------------- */
2368c2ecf20Sopenharmony_ci
2378c2ecf20Sopenharmony_ci/* Yuan MPC718: not working at the moment! */
2388c2ecf20Sopenharmony_ci
2398c2ecf20Sopenharmony_cistatic const struct cx18_card_pci_info cx18_pci_mpc718[] = {
2408c2ecf20Sopenharmony_ci	{ PCI_DEVICE_ID_CX23418, CX18_PCI_ID_YUAN, 0x0718 },
2418c2ecf20Sopenharmony_ci	{ 0, 0, 0 }
2428c2ecf20Sopenharmony_ci};
2438c2ecf20Sopenharmony_ci
2448c2ecf20Sopenharmony_cistatic const struct cx18_card cx18_card_mpc718 = {
2458c2ecf20Sopenharmony_ci	.type = CX18_CARD_YUAN_MPC718,
2468c2ecf20Sopenharmony_ci	.name = "Yuan MPC718 MiniPCI DVB-T/Analog",
2478c2ecf20Sopenharmony_ci	.comment = "Experimenters needed for device to work well.\n"
2488c2ecf20Sopenharmony_ci		  "\tTo help, mail the linux-media list (www.linuxtv.org).\n",
2498c2ecf20Sopenharmony_ci	.v4l2_capabilities = CX18_CAP_ENCODER,
2508c2ecf20Sopenharmony_ci	.hw_audio_ctrl = CX18_HW_418_AV,
2518c2ecf20Sopenharmony_ci	.hw_muxer = CX18_HW_GPIO_MUX,
2528c2ecf20Sopenharmony_ci	.hw_all = CX18_HW_TVEEPROM | CX18_HW_418_AV | CX18_HW_TUNER |
2538c2ecf20Sopenharmony_ci		  CX18_HW_GPIO_MUX | CX18_HW_DVB | CX18_HW_GPIO_RESET_CTRL,
2548c2ecf20Sopenharmony_ci	.video_inputs = {
2558c2ecf20Sopenharmony_ci		{ CX18_CARD_INPUT_VID_TUNER,  0, CX18_AV_COMPOSITE2 },
2568c2ecf20Sopenharmony_ci		{ CX18_CARD_INPUT_SVIDEO1,    1,
2578c2ecf20Sopenharmony_ci				CX18_AV_SVIDEO_LUMA3 | CX18_AV_SVIDEO_CHROMA4 },
2588c2ecf20Sopenharmony_ci		{ CX18_CARD_INPUT_COMPOSITE1, 1, CX18_AV_COMPOSITE1 },
2598c2ecf20Sopenharmony_ci		{ CX18_CARD_INPUT_SVIDEO2,    2,
2608c2ecf20Sopenharmony_ci				CX18_AV_SVIDEO_LUMA7 | CX18_AV_SVIDEO_CHROMA8 },
2618c2ecf20Sopenharmony_ci		{ CX18_CARD_INPUT_COMPOSITE2, 2, CX18_AV_COMPOSITE6 },
2628c2ecf20Sopenharmony_ci	},
2638c2ecf20Sopenharmony_ci	.audio_inputs = {
2648c2ecf20Sopenharmony_ci		{ CX18_CARD_INPUT_AUD_TUNER, CX18_AV_AUDIO5,        0 },
2658c2ecf20Sopenharmony_ci		{ CX18_CARD_INPUT_LINE_IN1,  CX18_AV_AUDIO_SERIAL1, 1 },
2668c2ecf20Sopenharmony_ci		{ CX18_CARD_INPUT_LINE_IN2,  CX18_AV_AUDIO_SERIAL2, 1 },
2678c2ecf20Sopenharmony_ci	},
2688c2ecf20Sopenharmony_ci	.tuners = {
2698c2ecf20Sopenharmony_ci		/* XC3028 tuner */
2708c2ecf20Sopenharmony_ci		{ .std = V4L2_STD_ALL, .tuner = TUNER_XC2028 },
2718c2ecf20Sopenharmony_ci	},
2728c2ecf20Sopenharmony_ci	/* FIXME - the FM radio is just a guess and driver doesn't use SIF */
2738c2ecf20Sopenharmony_ci	.radio_input = { CX18_CARD_INPUT_AUD_TUNER, CX18_AV_AUDIO5, 2 },
2748c2ecf20Sopenharmony_ci	.ddr = {
2758c2ecf20Sopenharmony_ci		/* Hynix HY5DU283222B DDR RAM */
2768c2ecf20Sopenharmony_ci		.chip_config = 0x303,
2778c2ecf20Sopenharmony_ci		.refresh = 0x3bd,
2788c2ecf20Sopenharmony_ci		.timing1 = 0x36320966,
2798c2ecf20Sopenharmony_ci		.timing2 = 0x1f,
2808c2ecf20Sopenharmony_ci		.tune_lane = 0,
2818c2ecf20Sopenharmony_ci		.initial_emrs = 2,
2828c2ecf20Sopenharmony_ci	},
2838c2ecf20Sopenharmony_ci	.gpio_init.initial_value = 0x1,
2848c2ecf20Sopenharmony_ci	.gpio_init.direction = 0x3,
2858c2ecf20Sopenharmony_ci	/* FIXME - these GPIO's are just guesses */
2868c2ecf20Sopenharmony_ci	.gpio_audio_input = { .mask   = 0x3,
2878c2ecf20Sopenharmony_ci			      .tuner  = 0x1,
2888c2ecf20Sopenharmony_ci			      .linein = 0x3,
2898c2ecf20Sopenharmony_ci			      .radio  = 0x1 },
2908c2ecf20Sopenharmony_ci	.xceive_pin = 0,
2918c2ecf20Sopenharmony_ci	.pci_list = cx18_pci_mpc718,
2928c2ecf20Sopenharmony_ci	.i2c = &cx18_i2c_std,
2938c2ecf20Sopenharmony_ci};
2948c2ecf20Sopenharmony_ci
2958c2ecf20Sopenharmony_ci/* ------------------------------------------------------------------------- */
2968c2ecf20Sopenharmony_ci
2978c2ecf20Sopenharmony_ci/* GoTView PCI */
2988c2ecf20Sopenharmony_ci
2998c2ecf20Sopenharmony_cistatic const struct cx18_card_pci_info cx18_pci_gotview_dvd3[] = {
3008c2ecf20Sopenharmony_ci	{ PCI_DEVICE_ID_CX23418, CX18_PCI_ID_GOTVIEW, 0x3343 },
3018c2ecf20Sopenharmony_ci	{ 0, 0, 0 }
3028c2ecf20Sopenharmony_ci};
3038c2ecf20Sopenharmony_ci
3048c2ecf20Sopenharmony_cistatic const struct cx18_card cx18_card_gotview_dvd3 = {
3058c2ecf20Sopenharmony_ci	.type = CX18_CARD_GOTVIEW_PCI_DVD3,
3068c2ecf20Sopenharmony_ci	.name = "GoTView PCI DVD3 Hybrid",
3078c2ecf20Sopenharmony_ci	.comment = "Experimenters needed for device to work well.\n"
3088c2ecf20Sopenharmony_ci		  "\tTo help, mail the linux-media list (www.linuxtv.org).\n",
3098c2ecf20Sopenharmony_ci	.v4l2_capabilities = CX18_CAP_ENCODER,
3108c2ecf20Sopenharmony_ci	.hw_audio_ctrl = CX18_HW_418_AV,
3118c2ecf20Sopenharmony_ci	.hw_muxer = CX18_HW_GPIO_MUX,
3128c2ecf20Sopenharmony_ci	.hw_all = CX18_HW_TVEEPROM | CX18_HW_418_AV | CX18_HW_TUNER |
3138c2ecf20Sopenharmony_ci		  CX18_HW_GPIO_MUX | CX18_HW_DVB | CX18_HW_GPIO_RESET_CTRL,
3148c2ecf20Sopenharmony_ci	.video_inputs = {
3158c2ecf20Sopenharmony_ci		{ CX18_CARD_INPUT_VID_TUNER,  0, CX18_AV_COMPOSITE2 },
3168c2ecf20Sopenharmony_ci		{ CX18_CARD_INPUT_SVIDEO1,    1,
3178c2ecf20Sopenharmony_ci				CX18_AV_SVIDEO_LUMA3 | CX18_AV_SVIDEO_CHROMA4 },
3188c2ecf20Sopenharmony_ci		{ CX18_CARD_INPUT_COMPOSITE1, 1, CX18_AV_COMPOSITE1 },
3198c2ecf20Sopenharmony_ci		{ CX18_CARD_INPUT_SVIDEO2,    2,
3208c2ecf20Sopenharmony_ci				CX18_AV_SVIDEO_LUMA7 | CX18_AV_SVIDEO_CHROMA8 },
3218c2ecf20Sopenharmony_ci		{ CX18_CARD_INPUT_COMPOSITE2, 2, CX18_AV_COMPOSITE6 },
3228c2ecf20Sopenharmony_ci	},
3238c2ecf20Sopenharmony_ci	.audio_inputs = {
3248c2ecf20Sopenharmony_ci		{ CX18_CARD_INPUT_AUD_TUNER, CX18_AV_AUDIO5,        0 },
3258c2ecf20Sopenharmony_ci		{ CX18_CARD_INPUT_LINE_IN1,  CX18_AV_AUDIO_SERIAL1, 1 },
3268c2ecf20Sopenharmony_ci		{ CX18_CARD_INPUT_LINE_IN2,  CX18_AV_AUDIO_SERIAL2, 1 },
3278c2ecf20Sopenharmony_ci	},
3288c2ecf20Sopenharmony_ci	.tuners = {
3298c2ecf20Sopenharmony_ci		/* XC3028 tuner */
3308c2ecf20Sopenharmony_ci		{ .std = V4L2_STD_ALL, .tuner = TUNER_XC2028 },
3318c2ecf20Sopenharmony_ci	},
3328c2ecf20Sopenharmony_ci	/* FIXME - the FM radio is just a guess and driver doesn't use SIF */
3338c2ecf20Sopenharmony_ci	.radio_input = { CX18_CARD_INPUT_AUD_TUNER, CX18_AV_AUDIO5, 2 },
3348c2ecf20Sopenharmony_ci	.ddr = {
3358c2ecf20Sopenharmony_ci		/* Hynix HY5DU283222B DDR RAM */
3368c2ecf20Sopenharmony_ci		.chip_config = 0x303,
3378c2ecf20Sopenharmony_ci		.refresh = 0x3bd,
3388c2ecf20Sopenharmony_ci		.timing1 = 0x36320966,
3398c2ecf20Sopenharmony_ci		.timing2 = 0x1f,
3408c2ecf20Sopenharmony_ci		.tune_lane = 0,
3418c2ecf20Sopenharmony_ci		.initial_emrs = 2,
3428c2ecf20Sopenharmony_ci	},
3438c2ecf20Sopenharmony_ci	.gpio_init.initial_value = 0x1,
3448c2ecf20Sopenharmony_ci	.gpio_init.direction = 0x3,
3458c2ecf20Sopenharmony_ci
3468c2ecf20Sopenharmony_ci	.gpio_audio_input = { .mask   = 0x3,
3478c2ecf20Sopenharmony_ci			      .tuner  = 0x1,
3488c2ecf20Sopenharmony_ci			      .linein = 0x2,
3498c2ecf20Sopenharmony_ci			      .radio  = 0x1 },
3508c2ecf20Sopenharmony_ci	.xceive_pin = 0,
3518c2ecf20Sopenharmony_ci	.pci_list = cx18_pci_gotview_dvd3,
3528c2ecf20Sopenharmony_ci	.i2c = &cx18_i2c_std,
3538c2ecf20Sopenharmony_ci};
3548c2ecf20Sopenharmony_ci
3558c2ecf20Sopenharmony_ci/* ------------------------------------------------------------------------- */
3568c2ecf20Sopenharmony_ci
3578c2ecf20Sopenharmony_ci/* Conexant Raptor PAL/SECAM: note that this card is analog only! */
3588c2ecf20Sopenharmony_ci
3598c2ecf20Sopenharmony_cistatic const struct cx18_card_pci_info cx18_pci_cnxt_raptor_pal[] = {
3608c2ecf20Sopenharmony_ci	{ PCI_DEVICE_ID_CX23418, CX18_PCI_ID_CONEXANT, 0x0009 },
3618c2ecf20Sopenharmony_ci	{ 0, 0, 0 }
3628c2ecf20Sopenharmony_ci};
3638c2ecf20Sopenharmony_ci
3648c2ecf20Sopenharmony_cistatic const struct cx18_card cx18_card_cnxt_raptor_pal = {
3658c2ecf20Sopenharmony_ci	.type = CX18_CARD_CNXT_RAPTOR_PAL,
3668c2ecf20Sopenharmony_ci	.name = "Conexant Raptor PAL/SECAM",
3678c2ecf20Sopenharmony_ci	.comment = "Analog TV capture supported\n",
3688c2ecf20Sopenharmony_ci	.v4l2_capabilities = CX18_CAP_ENCODER,
3698c2ecf20Sopenharmony_ci	.hw_audio_ctrl = CX18_HW_418_AV,
3708c2ecf20Sopenharmony_ci	.hw_muxer = CX18_HW_GPIO_MUX,
3718c2ecf20Sopenharmony_ci	.hw_all = CX18_HW_418_AV | CX18_HW_TUNER | CX18_HW_GPIO_MUX,
3728c2ecf20Sopenharmony_ci	.video_inputs = {
3738c2ecf20Sopenharmony_ci		{ CX18_CARD_INPUT_VID_TUNER,  0, CX18_AV_COMPOSITE2 },
3748c2ecf20Sopenharmony_ci		{ CX18_CARD_INPUT_SVIDEO1,    1,
3758c2ecf20Sopenharmony_ci			CX18_AV_SVIDEO_LUMA3 | CX18_AV_SVIDEO_CHROMA4 },
3768c2ecf20Sopenharmony_ci		{ CX18_CARD_INPUT_COMPOSITE1, 1, CX18_AV_COMPOSITE1 },
3778c2ecf20Sopenharmony_ci		{ CX18_CARD_INPUT_SVIDEO2,    2,
3788c2ecf20Sopenharmony_ci			CX18_AV_SVIDEO_LUMA7 | CX18_AV_SVIDEO_CHROMA8 },
3798c2ecf20Sopenharmony_ci		{ CX18_CARD_INPUT_COMPOSITE2, 2, CX18_AV_COMPOSITE6 },
3808c2ecf20Sopenharmony_ci	},
3818c2ecf20Sopenharmony_ci	.audio_inputs = {
3828c2ecf20Sopenharmony_ci		{ CX18_CARD_INPUT_AUD_TUNER, CX18_AV_AUDIO5,	    0 },
3838c2ecf20Sopenharmony_ci		{ CX18_CARD_INPUT_LINE_IN1,  CX18_AV_AUDIO_SERIAL1, 1 },
3848c2ecf20Sopenharmony_ci		{ CX18_CARD_INPUT_LINE_IN2,  CX18_AV_AUDIO_SERIAL2, 1 },
3858c2ecf20Sopenharmony_ci	},
3868c2ecf20Sopenharmony_ci	.tuners = {
3878c2ecf20Sopenharmony_ci		{ .std = V4L2_STD_PAL_SECAM, .tuner = TUNER_PHILIPS_FM1216ME_MK3 },
3888c2ecf20Sopenharmony_ci	},
3898c2ecf20Sopenharmony_ci	.radio_input = { CX18_CARD_INPUT_AUD_TUNER, CX18_AV_AUDIO_SERIAL1, 2 },
3908c2ecf20Sopenharmony_ci	.ddr = {
3918c2ecf20Sopenharmony_ci		/* MT 46V16M16 memory */
3928c2ecf20Sopenharmony_ci		.chip_config = 0x50306,
3938c2ecf20Sopenharmony_ci		.refresh = 0x753,
3948c2ecf20Sopenharmony_ci		.timing1 = 0x33220953,
3958c2ecf20Sopenharmony_ci		.timing2 = 0x09,
3968c2ecf20Sopenharmony_ci		.tune_lane = 0,
3978c2ecf20Sopenharmony_ci		.initial_emrs = 0,
3988c2ecf20Sopenharmony_ci	},
3998c2ecf20Sopenharmony_ci	.gpio_init.initial_value = 0x1002,
4008c2ecf20Sopenharmony_ci	.gpio_init.direction = 0xf002,
4018c2ecf20Sopenharmony_ci	.gpio_audio_input = { .mask   = 0xf002,
4028c2ecf20Sopenharmony_ci			      .tuner  = 0x1002,   /* LED D1  Tuner AF  */
4038c2ecf20Sopenharmony_ci			      .linein = 0x2000,   /* LED D2  Line In 1 */
4048c2ecf20Sopenharmony_ci			      .radio  = 0x4002 }, /* LED D3  Tuner AF  */
4058c2ecf20Sopenharmony_ci	.pci_list = cx18_pci_cnxt_raptor_pal,
4068c2ecf20Sopenharmony_ci	.i2c = &cx18_i2c_std,
4078c2ecf20Sopenharmony_ci};
4088c2ecf20Sopenharmony_ci
4098c2ecf20Sopenharmony_ci/* ------------------------------------------------------------------------- */
4108c2ecf20Sopenharmony_ci
4118c2ecf20Sopenharmony_ci/* Toshiba Qosmio laptop internal DVB-T/Analog Hybrid Tuner */
4128c2ecf20Sopenharmony_ci
4138c2ecf20Sopenharmony_cistatic const struct cx18_card_pci_info cx18_pci_toshiba_qosmio_dvbt[] = {
4148c2ecf20Sopenharmony_ci	{ PCI_DEVICE_ID_CX23418, CX18_PCI_ID_TOSHIBA, 0x0110 },
4158c2ecf20Sopenharmony_ci	{ 0, 0, 0 }
4168c2ecf20Sopenharmony_ci};
4178c2ecf20Sopenharmony_ci
4188c2ecf20Sopenharmony_cistatic const struct cx18_card cx18_card_toshiba_qosmio_dvbt = {
4198c2ecf20Sopenharmony_ci	.type = CX18_CARD_TOSHIBA_QOSMIO_DVBT,
4208c2ecf20Sopenharmony_ci	.name = "Toshiba Qosmio DVB-T/Analog",
4218c2ecf20Sopenharmony_ci	.comment = "Experimenters and photos needed for device to work well.\n"
4228c2ecf20Sopenharmony_ci		  "\tTo help, mail the linux-media list (www.linuxtv.org).\n",
4238c2ecf20Sopenharmony_ci	.v4l2_capabilities = CX18_CAP_ENCODER,
4248c2ecf20Sopenharmony_ci	.hw_audio_ctrl = CX18_HW_418_AV,
4258c2ecf20Sopenharmony_ci	.hw_all = CX18_HW_418_AV | CX18_HW_TUNER | CX18_HW_GPIO_RESET_CTRL,
4268c2ecf20Sopenharmony_ci	.video_inputs = {
4278c2ecf20Sopenharmony_ci		{ CX18_CARD_INPUT_VID_TUNER,  0, CX18_AV_COMPOSITE6 },
4288c2ecf20Sopenharmony_ci		{ CX18_CARD_INPUT_SVIDEO1,    1,
4298c2ecf20Sopenharmony_ci			CX18_AV_SVIDEO_LUMA3 | CX18_AV_SVIDEO_CHROMA4 },
4308c2ecf20Sopenharmony_ci		{ CX18_CARD_INPUT_COMPOSITE1, 1, CX18_AV_COMPOSITE1 },
4318c2ecf20Sopenharmony_ci	},
4328c2ecf20Sopenharmony_ci	.audio_inputs = {
4338c2ecf20Sopenharmony_ci		{ CX18_CARD_INPUT_AUD_TUNER, CX18_AV_AUDIO5,	    0 },
4348c2ecf20Sopenharmony_ci		{ CX18_CARD_INPUT_LINE_IN1,  CX18_AV_AUDIO_SERIAL1, 1 },
4358c2ecf20Sopenharmony_ci	},
4368c2ecf20Sopenharmony_ci	.tuners = {
4378c2ecf20Sopenharmony_ci		{ .std = V4L2_STD_ALL, .tuner = TUNER_XC2028 },
4388c2ecf20Sopenharmony_ci	},
4398c2ecf20Sopenharmony_ci	.ddr = {
4408c2ecf20Sopenharmony_ci		.chip_config = 0x202,
4418c2ecf20Sopenharmony_ci		.refresh = 0x3bb,
4428c2ecf20Sopenharmony_ci		.timing1 = 0x33320a63,
4438c2ecf20Sopenharmony_ci		.timing2 = 0x0a,
4448c2ecf20Sopenharmony_ci		.tune_lane = 0,
4458c2ecf20Sopenharmony_ci		.initial_emrs = 0x42,
4468c2ecf20Sopenharmony_ci	},
4478c2ecf20Sopenharmony_ci	.xceive_pin = 15,
4488c2ecf20Sopenharmony_ci	.pci_list = cx18_pci_toshiba_qosmio_dvbt,
4498c2ecf20Sopenharmony_ci	.i2c = &cx18_i2c_std,
4508c2ecf20Sopenharmony_ci};
4518c2ecf20Sopenharmony_ci
4528c2ecf20Sopenharmony_ci/* ------------------------------------------------------------------------- */
4538c2ecf20Sopenharmony_ci
4548c2ecf20Sopenharmony_ci/* Leadtek WinFast PVR2100 */
4558c2ecf20Sopenharmony_ci
4568c2ecf20Sopenharmony_cistatic const struct cx18_card_pci_info cx18_pci_leadtek_pvr2100[] = {
4578c2ecf20Sopenharmony_ci	{ PCI_DEVICE_ID_CX23418, CX18_PCI_ID_LEADTEK, 0x6f27 }, /* PVR2100   */
4588c2ecf20Sopenharmony_ci	{ 0, 0, 0 }
4598c2ecf20Sopenharmony_ci};
4608c2ecf20Sopenharmony_ci
4618c2ecf20Sopenharmony_cistatic const struct cx18_card cx18_card_leadtek_pvr2100 = {
4628c2ecf20Sopenharmony_ci	.type = CX18_CARD_LEADTEK_PVR2100,
4638c2ecf20Sopenharmony_ci	.name = "Leadtek WinFast PVR2100",
4648c2ecf20Sopenharmony_ci	.comment = "Experimenters and photos needed for device to work well.\n"
4658c2ecf20Sopenharmony_ci		  "\tTo help, mail the linux-media list (www.linuxtv.org).\n",
4668c2ecf20Sopenharmony_ci	.v4l2_capabilities = CX18_CAP_ENCODER,
4678c2ecf20Sopenharmony_ci	.hw_audio_ctrl = CX18_HW_418_AV,
4688c2ecf20Sopenharmony_ci	.hw_muxer = CX18_HW_GPIO_MUX,
4698c2ecf20Sopenharmony_ci	.hw_all = CX18_HW_418_AV | CX18_HW_TUNER | CX18_HW_GPIO_MUX |
4708c2ecf20Sopenharmony_ci		  CX18_HW_GPIO_RESET_CTRL,
4718c2ecf20Sopenharmony_ci	.video_inputs = {
4728c2ecf20Sopenharmony_ci		{ CX18_CARD_INPUT_VID_TUNER,  0, CX18_AV_COMPOSITE2 },
4738c2ecf20Sopenharmony_ci		{ CX18_CARD_INPUT_SVIDEO1,    1,
4748c2ecf20Sopenharmony_ci			CX18_AV_SVIDEO_LUMA3 | CX18_AV_SVIDEO_CHROMA4 },
4758c2ecf20Sopenharmony_ci		{ CX18_CARD_INPUT_COMPOSITE1, 1, CX18_AV_COMPOSITE7 },
4768c2ecf20Sopenharmony_ci		{ CX18_CARD_INPUT_COMPONENT1, 1, CX18_AV_COMPONENT1 },
4778c2ecf20Sopenharmony_ci	},
4788c2ecf20Sopenharmony_ci	.audio_inputs = {
4798c2ecf20Sopenharmony_ci		{ CX18_CARD_INPUT_AUD_TUNER, CX18_AV_AUDIO5,	    0 },
4808c2ecf20Sopenharmony_ci		{ CX18_CARD_INPUT_LINE_IN1,  CX18_AV_AUDIO_SERIAL1, 1 },
4818c2ecf20Sopenharmony_ci	},
4828c2ecf20Sopenharmony_ci	.tuners = {
4838c2ecf20Sopenharmony_ci		/* XC2028 tuner */
4848c2ecf20Sopenharmony_ci		{ .std = V4L2_STD_ALL, .tuner = TUNER_XC2028 },
4858c2ecf20Sopenharmony_ci	},
4868c2ecf20Sopenharmony_ci	.radio_input = { CX18_CARD_INPUT_AUD_TUNER, CX18_AV_AUDIO5, 2 },
4878c2ecf20Sopenharmony_ci	.ddr = {
4888c2ecf20Sopenharmony_ci		/* Pointer to proper DDR config values provided by Terry Wu */
4898c2ecf20Sopenharmony_ci		.chip_config = 0x303,
4908c2ecf20Sopenharmony_ci		.refresh = 0x3bb,
4918c2ecf20Sopenharmony_ci		.timing1 = 0x24220e83,
4928c2ecf20Sopenharmony_ci		.timing2 = 0x1f,
4938c2ecf20Sopenharmony_ci		.tune_lane = 0,
4948c2ecf20Sopenharmony_ci		.initial_emrs = 0x2,
4958c2ecf20Sopenharmony_ci	},
4968c2ecf20Sopenharmony_ci	.gpio_init.initial_value = 0x6,
4978c2ecf20Sopenharmony_ci	.gpio_init.direction = 0x7,
4988c2ecf20Sopenharmony_ci	.gpio_audio_input = { .mask   = 0x7,
4998c2ecf20Sopenharmony_ci			      .tuner  = 0x6, .linein = 0x2, .radio  = 0x2 },
5008c2ecf20Sopenharmony_ci	.xceive_pin = 1,
5018c2ecf20Sopenharmony_ci	.pci_list = cx18_pci_leadtek_pvr2100,
5028c2ecf20Sopenharmony_ci	.i2c = &cx18_i2c_std,
5038c2ecf20Sopenharmony_ci};
5048c2ecf20Sopenharmony_ci
5058c2ecf20Sopenharmony_ci/* ------------------------------------------------------------------------- */
5068c2ecf20Sopenharmony_ci
5078c2ecf20Sopenharmony_ci/* Leadtek WinFast DVR3100 H */
5088c2ecf20Sopenharmony_ci
5098c2ecf20Sopenharmony_cistatic const struct cx18_card_pci_info cx18_pci_leadtek_dvr3100h[] = {
5108c2ecf20Sopenharmony_ci	{ PCI_DEVICE_ID_CX23418, CX18_PCI_ID_LEADTEK, 0x6690 }, /* DVR3100 H */
5118c2ecf20Sopenharmony_ci	{ 0, 0, 0 }
5128c2ecf20Sopenharmony_ci};
5138c2ecf20Sopenharmony_ci
5148c2ecf20Sopenharmony_cistatic const struct cx18_card cx18_card_leadtek_dvr3100h = {
5158c2ecf20Sopenharmony_ci	.type = CX18_CARD_LEADTEK_DVR3100H,
5168c2ecf20Sopenharmony_ci	.name = "Leadtek WinFast DVR3100 H",
5178c2ecf20Sopenharmony_ci	.comment = "Simultaneous DVB-T and Analog capture supported,\n"
5188c2ecf20Sopenharmony_ci		  "\texcept when capturing Analog from the antenna input.\n",
5198c2ecf20Sopenharmony_ci	.v4l2_capabilities = CX18_CAP_ENCODER,
5208c2ecf20Sopenharmony_ci	.hw_audio_ctrl = CX18_HW_418_AV,
5218c2ecf20Sopenharmony_ci	.hw_muxer = CX18_HW_GPIO_MUX,
5228c2ecf20Sopenharmony_ci	.hw_all = CX18_HW_418_AV | CX18_HW_TUNER | CX18_HW_GPIO_MUX |
5238c2ecf20Sopenharmony_ci		  CX18_HW_DVB | CX18_HW_GPIO_RESET_CTRL,
5248c2ecf20Sopenharmony_ci	.video_inputs = {
5258c2ecf20Sopenharmony_ci		{ CX18_CARD_INPUT_VID_TUNER,  0, CX18_AV_COMPOSITE2 },
5268c2ecf20Sopenharmony_ci		{ CX18_CARD_INPUT_SVIDEO1,    1,
5278c2ecf20Sopenharmony_ci			CX18_AV_SVIDEO_LUMA3 | CX18_AV_SVIDEO_CHROMA4 },
5288c2ecf20Sopenharmony_ci		{ CX18_CARD_INPUT_COMPOSITE1, 1, CX18_AV_COMPOSITE7 },
5298c2ecf20Sopenharmony_ci		{ CX18_CARD_INPUT_COMPONENT1, 1, CX18_AV_COMPONENT1 },
5308c2ecf20Sopenharmony_ci	},
5318c2ecf20Sopenharmony_ci	.audio_inputs = {
5328c2ecf20Sopenharmony_ci		{ CX18_CARD_INPUT_AUD_TUNER, CX18_AV_AUDIO5,	    0 },
5338c2ecf20Sopenharmony_ci		{ CX18_CARD_INPUT_LINE_IN1,  CX18_AV_AUDIO_SERIAL1, 1 },
5348c2ecf20Sopenharmony_ci	},
5358c2ecf20Sopenharmony_ci	.tuners = {
5368c2ecf20Sopenharmony_ci		/* XC3028 tuner */
5378c2ecf20Sopenharmony_ci		{ .std = V4L2_STD_ALL, .tuner = TUNER_XC2028 },
5388c2ecf20Sopenharmony_ci	},
5398c2ecf20Sopenharmony_ci	.radio_input = { CX18_CARD_INPUT_AUD_TUNER, CX18_AV_AUDIO5, 2 },
5408c2ecf20Sopenharmony_ci	.ddr = {
5418c2ecf20Sopenharmony_ci		/* Pointer to proper DDR config values provided by Terry Wu */
5428c2ecf20Sopenharmony_ci		.chip_config = 0x303,
5438c2ecf20Sopenharmony_ci		.refresh = 0x3bb,
5448c2ecf20Sopenharmony_ci		.timing1 = 0x24220e83,
5458c2ecf20Sopenharmony_ci		.timing2 = 0x1f,
5468c2ecf20Sopenharmony_ci		.tune_lane = 0,
5478c2ecf20Sopenharmony_ci		.initial_emrs = 0x2,
5488c2ecf20Sopenharmony_ci	},
5498c2ecf20Sopenharmony_ci	.gpio_init.initial_value = 0x6,
5508c2ecf20Sopenharmony_ci	.gpio_init.direction = 0x7,
5518c2ecf20Sopenharmony_ci	.gpio_audio_input = { .mask   = 0x7,
5528c2ecf20Sopenharmony_ci			      .tuner  = 0x6, .linein = 0x2, .radio  = 0x2 },
5538c2ecf20Sopenharmony_ci	.xceive_pin = 1,
5548c2ecf20Sopenharmony_ci	.pci_list = cx18_pci_leadtek_dvr3100h,
5558c2ecf20Sopenharmony_ci	.i2c = &cx18_i2c_std,
5568c2ecf20Sopenharmony_ci};
5578c2ecf20Sopenharmony_ci
5588c2ecf20Sopenharmony_ci/* ------------------------------------------------------------------------- */
5598c2ecf20Sopenharmony_ci
5608c2ecf20Sopenharmony_cistatic const struct cx18_card *cx18_card_list[] = {
5618c2ecf20Sopenharmony_ci	&cx18_card_hvr1600_esmt,
5628c2ecf20Sopenharmony_ci	&cx18_card_hvr1600_samsung,
5638c2ecf20Sopenharmony_ci	&cx18_card_h900,
5648c2ecf20Sopenharmony_ci	&cx18_card_mpc718,
5658c2ecf20Sopenharmony_ci	&cx18_card_cnxt_raptor_pal,
5668c2ecf20Sopenharmony_ci	&cx18_card_toshiba_qosmio_dvbt,
5678c2ecf20Sopenharmony_ci	&cx18_card_leadtek_pvr2100,
5688c2ecf20Sopenharmony_ci	&cx18_card_leadtek_dvr3100h,
5698c2ecf20Sopenharmony_ci	&cx18_card_gotview_dvd3,
5708c2ecf20Sopenharmony_ci	&cx18_card_hvr1600_s5h1411
5718c2ecf20Sopenharmony_ci};
5728c2ecf20Sopenharmony_ci
5738c2ecf20Sopenharmony_ciconst struct cx18_card *cx18_get_card(u16 index)
5748c2ecf20Sopenharmony_ci{
5758c2ecf20Sopenharmony_ci	if (index >= ARRAY_SIZE(cx18_card_list))
5768c2ecf20Sopenharmony_ci		return NULL;
5778c2ecf20Sopenharmony_ci	return cx18_card_list[index];
5788c2ecf20Sopenharmony_ci}
5798c2ecf20Sopenharmony_ci
5808c2ecf20Sopenharmony_ciint cx18_get_input(struct cx18 *cx, u16 index, struct v4l2_input *input)
5818c2ecf20Sopenharmony_ci{
5828c2ecf20Sopenharmony_ci	const struct cx18_card_video_input *card_input =
5838c2ecf20Sopenharmony_ci		cx->card->video_inputs + index;
5848c2ecf20Sopenharmony_ci	static const char * const input_strs[] = {
5858c2ecf20Sopenharmony_ci		"Tuner 1",
5868c2ecf20Sopenharmony_ci		"S-Video 1",
5878c2ecf20Sopenharmony_ci		"S-Video 2",
5888c2ecf20Sopenharmony_ci		"Composite 1",
5898c2ecf20Sopenharmony_ci		"Composite 2",
5908c2ecf20Sopenharmony_ci		"Component 1"
5918c2ecf20Sopenharmony_ci	};
5928c2ecf20Sopenharmony_ci
5938c2ecf20Sopenharmony_ci	if (index >= cx->nof_inputs)
5948c2ecf20Sopenharmony_ci		return -EINVAL;
5958c2ecf20Sopenharmony_ci	input->index = index;
5968c2ecf20Sopenharmony_ci	strscpy(input->name, input_strs[card_input->video_type - 1],
5978c2ecf20Sopenharmony_ci		sizeof(input->name));
5988c2ecf20Sopenharmony_ci	input->type = (card_input->video_type == CX18_CARD_INPUT_VID_TUNER ?
5998c2ecf20Sopenharmony_ci			V4L2_INPUT_TYPE_TUNER : V4L2_INPUT_TYPE_CAMERA);
6008c2ecf20Sopenharmony_ci	input->audioset = (1 << cx->nof_audio_inputs) - 1;
6018c2ecf20Sopenharmony_ci	input->std = (input->type == V4L2_INPUT_TYPE_TUNER) ?
6028c2ecf20Sopenharmony_ci				cx->tuner_std : V4L2_STD_ALL;
6038c2ecf20Sopenharmony_ci	return 0;
6048c2ecf20Sopenharmony_ci}
6058c2ecf20Sopenharmony_ci
6068c2ecf20Sopenharmony_ciint cx18_get_audio_input(struct cx18 *cx, u16 index, struct v4l2_audio *audio)
6078c2ecf20Sopenharmony_ci{
6088c2ecf20Sopenharmony_ci	const struct cx18_card_audio_input *aud_input =
6098c2ecf20Sopenharmony_ci		cx->card->audio_inputs + index;
6108c2ecf20Sopenharmony_ci	static const char * const input_strs[] = {
6118c2ecf20Sopenharmony_ci		"Tuner 1",
6128c2ecf20Sopenharmony_ci		"Line In 1",
6138c2ecf20Sopenharmony_ci		"Line In 2"
6148c2ecf20Sopenharmony_ci	};
6158c2ecf20Sopenharmony_ci
6168c2ecf20Sopenharmony_ci	memset(audio, 0, sizeof(*audio));
6178c2ecf20Sopenharmony_ci	if (index >= cx->nof_audio_inputs)
6188c2ecf20Sopenharmony_ci		return -EINVAL;
6198c2ecf20Sopenharmony_ci	strscpy(audio->name, input_strs[aud_input->audio_type - 1],
6208c2ecf20Sopenharmony_ci		sizeof(audio->name));
6218c2ecf20Sopenharmony_ci	audio->index = index;
6228c2ecf20Sopenharmony_ci	audio->capability = V4L2_AUDCAP_STEREO;
6238c2ecf20Sopenharmony_ci	return 0;
6248c2ecf20Sopenharmony_ci}
625