Laurent Pinchart | 140d881 | 2010-08-18 11:41:22 -0300 | [diff] [blame] | 1 | /* |
| 2 | * Multimedia device API |
| 3 | * |
| 4 | * Copyright (C) 2010 Nokia Corporation |
| 5 | * |
| 6 | * Contacts: Laurent Pinchart <laurent.pinchart@ideasonboard.com> |
| 7 | * Sakari Ailus <sakari.ailus@iki.fi> |
| 8 | * |
| 9 | * This program is free software; you can redistribute it and/or modify |
| 10 | * it under the terms of the GNU General Public License version 2 as |
| 11 | * published by the Free Software Foundation. |
| 12 | * |
| 13 | * This program is distributed in the hope that it will be useful, |
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 | * GNU General Public License for more details. |
| 17 | * |
| 18 | * You should have received a copy of the GNU General Public License |
| 19 | * along with this program; if not, write to the Free Software |
| 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 21 | */ |
| 22 | |
| 23 | #ifndef __LINUX_MEDIA_H |
| 24 | #define __LINUX_MEDIA_H |
| 25 | |
Mauro Carvalho Chehab | b3b7a9f | 2015-12-11 16:07:57 -0200 | [diff] [blame] | 26 | #ifndef __KERNEL__ |
| 27 | #include <stdint.h> |
| 28 | #endif |
Laurent Pinchart | 140d881 | 2010-08-18 11:41:22 -0300 | [diff] [blame] | 29 | #include <linux/ioctl.h> |
| 30 | #include <linux/types.h> |
| 31 | #include <linux/version.h> |
| 32 | |
| 33 | #define MEDIA_API_VERSION KERNEL_VERSION(0, 1, 0) |
| 34 | |
| 35 | struct media_device_info { |
| 36 | char driver[16]; |
| 37 | char model[32]; |
| 38 | char serial[40]; |
| 39 | char bus_info[32]; |
| 40 | __u32 media_version; |
| 41 | __u32 hw_revision; |
| 42 | __u32 driver_version; |
| 43 | __u32 reserved[31]; |
| 44 | }; |
| 45 | |
Laurent Pinchart | 1651333 | 2009-12-09 08:40:01 -0300 | [diff] [blame] | 46 | #define MEDIA_ENT_ID_FLAG_NEXT (1 << 31) |
| 47 | |
Mauro Carvalho Chehab | b50bde4 | 2015-05-07 22:12:38 -0300 | [diff] [blame] | 48 | /* |
| 49 | * Initial value to be used when a new entity is created |
| 50 | * Drivers should change it to something useful |
| 51 | */ |
Mauro Carvalho Chehab | 4ca72ef | 2015-12-10 17:25:41 -0200 | [diff] [blame] | 52 | #define MEDIA_ENT_F_UNKNOWN 0x00000000 |
Mauro Carvalho Chehab | b50bde4 | 2015-05-07 22:12:38 -0300 | [diff] [blame] | 53 | |
Mauro Carvalho Chehab | 32fdc0e | 2015-08-21 11:40:34 -0300 | [diff] [blame] | 54 | /* |
Mauro Carvalho Chehab | 4ca72ef | 2015-12-10 17:25:41 -0200 | [diff] [blame] | 55 | * Base number ranges for entity functions |
Mauro Carvalho Chehab | 32fdc0e | 2015-08-21 11:40:34 -0300 | [diff] [blame] | 56 | * |
Mauro Carvalho Chehab | 4ca72ef | 2015-12-10 17:25:41 -0200 | [diff] [blame] | 57 | * NOTE: those ranges and entity function number are phased just to |
| 58 | * make it easier to maintain this file. Userspace should not rely on |
| 59 | * the ranges to identify a group of function types, as newer |
| 60 | * functions can be added with any name within the full u32 range. |
| 61 | */ |
| 62 | #define MEDIA_ENT_F_BASE 0x00000000 |
| 63 | #define MEDIA_ENT_F_OLD_BASE 0x00010000 |
| 64 | #define MEDIA_ENT_F_OLD_SUBDEV_BASE 0x00020000 |
| 65 | |
| 66 | /* |
| 67 | * DVB entities |
| 68 | */ |
Hans Verkuil | 58402b6e9 | 2016-02-29 09:02:47 +0100 | [diff] [blame] | 69 | #define MEDIA_ENT_F_DTV_DEMOD (MEDIA_ENT_F_BASE + 0x00001) |
| 70 | #define MEDIA_ENT_F_TS_DEMUX (MEDIA_ENT_F_BASE + 0x00002) |
| 71 | #define MEDIA_ENT_F_DTV_CA (MEDIA_ENT_F_BASE + 0x00003) |
| 72 | #define MEDIA_ENT_F_DTV_NET_DECAP (MEDIA_ENT_F_BASE + 0x00004) |
Mauro Carvalho Chehab | 4ca72ef | 2015-12-10 17:25:41 -0200 | [diff] [blame] | 73 | |
| 74 | /* |
Mauro Carvalho Chehab | 4ca72ef | 2015-12-10 17:25:41 -0200 | [diff] [blame] | 75 | * I/O entities |
| 76 | */ |
Hans Verkuil | 58402b6e9 | 2016-02-29 09:02:47 +0100 | [diff] [blame] | 77 | #define MEDIA_ENT_F_IO_DTV (MEDIA_ENT_F_BASE + 0x01001) |
| 78 | #define MEDIA_ENT_F_IO_VBI (MEDIA_ENT_F_BASE + 0x01002) |
| 79 | #define MEDIA_ENT_F_IO_SWRADIO (MEDIA_ENT_F_BASE + 0x01003) |
Mauro Carvalho Chehab | 4ca72ef | 2015-12-10 17:25:41 -0200 | [diff] [blame] | 80 | |
| 81 | /* |
Mauro Carvalho Chehab | 0613193 | 2016-01-28 07:28:08 -0200 | [diff] [blame] | 82 | * Analog TV IF-PLL decoders |
| 83 | * |
| 84 | * It is a responsibility of the master/bridge drivers to create links |
| 85 | * for MEDIA_ENT_F_IF_VID_DECODER and MEDIA_ENT_F_IF_AUD_DECODER. |
| 86 | */ |
Hans Verkuil | 87294e9 | 2016-02-29 05:02:47 -0300 | [diff] [blame^] | 87 | #define MEDIA_ENT_F_IF_VID_DECODER (MEDIA_ENT_F_BASE + 0x02001) |
| 88 | #define MEDIA_ENT_F_IF_AUD_DECODER (MEDIA_ENT_F_BASE + 0x02002) |
Mauro Carvalho Chehab | 8c755c2 | 2016-02-16 09:20:45 -0200 | [diff] [blame] | 89 | |
| 90 | /* |
Shuah Khan | 7a2eba1 | 2016-02-11 21:41:20 -0200 | [diff] [blame] | 91 | * Audio Entity Functions |
| 92 | */ |
Hans Verkuil | 87294e9 | 2016-02-29 05:02:47 -0300 | [diff] [blame^] | 93 | #define MEDIA_ENT_F_AUDIO_CAPTURE (MEDIA_ENT_F_BASE + 0x03000) |
| 94 | #define MEDIA_ENT_F_AUDIO_PLAYBACK (MEDIA_ENT_F_BASE + 0x03001) |
| 95 | #define MEDIA_ENT_F_AUDIO_MIXER (MEDIA_ENT_F_BASE + 0x03002) |
Shuah Khan | 7a2eba1 | 2016-02-11 21:41:20 -0200 | [diff] [blame] | 96 | |
| 97 | /* |
Mauro Carvalho Chehab | 4ca72ef | 2015-12-10 17:25:41 -0200 | [diff] [blame] | 98 | * Connectors |
| 99 | */ |
| 100 | /* It is a responsibility of the entity drivers to add connectors and links */ |
Hans Verkuil | 58402b6e9 | 2016-02-29 09:02:47 +0100 | [diff] [blame] | 101 | #define MEDIA_ENT_F_CONN_RF (MEDIA_ENT_F_BASE + 0x30001) |
| 102 | #define MEDIA_ENT_F_CONN_SVIDEO (MEDIA_ENT_F_BASE + 0x30002) |
| 103 | #define MEDIA_ENT_F_CONN_COMPOSITE (MEDIA_ENT_F_BASE + 0x30003) |
Mauro Carvalho Chehab | 0613193 | 2016-01-28 07:28:08 -0200 | [diff] [blame] | 104 | |
| 105 | /* |
Mauro Carvalho Chehab | 4ca72ef | 2015-12-10 17:25:41 -0200 | [diff] [blame] | 106 | * Don't touch on those. The ranges MEDIA_ENT_F_OLD_BASE and |
| 107 | * MEDIA_ENT_F_OLD_SUBDEV_BASE are kept to keep backward compatibility |
| 108 | * with the legacy v1 API.The number range is out of range by purpose: |
| 109 | * several previously reserved numbers got excluded from this range. |
Mauro Carvalho Chehab | 32fdc0e | 2015-08-21 11:40:34 -0300 | [diff] [blame] | 110 | * |
Mauro Carvalho Chehab | b50bde4 | 2015-05-07 22:12:38 -0300 | [diff] [blame] | 111 | * Subdevs are initialized with MEDIA_ENT_T_V4L2_SUBDEV_UNKNOWN, |
| 112 | * in order to preserve backward compatibility. |
Mauro Carvalho Chehab | d1b9da2 | 2015-12-11 12:41:12 -0200 | [diff] [blame] | 113 | * Drivers must change to the proper subdev type before |
Mauro Carvalho Chehab | b50bde4 | 2015-05-07 22:12:38 -0300 | [diff] [blame] | 114 | * registering the entity. |
| 115 | */ |
Mauro Carvalho Chehab | fa17b46 | 2015-08-21 12:17:40 -0300 | [diff] [blame] | 116 | |
Mauro Carvalho Chehab | 4ca72ef | 2015-12-10 17:25:41 -0200 | [diff] [blame] | 117 | #define MEDIA_ENT_F_IO_V4L (MEDIA_ENT_F_OLD_BASE + 1) |
Mauro Carvalho Chehab | 32fdc0e | 2015-08-21 11:40:34 -0300 | [diff] [blame] | 118 | |
Mauro Carvalho Chehab | 4ca72ef | 2015-12-10 17:25:41 -0200 | [diff] [blame] | 119 | #define MEDIA_ENT_F_CAM_SENSOR (MEDIA_ENT_F_OLD_SUBDEV_BASE + 1) |
| 120 | #define MEDIA_ENT_F_FLASH (MEDIA_ENT_F_OLD_SUBDEV_BASE + 2) |
| 121 | #define MEDIA_ENT_F_LENS (MEDIA_ENT_F_OLD_SUBDEV_BASE + 3) |
| 122 | #define MEDIA_ENT_F_ATV_DECODER (MEDIA_ENT_F_OLD_SUBDEV_BASE + 4) |
Mauro Carvalho Chehab | b3109d6 | 2015-12-11 18:26:53 -0200 | [diff] [blame] | 123 | /* |
Mauro Carvalho Chehab | 0613193 | 2016-01-28 07:28:08 -0200 | [diff] [blame] | 124 | * It is a responsibility of the master/bridge drivers to add connectors |
| 125 | * and links for MEDIA_ENT_F_TUNER. Please notice that some old tuners |
| 126 | * may require the usage of separate I2C chips to decode analog TV signals, |
| 127 | * when the master/bridge chipset doesn't have its own TV standard decoder. |
| 128 | * On such cases, the IF-PLL staging is mapped via one or two entities: |
| 129 | * MEDIA_ENT_F_IF_VID_DECODER and/or MEDIA_ENT_F_IF_AUD_DECODER. |
Mauro Carvalho Chehab | b3109d6 | 2015-12-11 18:26:53 -0200 | [diff] [blame] | 130 | */ |
Mauro Carvalho Chehab | 4ca72ef | 2015-12-10 17:25:41 -0200 | [diff] [blame] | 131 | #define MEDIA_ENT_F_TUNER (MEDIA_ENT_F_OLD_SUBDEV_BASE + 5) |
Mauro Carvalho Chehab | 32fdc0e | 2015-08-21 11:40:34 -0300 | [diff] [blame] | 132 | |
Mauro Carvalho Chehab | 4ca72ef | 2015-12-10 17:25:41 -0200 | [diff] [blame] | 133 | #define MEDIA_ENT_F_V4L2_SUBDEV_UNKNOWN MEDIA_ENT_F_OLD_SUBDEV_BASE |
Mauro Carvalho Chehab | 49a1151 | 2015-08-31 11:41:29 -0300 | [diff] [blame] | 134 | |
Mauro Carvalho Chehab | 4376679 | 2015-08-29 14:50:46 -0300 | [diff] [blame] | 135 | #ifndef __KERNEL__ |
Mauro Carvalho Chehab | 4ca72ef | 2015-12-10 17:25:41 -0200 | [diff] [blame] | 136 | |
| 137 | /* |
| 138 | * Legacy symbols used to avoid userspace compilation breakages |
| 139 | * |
| 140 | * Those symbols map the entity function into types and should be |
| 141 | * used only on legacy programs for legacy hardware. Don't rely |
| 142 | * on those for MEDIA_IOC_G_TOPOLOGY. |
| 143 | */ |
Laurent Pinchart | 1651333 | 2009-12-09 08:40:01 -0300 | [diff] [blame] | 144 | #define MEDIA_ENT_TYPE_SHIFT 16 |
| 145 | #define MEDIA_ENT_TYPE_MASK 0x00ff0000 |
| 146 | #define MEDIA_ENT_SUBTYPE_MASK 0x0000ffff |
| 147 | |
Mauro Carvalho Chehab | 4ca72ef | 2015-12-10 17:25:41 -0200 | [diff] [blame] | 148 | #define MEDIA_ENT_T_DEVNODE MEDIA_ENT_F_OLD_BASE |
| 149 | #define MEDIA_ENT_T_DEVNODE_V4L MEDIA_ENT_F_IO_V4L |
Laurent Pinchart | 1651333 | 2009-12-09 08:40:01 -0300 | [diff] [blame] | 150 | #define MEDIA_ENT_T_DEVNODE_FB (MEDIA_ENT_T_DEVNODE + 2) |
| 151 | #define MEDIA_ENT_T_DEVNODE_ALSA (MEDIA_ENT_T_DEVNODE + 3) |
Mauro Carvalho Chehab | 32fdc0e | 2015-08-21 11:40:34 -0300 | [diff] [blame] | 152 | #define MEDIA_ENT_T_DEVNODE_DVB (MEDIA_ENT_T_DEVNODE + 4) |
Mauro Carvalho Chehab | 4ca72ef | 2015-12-10 17:25:41 -0200 | [diff] [blame] | 153 | |
| 154 | #define MEDIA_ENT_T_UNKNOWN MEDIA_ENT_F_UNKNOWN |
| 155 | #define MEDIA_ENT_T_V4L2_VIDEO MEDIA_ENT_F_IO_V4L |
| 156 | #define MEDIA_ENT_T_V4L2_SUBDEV MEDIA_ENT_F_V4L2_SUBDEV_UNKNOWN |
| 157 | #define MEDIA_ENT_T_V4L2_SUBDEV_SENSOR MEDIA_ENT_F_CAM_SENSOR |
| 158 | #define MEDIA_ENT_T_V4L2_SUBDEV_FLASH MEDIA_ENT_F_FLASH |
| 159 | #define MEDIA_ENT_T_V4L2_SUBDEV_LENS MEDIA_ENT_F_LENS |
| 160 | #define MEDIA_ENT_T_V4L2_SUBDEV_DECODER MEDIA_ENT_F_ATV_DECODER |
| 161 | #define MEDIA_ENT_T_V4L2_SUBDEV_TUNER MEDIA_ENT_F_TUNER |
Mauro Carvalho Chehab | 4376679 | 2015-08-29 14:50:46 -0300 | [diff] [blame] | 162 | #endif |
Mauro Carvalho Chehab | 1d20f9f | 2015-01-03 11:09:39 -0300 | [diff] [blame] | 163 | |
Mauro Carvalho Chehab | 49a1151 | 2015-08-31 11:41:29 -0300 | [diff] [blame] | 164 | /* Entity flags */ |
Laurent Pinchart | 1651333 | 2009-12-09 08:40:01 -0300 | [diff] [blame] | 165 | #define MEDIA_ENT_FL_DEFAULT (1 << 0) |
Mauro Carvalho Chehab | 49a1151 | 2015-08-31 11:41:29 -0300 | [diff] [blame] | 166 | #define MEDIA_ENT_FL_CONNECTOR (1 << 1) |
Laurent Pinchart | 1651333 | 2009-12-09 08:40:01 -0300 | [diff] [blame] | 167 | |
| 168 | struct media_entity_desc { |
| 169 | __u32 id; |
| 170 | char name[32]; |
| 171 | __u32 type; |
| 172 | __u32 revision; |
| 173 | __u32 flags; |
| 174 | __u32 group_id; |
| 175 | __u16 pads; |
| 176 | __u16 links; |
| 177 | |
| 178 | __u32 reserved[4]; |
| 179 | |
| 180 | union { |
| 181 | /* Node specifications */ |
| 182 | struct { |
| 183 | __u32 major; |
| 184 | __u32 minor; |
Mauro Carvalho Chehab | e31a0ba | 2015-01-02 12:18:23 -0300 | [diff] [blame] | 185 | } dev; |
| 186 | |
| 187 | #if 1 |
| 188 | /* |
Hans Verkuil | 7e182f7 | 2015-02-25 12:05:13 -0300 | [diff] [blame] | 189 | * TODO: this shouldn't have been added without |
| 190 | * actual drivers that use this. When the first real driver |
| 191 | * appears that sets this information, special attention |
| 192 | * should be given whether this information is 1) enough, and |
| 193 | * 2) can deal with udev rules that rename devices. The struct |
| 194 | * dev would not be sufficient for this since that does not |
| 195 | * contain the subdevice information. In addition, struct dev |
| 196 | * can only refer to a single device, and not to multiple (e.g. |
| 197 | * pcm and mixer devices). |
| 198 | * |
| 199 | * So for now mark this as a to do. |
| 200 | */ |
| 201 | struct { |
| 202 | __u32 card; |
| 203 | __u32 device; |
| 204 | __u32 subdevice; |
| 205 | } alsa; |
| 206 | #endif |
| 207 | |
| 208 | #if 1 |
| 209 | /* |
Mauro Carvalho Chehab | e31a0ba | 2015-01-02 12:18:23 -0300 | [diff] [blame] | 210 | * DEPRECATED: previous node specifications. Kept just to |
| 211 | * avoid breaking compilation, but media_entity_desc.dev |
| 212 | * should be used instead. In particular, alsa and dvb |
| 213 | * fields below are wrong: for all devnodes, there should |
| 214 | * be just major/minor inside the struct, as this is enough |
| 215 | * to represent any devnode, no matter what type. |
| 216 | */ |
| 217 | struct { |
| 218 | __u32 major; |
| 219 | __u32 minor; |
Laurent Pinchart | 1651333 | 2009-12-09 08:40:01 -0300 | [diff] [blame] | 220 | } v4l; |
| 221 | struct { |
| 222 | __u32 major; |
| 223 | __u32 minor; |
| 224 | } fb; |
Laurent Pinchart | 1651333 | 2009-12-09 08:40:01 -0300 | [diff] [blame] | 225 | int dvb; |
Mauro Carvalho Chehab | e31a0ba | 2015-01-02 12:18:23 -0300 | [diff] [blame] | 226 | #endif |
Laurent Pinchart | 1651333 | 2009-12-09 08:40:01 -0300 | [diff] [blame] | 227 | |
| 228 | /* Sub-device specifications */ |
| 229 | /* Nothing needed yet */ |
| 230 | __u8 raw[184]; |
| 231 | }; |
| 232 | }; |
| 233 | |
| 234 | #define MEDIA_PAD_FL_SINK (1 << 0) |
| 235 | #define MEDIA_PAD_FL_SOURCE (1 << 1) |
Sakari Ailus | d0700c5 | 2013-10-13 07:58:43 -0300 | [diff] [blame] | 236 | #define MEDIA_PAD_FL_MUST_CONNECT (1 << 2) |
Laurent Pinchart | 1651333 | 2009-12-09 08:40:01 -0300 | [diff] [blame] | 237 | |
| 238 | struct media_pad_desc { |
| 239 | __u32 entity; /* entity ID */ |
| 240 | __u16 index; /* pad index */ |
| 241 | __u32 flags; /* pad flags */ |
| 242 | __u32 reserved[2]; |
| 243 | }; |
| 244 | |
| 245 | #define MEDIA_LNK_FL_ENABLED (1 << 0) |
| 246 | #define MEDIA_LNK_FL_IMMUTABLE (1 << 1) |
Laurent Pinchart | e02188c | 2010-08-25 09:00:41 -0300 | [diff] [blame] | 247 | #define MEDIA_LNK_FL_DYNAMIC (1 << 2) |
Laurent Pinchart | 1651333 | 2009-12-09 08:40:01 -0300 | [diff] [blame] | 248 | |
Mauro Carvalho Chehab | c398bb6 | 2015-08-23 08:28:21 -0300 | [diff] [blame] | 249 | #define MEDIA_LNK_FL_LINK_TYPE (0xf << 28) |
| 250 | # define MEDIA_LNK_FL_DATA_LINK (0 << 28) |
| 251 | # define MEDIA_LNK_FL_INTERFACE_LINK (1 << 28) |
| 252 | |
Laurent Pinchart | 1651333 | 2009-12-09 08:40:01 -0300 | [diff] [blame] | 253 | struct media_link_desc { |
| 254 | struct media_pad_desc source; |
| 255 | struct media_pad_desc sink; |
| 256 | __u32 flags; |
| 257 | __u32 reserved[2]; |
| 258 | }; |
| 259 | |
| 260 | struct media_links_enum { |
| 261 | __u32 entity; |
| 262 | /* Should have enough room for pads elements */ |
| 263 | struct media_pad_desc __user *pads; |
| 264 | /* Should have enough room for links elements */ |
| 265 | struct media_link_desc __user *links; |
| 266 | __u32 reserved[4]; |
| 267 | }; |
| 268 | |
Mauro Carvalho Chehab | a1d2510 | 2015-08-20 07:43:07 -0300 | [diff] [blame] | 269 | /* Interface type ranges */ |
| 270 | |
| 271 | #define MEDIA_INTF_T_DVB_BASE 0x00000100 |
| 272 | #define MEDIA_INTF_T_V4L_BASE 0x00000200 |
Shuah Khan | 5af557a | 2016-02-11 21:41:18 -0200 | [diff] [blame] | 273 | #define MEDIA_INTF_T_ALSA_BASE 0x00000300 |
Mauro Carvalho Chehab | a1d2510 | 2015-08-20 07:43:07 -0300 | [diff] [blame] | 274 | |
| 275 | /* Interface types */ |
| 276 | |
| 277 | #define MEDIA_INTF_T_DVB_FE (MEDIA_INTF_T_DVB_BASE) |
| 278 | #define MEDIA_INTF_T_DVB_DEMUX (MEDIA_INTF_T_DVB_BASE + 1) |
| 279 | #define MEDIA_INTF_T_DVB_DVR (MEDIA_INTF_T_DVB_BASE + 2) |
| 280 | #define MEDIA_INTF_T_DVB_CA (MEDIA_INTF_T_DVB_BASE + 3) |
| 281 | #define MEDIA_INTF_T_DVB_NET (MEDIA_INTF_T_DVB_BASE + 4) |
| 282 | |
| 283 | #define MEDIA_INTF_T_V4L_VIDEO (MEDIA_INTF_T_V4L_BASE) |
| 284 | #define MEDIA_INTF_T_V4L_VBI (MEDIA_INTF_T_V4L_BASE + 1) |
| 285 | #define MEDIA_INTF_T_V4L_RADIO (MEDIA_INTF_T_V4L_BASE + 2) |
| 286 | #define MEDIA_INTF_T_V4L_SUBDEV (MEDIA_INTF_T_V4L_BASE + 3) |
| 287 | #define MEDIA_INTF_T_V4L_SWRADIO (MEDIA_INTF_T_V4L_BASE + 4) |
| 288 | |
Shuah Khan | 5af557a | 2016-02-11 21:41:18 -0200 | [diff] [blame] | 289 | #define MEDIA_INTF_T_ALSA_PCM_CAPTURE (MEDIA_INTF_T_ALSA_BASE) |
| 290 | #define MEDIA_INTF_T_ALSA_PCM_PLAYBACK (MEDIA_INTF_T_ALSA_BASE + 1) |
| 291 | #define MEDIA_INTF_T_ALSA_CONTROL (MEDIA_INTF_T_ALSA_BASE + 2) |
| 292 | #define MEDIA_INTF_T_ALSA_COMPRESS (MEDIA_INTF_T_ALSA_BASE + 3) |
| 293 | #define MEDIA_INTF_T_ALSA_RAWMIDI (MEDIA_INTF_T_ALSA_BASE + 4) |
| 294 | #define MEDIA_INTF_T_ALSA_HWDEP (MEDIA_INTF_T_ALSA_BASE + 5) |
| 295 | #define MEDIA_INTF_T_ALSA_SEQUENCER (MEDIA_INTF_T_ALSA_BASE + 6) |
| 296 | #define MEDIA_INTF_T_ALSA_TIMER (MEDIA_INTF_T_ALSA_BASE + 7) |
| 297 | |
Mauro Carvalho Chehab | c398bb6 | 2015-08-23 08:28:21 -0300 | [diff] [blame] | 298 | /* |
| 299 | * MC next gen API definitions |
| 300 | * |
| 301 | * NOTE: The declarations below are close to the MC RFC for the Media |
| 302 | * Controller, the next generation. Yet, there are a few adjustments |
| 303 | * to do, as we want to be able to have a functional API before |
| 304 | * the MC properties change. Those will be properly marked below. |
| 305 | * Please also notice that I removed "num_pads", "num_links", |
| 306 | * from the proposal, as a proper userspace application will likely |
| 307 | * use lists for pads/links, just as we intend to do in Kernelspace. |
| 308 | * The API definition should be freed from fields that are bound to |
| 309 | * some specific data structure. |
| 310 | * |
| 311 | * FIXME: Currently, I opted to name the new types as "media_v2", as this |
| 312 | * won't cause any conflict with the Kernelspace namespace, nor with |
| 313 | * the previous kAPI media_*_desc namespace. This can be changed |
| 314 | * later, before the adding this API upstream. |
| 315 | */ |
| 316 | |
Mauro Carvalho Chehab | 333a651 | 2016-01-25 07:29:13 -0200 | [diff] [blame] | 317 | |
Mauro Carvalho Chehab | c398bb6 | 2015-08-23 08:28:21 -0300 | [diff] [blame] | 318 | struct media_v2_entity { |
| 319 | __u32 id; |
| 320 | char name[64]; /* FIXME: move to a property? (RFC says so) */ |
Mauro Carvalho Chehab | d87cdb8 | 2015-09-06 10:59:08 -0300 | [diff] [blame] | 321 | __u32 function; /* Main function of the entity */ |
| 322 | __u16 reserved[12]; |
Mauro Carvalho Chehab | c398bb6 | 2015-08-23 08:28:21 -0300 | [diff] [blame] | 323 | }; |
| 324 | |
| 325 | /* Should match the specific fields at media_intf_devnode */ |
| 326 | struct media_v2_intf_devnode { |
| 327 | __u32 major; |
| 328 | __u32 minor; |
| 329 | }; |
| 330 | |
| 331 | struct media_v2_interface { |
| 332 | __u32 id; |
| 333 | __u32 intf_type; |
| 334 | __u32 flags; |
| 335 | __u32 reserved[9]; |
| 336 | |
| 337 | union { |
| 338 | struct media_v2_intf_devnode devnode; |
| 339 | __u32 raw[16]; |
| 340 | }; |
| 341 | }; |
| 342 | |
| 343 | struct media_v2_pad { |
| 344 | __u32 id; |
| 345 | __u32 entity_id; |
| 346 | __u32 flags; |
| 347 | __u16 reserved[9]; |
| 348 | }; |
| 349 | |
| 350 | struct media_v2_link { |
| 351 | __u32 id; |
| 352 | __u32 source_id; |
| 353 | __u32 sink_id; |
| 354 | __u32 flags; |
| 355 | __u32 reserved[5]; |
| 356 | }; |
| 357 | |
| 358 | struct media_v2_topology { |
Mauro Carvalho Chehab | b3b7a9f | 2015-12-11 16:07:57 -0200 | [diff] [blame] | 359 | __u64 topology_version; |
Mauro Carvalho Chehab | c398bb6 | 2015-08-23 08:28:21 -0300 | [diff] [blame] | 360 | |
Mauro Carvalho Chehab | 7c9d673 | 2015-12-17 09:07:38 -0200 | [diff] [blame] | 361 | __u32 num_entities; |
| 362 | __u32 reserved1; |
Mauro Carvalho Chehab | b3b7a9f | 2015-12-11 16:07:57 -0200 | [diff] [blame] | 363 | __u64 ptr_entities; |
Mauro Carvalho Chehab | c398bb6 | 2015-08-23 08:28:21 -0300 | [diff] [blame] | 364 | |
Mauro Carvalho Chehab | 7c9d673 | 2015-12-17 09:07:38 -0200 | [diff] [blame] | 365 | __u32 num_interfaces; |
| 366 | __u32 reserved2; |
Mauro Carvalho Chehab | b3b7a9f | 2015-12-11 16:07:57 -0200 | [diff] [blame] | 367 | __u64 ptr_interfaces; |
Mauro Carvalho Chehab | c398bb6 | 2015-08-23 08:28:21 -0300 | [diff] [blame] | 368 | |
Mauro Carvalho Chehab | 7c9d673 | 2015-12-17 09:07:38 -0200 | [diff] [blame] | 369 | __u32 num_pads; |
| 370 | __u32 reserved3; |
Mauro Carvalho Chehab | b3b7a9f | 2015-12-11 16:07:57 -0200 | [diff] [blame] | 371 | __u64 ptr_pads; |
Mauro Carvalho Chehab | c398bb6 | 2015-08-23 08:28:21 -0300 | [diff] [blame] | 372 | |
Mauro Carvalho Chehab | 7c9d673 | 2015-12-17 09:07:38 -0200 | [diff] [blame] | 373 | __u32 num_links; |
| 374 | __u32 reserved4; |
Mauro Carvalho Chehab | b3b7a9f | 2015-12-11 16:07:57 -0200 | [diff] [blame] | 375 | __u64 ptr_links; |
Mauro Carvalho Chehab | c398bb6 | 2015-08-23 08:28:21 -0300 | [diff] [blame] | 376 | }; |
| 377 | |
Mauro Carvalho Chehab | b3b7a9f | 2015-12-11 16:07:57 -0200 | [diff] [blame] | 378 | static inline void __user *media_get_uptr(__u64 arg) |
| 379 | { |
| 380 | return (void __user *)(uintptr_t)arg; |
| 381 | } |
| 382 | |
Mauro Carvalho Chehab | c398bb6 | 2015-08-23 08:28:21 -0300 | [diff] [blame] | 383 | /* ioctls */ |
Mauro Carvalho Chehab | a1d2510 | 2015-08-20 07:43:07 -0300 | [diff] [blame] | 384 | |
Laurent Pinchart | 474966e | 2011-03-05 17:14:33 -0300 | [diff] [blame] | 385 | #define MEDIA_IOC_DEVICE_INFO _IOWR('|', 0x00, struct media_device_info) |
| 386 | #define MEDIA_IOC_ENUM_ENTITIES _IOWR('|', 0x01, struct media_entity_desc) |
| 387 | #define MEDIA_IOC_ENUM_LINKS _IOWR('|', 0x02, struct media_links_enum) |
| 388 | #define MEDIA_IOC_SETUP_LINK _IOWR('|', 0x03, struct media_link_desc) |
Mauro Carvalho Chehab | c398bb6 | 2015-08-23 08:28:21 -0300 | [diff] [blame] | 389 | #define MEDIA_IOC_G_TOPOLOGY _IOWR('|', 0x04, struct media_v2_topology) |
Laurent Pinchart | 140d881 | 2010-08-18 11:41:22 -0300 | [diff] [blame] | 390 | |
| 391 | #endif /* __LINUX_MEDIA_H */ |