Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-or-later */
0002 /*
0003     Functions to query card hardware
0004     Copyright (C) 2003-2004  Kevin Thayer <nufan_wfk at yahoo.com>
0005     Copyright (C) 2005-2007  Hans Verkuil <hverkuil@xs4all.nl>
0006 
0007  */
0008 
0009 #ifndef IVTV_CARDS_H
0010 #define IVTV_CARDS_H
0011 
0012 /* Supported cards */
0013 #define IVTV_CARD_PVR_250         0 /* WinTV PVR 250 */
0014 #define IVTV_CARD_PVR_350         1 /* encoder, decoder, tv-out */
0015 #define IVTV_CARD_PVR_150         2 /* WinTV PVR 150 and PVR 500 (really just two
0016                        PVR150s on one PCI board) */
0017 #define IVTV_CARD_M179            3 /* AVerMedia M179 (encoder only) */
0018 #define IVTV_CARD_MPG600          4 /* Kuroutoshikou ITVC16-STVLP/YUAN MPG600, encoder only */
0019 #define IVTV_CARD_MPG160          5 /* Kuroutoshikou ITVC15-STVLP/YUAN MPG160
0020                        cx23415 based, but does not have tv-out */
0021 #define IVTV_CARD_PG600           6 /* YUAN PG600/DIAMONDMM PVR-550 based on the CX Falcon 2 */
0022 #define IVTV_CARD_AVC2410         7 /* Adaptec AVC-2410 */
0023 #define IVTV_CARD_AVC2010         8 /* Adaptec AVD-2010 (No Tuner) */
0024 #define IVTV_CARD_TG5000TV        9 /* NAGASE TRANSGEAR 5000TV, encoder only */
0025 #define IVTV_CARD_VA2000MAX_SNT6     10 /* VA2000MAX-STN6 */
0026 #define IVTV_CARD_CX23416GYC         11 /* Kuroutoshikou CX23416GYC-STVLP (Yuan MPG600GR OEM) */
0027 #define IVTV_CARD_GV_MVPRX       12 /* I/O Data GV-MVP/RX, RX2, RX2W */
0028 #define IVTV_CARD_GV_MVPRX2E         13 /* I/O Data GV-MVP/RX2E */
0029 #define IVTV_CARD_GOTVIEW_PCI_DVD    14 /* GotView PCI DVD */
0030 #define IVTV_CARD_GOTVIEW_PCI_DVD2   15 /* GotView PCI DVD2 */
0031 #define IVTV_CARD_YUAN_MPC622        16 /* Yuan MPC622 miniPCI */
0032 #define IVTV_CARD_DCTMTVP1       17 /* DIGITAL COWBOY DCT-MTVP1 */
0033 #define IVTV_CARD_PG600V2        18 /* Yuan PG600V2/GotView PCI DVD Lite */
0034 #define IVTV_CARD_CLUB3D         19 /* Club3D ZAP-TV1x01 */
0035 #define IVTV_CARD_AVERTV_MCE116      20 /* AVerTV MCE 116 Plus */
0036 #define IVTV_CARD_ASUS_FALCON2       21 /* ASUS Falcon2 */
0037 #define IVTV_CARD_AVER_PVR150PLUS    22 /* AVerMedia PVR-150 Plus */
0038 #define IVTV_CARD_AVER_EZMAKER       23 /* AVerMedia EZMaker PCI Deluxe */
0039 #define IVTV_CARD_AVER_M104          24 /* AverMedia M104 miniPCI card */
0040 #define IVTV_CARD_BUFFALO_MV5L       25 /* Buffalo PC-MV5L/PCI card */
0041 #define IVTV_CARD_AVER_ULTRA1500MCE  26 /* AVerMedia UltraTV 1500 MCE */
0042 #define IVTV_CARD_KIKYOU             27 /* Sony VAIO Giga Pocket (ENX Kikyou) */
0043 #define IVTV_CARD_LAST           27
0044 
0045 /* Variants of existing cards but with the same PCI IDs. The driver
0046    detects these based on other device information.
0047    These cards must always come last.
0048    New cards must be inserted above, and the indices of the cards below
0049    must be adjusted accordingly. */
0050 
0051 /* PVR-350 V1 (uses saa7114) */
0052 #define IVTV_CARD_PVR_350_V1         (IVTV_CARD_LAST+1)
0053 /* 2 variants of Kuroutoshikou CX23416GYC-STVLP (Yuan MPG600GR OEM) */
0054 #define IVTV_CARD_CX23416GYC_NOGR    (IVTV_CARD_LAST+2)
0055 #define IVTV_CARD_CX23416GYC_NOGRYCS (IVTV_CARD_LAST+3)
0056 
0057 /* system vendor and device IDs */
0058 #define PCI_VENDOR_ID_ICOMP  0x4444
0059 #define PCI_DEVICE_ID_IVTV15 0x0803
0060 #define PCI_DEVICE_ID_IVTV16 0x0016
0061 
0062 /* subsystem vendor ID */
0063 #define IVTV_PCI_ID_HAUPPAUGE       0x0070
0064 #define IVTV_PCI_ID_HAUPPAUGE_ALT1  0x0270
0065 #define IVTV_PCI_ID_HAUPPAUGE_ALT2  0x4070
0066 #define IVTV_PCI_ID_ADAPTEC     0x9005
0067 #define IVTV_PCI_ID_ASUSTEK     0x1043
0068 #define IVTV_PCI_ID_AVERMEDIA       0x1461
0069 #define IVTV_PCI_ID_YUAN1       0x12ab
0070 #define IVTV_PCI_ID_YUAN2       0xff01
0071 #define IVTV_PCI_ID_YUAN3       0xffab
0072 #define IVTV_PCI_ID_YUAN4       0xfbab
0073 #define IVTV_PCI_ID_DIAMONDMM       0xff92
0074 #define IVTV_PCI_ID_IODATA      0x10fc
0075 #define IVTV_PCI_ID_MELCO       0x1154
0076 #define IVTV_PCI_ID_GOTVIEW1        0xffac
0077 #define IVTV_PCI_ID_GOTVIEW2        0xffad
0078 #define IVTV_PCI_ID_SONY        0x104d
0079 
0080 /* hardware flags, no gaps allowed */
0081 enum ivtv_hw_bits {
0082     IVTV_HW_BIT_CX25840,
0083     IVTV_HW_BIT_SAA7115,
0084     IVTV_HW_BIT_SAA7127,
0085     IVTV_HW_BIT_MSP34XX,
0086     IVTV_HW_BIT_TUNER,
0087     IVTV_HW_BIT_WM8775,
0088     IVTV_HW_BIT_CS53L32A,
0089     IVTV_HW_BIT_TVEEPROM,
0090     IVTV_HW_BIT_SAA7114,
0091     IVTV_HW_BIT_UPD64031A,
0092     IVTV_HW_BIT_UPD6408X,
0093     IVTV_HW_BIT_SAA717X,
0094     IVTV_HW_BIT_WM8739,
0095     IVTV_HW_BIT_VP27SMPX,
0096     IVTV_HW_BIT_M52790,
0097     IVTV_HW_BIT_GPIO,
0098     IVTV_HW_BIT_I2C_IR_RX_AVER,
0099     IVTV_HW_BIT_I2C_IR_RX_HAUP_EXT,      /* External before internal */
0100     IVTV_HW_BIT_I2C_IR_RX_HAUP_INT,
0101     IVTV_HW_BIT_Z8F0811_IR_HAUP,
0102     IVTV_HW_BIT_I2C_IR_RX_ADAPTEC,
0103 
0104     IVTV_HW_MAX_BITS    /* Should be the last one */
0105 };
0106 
0107 #define IVTV_HW_CX25840         BIT(IVTV_HW_BIT_CX25840)
0108 #define IVTV_HW_SAA7115         BIT(IVTV_HW_BIT_SAA7115)
0109 #define IVTV_HW_SAA7127         BIT(IVTV_HW_BIT_SAA7127)
0110 #define IVTV_HW_MSP34XX         BIT(IVTV_HW_BIT_MSP34XX)
0111 #define IVTV_HW_TUNER           BIT(IVTV_HW_BIT_TUNER)
0112 #define IVTV_HW_WM8775          BIT(IVTV_HW_BIT_WM8775)
0113 #define IVTV_HW_CS53L32A        BIT(IVTV_HW_BIT_CS53L32A)
0114 #define IVTV_HW_TVEEPROM        BIT(IVTV_HW_BIT_TVEEPROM)
0115 #define IVTV_HW_SAA7114         BIT(IVTV_HW_BIT_SAA7114)
0116 #define IVTV_HW_UPD64031A       BIT(IVTV_HW_BIT_UPD64031A)
0117 #define IVTV_HW_UPD6408X        BIT(IVTV_HW_BIT_UPD6408X)
0118 #define IVTV_HW_SAA717X         BIT(IVTV_HW_BIT_SAA717X)
0119 #define IVTV_HW_WM8739          BIT(IVTV_HW_BIT_WM8739)
0120 #define IVTV_HW_VP27SMPX        BIT(IVTV_HW_BIT_VP27SMPX)
0121 #define IVTV_HW_M52790          BIT(IVTV_HW_BIT_M52790)
0122 #define IVTV_HW_GPIO            BIT(IVTV_HW_BIT_GPIO)
0123 #define IVTV_HW_I2C_IR_RX_AVER      BIT(IVTV_HW_BIT_I2C_IR_RX_AVER)
0124 #define IVTV_HW_I2C_IR_RX_HAUP_EXT  BIT(IVTV_HW_BIT_I2C_IR_RX_HAUP_EXT)
0125 #define IVTV_HW_I2C_IR_RX_HAUP_INT  BIT(IVTV_HW_BIT_I2C_IR_RX_HAUP_INT)
0126 #define IVTV_HW_Z8F0811_IR_HAUP     BIT(IVTV_HW_BIT_Z8F0811_IR_HAUP)
0127 #define IVTV_HW_I2C_IR_RX_ADAPTEC   BIT(IVTV_HW_BIT_I2C_IR_RX_ADAPTEC)
0128 
0129 #define IVTV_HW_SAA711X   (IVTV_HW_SAA7115 | IVTV_HW_SAA7114)
0130 
0131 #define IVTV_HW_IR_ANY (IVTV_HW_I2C_IR_RX_AVER | \
0132             IVTV_HW_I2C_IR_RX_HAUP_EXT | \
0133             IVTV_HW_I2C_IR_RX_HAUP_INT | \
0134             IVTV_HW_Z8F0811_IR_HAUP | \
0135             IVTV_HW_I2C_IR_RX_ADAPTEC)
0136 
0137 /* video inputs */
0138 #define IVTV_CARD_INPUT_VID_TUNER   1
0139 #define IVTV_CARD_INPUT_SVIDEO1     2
0140 #define IVTV_CARD_INPUT_SVIDEO2     3
0141 #define IVTV_CARD_INPUT_COMPOSITE1  4
0142 #define IVTV_CARD_INPUT_COMPOSITE2  5
0143 #define IVTV_CARD_INPUT_COMPOSITE3  6
0144 
0145 /* audio inputs */
0146 #define IVTV_CARD_INPUT_AUD_TUNER   1
0147 #define IVTV_CARD_INPUT_LINE_IN1    2
0148 #define IVTV_CARD_INPUT_LINE_IN2    3
0149 
0150 #define IVTV_CARD_MAX_VIDEO_INPUTS 6
0151 #define IVTV_CARD_MAX_AUDIO_INPUTS 3
0152 #define IVTV_CARD_MAX_TUNERS       3
0153 
0154 /* SAA71XX HW inputs */
0155 #define IVTV_SAA71XX_COMPOSITE0 0
0156 #define IVTV_SAA71XX_COMPOSITE1 1
0157 #define IVTV_SAA71XX_COMPOSITE2 2
0158 #define IVTV_SAA71XX_COMPOSITE3 3
0159 #define IVTV_SAA71XX_COMPOSITE4 4
0160 #define IVTV_SAA71XX_COMPOSITE5 5
0161 #define IVTV_SAA71XX_SVIDEO0    6
0162 #define IVTV_SAA71XX_SVIDEO1    7
0163 #define IVTV_SAA71XX_SVIDEO2    8
0164 #define IVTV_SAA71XX_SVIDEO3    9
0165 
0166 /* SAA717X needs to mark the tuner input by ORing with this flag */
0167 #define IVTV_SAA717X_TUNER_FLAG 0x80
0168 
0169 /* Dummy HW input */
0170 #define IVTV_DUMMY_AUDIO        0
0171 
0172 /* GPIO HW inputs */
0173 #define IVTV_GPIO_TUNER   0
0174 #define IVTV_GPIO_LINE_IN 1
0175 
0176 /* SAA717X HW inputs */
0177 #define IVTV_SAA717X_IN0 0
0178 #define IVTV_SAA717X_IN1 1
0179 #define IVTV_SAA717X_IN2 2
0180 
0181 /* V4L2 capability aliases */
0182 #define IVTV_CAP_ENCODER (V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_TUNER | \
0183               V4L2_CAP_AUDIO | V4L2_CAP_READWRITE | V4L2_CAP_VBI_CAPTURE | \
0184               V4L2_CAP_SLICED_VBI_CAPTURE)
0185 #define IVTV_CAP_DECODER (V4L2_CAP_VIDEO_OUTPUT | V4L2_CAP_SLICED_VBI_OUTPUT)
0186 
0187 struct ivtv_card_video_input {
0188     u8  video_type;     /* video input type */
0189     u8  audio_index;    /* index in ivtv_card_audio_input array */
0190     u16 video_input;    /* hardware video input */
0191 };
0192 
0193 struct ivtv_card_audio_input {
0194     u8  audio_type;     /* audio input type */
0195     u32 audio_input;    /* hardware audio input */
0196     u16 muxer_input;    /* hardware muxer input for boards with a
0197                    multiplexer chip */
0198 };
0199 
0200 struct ivtv_card_output {
0201     u8  name[32];
0202     u16 video_output;  /* hardware video output */
0203 };
0204 
0205 struct ivtv_card_pci_info {
0206     u16 device;
0207     u16 subsystem_vendor;
0208     u16 subsystem_device;
0209 };
0210 
0211 /* GPIO definitions */
0212 
0213 /* The mask is the set of bits used by the operation */
0214 
0215 struct ivtv_gpio_init {     /* set initial GPIO DIR and OUT values */
0216     u16 direction;      /* DIR setting. Leave to 0 if no init is needed */
0217     u16 initial_value;
0218 };
0219 
0220 struct ivtv_gpio_video_input {  /* select tuner/line in input */
0221     u16 mask;       /* leave to 0 if not supported */
0222     u16 tuner;
0223     u16 composite;
0224     u16 svideo;
0225 };
0226 
0227 struct ivtv_gpio_audio_input {  /* select tuner/line in input */
0228     u16 mask;       /* leave to 0 if not supported */
0229     u16 tuner;
0230     u16 linein;
0231     u16 radio;
0232 };
0233 
0234 struct ivtv_gpio_audio_mute {
0235     u16 mask;       /* leave to 0 if not supported */
0236     u16 mute;       /* set this value to mute, 0 to unmute */
0237 };
0238 
0239 struct ivtv_gpio_audio_mode {
0240     u16 mask;       /* leave to 0 if not supported */
0241     u16 mono;       /* set audio to mono */
0242     u16 stereo;     /* set audio to stereo */
0243     u16 lang1;      /* set audio to the first language */
0244     u16 lang2;      /* set audio to the second language */
0245     u16 both;       /* both languages are output */
0246 };
0247 
0248 struct ivtv_gpio_audio_freq {
0249     u16 mask;       /* leave to 0 if not supported */
0250     u16 f32000;
0251     u16 f44100;
0252     u16 f48000;
0253 };
0254 
0255 struct ivtv_gpio_audio_detect {
0256     u16 mask;       /* leave to 0 if not supported */
0257     u16 stereo;     /* if the input matches this value then
0258                    stereo is detected */
0259 };
0260 
0261 struct ivtv_card_tuner {
0262     v4l2_std_id std;    /* standard for which the tuner is suitable */
0263     int     tuner;  /* tuner ID (from tuner.h) */
0264 };
0265 
0266 struct ivtv_card_tuner_i2c {
0267     unsigned short radio[2];/* radio tuner i2c address to probe */
0268     unsigned short demod[2];/* demodulator i2c address to probe */
0269     unsigned short tv[4];   /* tv tuner i2c addresses to probe */
0270 };
0271 
0272 /* for card information/parameters */
0273 struct ivtv_card {
0274     int type;
0275     char *name;
0276     char *comment;
0277     u32 v4l2_capabilities;
0278     u32 hw_video;       /* hardware used to process video */
0279     u32 hw_audio;       /* hardware used to process audio */
0280     u32 hw_audio_ctrl;  /* hardware used for the V4L2 controls (only 1 dev allowed) */
0281     u32 hw_muxer;       /* hardware used to multiplex audio input */
0282     u32 hw_all;     /* all hardware used by the board */
0283     struct ivtv_card_video_input video_inputs[IVTV_CARD_MAX_VIDEO_INPUTS];
0284     struct ivtv_card_audio_input audio_inputs[IVTV_CARD_MAX_AUDIO_INPUTS];
0285     struct ivtv_card_audio_input radio_input;
0286     int nof_outputs;
0287     const struct ivtv_card_output *video_outputs;
0288     u8 gr_config;       /* config byte for the ghost reduction device */
0289     u8 xceive_pin;      /* XCeive tuner GPIO reset pin */
0290 
0291     /* GPIO card-specific settings */
0292     struct ivtv_gpio_init       gpio_init;
0293     struct ivtv_gpio_video_input    gpio_video_input;
0294     struct ivtv_gpio_audio_input    gpio_audio_input;
0295     struct ivtv_gpio_audio_mute gpio_audio_mute;
0296     struct ivtv_gpio_audio_mode gpio_audio_mode;
0297     struct ivtv_gpio_audio_freq gpio_audio_freq;
0298     struct ivtv_gpio_audio_detect   gpio_audio_detect;
0299 
0300     struct ivtv_card_tuner tuners[IVTV_CARD_MAX_TUNERS];
0301     struct ivtv_card_tuner_i2c *i2c;
0302 
0303     /* list of device and subsystem vendor/devices that
0304        correspond to this card type. */
0305     const struct ivtv_card_pci_info *pci_list;
0306 };
0307 
0308 int ivtv_get_input(struct ivtv *itv, u16 index, struct v4l2_input *input);
0309 int ivtv_get_output(struct ivtv *itv, u16 index, struct v4l2_output *output);
0310 int ivtv_get_audio_input(struct ivtv *itv, u16 index, struct v4l2_audio *input);
0311 int ivtv_get_audio_output(struct ivtv *itv, u16 index, struct v4l2_audioout *output);
0312 const struct ivtv_card *ivtv_get_card(u16 index);
0313 
0314 #endif