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 | /* |
Hans Verkuil | 1f45224 | 2016-02-11 12:28:55 -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) |
Hans Verkuil | 1f45224 | 2016-02-11 12:28:55 -0200 | [diff] [blame] | 80 | |
| 81 | /* |
Mauro Carvalho Chehab | 4ca72ef | 2015-12-10 17:25:41 -0200 | [diff] [blame] | 82 | * Connectors |
| 83 | */ |
Mauro Carvalho Chehab | b3109d6 | 2015-12-11 18:26:53 -0200 | [diff] [blame] | 84 | /* It is a responsibility of the entity drivers to add connectors and links */ |
Mauro Carvalho Chehab | 9312509 | 2016-03-03 14:52:51 -0300 | [diff] [blame] | 85 | #ifdef __KERNEL__ |
| 86 | /* |
| 87 | * For now, it should not be used in userspace, as some |
| 88 | * definitions may change |
| 89 | */ |
| 90 | |
Hans Verkuil | 58402b6e9 | 2016-02-29 09:02:47 +0100 | [diff] [blame] | 91 | #define MEDIA_ENT_F_CONN_RF (MEDIA_ENT_F_BASE + 0x30001) |
| 92 | #define MEDIA_ENT_F_CONN_SVIDEO (MEDIA_ENT_F_BASE + 0x30002) |
| 93 | #define MEDIA_ENT_F_CONN_COMPOSITE (MEDIA_ENT_F_BASE + 0x30003) |
Mauro Carvalho Chehab | 4ca72ef | 2015-12-10 17:25:41 -0200 | [diff] [blame] | 94 | |
Mauro Carvalho Chehab | 9312509 | 2016-03-03 14:52:51 -0300 | [diff] [blame] | 95 | #endif |
| 96 | |
Mauro Carvalho Chehab | 4ca72ef | 2015-12-10 17:25:41 -0200 | [diff] [blame] | 97 | /* |
| 98 | * Don't touch on those. The ranges MEDIA_ENT_F_OLD_BASE and |
| 99 | * MEDIA_ENT_F_OLD_SUBDEV_BASE are kept to keep backward compatibility |
| 100 | * with the legacy v1 API.The number range is out of range by purpose: |
| 101 | * several previously reserved numbers got excluded from this range. |
Mauro Carvalho Chehab | 32fdc0e | 2015-08-21 11:40:34 -0300 | [diff] [blame] | 102 | * |
Mauro Carvalho Chehab | b50bde4 | 2015-05-07 22:12:38 -0300 | [diff] [blame] | 103 | * Subdevs are initialized with MEDIA_ENT_T_V4L2_SUBDEV_UNKNOWN, |
| 104 | * in order to preserve backward compatibility. |
Mauro Carvalho Chehab | d1b9da2 | 2015-12-11 12:41:12 -0200 | [diff] [blame] | 105 | * Drivers must change to the proper subdev type before |
Mauro Carvalho Chehab | b50bde4 | 2015-05-07 22:12:38 -0300 | [diff] [blame] | 106 | * registering the entity. |
| 107 | */ |
Mauro Carvalho Chehab | fa17b46 | 2015-08-21 12:17:40 -0300 | [diff] [blame] | 108 | |
Mauro Carvalho Chehab | 4ca72ef | 2015-12-10 17:25:41 -0200 | [diff] [blame] | 109 | #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] | 110 | |
Mauro Carvalho Chehab | 4ca72ef | 2015-12-10 17:25:41 -0200 | [diff] [blame] | 111 | #define MEDIA_ENT_F_CAM_SENSOR (MEDIA_ENT_F_OLD_SUBDEV_BASE + 1) |
| 112 | #define MEDIA_ENT_F_FLASH (MEDIA_ENT_F_OLD_SUBDEV_BASE + 2) |
| 113 | #define MEDIA_ENT_F_LENS (MEDIA_ENT_F_OLD_SUBDEV_BASE + 3) |
| 114 | #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] | 115 | /* |
| 116 | * It is a responsibility of the entity drivers to add connectors and links |
| 117 | * for the tuner entities. |
| 118 | */ |
Mauro Carvalho Chehab | 4ca72ef | 2015-12-10 17:25:41 -0200 | [diff] [blame] | 119 | #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] | 120 | |
Mauro Carvalho Chehab | 4ca72ef | 2015-12-10 17:25:41 -0200 | [diff] [blame] | 121 | #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] | 122 | |
Mauro Carvalho Chehab | 4376679 | 2015-08-29 14:50:46 -0300 | [diff] [blame] | 123 | #ifndef __KERNEL__ |
Mauro Carvalho Chehab | 4ca72ef | 2015-12-10 17:25:41 -0200 | [diff] [blame] | 124 | |
| 125 | /* |
| 126 | * Legacy symbols used to avoid userspace compilation breakages |
| 127 | * |
| 128 | * Those symbols map the entity function into types and should be |
| 129 | * used only on legacy programs for legacy hardware. Don't rely |
| 130 | * on those for MEDIA_IOC_G_TOPOLOGY. |
| 131 | */ |
Laurent Pinchart | 1651333 | 2009-12-09 08:40:01 -0300 | [diff] [blame] | 132 | #define MEDIA_ENT_TYPE_SHIFT 16 |
| 133 | #define MEDIA_ENT_TYPE_MASK 0x00ff0000 |
| 134 | #define MEDIA_ENT_SUBTYPE_MASK 0x0000ffff |
| 135 | |
Mauro Carvalho Chehab | 4ca72ef | 2015-12-10 17:25:41 -0200 | [diff] [blame] | 136 | #define MEDIA_ENT_T_DEVNODE MEDIA_ENT_F_OLD_BASE |
| 137 | #define MEDIA_ENT_T_DEVNODE_V4L MEDIA_ENT_F_IO_V4L |
Laurent Pinchart | 1651333 | 2009-12-09 08:40:01 -0300 | [diff] [blame] | 138 | #define MEDIA_ENT_T_DEVNODE_FB (MEDIA_ENT_T_DEVNODE + 2) |
| 139 | #define MEDIA_ENT_T_DEVNODE_ALSA (MEDIA_ENT_T_DEVNODE + 3) |
Mauro Carvalho Chehab | 32fdc0e | 2015-08-21 11:40:34 -0300 | [diff] [blame] | 140 | #define MEDIA_ENT_T_DEVNODE_DVB (MEDIA_ENT_T_DEVNODE + 4) |
Mauro Carvalho Chehab | 4ca72ef | 2015-12-10 17:25:41 -0200 | [diff] [blame] | 141 | |
| 142 | #define MEDIA_ENT_T_UNKNOWN MEDIA_ENT_F_UNKNOWN |
| 143 | #define MEDIA_ENT_T_V4L2_VIDEO MEDIA_ENT_F_IO_V4L |
| 144 | #define MEDIA_ENT_T_V4L2_SUBDEV MEDIA_ENT_F_V4L2_SUBDEV_UNKNOWN |
| 145 | #define MEDIA_ENT_T_V4L2_SUBDEV_SENSOR MEDIA_ENT_F_CAM_SENSOR |
| 146 | #define MEDIA_ENT_T_V4L2_SUBDEV_FLASH MEDIA_ENT_F_FLASH |
| 147 | #define MEDIA_ENT_T_V4L2_SUBDEV_LENS MEDIA_ENT_F_LENS |
| 148 | #define MEDIA_ENT_T_V4L2_SUBDEV_DECODER MEDIA_ENT_F_ATV_DECODER |
| 149 | #define MEDIA_ENT_T_V4L2_SUBDEV_TUNER MEDIA_ENT_F_TUNER |
Mauro Carvalho Chehab | 4376679 | 2015-08-29 14:50:46 -0300 | [diff] [blame] | 150 | #endif |
Mauro Carvalho Chehab | 1d20f9f | 2015-01-03 11:09:39 -0300 | [diff] [blame] | 151 | |
Mauro Carvalho Chehab | 49a1151 | 2015-08-31 11:41:29 -0300 | [diff] [blame] | 152 | /* Entity flags */ |
Laurent Pinchart | 1651333 | 2009-12-09 08:40:01 -0300 | [diff] [blame] | 153 | #define MEDIA_ENT_FL_DEFAULT (1 << 0) |
Mauro Carvalho Chehab | 49a1151 | 2015-08-31 11:41:29 -0300 | [diff] [blame] | 154 | #define MEDIA_ENT_FL_CONNECTOR (1 << 1) |
Laurent Pinchart | 1651333 | 2009-12-09 08:40:01 -0300 | [diff] [blame] | 155 | |
| 156 | struct media_entity_desc { |
| 157 | __u32 id; |
| 158 | char name[32]; |
| 159 | __u32 type; |
| 160 | __u32 revision; |
| 161 | __u32 flags; |
| 162 | __u32 group_id; |
| 163 | __u16 pads; |
| 164 | __u16 links; |
| 165 | |
| 166 | __u32 reserved[4]; |
| 167 | |
| 168 | union { |
| 169 | /* Node specifications */ |
| 170 | struct { |
| 171 | __u32 major; |
| 172 | __u32 minor; |
Mauro Carvalho Chehab | e31a0ba | 2015-01-02 12:18:23 -0300 | [diff] [blame] | 173 | } dev; |
| 174 | |
| 175 | #if 1 |
| 176 | /* |
Hans Verkuil | 7e182f7 | 2015-02-25 12:05:13 -0300 | [diff] [blame] | 177 | * TODO: this shouldn't have been added without |
| 178 | * actual drivers that use this. When the first real driver |
| 179 | * appears that sets this information, special attention |
| 180 | * should be given whether this information is 1) enough, and |
| 181 | * 2) can deal with udev rules that rename devices. The struct |
| 182 | * dev would not be sufficient for this since that does not |
| 183 | * contain the subdevice information. In addition, struct dev |
| 184 | * can only refer to a single device, and not to multiple (e.g. |
| 185 | * pcm and mixer devices). |
| 186 | * |
| 187 | * So for now mark this as a to do. |
| 188 | */ |
| 189 | struct { |
| 190 | __u32 card; |
| 191 | __u32 device; |
| 192 | __u32 subdevice; |
| 193 | } alsa; |
| 194 | #endif |
| 195 | |
| 196 | #if 1 |
| 197 | /* |
Mauro Carvalho Chehab | e31a0ba | 2015-01-02 12:18:23 -0300 | [diff] [blame] | 198 | * DEPRECATED: previous node specifications. Kept just to |
| 199 | * avoid breaking compilation, but media_entity_desc.dev |
| 200 | * should be used instead. In particular, alsa and dvb |
| 201 | * fields below are wrong: for all devnodes, there should |
| 202 | * be just major/minor inside the struct, as this is enough |
| 203 | * to represent any devnode, no matter what type. |
| 204 | */ |
| 205 | struct { |
| 206 | __u32 major; |
| 207 | __u32 minor; |
Laurent Pinchart | 1651333 | 2009-12-09 08:40:01 -0300 | [diff] [blame] | 208 | } v4l; |
| 209 | struct { |
| 210 | __u32 major; |
| 211 | __u32 minor; |
| 212 | } fb; |
Laurent Pinchart | 1651333 | 2009-12-09 08:40:01 -0300 | [diff] [blame] | 213 | int dvb; |
Mauro Carvalho Chehab | e31a0ba | 2015-01-02 12:18:23 -0300 | [diff] [blame] | 214 | #endif |
Laurent Pinchart | 1651333 | 2009-12-09 08:40:01 -0300 | [diff] [blame] | 215 | |
| 216 | /* Sub-device specifications */ |
| 217 | /* Nothing needed yet */ |
| 218 | __u8 raw[184]; |
| 219 | }; |
| 220 | }; |
| 221 | |
| 222 | #define MEDIA_PAD_FL_SINK (1 << 0) |
| 223 | #define MEDIA_PAD_FL_SOURCE (1 << 1) |
Sakari Ailus | d0700c5 | 2013-10-13 07:58:43 -0300 | [diff] [blame] | 224 | #define MEDIA_PAD_FL_MUST_CONNECT (1 << 2) |
Laurent Pinchart | 1651333 | 2009-12-09 08:40:01 -0300 | [diff] [blame] | 225 | |
| 226 | struct media_pad_desc { |
| 227 | __u32 entity; /* entity ID */ |
| 228 | __u16 index; /* pad index */ |
| 229 | __u32 flags; /* pad flags */ |
| 230 | __u32 reserved[2]; |
| 231 | }; |
| 232 | |
| 233 | #define MEDIA_LNK_FL_ENABLED (1 << 0) |
| 234 | #define MEDIA_LNK_FL_IMMUTABLE (1 << 1) |
Laurent Pinchart | e02188c | 2010-08-25 09:00:41 -0300 | [diff] [blame] | 235 | #define MEDIA_LNK_FL_DYNAMIC (1 << 2) |
Laurent Pinchart | 1651333 | 2009-12-09 08:40:01 -0300 | [diff] [blame] | 236 | |
Mauro Carvalho Chehab | c398bb6 | 2015-08-23 08:28:21 -0300 | [diff] [blame] | 237 | #define MEDIA_LNK_FL_LINK_TYPE (0xf << 28) |
| 238 | # define MEDIA_LNK_FL_DATA_LINK (0 << 28) |
| 239 | # define MEDIA_LNK_FL_INTERFACE_LINK (1 << 28) |
| 240 | |
Laurent Pinchart | 1651333 | 2009-12-09 08:40:01 -0300 | [diff] [blame] | 241 | struct media_link_desc { |
| 242 | struct media_pad_desc source; |
| 243 | struct media_pad_desc sink; |
| 244 | __u32 flags; |
| 245 | __u32 reserved[2]; |
| 246 | }; |
| 247 | |
| 248 | struct media_links_enum { |
| 249 | __u32 entity; |
| 250 | /* Should have enough room for pads elements */ |
| 251 | struct media_pad_desc __user *pads; |
| 252 | /* Should have enough room for links elements */ |
| 253 | struct media_link_desc __user *links; |
| 254 | __u32 reserved[4]; |
| 255 | }; |
| 256 | |
Mauro Carvalho Chehab | a1d2510 | 2015-08-20 07:43:07 -0300 | [diff] [blame] | 257 | /* Interface type ranges */ |
| 258 | |
| 259 | #define MEDIA_INTF_T_DVB_BASE 0x00000100 |
| 260 | #define MEDIA_INTF_T_V4L_BASE 0x00000200 |
| 261 | |
| 262 | /* Interface types */ |
| 263 | |
| 264 | #define MEDIA_INTF_T_DVB_FE (MEDIA_INTF_T_DVB_BASE) |
| 265 | #define MEDIA_INTF_T_DVB_DEMUX (MEDIA_INTF_T_DVB_BASE + 1) |
| 266 | #define MEDIA_INTF_T_DVB_DVR (MEDIA_INTF_T_DVB_BASE + 2) |
| 267 | #define MEDIA_INTF_T_DVB_CA (MEDIA_INTF_T_DVB_BASE + 3) |
| 268 | #define MEDIA_INTF_T_DVB_NET (MEDIA_INTF_T_DVB_BASE + 4) |
| 269 | |
| 270 | #define MEDIA_INTF_T_V4L_VIDEO (MEDIA_INTF_T_V4L_BASE) |
| 271 | #define MEDIA_INTF_T_V4L_VBI (MEDIA_INTF_T_V4L_BASE + 1) |
| 272 | #define MEDIA_INTF_T_V4L_RADIO (MEDIA_INTF_T_V4L_BASE + 2) |
| 273 | #define MEDIA_INTF_T_V4L_SUBDEV (MEDIA_INTF_T_V4L_BASE + 3) |
| 274 | #define MEDIA_INTF_T_V4L_SWRADIO (MEDIA_INTF_T_V4L_BASE + 4) |
| 275 | |
Mauro Carvalho Chehab | c398bb6 | 2015-08-23 08:28:21 -0300 | [diff] [blame] | 276 | /* |
| 277 | * MC next gen API definitions |
| 278 | * |
| 279 | * NOTE: The declarations below are close to the MC RFC for the Media |
| 280 | * Controller, the next generation. Yet, there are a few adjustments |
| 281 | * to do, as we want to be able to have a functional API before |
| 282 | * the MC properties change. Those will be properly marked below. |
| 283 | * Please also notice that I removed "num_pads", "num_links", |
| 284 | * from the proposal, as a proper userspace application will likely |
| 285 | * use lists for pads/links, just as we intend to do in Kernelspace. |
| 286 | * The API definition should be freed from fields that are bound to |
| 287 | * some specific data structure. |
| 288 | * |
| 289 | * FIXME: Currently, I opted to name the new types as "media_v2", as this |
| 290 | * won't cause any conflict with the Kernelspace namespace, nor with |
| 291 | * the previous kAPI media_*_desc namespace. This can be changed |
| 292 | * later, before the adding this API upstream. |
| 293 | */ |
| 294 | |
Mauro Carvalho Chehab | be0270e | 2015-12-28 12:03:47 -0200 | [diff] [blame] | 295 | #if 0 /* Let's postpone it to Kernel 4.6 */ |
Mauro Carvalho Chehab | c398bb6 | 2015-08-23 08:28:21 -0300 | [diff] [blame] | 296 | struct media_v2_entity { |
| 297 | __u32 id; |
| 298 | char name[64]; /* FIXME: move to a property? (RFC says so) */ |
Mauro Carvalho Chehab | d87cdb8 | 2015-09-06 10:59:08 -0300 | [diff] [blame] | 299 | __u32 function; /* Main function of the entity */ |
Sakari Ailus | fbe093a | 2016-03-03 14:20:14 -0300 | [diff] [blame] | 300 | __u32 reserved[6]; |
| 301 | } __attribute__ ((packed)); |
Mauro Carvalho Chehab | c398bb6 | 2015-08-23 08:28:21 -0300 | [diff] [blame] | 302 | |
| 303 | /* Should match the specific fields at media_intf_devnode */ |
| 304 | struct media_v2_intf_devnode { |
| 305 | __u32 major; |
| 306 | __u32 minor; |
Sakari Ailus | fbe093a | 2016-03-03 14:20:14 -0300 | [diff] [blame] | 307 | } __attribute__ ((packed)); |
Mauro Carvalho Chehab | c398bb6 | 2015-08-23 08:28:21 -0300 | [diff] [blame] | 308 | |
| 309 | struct media_v2_interface { |
| 310 | __u32 id; |
| 311 | __u32 intf_type; |
| 312 | __u32 flags; |
| 313 | __u32 reserved[9]; |
| 314 | |
| 315 | union { |
| 316 | struct media_v2_intf_devnode devnode; |
| 317 | __u32 raw[16]; |
| 318 | }; |
Sakari Ailus | fbe093a | 2016-03-03 14:20:14 -0300 | [diff] [blame] | 319 | } __attribute__ ((packed)); |
Mauro Carvalho Chehab | c398bb6 | 2015-08-23 08:28:21 -0300 | [diff] [blame] | 320 | |
| 321 | struct media_v2_pad { |
| 322 | __u32 id; |
| 323 | __u32 entity_id; |
| 324 | __u32 flags; |
Sakari Ailus | fbe093a | 2016-03-03 14:20:14 -0300 | [diff] [blame] | 325 | __u32 reserved[5]; |
| 326 | } __attribute__ ((packed)); |
Mauro Carvalho Chehab | c398bb6 | 2015-08-23 08:28:21 -0300 | [diff] [blame] | 327 | |
| 328 | struct media_v2_link { |
| 329 | __u32 id; |
| 330 | __u32 source_id; |
| 331 | __u32 sink_id; |
| 332 | __u32 flags; |
Sakari Ailus | fbe093a | 2016-03-03 14:20:14 -0300 | [diff] [blame] | 333 | __u32 reserved[6]; |
| 334 | } __attribute__ ((packed)); |
Mauro Carvalho Chehab | c398bb6 | 2015-08-23 08:28:21 -0300 | [diff] [blame] | 335 | |
| 336 | struct media_v2_topology { |
Mauro Carvalho Chehab | b3b7a9f | 2015-12-11 16:07:57 -0200 | [diff] [blame] | 337 | __u64 topology_version; |
Mauro Carvalho Chehab | c398bb6 | 2015-08-23 08:28:21 -0300 | [diff] [blame] | 338 | |
Mauro Carvalho Chehab | 7c9d673 | 2015-12-17 09:07:38 -0200 | [diff] [blame] | 339 | __u32 num_entities; |
| 340 | __u32 reserved1; |
Mauro Carvalho Chehab | b3b7a9f | 2015-12-11 16:07:57 -0200 | [diff] [blame] | 341 | __u64 ptr_entities; |
Mauro Carvalho Chehab | c398bb6 | 2015-08-23 08:28:21 -0300 | [diff] [blame] | 342 | |
Mauro Carvalho Chehab | 7c9d673 | 2015-12-17 09:07:38 -0200 | [diff] [blame] | 343 | __u32 num_interfaces; |
| 344 | __u32 reserved2; |
Mauro Carvalho Chehab | b3b7a9f | 2015-12-11 16:07:57 -0200 | [diff] [blame] | 345 | __u64 ptr_interfaces; |
Mauro Carvalho Chehab | c398bb6 | 2015-08-23 08:28:21 -0300 | [diff] [blame] | 346 | |
Mauro Carvalho Chehab | 7c9d673 | 2015-12-17 09:07:38 -0200 | [diff] [blame] | 347 | __u32 num_pads; |
| 348 | __u32 reserved3; |
Mauro Carvalho Chehab | b3b7a9f | 2015-12-11 16:07:57 -0200 | [diff] [blame] | 349 | __u64 ptr_pads; |
Mauro Carvalho Chehab | c398bb6 | 2015-08-23 08:28:21 -0300 | [diff] [blame] | 350 | |
Mauro Carvalho Chehab | 7c9d673 | 2015-12-17 09:07:38 -0200 | [diff] [blame] | 351 | __u32 num_links; |
| 352 | __u32 reserved4; |
Mauro Carvalho Chehab | b3b7a9f | 2015-12-11 16:07:57 -0200 | [diff] [blame] | 353 | __u64 ptr_links; |
Sakari Ailus | fbe093a | 2016-03-03 14:20:14 -0300 | [diff] [blame] | 354 | } __attribute__ ((packed)); |
Mauro Carvalho Chehab | c398bb6 | 2015-08-23 08:28:21 -0300 | [diff] [blame] | 355 | |
Mauro Carvalho Chehab | b3b7a9f | 2015-12-11 16:07:57 -0200 | [diff] [blame] | 356 | static inline void __user *media_get_uptr(__u64 arg) |
| 357 | { |
| 358 | return (void __user *)(uintptr_t)arg; |
| 359 | } |
Mauro Carvalho Chehab | be0270e | 2015-12-28 12:03:47 -0200 | [diff] [blame] | 360 | #endif |
Mauro Carvalho Chehab | b3b7a9f | 2015-12-11 16:07:57 -0200 | [diff] [blame] | 361 | |
Mauro Carvalho Chehab | c398bb6 | 2015-08-23 08:28:21 -0300 | [diff] [blame] | 362 | /* ioctls */ |
Mauro Carvalho Chehab | a1d2510 | 2015-08-20 07:43:07 -0300 | [diff] [blame] | 363 | |
Laurent Pinchart | 474966e | 2011-03-05 17:14:33 -0300 | [diff] [blame] | 364 | #define MEDIA_IOC_DEVICE_INFO _IOWR('|', 0x00, struct media_device_info) |
| 365 | #define MEDIA_IOC_ENUM_ENTITIES _IOWR('|', 0x01, struct media_entity_desc) |
| 366 | #define MEDIA_IOC_ENUM_LINKS _IOWR('|', 0x02, struct media_links_enum) |
| 367 | #define MEDIA_IOC_SETUP_LINK _IOWR('|', 0x03, struct media_link_desc) |
Mauro Carvalho Chehab | be0270e | 2015-12-28 12:03:47 -0200 | [diff] [blame] | 368 | |
| 369 | #if 0 /* Let's postpone it to Kernel 4.6 */ |
Mauro Carvalho Chehab | c398bb6 | 2015-08-23 08:28:21 -0300 | [diff] [blame] | 370 | #define MEDIA_IOC_G_TOPOLOGY _IOWR('|', 0x04, struct media_v2_topology) |
Mauro Carvalho Chehab | be0270e | 2015-12-28 12:03:47 -0200 | [diff] [blame] | 371 | #endif |
Laurent Pinchart | 140d881 | 2010-08-18 11:41:22 -0300 | [diff] [blame] | 372 | |
| 373 | #endif /* __LINUX_MEDIA_H */ |