Path: blob/master/drivers/media/video/cx18/cx18-cards.c
17768 views
/*1* cx18 functions to query card hardware2*3* Derived from ivtv-cards.c4*5* Copyright (C) 2007 Hans Verkuil <[email protected]>6* Copyright (C) 2008 Andy Walls <[email protected]>7*8* This program is free software; you can redistribute it and/or modify9* it under the terms of the GNU General Public License as published by10* the Free Software Foundation; either version 2 of the License, or11* (at your option) any later version.12*13* This program is distributed in the hope that it will be useful,14* but WITHOUT ANY WARRANTY; without even the implied warranty of15* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the16* GNU General Public License for more details.17*18* You should have received a copy of the GNU General Public License19* along with this program; if not, write to the Free Software20* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA21* 02111-1307 USA22*/2324#include "cx18-driver.h"25#include "cx18-cards.h"26#include "cx18-av-core.h"27#include "cx18-i2c.h"28#include <media/cs5345.h>2930#define V4L2_STD_PAL_SECAM (V4L2_STD_PAL|V4L2_STD_SECAM)3132/********************** card configuration *******************************/3334/* usual i2c tuner addresses to probe */35static struct cx18_card_tuner_i2c cx18_i2c_std = {36.radio = { I2C_CLIENT_END },37.demod = { 0x43, I2C_CLIENT_END },38.tv = { 0x61, 0x60, I2C_CLIENT_END },39};4041/*42* usual i2c tuner addresses to probe with additional demod address for43* an NXP TDA8295 at 0x42 (N.B. it can possibly be at 0x4b or 0x4c too).44*/45static struct cx18_card_tuner_i2c cx18_i2c_nxp = {46.radio = { I2C_CLIENT_END },47.demod = { 0x42, 0x43, I2C_CLIENT_END },48.tv = { 0x61, 0x60, I2C_CLIENT_END },49};5051/* Please add new PCI IDs to: http://pci-ids.ucw.cz/52This keeps the PCI ID database up to date. Note that the entries53must be added under vendor 0x4444 (Conexant) as subsystem IDs.54New vendor IDs should still be added to the vendor ID list. */5556/* Hauppauge HVR-1600 cards */5758/* Note: for Hauppauge cards the tveeprom information is used instead59of PCI IDs */60static const struct cx18_card cx18_card_hvr1600_esmt = {61.type = CX18_CARD_HVR_1600_ESMT,62.name = "Hauppauge HVR-1600",63.comment = "Simultaneous Digital and Analog TV capture supported\n",64.v4l2_capabilities = CX18_CAP_ENCODER,65.hw_audio_ctrl = CX18_HW_418_AV,66.hw_muxer = CX18_HW_CS5345,67.hw_all = CX18_HW_TVEEPROM | CX18_HW_418_AV | CX18_HW_TUNER |68CX18_HW_CS5345 | CX18_HW_DVB | CX18_HW_GPIO_RESET_CTRL |69CX18_HW_Z8F0811_IR_HAUP,70.video_inputs = {71{ CX18_CARD_INPUT_VID_TUNER, 0, CX18_AV_COMPOSITE7 },72{ CX18_CARD_INPUT_SVIDEO1, 1, CX18_AV_SVIDEO1 },73{ CX18_CARD_INPUT_COMPOSITE1, 1, CX18_AV_COMPOSITE3 },74{ CX18_CARD_INPUT_SVIDEO2, 2, CX18_AV_SVIDEO2 },75{ CX18_CARD_INPUT_COMPOSITE2, 2, CX18_AV_COMPOSITE4 },76},77.audio_inputs = {78{ CX18_CARD_INPUT_AUD_TUNER,79CX18_AV_AUDIO8, CS5345_IN_1 | CS5345_MCLK_1_5 },80{ CX18_CARD_INPUT_LINE_IN1,81CX18_AV_AUDIO_SERIAL1, CS5345_IN_2 },82{ CX18_CARD_INPUT_LINE_IN2,83CX18_AV_AUDIO_SERIAL1, CS5345_IN_3 },84},85.radio_input = { CX18_CARD_INPUT_AUD_TUNER,86CX18_AV_AUDIO_SERIAL1, CS5345_IN_4 },87.ddr = {88/* ESMT M13S128324A-5B memory */89.chip_config = 0x003,90.refresh = 0x30c,91.timing1 = 0x44220e82,92.timing2 = 0x08,93.tune_lane = 0,94.initial_emrs = 0,95},96.gpio_init.initial_value = 0x3001,97.gpio_init.direction = 0x3001,98.gpio_i2c_slave_reset = {99.active_lo_mask = 0x3001,100.msecs_asserted = 10,101.msecs_recovery = 40,102.ir_reset_mask = 0x0001,103},104.i2c = &cx18_i2c_std,105};106107static const struct cx18_card cx18_card_hvr1600_s5h1411 = {108.type = CX18_CARD_HVR_1600_S5H1411,109.name = "Hauppauge HVR-1600",110.comment = "Simultaneous Digital and Analog TV capture supported\n",111.v4l2_capabilities = CX18_CAP_ENCODER,112.hw_audio_ctrl = CX18_HW_418_AV,113.hw_muxer = CX18_HW_CS5345,114.hw_all = CX18_HW_TVEEPROM | CX18_HW_418_AV | CX18_HW_TUNER |115CX18_HW_CS5345 | CX18_HW_DVB | CX18_HW_GPIO_RESET_CTRL |116CX18_HW_Z8F0811_IR_HAUP,117.video_inputs = {118{ CX18_CARD_INPUT_VID_TUNER, 0, CX18_AV_COMPOSITE7 },119{ CX18_CARD_INPUT_SVIDEO1, 1, CX18_AV_SVIDEO1 },120{ CX18_CARD_INPUT_COMPOSITE1, 1, CX18_AV_COMPOSITE3 },121{ CX18_CARD_INPUT_SVIDEO2, 2, CX18_AV_SVIDEO2 },122{ CX18_CARD_INPUT_COMPOSITE2, 2, CX18_AV_COMPOSITE4 },123},124.audio_inputs = {125{ CX18_CARD_INPUT_AUD_TUNER,126CX18_AV_AUDIO8, CS5345_IN_1 | CS5345_MCLK_1_5 },127{ CX18_CARD_INPUT_LINE_IN1,128CX18_AV_AUDIO_SERIAL1, CS5345_IN_2 },129{ CX18_CARD_INPUT_LINE_IN2,130CX18_AV_AUDIO_SERIAL1, CS5345_IN_3 },131},132.radio_input = { CX18_CARD_INPUT_AUD_TUNER,133CX18_AV_AUDIO_SERIAL1, CS5345_IN_4 },134.ddr = {135/* ESMT M13S128324A-5B memory */136.chip_config = 0x003,137.refresh = 0x30c,138.timing1 = 0x44220e82,139.timing2 = 0x08,140.tune_lane = 0,141.initial_emrs = 0,142},143.gpio_init.initial_value = 0x3801,144.gpio_init.direction = 0x3801,145.gpio_i2c_slave_reset = {146.active_lo_mask = 0x3801,147.msecs_asserted = 10,148.msecs_recovery = 40,149.ir_reset_mask = 0x0001,150},151.i2c = &cx18_i2c_nxp,152};153154static const struct cx18_card cx18_card_hvr1600_samsung = {155.type = CX18_CARD_HVR_1600_SAMSUNG,156.name = "Hauppauge HVR-1600 (Preproduction)",157.comment = "Simultaneous Digital and Analog TV capture supported\n",158.v4l2_capabilities = CX18_CAP_ENCODER,159.hw_audio_ctrl = CX18_HW_418_AV,160.hw_muxer = CX18_HW_CS5345,161.hw_all = CX18_HW_TVEEPROM | CX18_HW_418_AV | CX18_HW_TUNER |162CX18_HW_CS5345 | CX18_HW_DVB | CX18_HW_GPIO_RESET_CTRL |163CX18_HW_Z8F0811_IR_HAUP,164.video_inputs = {165{ CX18_CARD_INPUT_VID_TUNER, 0, CX18_AV_COMPOSITE7 },166{ CX18_CARD_INPUT_SVIDEO1, 1, CX18_AV_SVIDEO1 },167{ CX18_CARD_INPUT_COMPOSITE1, 1, CX18_AV_COMPOSITE3 },168{ CX18_CARD_INPUT_SVIDEO2, 2, CX18_AV_SVIDEO2 },169{ CX18_CARD_INPUT_COMPOSITE2, 2, CX18_AV_COMPOSITE4 },170},171.audio_inputs = {172{ CX18_CARD_INPUT_AUD_TUNER,173CX18_AV_AUDIO8, CS5345_IN_1 | CS5345_MCLK_1_5 },174{ CX18_CARD_INPUT_LINE_IN1,175CX18_AV_AUDIO_SERIAL1, CS5345_IN_2 },176{ CX18_CARD_INPUT_LINE_IN2,177CX18_AV_AUDIO_SERIAL1, CS5345_IN_3 },178},179.radio_input = { CX18_CARD_INPUT_AUD_TUNER,180CX18_AV_AUDIO_SERIAL1, CS5345_IN_4 },181.ddr = {182/* Samsung K4D263238G-VC33 memory */183.chip_config = 0x003,184.refresh = 0x30c,185.timing1 = 0x23230b73,186.timing2 = 0x08,187.tune_lane = 0,188.initial_emrs = 2,189},190.gpio_init.initial_value = 0x3001,191.gpio_init.direction = 0x3001,192.gpio_i2c_slave_reset = {193.active_lo_mask = 0x3001,194.msecs_asserted = 10,195.msecs_recovery = 40,196.ir_reset_mask = 0x0001,197},198.i2c = &cx18_i2c_std,199};200201/* ------------------------------------------------------------------------- */202203/* Compro VideoMate H900: note that this card is analog only! */204205static const struct cx18_card_pci_info cx18_pci_h900[] = {206{ PCI_DEVICE_ID_CX23418, CX18_PCI_ID_COMPRO, 0xe100 },207{ 0, 0, 0 }208};209210static const struct cx18_card cx18_card_h900 = {211.type = CX18_CARD_COMPRO_H900,212.name = "Compro VideoMate H900",213.comment = "Analog TV capture supported\n",214.v4l2_capabilities = CX18_CAP_ENCODER,215.hw_audio_ctrl = CX18_HW_418_AV,216.hw_all = CX18_HW_418_AV | CX18_HW_TUNER | CX18_HW_GPIO_RESET_CTRL,217.video_inputs = {218{ CX18_CARD_INPUT_VID_TUNER, 0, CX18_AV_COMPOSITE2 },219{ CX18_CARD_INPUT_SVIDEO1, 1,220CX18_AV_SVIDEO_LUMA3 | CX18_AV_SVIDEO_CHROMA4 },221{ CX18_CARD_INPUT_COMPOSITE1, 1, CX18_AV_COMPOSITE1 },222},223.audio_inputs = {224{ CX18_CARD_INPUT_AUD_TUNER,225CX18_AV_AUDIO5, 0 },226{ CX18_CARD_INPUT_LINE_IN1,227CX18_AV_AUDIO_SERIAL1, 0 },228},229.radio_input = { CX18_CARD_INPUT_AUD_TUNER,230CX18_AV_AUDIO_SERIAL1, 0 },231.tuners = {232{ .std = V4L2_STD_ALL, .tuner = TUNER_XC2028 },233},234.ddr = {235/* EtronTech EM6A9160TS-5G memory */236.chip_config = 0x50003,237.refresh = 0x753,238.timing1 = 0x24330e84,239.timing2 = 0x1f,240.tune_lane = 0,241.initial_emrs = 0,242},243.xceive_pin = 15,244.pci_list = cx18_pci_h900,245.i2c = &cx18_i2c_std,246};247248/* ------------------------------------------------------------------------- */249250/* Yuan MPC718: not working at the moment! */251252static const struct cx18_card_pci_info cx18_pci_mpc718[] = {253{ PCI_DEVICE_ID_CX23418, CX18_PCI_ID_YUAN, 0x0718 },254{ 0, 0, 0 }255};256257static const struct cx18_card cx18_card_mpc718 = {258.type = CX18_CARD_YUAN_MPC718,259.name = "Yuan MPC718 MiniPCI DVB-T/Analog",260.comment = "Experimenters needed for device to work well.\n"261"\tTo help, mail the ivtv-devel list (www.ivtvdriver.org).\n",262.v4l2_capabilities = CX18_CAP_ENCODER,263.hw_audio_ctrl = CX18_HW_418_AV,264.hw_muxer = CX18_HW_GPIO_MUX,265.hw_all = CX18_HW_TVEEPROM | CX18_HW_418_AV | CX18_HW_TUNER |266CX18_HW_GPIO_MUX | CX18_HW_DVB | CX18_HW_GPIO_RESET_CTRL,267.video_inputs = {268{ CX18_CARD_INPUT_VID_TUNER, 0, CX18_AV_COMPOSITE2 },269{ CX18_CARD_INPUT_SVIDEO1, 1,270CX18_AV_SVIDEO_LUMA3 | CX18_AV_SVIDEO_CHROMA4 },271{ CX18_CARD_INPUT_COMPOSITE1, 1, CX18_AV_COMPOSITE1 },272{ CX18_CARD_INPUT_SVIDEO2, 2,273CX18_AV_SVIDEO_LUMA7 | CX18_AV_SVIDEO_CHROMA8 },274{ CX18_CARD_INPUT_COMPOSITE2, 2, CX18_AV_COMPOSITE6 },275},276.audio_inputs = {277{ CX18_CARD_INPUT_AUD_TUNER, CX18_AV_AUDIO5, 0 },278{ CX18_CARD_INPUT_LINE_IN1, CX18_AV_AUDIO_SERIAL1, 1 },279{ CX18_CARD_INPUT_LINE_IN2, CX18_AV_AUDIO_SERIAL2, 1 },280},281.tuners = {282/* XC3028 tuner */283{ .std = V4L2_STD_ALL, .tuner = TUNER_XC2028 },284},285/* FIXME - the FM radio is just a guess and driver doesn't use SIF */286.radio_input = { CX18_CARD_INPUT_AUD_TUNER, CX18_AV_AUDIO5, 2 },287.ddr = {288/* Hynix HY5DU283222B DDR RAM */289.chip_config = 0x303,290.refresh = 0x3bd,291.timing1 = 0x36320966,292.timing2 = 0x1f,293.tune_lane = 0,294.initial_emrs = 2,295},296.gpio_init.initial_value = 0x1,297.gpio_init.direction = 0x3,298/* FIXME - these GPIO's are just guesses */299.gpio_audio_input = { .mask = 0x3,300.tuner = 0x1,301.linein = 0x3,302.radio = 0x1 },303.xceive_pin = 0,304.pci_list = cx18_pci_mpc718,305.i2c = &cx18_i2c_std,306};307308/* ------------------------------------------------------------------------- */309310/* GoTView PCI */311312static const struct cx18_card_pci_info cx18_pci_gotview_dvd3[] = {313{ PCI_DEVICE_ID_CX23418, CX18_PCI_ID_GOTVIEW, 0x3343 },314{ 0, 0, 0 }315};316317static const struct cx18_card cx18_card_gotview_dvd3 = {318.type = CX18_CARD_GOTVIEW_PCI_DVD3,319.name = "GoTView PCI DVD3 Hybrid",320.comment = "Experimenters needed for device to work well.\n"321"\tTo help, mail the ivtv-devel list (www.ivtvdriver.org).\n",322.v4l2_capabilities = CX18_CAP_ENCODER,323.hw_audio_ctrl = CX18_HW_418_AV,324.hw_muxer = CX18_HW_GPIO_MUX,325.hw_all = CX18_HW_TVEEPROM | CX18_HW_418_AV | CX18_HW_TUNER |326CX18_HW_GPIO_MUX | CX18_HW_DVB | CX18_HW_GPIO_RESET_CTRL,327.video_inputs = {328{ CX18_CARD_INPUT_VID_TUNER, 0, CX18_AV_COMPOSITE2 },329{ CX18_CARD_INPUT_SVIDEO1, 1,330CX18_AV_SVIDEO_LUMA3 | CX18_AV_SVIDEO_CHROMA4 },331{ CX18_CARD_INPUT_COMPOSITE1, 1, CX18_AV_COMPOSITE1 },332{ CX18_CARD_INPUT_SVIDEO2, 2,333CX18_AV_SVIDEO_LUMA7 | CX18_AV_SVIDEO_CHROMA8 },334{ CX18_CARD_INPUT_COMPOSITE2, 2, CX18_AV_COMPOSITE6 },335},336.audio_inputs = {337{ CX18_CARD_INPUT_AUD_TUNER, CX18_AV_AUDIO5, 0 },338{ CX18_CARD_INPUT_LINE_IN1, CX18_AV_AUDIO_SERIAL1, 1 },339{ CX18_CARD_INPUT_LINE_IN2, CX18_AV_AUDIO_SERIAL2, 1 },340},341.tuners = {342/* XC3028 tuner */343{ .std = V4L2_STD_ALL, .tuner = TUNER_XC2028 },344},345/* FIXME - the FM radio is just a guess and driver doesn't use SIF */346.radio_input = { CX18_CARD_INPUT_AUD_TUNER, CX18_AV_AUDIO5, 2 },347.ddr = {348/* Hynix HY5DU283222B DDR RAM */349.chip_config = 0x303,350.refresh = 0x3bd,351.timing1 = 0x36320966,352.timing2 = 0x1f,353.tune_lane = 0,354.initial_emrs = 2,355},356.gpio_init.initial_value = 0x1,357.gpio_init.direction = 0x3,358359.gpio_audio_input = { .mask = 0x3,360.tuner = 0x1,361.linein = 0x2,362.radio = 0x1 },363.xceive_pin = 0,364.pci_list = cx18_pci_gotview_dvd3,365.i2c = &cx18_i2c_std,366};367368/* ------------------------------------------------------------------------- */369370/* Conexant Raptor PAL/SECAM: note that this card is analog only! */371372static const struct cx18_card_pci_info cx18_pci_cnxt_raptor_pal[] = {373{ PCI_DEVICE_ID_CX23418, CX18_PCI_ID_CONEXANT, 0x0009 },374{ 0, 0, 0 }375};376377static const struct cx18_card cx18_card_cnxt_raptor_pal = {378.type = CX18_CARD_CNXT_RAPTOR_PAL,379.name = "Conexant Raptor PAL/SECAM",380.comment = "Analog TV capture supported\n",381.v4l2_capabilities = CX18_CAP_ENCODER,382.hw_audio_ctrl = CX18_HW_418_AV,383.hw_muxer = CX18_HW_GPIO_MUX,384.hw_all = CX18_HW_418_AV | CX18_HW_TUNER | CX18_HW_GPIO_MUX,385.video_inputs = {386{ CX18_CARD_INPUT_VID_TUNER, 0, CX18_AV_COMPOSITE2 },387{ CX18_CARD_INPUT_SVIDEO1, 1,388CX18_AV_SVIDEO_LUMA3 | CX18_AV_SVIDEO_CHROMA4 },389{ CX18_CARD_INPUT_COMPOSITE1, 1, CX18_AV_COMPOSITE1 },390{ CX18_CARD_INPUT_SVIDEO2, 2,391CX18_AV_SVIDEO_LUMA7 | CX18_AV_SVIDEO_CHROMA8 },392{ CX18_CARD_INPUT_COMPOSITE2, 2, CX18_AV_COMPOSITE6 },393},394.audio_inputs = {395{ CX18_CARD_INPUT_AUD_TUNER, CX18_AV_AUDIO5, 0 },396{ CX18_CARD_INPUT_LINE_IN1, CX18_AV_AUDIO_SERIAL1, 1 },397{ CX18_CARD_INPUT_LINE_IN2, CX18_AV_AUDIO_SERIAL2, 1 },398},399.tuners = {400{ .std = V4L2_STD_PAL_SECAM, .tuner = TUNER_PHILIPS_FM1216ME_MK3 },401},402.radio_input = { CX18_CARD_INPUT_AUD_TUNER, CX18_AV_AUDIO_SERIAL1, 2 },403.ddr = {404/* MT 46V16M16 memory */405.chip_config = 0x50306,406.refresh = 0x753,407.timing1 = 0x33220953,408.timing2 = 0x09,409.tune_lane = 0,410.initial_emrs = 0,411},412.gpio_init.initial_value = 0x1002,413.gpio_init.direction = 0xf002,414.gpio_audio_input = { .mask = 0xf002,415.tuner = 0x1002, /* LED D1 Tuner AF */416.linein = 0x2000, /* LED D2 Line In 1 */417.radio = 0x4002 }, /* LED D3 Tuner AF */418.pci_list = cx18_pci_cnxt_raptor_pal,419.i2c = &cx18_i2c_std,420};421422/* ------------------------------------------------------------------------- */423424/* Toshiba Qosmio laptop internal DVB-T/Analog Hybrid Tuner */425426static const struct cx18_card_pci_info cx18_pci_toshiba_qosmio_dvbt[] = {427{ PCI_DEVICE_ID_CX23418, CX18_PCI_ID_TOSHIBA, 0x0110 },428{ 0, 0, 0 }429};430431static const struct cx18_card cx18_card_toshiba_qosmio_dvbt = {432.type = CX18_CARD_TOSHIBA_QOSMIO_DVBT,433.name = "Toshiba Qosmio DVB-T/Analog",434.comment = "Experimenters and photos needed for device to work well.\n"435"\tTo help, mail the ivtv-devel list (www.ivtvdriver.org).\n",436.v4l2_capabilities = CX18_CAP_ENCODER,437.hw_audio_ctrl = CX18_HW_418_AV,438.hw_all = CX18_HW_418_AV | CX18_HW_TUNER | CX18_HW_GPIO_RESET_CTRL,439.video_inputs = {440{ CX18_CARD_INPUT_VID_TUNER, 0, CX18_AV_COMPOSITE6 },441{ CX18_CARD_INPUT_SVIDEO1, 1,442CX18_AV_SVIDEO_LUMA3 | CX18_AV_SVIDEO_CHROMA4 },443{ CX18_CARD_INPUT_COMPOSITE1, 1, CX18_AV_COMPOSITE1 },444},445.audio_inputs = {446{ CX18_CARD_INPUT_AUD_TUNER, CX18_AV_AUDIO5, 0 },447{ CX18_CARD_INPUT_LINE_IN1, CX18_AV_AUDIO_SERIAL1, 1 },448},449.tuners = {450{ .std = V4L2_STD_ALL, .tuner = TUNER_XC2028 },451},452.ddr = {453.chip_config = 0x202,454.refresh = 0x3bb,455.timing1 = 0x33320a63,456.timing2 = 0x0a,457.tune_lane = 0,458.initial_emrs = 0x42,459},460.xceive_pin = 15,461.pci_list = cx18_pci_toshiba_qosmio_dvbt,462.i2c = &cx18_i2c_std,463};464465/* ------------------------------------------------------------------------- */466467/* Leadtek WinFast PVR2100 */468469static const struct cx18_card_pci_info cx18_pci_leadtek_pvr2100[] = {470{ PCI_DEVICE_ID_CX23418, CX18_PCI_ID_LEADTEK, 0x6f27 }, /* PVR2100 */471{ 0, 0, 0 }472};473474static const struct cx18_card cx18_card_leadtek_pvr2100 = {475.type = CX18_CARD_LEADTEK_PVR2100,476.name = "Leadtek WinFast PVR2100",477.comment = "Experimenters and photos needed for device to work well.\n"478"\tTo help, mail the ivtv-devel list (www.ivtvdriver.org).\n",479.v4l2_capabilities = CX18_CAP_ENCODER,480.hw_audio_ctrl = CX18_HW_418_AV,481.hw_muxer = CX18_HW_GPIO_MUX,482.hw_all = CX18_HW_418_AV | CX18_HW_TUNER | CX18_HW_GPIO_MUX |483CX18_HW_GPIO_RESET_CTRL,484.video_inputs = {485{ CX18_CARD_INPUT_VID_TUNER, 0, CX18_AV_COMPOSITE2 },486{ CX18_CARD_INPUT_SVIDEO1, 1,487CX18_AV_SVIDEO_LUMA3 | CX18_AV_SVIDEO_CHROMA4 },488{ CX18_CARD_INPUT_COMPOSITE1, 1, CX18_AV_COMPOSITE7 },489{ CX18_CARD_INPUT_COMPONENT1, 1, CX18_AV_COMPONENT1 },490},491.audio_inputs = {492{ CX18_CARD_INPUT_AUD_TUNER, CX18_AV_AUDIO5, 0 },493{ CX18_CARD_INPUT_LINE_IN1, CX18_AV_AUDIO_SERIAL1, 1 },494},495.tuners = {496/* XC2028 tuner */497{ .std = V4L2_STD_ALL, .tuner = TUNER_XC2028 },498},499.radio_input = { CX18_CARD_INPUT_AUD_TUNER, CX18_AV_AUDIO5, 2 },500.ddr = {501/* Pointer to proper DDR config values provided by Terry Wu */502.chip_config = 0x303,503.refresh = 0x3bb,504.timing1 = 0x24220e83,505.timing2 = 0x1f,506.tune_lane = 0,507.initial_emrs = 0x2,508},509.gpio_init.initial_value = 0x6,510.gpio_init.direction = 0x7,511.gpio_audio_input = { .mask = 0x7,512.tuner = 0x6, .linein = 0x2, .radio = 0x2 },513.xceive_pin = 1,514.pci_list = cx18_pci_leadtek_pvr2100,515.i2c = &cx18_i2c_std,516};517518/* ------------------------------------------------------------------------- */519520/* Leadtek WinFast DVR3100 H */521522static const struct cx18_card_pci_info cx18_pci_leadtek_dvr3100h[] = {523{ PCI_DEVICE_ID_CX23418, CX18_PCI_ID_LEADTEK, 0x6690 }, /* DVR3100 H */524{ 0, 0, 0 }525};526527static const struct cx18_card cx18_card_leadtek_dvr3100h = {528.type = CX18_CARD_LEADTEK_DVR3100H,529.name = "Leadtek WinFast DVR3100 H",530.comment = "Simultaneous DVB-T and Analog capture supported,\n"531"\texcept when capturing Analog from the antenna input.\n",532.v4l2_capabilities = CX18_CAP_ENCODER,533.hw_audio_ctrl = CX18_HW_418_AV,534.hw_muxer = CX18_HW_GPIO_MUX,535.hw_all = CX18_HW_418_AV | CX18_HW_TUNER | CX18_HW_GPIO_MUX |536CX18_HW_DVB | CX18_HW_GPIO_RESET_CTRL,537.video_inputs = {538{ CX18_CARD_INPUT_VID_TUNER, 0, CX18_AV_COMPOSITE2 },539{ CX18_CARD_INPUT_SVIDEO1, 1,540CX18_AV_SVIDEO_LUMA3 | CX18_AV_SVIDEO_CHROMA4 },541{ CX18_CARD_INPUT_COMPOSITE1, 1, CX18_AV_COMPOSITE7 },542{ CX18_CARD_INPUT_COMPONENT1, 1, CX18_AV_COMPONENT1 },543},544.audio_inputs = {545{ CX18_CARD_INPUT_AUD_TUNER, CX18_AV_AUDIO5, 0 },546{ CX18_CARD_INPUT_LINE_IN1, CX18_AV_AUDIO_SERIAL1, 1 },547},548.tuners = {549/* XC3028 tuner */550{ .std = V4L2_STD_ALL, .tuner = TUNER_XC2028 },551},552.radio_input = { CX18_CARD_INPUT_AUD_TUNER, CX18_AV_AUDIO5, 2 },553.ddr = {554/* Pointer to proper DDR config values provided by Terry Wu */555.chip_config = 0x303,556.refresh = 0x3bb,557.timing1 = 0x24220e83,558.timing2 = 0x1f,559.tune_lane = 0,560.initial_emrs = 0x2,561},562.gpio_init.initial_value = 0x6,563.gpio_init.direction = 0x7,564.gpio_audio_input = { .mask = 0x7,565.tuner = 0x6, .linein = 0x2, .radio = 0x2 },566.xceive_pin = 1,567.pci_list = cx18_pci_leadtek_dvr3100h,568.i2c = &cx18_i2c_std,569};570571/* ------------------------------------------------------------------------- */572573static const struct cx18_card *cx18_card_list[] = {574&cx18_card_hvr1600_esmt,575&cx18_card_hvr1600_samsung,576&cx18_card_h900,577&cx18_card_mpc718,578&cx18_card_cnxt_raptor_pal,579&cx18_card_toshiba_qosmio_dvbt,580&cx18_card_leadtek_pvr2100,581&cx18_card_leadtek_dvr3100h,582&cx18_card_gotview_dvd3,583&cx18_card_hvr1600_s5h1411584};585586const struct cx18_card *cx18_get_card(u16 index)587{588if (index >= ARRAY_SIZE(cx18_card_list))589return NULL;590return cx18_card_list[index];591}592593int cx18_get_input(struct cx18 *cx, u16 index, struct v4l2_input *input)594{595const struct cx18_card_video_input *card_input =596cx->card->video_inputs + index;597static const char * const input_strs[] = {598"Tuner 1",599"S-Video 1",600"S-Video 2",601"Composite 1",602"Composite 2",603"Component 1"604};605606if (index >= cx->nof_inputs)607return -EINVAL;608input->index = index;609strlcpy(input->name, input_strs[card_input->video_type - 1],610sizeof(input->name));611input->type = (card_input->video_type == CX18_CARD_INPUT_VID_TUNER ?612V4L2_INPUT_TYPE_TUNER : V4L2_INPUT_TYPE_CAMERA);613input->audioset = (1 << cx->nof_audio_inputs) - 1;614input->std = (input->type == V4L2_INPUT_TYPE_TUNER) ?615cx->tuner_std : V4L2_STD_ALL;616return 0;617}618619int cx18_get_audio_input(struct cx18 *cx, u16 index, struct v4l2_audio *audio)620{621const struct cx18_card_audio_input *aud_input =622cx->card->audio_inputs + index;623static const char * const input_strs[] = {624"Tuner 1",625"Line In 1",626"Line In 2"627};628629memset(audio, 0, sizeof(*audio));630if (index >= cx->nof_audio_inputs)631return -EINVAL;632strlcpy(audio->name, input_strs[aud_input->audio_type - 1],633sizeof(audio->name));634audio->index = index;635audio->capability = V4L2_AUDCAP_STEREO;636return 0;637}638639640