Hans Verkuil | 1a0adaf | 2007-04-27 12:31:25 -0300 | [diff] [blame] | 1 | /* |
| 2 | Functions to query card hardware |
| 3 | Copyright (C) 2003-2004 Kevin Thayer <nufan_wfk at yahoo.com> |
| 4 | Copyright (C) 2005-2007 Hans Verkuil <hverkuil@xs4all.nl> |
| 5 | |
| 6 | This program is free software; you can redistribute it and/or modify |
| 7 | it under the terms of the GNU General Public License as published by |
| 8 | the Free Software Foundation; either version 2 of the License, or |
| 9 | (at your option) any later version. |
| 10 | |
| 11 | This program is distributed in the hope that it will be useful, |
| 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | GNU General Public License for more details. |
| 15 | |
| 16 | You should have received a copy of the GNU General Public License |
| 17 | along with this program; if not, write to the Free Software |
| 18 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 19 | */ |
| 20 | |
Hans Verkuil | 612570f | 2007-08-23 05:42:59 -0300 | [diff] [blame] | 21 | #ifndef IVTV_CARDS_H |
| 22 | #define IVTV_CARDS_H |
| 23 | |
| 24 | /* Supported cards */ |
| 25 | #define IVTV_CARD_PVR_250 0 /* WinTV PVR 250 */ |
| 26 | #define IVTV_CARD_PVR_350 1 /* encoder, decoder, tv-out */ |
| 27 | #define IVTV_CARD_PVR_150 2 /* WinTV PVR 150 and PVR 500 (really just two |
| 28 | PVR150s on one PCI board) */ |
| 29 | #define IVTV_CARD_M179 3 /* AVerMedia M179 (encoder only) */ |
| 30 | #define IVTV_CARD_MPG600 4 /* Kuroutoshikou ITVC16-STVLP/YUAN MPG600, encoder only */ |
| 31 | #define IVTV_CARD_MPG160 5 /* Kuroutoshikou ITVC15-STVLP/YUAN MPG160 |
| 32 | cx23415 based, but does not have tv-out */ |
| 33 | #define IVTV_CARD_PG600 6 /* YUAN PG600/DIAMONDMM PVR-550 based on the CX Falcon 2 */ |
| 34 | #define IVTV_CARD_AVC2410 7 /* Adaptec AVC-2410 */ |
| 35 | #define IVTV_CARD_AVC2010 8 /* Adaptec AVD-2010 (No Tuner) */ |
| 36 | #define IVTV_CARD_TG5000TV 9 /* NAGASE TRANSGEAR 5000TV, encoder only */ |
| 37 | #define IVTV_CARD_VA2000MAX_SNT6 10 /* VA2000MAX-STN6 */ |
| 38 | #define IVTV_CARD_CX23416GYC 11 /* Kuroutoshikou CX23416GYC-STVLP (Yuan MPG600GR OEM) */ |
| 39 | #define IVTV_CARD_GV_MVPRX 12 /* I/O Data GV-MVP/RX, RX2, RX2W */ |
| 40 | #define IVTV_CARD_GV_MVPRX2E 13 /* I/O Data GV-MVP/RX2E */ |
| 41 | #define IVTV_CARD_GOTVIEW_PCI_DVD 14 /* GotView PCI DVD */ |
| 42 | #define IVTV_CARD_GOTVIEW_PCI_DVD2 15 /* GotView PCI DVD2 */ |
| 43 | #define IVTV_CARD_YUAN_MPC622 16 /* Yuan MPC622 miniPCI */ |
| 44 | #define IVTV_CARD_DCTMTVP1 17 /* DIGITAL COWBOY DCT-MTVP1 */ |
| 45 | #define IVTV_CARD_PG600V2 18 /* Yuan PG600V2/GotView PCI DVD Lite */ |
| 46 | #define IVTV_CARD_CLUB3D 19 /* Club3D ZAP-TV1x01 */ |
| 47 | #define IVTV_CARD_AVERTV_MCE116 20 /* AVerTV MCE 116 Plus */ |
Hans Verkuil | e2a1774 | 2007-10-30 05:50:03 -0300 | [diff] [blame] | 48 | #define IVTV_CARD_ASUS_FALCON2 21 /* ASUS Falcon2 */ |
Hans Verkuil | fdef464 | 2007-10-30 05:55:58 -0300 | [diff] [blame] | 49 | #define IVTV_CARD_AVER_PVR150PLUS 22 /* AVerMedia PVR-150 Plus */ |
Hans Verkuil | e08323f | 2007-12-07 20:40:16 -0300 | [diff] [blame] | 50 | #define IVTV_CARD_AVER_EZMAKER 23 /* AVerMedia EZMaker PCI Deluxe */ |
Hans Verkuil | 22f23fc | 2008-04-26 09:19:44 -0300 | [diff] [blame] | 51 | #define IVTV_CARD_AVER_M104 24 /* AverMedia M104 miniPCI card */ |
Hans Verkuil | d56eebf | 2008-05-20 06:19:47 -0300 | [diff] [blame] | 52 | #define IVTV_CARD_BUFFALO_MV5L 25 /* Buffalo PC-MV5L/PCI card */ |
Andy Walls | 5036459 | 2009-07-02 23:08:59 -0300 | [diff] [blame] | 53 | #define IVTV_CARD_AVER_ULTRA1500MCE 26 /* AVerMedia UltraTV 1500 MCE */ |
Eric Anderson | 7c12167 | 2010-02-10 22:14:54 -0300 | [diff] [blame] | 54 | #define IVTV_CARD_KIKYOU 27 /* Sony VAIO Giga Pocket (ENX Kikyou) */ |
| 55 | #define IVTV_CARD_LAST 27 |
Hans Verkuil | 612570f | 2007-08-23 05:42:59 -0300 | [diff] [blame] | 56 | |
| 57 | /* Variants of existing cards but with the same PCI IDs. The driver |
| 58 | detects these based on other device information. |
| 59 | These cards must always come last. |
| 60 | New cards must be inserted above, and the indices of the cards below |
| 61 | must be adjusted accordingly. */ |
| 62 | |
| 63 | /* PVR-350 V1 (uses saa7114) */ |
| 64 | #define IVTV_CARD_PVR_350_V1 (IVTV_CARD_LAST+1) |
| 65 | /* 2 variants of Kuroutoshikou CX23416GYC-STVLP (Yuan MPG600GR OEM) */ |
| 66 | #define IVTV_CARD_CX23416GYC_NOGR (IVTV_CARD_LAST+2) |
| 67 | #define IVTV_CARD_CX23416GYC_NOGRYCS (IVTV_CARD_LAST+3) |
| 68 | |
| 69 | /* system vendor and device IDs */ |
| 70 | #define PCI_VENDOR_ID_ICOMP 0x4444 |
| 71 | #define PCI_DEVICE_ID_IVTV15 0x0803 |
| 72 | #define PCI_DEVICE_ID_IVTV16 0x0016 |
| 73 | |
| 74 | /* subsystem vendor ID */ |
| 75 | #define IVTV_PCI_ID_HAUPPAUGE 0x0070 |
| 76 | #define IVTV_PCI_ID_HAUPPAUGE_ALT1 0x0270 |
| 77 | #define IVTV_PCI_ID_HAUPPAUGE_ALT2 0x4070 |
| 78 | #define IVTV_PCI_ID_ADAPTEC 0x9005 |
Hans Verkuil | e2a1774 | 2007-10-30 05:50:03 -0300 | [diff] [blame] | 79 | #define IVTV_PCI_ID_ASUSTEK 0x1043 |
Hans Verkuil | 612570f | 2007-08-23 05:42:59 -0300 | [diff] [blame] | 80 | #define IVTV_PCI_ID_AVERMEDIA 0x1461 |
| 81 | #define IVTV_PCI_ID_YUAN1 0x12ab |
| 82 | #define IVTV_PCI_ID_YUAN2 0xff01 |
| 83 | #define IVTV_PCI_ID_YUAN3 0xffab |
| 84 | #define IVTV_PCI_ID_YUAN4 0xfbab |
| 85 | #define IVTV_PCI_ID_DIAMONDMM 0xff92 |
| 86 | #define IVTV_PCI_ID_IODATA 0x10fc |
| 87 | #define IVTV_PCI_ID_MELCO 0x1154 |
| 88 | #define IVTV_PCI_ID_GOTVIEW1 0xffac |
| 89 | #define IVTV_PCI_ID_GOTVIEW2 0xffad |
Eric Anderson | 7c12167 | 2010-02-10 22:14:54 -0300 | [diff] [blame] | 90 | #define IVTV_PCI_ID_SONY 0x104d |
Hans Verkuil | 612570f | 2007-08-23 05:42:59 -0300 | [diff] [blame] | 91 | |
Andy Walls | ad2fe2d | 2009-11-21 12:52:34 -0300 | [diff] [blame] | 92 | /* hardware flags, no gaps allowed */ |
Andy Walls | 7ce5c41 | 2009-11-21 16:19:27 -0300 | [diff] [blame] | 93 | #define IVTV_HW_CX25840 (1 << 0) |
| 94 | #define IVTV_HW_SAA7115 (1 << 1) |
| 95 | #define IVTV_HW_SAA7127 (1 << 2) |
| 96 | #define IVTV_HW_MSP34XX (1 << 3) |
| 97 | #define IVTV_HW_TUNER (1 << 4) |
| 98 | #define IVTV_HW_WM8775 (1 << 5) |
| 99 | #define IVTV_HW_CS53L32A (1 << 6) |
| 100 | #define IVTV_HW_TVEEPROM (1 << 7) |
| 101 | #define IVTV_HW_SAA7114 (1 << 8) |
| 102 | #define IVTV_HW_UPD64031A (1 << 9) |
| 103 | #define IVTV_HW_UPD6408X (1 << 10) |
| 104 | #define IVTV_HW_SAA717X (1 << 11) |
| 105 | #define IVTV_HW_WM8739 (1 << 12) |
| 106 | #define IVTV_HW_VP27SMPX (1 << 13) |
| 107 | #define IVTV_HW_M52790 (1 << 14) |
| 108 | #define IVTV_HW_GPIO (1 << 15) |
| 109 | #define IVTV_HW_I2C_IR_RX_AVER (1 << 16) |
| 110 | #define IVTV_HW_I2C_IR_RX_HAUP_EXT (1 << 17) /* External before internal */ |
| 111 | #define IVTV_HW_I2C_IR_RX_HAUP_INT (1 << 18) |
| 112 | #define IVTV_HW_Z8F0811_IR_TX_HAUP (1 << 19) |
| 113 | #define IVTV_HW_Z8F0811_IR_RX_HAUP (1 << 20) |
Mauro Carvalho Chehab | e1e2c57 | 2010-12-30 08:31:10 -0300 | [diff] [blame] | 114 | #define IVTV_HW_I2C_IR_RX_ADAPTEC (1 << 21) |
Andy Walls | 7ce5c41 | 2009-11-21 16:19:27 -0300 | [diff] [blame] | 115 | |
| 116 | #define IVTV_HW_Z8F0811_IR_HAUP (IVTV_HW_Z8F0811_IR_RX_HAUP | \ |
| 117 | IVTV_HW_Z8F0811_IR_TX_HAUP) |
Hans Verkuil | 1a0adaf | 2007-04-27 12:31:25 -0300 | [diff] [blame] | 118 | |
| 119 | #define IVTV_HW_SAA711X (IVTV_HW_SAA7115 | IVTV_HW_SAA7114) |
Andy Walls | 7ce5c41 | 2009-11-21 16:19:27 -0300 | [diff] [blame] | 120 | |
| 121 | #define IVTV_HW_IR_RX_ANY (IVTV_HW_I2C_IR_RX_AVER | \ |
| 122 | IVTV_HW_I2C_IR_RX_HAUP_EXT | \ |
| 123 | IVTV_HW_I2C_IR_RX_HAUP_INT | \ |
Mauro Carvalho Chehab | e1e2c57 | 2010-12-30 08:31:10 -0300 | [diff] [blame] | 124 | IVTV_HW_Z8F0811_IR_RX_HAUP | \ |
| 125 | IVTV_HW_I2C_IR_RX_ADAPTEC) |
Andy Walls | 7ce5c41 | 2009-11-21 16:19:27 -0300 | [diff] [blame] | 126 | |
| 127 | #define IVTV_HW_IR_TX_ANY (IVTV_HW_Z8F0811_IR_TX_HAUP) |
| 128 | |
| 129 | #define IVTV_HW_IR_ANY (IVTV_HW_IR_RX_ANY | IVTV_HW_IR_TX_ANY) |
Hans Verkuil | 1a0adaf | 2007-04-27 12:31:25 -0300 | [diff] [blame] | 130 | |
| 131 | /* video inputs */ |
| 132 | #define IVTV_CARD_INPUT_VID_TUNER 1 |
| 133 | #define IVTV_CARD_INPUT_SVIDEO1 2 |
| 134 | #define IVTV_CARD_INPUT_SVIDEO2 3 |
| 135 | #define IVTV_CARD_INPUT_COMPOSITE1 4 |
| 136 | #define IVTV_CARD_INPUT_COMPOSITE2 5 |
| 137 | #define IVTV_CARD_INPUT_COMPOSITE3 6 |
| 138 | |
| 139 | /* audio inputs */ |
| 140 | #define IVTV_CARD_INPUT_AUD_TUNER 1 |
| 141 | #define IVTV_CARD_INPUT_LINE_IN1 2 |
| 142 | #define IVTV_CARD_INPUT_LINE_IN2 3 |
| 143 | |
| 144 | #define IVTV_CARD_MAX_VIDEO_INPUTS 6 |
| 145 | #define IVTV_CARD_MAX_AUDIO_INPUTS 3 |
Hans Verkuil | d00573b | 2008-04-22 14:45:50 -0300 | [diff] [blame] | 146 | #define IVTV_CARD_MAX_TUNERS 3 |
Hans Verkuil | 1a0adaf | 2007-04-27 12:31:25 -0300 | [diff] [blame] | 147 | |
| 148 | /* SAA71XX HW inputs */ |
| 149 | #define IVTV_SAA71XX_COMPOSITE0 0 |
| 150 | #define IVTV_SAA71XX_COMPOSITE1 1 |
| 151 | #define IVTV_SAA71XX_COMPOSITE2 2 |
| 152 | #define IVTV_SAA71XX_COMPOSITE3 3 |
| 153 | #define IVTV_SAA71XX_COMPOSITE4 4 |
| 154 | #define IVTV_SAA71XX_COMPOSITE5 5 |
| 155 | #define IVTV_SAA71XX_SVIDEO0 6 |
| 156 | #define IVTV_SAA71XX_SVIDEO1 7 |
| 157 | #define IVTV_SAA71XX_SVIDEO2 8 |
| 158 | #define IVTV_SAA71XX_SVIDEO3 9 |
| 159 | |
| 160 | /* SAA717X needs to mark the tuner input by ORing with this flag */ |
| 161 | #define IVTV_SAA717X_TUNER_FLAG 0x80 |
| 162 | |
| 163 | /* Dummy HW input */ |
| 164 | #define IVTV_DUMMY_AUDIO 0 |
| 165 | |
| 166 | /* GPIO HW inputs */ |
| 167 | #define IVTV_GPIO_TUNER 0 |
| 168 | #define IVTV_GPIO_LINE_IN 1 |
| 169 | |
| 170 | /* SAA717X HW inputs */ |
| 171 | #define IVTV_SAA717X_IN0 0 |
| 172 | #define IVTV_SAA717X_IN1 1 |
| 173 | #define IVTV_SAA717X_IN2 2 |
| 174 | |
| 175 | /* V4L2 capability aliases */ |
| 176 | #define IVTV_CAP_ENCODER (V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_TUNER | \ |
| 177 | V4L2_CAP_AUDIO | V4L2_CAP_READWRITE | V4L2_CAP_VBI_CAPTURE | \ |
| 178 | V4L2_CAP_SLICED_VBI_CAPTURE) |
Hans Verkuil | 854ad9a | 2008-09-06 09:56:17 -0300 | [diff] [blame] | 179 | #define IVTV_CAP_DECODER (V4L2_CAP_VIDEO_OUTPUT | \ |
Hans Verkuil | 1f13760 | 2007-05-29 08:18:37 -0300 | [diff] [blame] | 180 | V4L2_CAP_SLICED_VBI_OUTPUT | V4L2_CAP_VIDEO_OUTPUT_OVERLAY) |
Hans Verkuil | 1a0adaf | 2007-04-27 12:31:25 -0300 | [diff] [blame] | 181 | |
| 182 | struct ivtv_card_video_input { |
| 183 | u8 video_type; /* video input type */ |
| 184 | u8 audio_index; /* index in ivtv_card_audio_input array */ |
| 185 | u16 video_input; /* hardware video input */ |
| 186 | }; |
| 187 | |
| 188 | struct ivtv_card_audio_input { |
| 189 | u8 audio_type; /* audio input type */ |
| 190 | u32 audio_input; /* hardware audio input */ |
| 191 | u16 muxer_input; /* hardware muxer input for boards with a |
| 192 | multiplexer chip */ |
| 193 | }; |
| 194 | |
| 195 | struct ivtv_card_output { |
| 196 | u8 name[32]; |
| 197 | u16 video_output; /* hardware video output */ |
| 198 | }; |
| 199 | |
| 200 | struct ivtv_card_pci_info { |
| 201 | u16 device; |
| 202 | u16 subsystem_vendor; |
| 203 | u16 subsystem_device; |
| 204 | }; |
| 205 | |
| 206 | /* GPIO definitions */ |
| 207 | |
| 208 | /* The mask is the set of bits used by the operation */ |
| 209 | |
| 210 | struct ivtv_gpio_init { /* set initial GPIO DIR and OUT values */ |
| 211 | u16 direction; /* DIR setting. Leave to 0 if no init is needed */ |
| 212 | u16 initial_value; |
| 213 | }; |
| 214 | |
| 215 | struct ivtv_gpio_video_input { /* select tuner/line in input */ |
| 216 | u16 mask; /* leave to 0 if not supported */ |
| 217 | u16 tuner; |
| 218 | u16 composite; |
| 219 | u16 svideo; |
| 220 | }; |
| 221 | |
| 222 | struct ivtv_gpio_audio_input { /* select tuner/line in input */ |
| 223 | u16 mask; /* leave to 0 if not supported */ |
| 224 | u16 tuner; |
| 225 | u16 linein; |
| 226 | u16 radio; |
| 227 | }; |
| 228 | |
| 229 | struct ivtv_gpio_audio_mute { |
| 230 | u16 mask; /* leave to 0 if not supported */ |
| 231 | u16 mute; /* set this value to mute, 0 to unmute */ |
| 232 | }; |
| 233 | |
| 234 | struct ivtv_gpio_audio_mode { |
| 235 | u16 mask; /* leave to 0 if not supported */ |
| 236 | u16 mono; /* set audio to mono */ |
| 237 | u16 stereo; /* set audio to stereo */ |
| 238 | u16 lang1; /* set audio to the first language */ |
| 239 | u16 lang2; /* set audio to the second language */ |
| 240 | u16 both; /* both languages are output */ |
| 241 | }; |
| 242 | |
| 243 | struct ivtv_gpio_audio_freq { |
| 244 | u16 mask; /* leave to 0 if not supported */ |
| 245 | u16 f32000; |
| 246 | u16 f44100; |
| 247 | u16 f48000; |
| 248 | }; |
| 249 | |
| 250 | struct ivtv_gpio_audio_detect { |
| 251 | u16 mask; /* leave to 0 if not supported */ |
| 252 | u16 stereo; /* if the input matches this value then |
| 253 | stereo is detected */ |
| 254 | }; |
| 255 | |
| 256 | struct ivtv_card_tuner { |
| 257 | v4l2_std_id std; /* standard for which the tuner is suitable */ |
| 258 | int tuner; /* tuner ID (from tuner.h) */ |
| 259 | }; |
| 260 | |
Hans Verkuil | d900920 | 2007-12-07 21:01:15 -0300 | [diff] [blame] | 261 | struct ivtv_card_tuner_i2c { |
| 262 | unsigned short radio[2];/* radio tuner i2c address to probe */ |
| 263 | unsigned short demod[2];/* demodulator i2c address to probe */ |
| 264 | unsigned short tv[4]; /* tv tuner i2c addresses to probe */ |
| 265 | }; |
| 266 | |
Hans Verkuil | 1a0adaf | 2007-04-27 12:31:25 -0300 | [diff] [blame] | 267 | /* for card information/parameters */ |
| 268 | struct ivtv_card { |
| 269 | int type; |
| 270 | char *name; |
Hans Verkuil | ecfcc83 | 2008-04-26 08:48:26 -0300 | [diff] [blame] | 271 | char *comment; |
Hans Verkuil | 1a0adaf | 2007-04-27 12:31:25 -0300 | [diff] [blame] | 272 | u32 v4l2_capabilities; |
| 273 | u32 hw_video; /* hardware used to process video */ |
| 274 | u32 hw_audio; /* hardware used to process audio */ |
| 275 | u32 hw_audio_ctrl; /* hardware used for the V4L2 controls (only 1 dev allowed) */ |
| 276 | u32 hw_muxer; /* hardware used to multiplex audio input */ |
| 277 | u32 hw_all; /* all hardware used by the board */ |
| 278 | struct ivtv_card_video_input video_inputs[IVTV_CARD_MAX_VIDEO_INPUTS]; |
| 279 | struct ivtv_card_audio_input audio_inputs[IVTV_CARD_MAX_AUDIO_INPUTS]; |
| 280 | struct ivtv_card_audio_input radio_input; |
| 281 | int nof_outputs; |
| 282 | const struct ivtv_card_output *video_outputs; |
| 283 | u8 gr_config; /* config byte for the ghost reduction device */ |
Hans Verkuil | 136531d | 2008-04-26 14:16:18 -0300 | [diff] [blame] | 284 | u8 xceive_pin; /* XCeive tuner GPIO reset pin */ |
Hans Verkuil | 1a0adaf | 2007-04-27 12:31:25 -0300 | [diff] [blame] | 285 | |
| 286 | /* GPIO card-specific settings */ |
| 287 | struct ivtv_gpio_init gpio_init; |
| 288 | struct ivtv_gpio_video_input gpio_video_input; |
| 289 | struct ivtv_gpio_audio_input gpio_audio_input; |
| 290 | struct ivtv_gpio_audio_mute gpio_audio_mute; |
| 291 | struct ivtv_gpio_audio_mode gpio_audio_mode; |
| 292 | struct ivtv_gpio_audio_freq gpio_audio_freq; |
| 293 | struct ivtv_gpio_audio_detect gpio_audio_detect; |
| 294 | |
| 295 | struct ivtv_card_tuner tuners[IVTV_CARD_MAX_TUNERS]; |
Hans Verkuil | d900920 | 2007-12-07 21:01:15 -0300 | [diff] [blame] | 296 | struct ivtv_card_tuner_i2c *i2c; |
Hans Verkuil | 1a0adaf | 2007-04-27 12:31:25 -0300 | [diff] [blame] | 297 | |
| 298 | /* list of device and subsystem vendor/devices that |
| 299 | correspond to this card type. */ |
| 300 | const struct ivtv_card_pci_info *pci_list; |
| 301 | }; |
| 302 | |
| 303 | int ivtv_get_input(struct ivtv *itv, u16 index, struct v4l2_input *input); |
| 304 | int ivtv_get_output(struct ivtv *itv, u16 index, struct v4l2_output *output); |
| 305 | int ivtv_get_audio_input(struct ivtv *itv, u16 index, struct v4l2_audio *input); |
| 306 | int ivtv_get_audio_output(struct ivtv *itv, u16 index, struct v4l2_audioout *output); |
| 307 | const struct ivtv_card *ivtv_get_card(u16 index); |
Hans Verkuil | 612570f | 2007-08-23 05:42:59 -0300 | [diff] [blame] | 308 | |
| 309 | #endif |