Add a new ioctl that will report the entire topology on one go.
Showing the changes to include/uapi (1 of 2 files). Show all
Unified · Split
| @@ -206,6 +206,10 @@ struct media_pad_desc { · 205 unmodified lines | |||
| 206 | #define MEDIA_LNK_FL_IMMUTABLE (1 << 1) | 206 | #define MEDIA_LNK_FL_IMMUTABLE (1 << 1) |
| 207 | #define MEDIA_LNK_FL_DYNAMIC (1 << 2) | 207 | #define MEDIA_LNK_FL_DYNAMIC (1 << 2) |
| 208 | 208 | ||
| 209 | #define MEDIA_LNK_FL_LINK_TYPE (0xf << 28) | ||
| 210 | # define MEDIA_LNK_FL_DATA_LINK (0 << 28) | ||
| 211 | # define MEDIA_LNK_FL_INTERFACE_LINK (1 << 28) | ||
| 212 | |||
| 209 | struct media_link_desc { | 213 | struct media_link_desc { |
| 210 | struct media_pad_desc source; | 214 | struct media_pad_desc source; |
| 211 | struct media_pad_desc sink; | 215 | struct media_pad_desc sink; |
| @@ -241,11 +245,93 @@ struct media_links_enum { · 29 unmodified lines | |||
| 241 | #define MEDIA_INTF_T_V4L_SUBDEV (MEDIA_INTF_T_V4L_BASE + 3) | 245 | #define MEDIA_INTF_T_V4L_SUBDEV (MEDIA_INTF_T_V4L_BASE + 3) |
| 242 | #define MEDIA_INTF_T_V4L_SWRADIO (MEDIA_INTF_T_V4L_BASE + 4) | 246 | #define MEDIA_INTF_T_V4L_SWRADIO (MEDIA_INTF_T_V4L_BASE + 4) |
| 243 | 247 | ||
| 244 | /* TBD: declare the structs needed for the new G_TOPOLOGY ioctl */ | 248 | /* |
| 249 | * MC next gen API definitions | ||
| 250 | * | ||
| 251 | * NOTE: The declarations below are close to the MC RFC for the Media | ||
| 252 | * Controller, the next generation. Yet, there are a few adjustments | ||
| 253 | * to do, as we want to be able to have a functional API before | ||
| 254 | * the MC properties change. Those will be properly marked below. | ||
| 255 | * Please also notice that I removed "num_pads", "num_links", | ||
| 256 | * from the proposal, as a proper userspace application will likely | ||
| 257 | * use lists for pads/links, just as we intend to do in Kernelspace. | ||
| 258 | * The API definition should be freed from fields that are bound to | ||
| 259 | * some specific data structure. | ||
| 260 | * | ||
| 261 | * FIXME: Currently, I opted to name the new types as "media_v2", as this | ||
| 262 | * won't cause any conflict with the Kernelspace namespace, nor with | ||
| 263 | * the previous kAPI media_*_desc namespace. This can be changed | ||
| 264 | * later, before the adding this API upstream. | ||
| 265 | */ | ||
| 266 | |||
| 267 | |||
| 268 | struct media_v2_entity { | ||
| 269 | __u32 id; | ||
| 270 | char name[64]; /* FIXME: move to a property? (RFC says so) */ | ||
| 271 | __u16 reserved[14]; | ||
| 272 | }; | ||
| 273 | |||
| 274 | /* Should match the specific fields at media_intf_devnode */ | ||
| 275 | struct media_v2_intf_devnode { | ||
| 276 | __u32 major; | ||
| 277 | __u32 minor; | ||
| 278 | }; | ||
| 279 | |||
| 280 | struct media_v2_interface { | ||
| 281 | __u32 id; | ||
| 282 | __u32 intf_type; | ||
| 283 | __u32 flags; | ||
| 284 | __u32 reserved[9]; | ||
| 285 | |||
| 286 | union { | ||
| 287 | struct media_v2_intf_devnode devnode; | ||
| 288 | __u32 raw[16]; | ||
| 289 | }; | ||
| 290 | }; | ||
| 291 | |||
| 292 | struct media_v2_pad { | ||
| 293 | __u32 id; | ||
| 294 | __u32 entity_id; | ||
| 295 | __u32 flags; | ||
| 296 | __u16 reserved[9]; | ||
| 297 | }; | ||
| 298 | |||
| 299 | struct media_v2_link { | ||
| 300 | __u32 id; | ||
| 301 | __u32 source_id; | ||
| 302 | __u32 sink_id; | ||
| 303 | __u32 flags; | ||
| 304 | __u32 reserved[5]; | ||
| 305 | }; | ||
| 306 | |||
| 307 | struct media_v2_topology { | ||
| 308 | __u32 topology_version; | ||
| 309 | |||
| 310 | __u32 num_entities; | ||
| 311 | struct media_v2_entity *entities; | ||
| 312 | |||
| 313 | __u32 num_interfaces; | ||
| 314 | struct media_v2_interface *interfaces; | ||
| 315 | |||
| 316 | __u32 num_pads; | ||
| 317 | struct media_v2_pad *pads; | ||
| 318 | |||
| 319 | __u32 num_links; | ||
| 320 | struct media_v2_link *links; | ||
| 321 | |||
| 322 | struct { | ||
| 323 | __u32 reserved_num; | ||
| 324 | void *reserved_ptr; | ||
| 325 | } reserved_types[16]; | ||
| 326 | __u32 reserved[8]; | ||
| 327 | }; | ||
| 328 | |||
| 329 | /* ioctls */ | ||
| 245 | 330 | ||
| 246 | #define MEDIA_IOC_DEVICE_INFO _IOWR('|', 0x00, struct media_device_info) | 331 | #define MEDIA_IOC_DEVICE_INFO _IOWR('|', 0x00, struct media_device_info) |
| 247 | #define MEDIA_IOC_ENUM_ENTITIES _IOWR('|', 0x01, struct media_entity_desc) | 332 | #define MEDIA_IOC_ENUM_ENTITIES _IOWR('|', 0x01, struct media_entity_desc) |
| 248 | #define MEDIA_IOC_ENUM_LINKS _IOWR('|', 0x02, struct media_links_enum) | 333 | #define MEDIA_IOC_ENUM_LINKS _IOWR('|', 0x02, struct media_links_enum) |
| 249 | #define MEDIA_IOC_SETUP_LINK _IOWR('|', 0x03, struct media_link_desc) | 334 | #define MEDIA_IOC_SETUP_LINK _IOWR('|', 0x03, struct media_link_desc) |
| 335 | #define MEDIA_IOC_G_TOPOLOGY _IOWR('|', 0x04, struct media_v2_topology) | ||
| 250 | 336 | ||
| 251 | #endif /* __LINUX_MEDIA_H */ | 337 | #endif /* __LINUX_MEDIA_H */ |