1e2be04c7SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ 2607ca46eSDavid Howells /* 3607ca46eSDavid Howells * Multimedia device API 4607ca46eSDavid Howells * 5607ca46eSDavid Howells * Copyright (C) 2010 Nokia Corporation 6607ca46eSDavid Howells * 7607ca46eSDavid Howells * Contacts: Laurent Pinchart <laurent.pinchart@ideasonboard.com> 8607ca46eSDavid Howells * Sakari Ailus <sakari.ailus@iki.fi> 9607ca46eSDavid Howells * 10607ca46eSDavid Howells * This program is free software; you can redistribute it and/or modify 11607ca46eSDavid Howells * it under the terms of the GNU General Public License version 2 as 12607ca46eSDavid Howells * published by the Free Software Foundation. 13607ca46eSDavid Howells * 14607ca46eSDavid Howells * This program is distributed in the hope that it will be useful, 15607ca46eSDavid Howells * but WITHOUT ANY WARRANTY; without even the implied warranty of 16607ca46eSDavid Howells * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17607ca46eSDavid Howells * GNU General Public License for more details. 18607ca46eSDavid Howells */ 19607ca46eSDavid Howells 20607ca46eSDavid Howells #ifndef __LINUX_MEDIA_H 21607ca46eSDavid Howells #define __LINUX_MEDIA_H 22607ca46eSDavid Howells 23b3b7a9f1SMauro Carvalho Chehab #ifndef __KERNEL__ 24b3b7a9f1SMauro Carvalho Chehab #include <stdint.h> 25b3b7a9f1SMauro Carvalho Chehab #endif 26607ca46eSDavid Howells #include <linux/ioctl.h> 27607ca46eSDavid Howells #include <linux/types.h> 28607ca46eSDavid Howells #include <linux/version.h> 29607ca46eSDavid Howells 30607ca46eSDavid Howells struct media_device_info { 31607ca46eSDavid Howells char driver[16]; 32607ca46eSDavid Howells char model[32]; 33607ca46eSDavid Howells char serial[40]; 34607ca46eSDavid Howells char bus_info[32]; 35607ca46eSDavid Howells __u32 media_version; 36607ca46eSDavid Howells __u32 hw_revision; 37607ca46eSDavid Howells __u32 driver_version; 38607ca46eSDavid Howells __u32 reserved[31]; 39607ca46eSDavid Howells }; 40607ca46eSDavid Howells 4132fdc0e1SMauro Carvalho Chehab /* 424ca72efaSMauro Carvalho Chehab * Base number ranges for entity functions 4332fdc0e1SMauro Carvalho Chehab * 44ed3056f0SHans Verkuil * NOTE: Userspace should not rely on these ranges to identify a group 45ed3056f0SHans Verkuil * of function types, as newer functions can be added with any name within 46ed3056f0SHans Verkuil * the full u32 range. 47ed3056f0SHans Verkuil * 48ed3056f0SHans Verkuil * Some older functions use the MEDIA_ENT_F_OLD_*_BASE range. Do not 49ed3056f0SHans Verkuil * change this, this is for backwards compatibility. When adding new 50ed3056f0SHans Verkuil * functions always use MEDIA_ENT_F_BASE. 514ca72efaSMauro Carvalho Chehab */ 524ca72efaSMauro Carvalho Chehab #define MEDIA_ENT_F_BASE 0x00000000 534ca72efaSMauro Carvalho Chehab #define MEDIA_ENT_F_OLD_BASE 0x00010000 544ca72efaSMauro Carvalho Chehab #define MEDIA_ENT_F_OLD_SUBDEV_BASE 0x00020000 554ca72efaSMauro Carvalho Chehab 564ca72efaSMauro Carvalho Chehab /* 57ed3056f0SHans Verkuil * Initial value to be used when a new entity is created 58ed3056f0SHans Verkuil * Drivers should change it to something useful. 59ed3056f0SHans Verkuil */ 60ed3056f0SHans Verkuil #define MEDIA_ENT_F_UNKNOWN MEDIA_ENT_F_BASE 61ed3056f0SHans Verkuil 62ed3056f0SHans Verkuil /* 63ed3056f0SHans Verkuil * Subdevs are initialized with MEDIA_ENT_F_V4L2_SUBDEV_UNKNOWN in order 64ed3056f0SHans Verkuil * to preserve backward compatibility. Drivers must change to the proper 65ed3056f0SHans Verkuil * subdev type before registering the entity. 66ed3056f0SHans Verkuil */ 67ed3056f0SHans Verkuil #define MEDIA_ENT_F_V4L2_SUBDEV_UNKNOWN MEDIA_ENT_F_OLD_SUBDEV_BASE 68ed3056f0SHans Verkuil 69ed3056f0SHans Verkuil /* 70ed3056f0SHans Verkuil * DVB entity functions 714ca72efaSMauro Carvalho Chehab */ 7258402b6eSHans Verkuil #define MEDIA_ENT_F_DTV_DEMOD (MEDIA_ENT_F_BASE + 0x00001) 7358402b6eSHans Verkuil #define MEDIA_ENT_F_TS_DEMUX (MEDIA_ENT_F_BASE + 0x00002) 7458402b6eSHans Verkuil #define MEDIA_ENT_F_DTV_CA (MEDIA_ENT_F_BASE + 0x00003) 7558402b6eSHans Verkuil #define MEDIA_ENT_F_DTV_NET_DECAP (MEDIA_ENT_F_BASE + 0x00004) 764ca72efaSMauro Carvalho Chehab 774ca72efaSMauro Carvalho Chehab /* 78ed3056f0SHans Verkuil * I/O entity functions 791f452240SHans Verkuil */ 80ed3056f0SHans Verkuil #define MEDIA_ENT_F_IO_V4L (MEDIA_ENT_F_OLD_BASE + 1) 8158402b6eSHans Verkuil #define MEDIA_ENT_F_IO_DTV (MEDIA_ENT_F_BASE + 0x01001) 8258402b6eSHans Verkuil #define MEDIA_ENT_F_IO_VBI (MEDIA_ENT_F_BASE + 0x01002) 8358402b6eSHans Verkuil #define MEDIA_ENT_F_IO_SWRADIO (MEDIA_ENT_F_BASE + 0x01003) 841f452240SHans Verkuil 851f452240SHans Verkuil /* 86ed3056f0SHans Verkuil * Sensor functions 8706131932SMauro Carvalho Chehab */ 884ca72efaSMauro Carvalho Chehab #define MEDIA_ENT_F_CAM_SENSOR (MEDIA_ENT_F_OLD_SUBDEV_BASE + 1) 894ca72efaSMauro Carvalho Chehab #define MEDIA_ENT_F_FLASH (MEDIA_ENT_F_OLD_SUBDEV_BASE + 2) 904ca72efaSMauro Carvalho Chehab #define MEDIA_ENT_F_LENS (MEDIA_ENT_F_OLD_SUBDEV_BASE + 3) 91ed3056f0SHans Verkuil 92b3109d66SMauro Carvalho Chehab /* 93ed3056f0SHans Verkuil * Digital TV, analog TV, radio and/or software defined radio tuner functions. 94ed3056f0SHans Verkuil * 9506131932SMauro Carvalho Chehab * It is a responsibility of the master/bridge drivers to add connectors 9606131932SMauro Carvalho Chehab * and links for MEDIA_ENT_F_TUNER. Please notice that some old tuners 9706131932SMauro Carvalho Chehab * may require the usage of separate I2C chips to decode analog TV signals, 9806131932SMauro Carvalho Chehab * when the master/bridge chipset doesn't have its own TV standard decoder. 9906131932SMauro Carvalho Chehab * On such cases, the IF-PLL staging is mapped via one or two entities: 10006131932SMauro Carvalho Chehab * MEDIA_ENT_F_IF_VID_DECODER and/or MEDIA_ENT_F_IF_AUD_DECODER. 101b3109d66SMauro Carvalho Chehab */ 1024ca72efaSMauro Carvalho Chehab #define MEDIA_ENT_F_TUNER (MEDIA_ENT_F_OLD_SUBDEV_BASE + 5) 10332fdc0e1SMauro Carvalho Chehab 104ed3056f0SHans Verkuil /* 105ed3056f0SHans Verkuil * Analog TV IF-PLL decoder functions 106ed3056f0SHans Verkuil * 107ed3056f0SHans Verkuil * It is a responsibility of the master/bridge drivers to create links 108ed3056f0SHans Verkuil * for MEDIA_ENT_F_IF_VID_DECODER and MEDIA_ENT_F_IF_AUD_DECODER. 109ed3056f0SHans Verkuil */ 110ed3056f0SHans Verkuil #define MEDIA_ENT_F_IF_VID_DECODER (MEDIA_ENT_F_BASE + 0x02001) 111ed3056f0SHans Verkuil #define MEDIA_ENT_F_IF_AUD_DECODER (MEDIA_ENT_F_BASE + 0x02002) 1124ca72efaSMauro Carvalho Chehab 1134ca72efaSMauro Carvalho Chehab /* 114ed3056f0SHans Verkuil * Audio entity functions 1154ca72efaSMauro Carvalho Chehab */ 116ed3056f0SHans Verkuil #define MEDIA_ENT_F_AUDIO_CAPTURE (MEDIA_ENT_F_BASE + 0x03001) 117ed3056f0SHans Verkuil #define MEDIA_ENT_F_AUDIO_PLAYBACK (MEDIA_ENT_F_BASE + 0x03002) 118ed3056f0SHans Verkuil #define MEDIA_ENT_F_AUDIO_MIXER (MEDIA_ENT_F_BASE + 0x03003) 119607ca46eSDavid Howells 120ed3056f0SHans Verkuil /* 121ed3056f0SHans Verkuil * Processing entity functions 122ed3056f0SHans Verkuil */ 123ed3056f0SHans Verkuil #define MEDIA_ENT_F_PROC_VIDEO_COMPOSER (MEDIA_ENT_F_BASE + 0x4001) 124ed3056f0SHans Verkuil #define MEDIA_ENT_F_PROC_VIDEO_PIXEL_FORMATTER (MEDIA_ENT_F_BASE + 0x4002) 125ed3056f0SHans Verkuil #define MEDIA_ENT_F_PROC_VIDEO_PIXEL_ENC_CONV (MEDIA_ENT_F_BASE + 0x4003) 126ed3056f0SHans Verkuil #define MEDIA_ENT_F_PROC_VIDEO_LUT (MEDIA_ENT_F_BASE + 0x4004) 127ed3056f0SHans Verkuil #define MEDIA_ENT_F_PROC_VIDEO_SCALER (MEDIA_ENT_F_BASE + 0x4005) 128ed3056f0SHans Verkuil #define MEDIA_ENT_F_PROC_VIDEO_STATISTICS (MEDIA_ENT_F_BASE + 0x4006) 129*45841a97SHans Verkuil #define MEDIA_ENT_F_PROC_VIDEO_ENCODER (MEDIA_ENT_F_BASE + 0x4007) 130*45841a97SHans Verkuil #define MEDIA_ENT_F_PROC_VIDEO_DECODER (MEDIA_ENT_F_BASE + 0x4008) 131b2cd2744SMauro Carvalho Chehab 132ed3056f0SHans Verkuil /* 133ed3056f0SHans Verkuil * Switch and bridge entity functions 134ed3056f0SHans Verkuil */ 135ed3056f0SHans Verkuil #define MEDIA_ENT_F_VID_MUX (MEDIA_ENT_F_BASE + 0x5001) 136ed3056f0SHans Verkuil #define MEDIA_ENT_F_VID_IF_BRIDGE (MEDIA_ENT_F_BASE + 0x5002) 1371d20f9f6SMauro Carvalho Chehab 138f2399f75SHans Verkuil /* 139f2399f75SHans Verkuil * Video decoder/encoder functions 140f2399f75SHans Verkuil */ 141f2399f75SHans Verkuil #define MEDIA_ENT_F_ATV_DECODER (MEDIA_ENT_F_OLD_SUBDEV_BASE + 4) 142f2399f75SHans Verkuil #define MEDIA_ENT_F_DV_DECODER (MEDIA_ENT_F_BASE + 0x6001) 143f2399f75SHans Verkuil #define MEDIA_ENT_F_DV_ENCODER (MEDIA_ENT_F_BASE + 0x6002) 144f2399f75SHans Verkuil 14549a11518SMauro Carvalho Chehab /* Entity flags */ 146607ca46eSDavid Howells #define MEDIA_ENT_FL_DEFAULT (1 << 0) 14749a11518SMauro Carvalho Chehab #define MEDIA_ENT_FL_CONNECTOR (1 << 1) 148607ca46eSDavid Howells 149ed3056f0SHans Verkuil /* OR with the entity id value to find the next entity */ 150ed3056f0SHans Verkuil #define MEDIA_ENT_ID_FLAG_NEXT (1 << 31) 151ed3056f0SHans Verkuil 152607ca46eSDavid Howells struct media_entity_desc { 153607ca46eSDavid Howells __u32 id; 154607ca46eSDavid Howells char name[32]; 155607ca46eSDavid Howells __u32 type; 156607ca46eSDavid Howells __u32 revision; 157607ca46eSDavid Howells __u32 flags; 158607ca46eSDavid Howells __u32 group_id; 159607ca46eSDavid Howells __u16 pads; 160607ca46eSDavid Howells __u16 links; 161607ca46eSDavid Howells 162607ca46eSDavid Howells __u32 reserved[4]; 163607ca46eSDavid Howells 164607ca46eSDavid Howells union { 165607ca46eSDavid Howells /* Node specifications */ 166607ca46eSDavid Howells struct { 167607ca46eSDavid Howells __u32 major; 168607ca46eSDavid Howells __u32 minor; 169e31a0ba7SMauro Carvalho Chehab } dev; 170e31a0ba7SMauro Carvalho Chehab 171ed3056f0SHans Verkuil #if !defined(__KERNEL__) 172e31a0ba7SMauro Carvalho Chehab /* 1737e182f78SHans Verkuil * TODO: this shouldn't have been added without 1747e182f78SHans Verkuil * actual drivers that use this. When the first real driver 1757e182f78SHans Verkuil * appears that sets this information, special attention 1767e182f78SHans Verkuil * should be given whether this information is 1) enough, and 1777e182f78SHans Verkuil * 2) can deal with udev rules that rename devices. The struct 1787e182f78SHans Verkuil * dev would not be sufficient for this since that does not 1797e182f78SHans Verkuil * contain the subdevice information. In addition, struct dev 1807e182f78SHans Verkuil * can only refer to a single device, and not to multiple (e.g. 1817e182f78SHans Verkuil * pcm and mixer devices). 1827e182f78SHans Verkuil */ 1837e182f78SHans Verkuil struct { 1847e182f78SHans Verkuil __u32 card; 1857e182f78SHans Verkuil __u32 device; 1867e182f78SHans Verkuil __u32 subdevice; 1877e182f78SHans Verkuil } alsa; 1887e182f78SHans Verkuil 1897e182f78SHans Verkuil /* 190e31a0ba7SMauro Carvalho Chehab * DEPRECATED: previous node specifications. Kept just to 191ed3056f0SHans Verkuil * avoid breaking compilation. Use media_entity_desc.dev 192ed3056f0SHans Verkuil * instead. 193e31a0ba7SMauro Carvalho Chehab */ 194e31a0ba7SMauro Carvalho Chehab struct { 195e31a0ba7SMauro Carvalho Chehab __u32 major; 196e31a0ba7SMauro Carvalho Chehab __u32 minor; 197607ca46eSDavid Howells } v4l; 198607ca46eSDavid Howells struct { 199607ca46eSDavid Howells __u32 major; 200607ca46eSDavid Howells __u32 minor; 201607ca46eSDavid Howells } fb; 202607ca46eSDavid Howells int dvb; 203e31a0ba7SMauro Carvalho Chehab #endif 204607ca46eSDavid Howells 205607ca46eSDavid Howells /* Sub-device specifications */ 206607ca46eSDavid Howells /* Nothing needed yet */ 207607ca46eSDavid Howells __u8 raw[184]; 208607ca46eSDavid Howells }; 209607ca46eSDavid Howells }; 210607ca46eSDavid Howells 211607ca46eSDavid Howells #define MEDIA_PAD_FL_SINK (1 << 0) 212607ca46eSDavid Howells #define MEDIA_PAD_FL_SOURCE (1 << 1) 213d0700c51SSakari Ailus #define MEDIA_PAD_FL_MUST_CONNECT (1 << 2) 214607ca46eSDavid Howells 215607ca46eSDavid Howells struct media_pad_desc { 216607ca46eSDavid Howells __u32 entity; /* entity ID */ 217607ca46eSDavid Howells __u16 index; /* pad index */ 218607ca46eSDavid Howells __u32 flags; /* pad flags */ 219607ca46eSDavid Howells __u32 reserved[2]; 220607ca46eSDavid Howells }; 221607ca46eSDavid Howells 222607ca46eSDavid Howells #define MEDIA_LNK_FL_ENABLED (1 << 0) 223607ca46eSDavid Howells #define MEDIA_LNK_FL_IMMUTABLE (1 << 1) 224607ca46eSDavid Howells #define MEDIA_LNK_FL_DYNAMIC (1 << 2) 225607ca46eSDavid Howells 226c398bb64SMauro Carvalho Chehab #define MEDIA_LNK_FL_LINK_TYPE (0xf << 28) 227c398bb64SMauro Carvalho Chehab # define MEDIA_LNK_FL_DATA_LINK (0 << 28) 228c398bb64SMauro Carvalho Chehab # define MEDIA_LNK_FL_INTERFACE_LINK (1 << 28) 229c398bb64SMauro Carvalho Chehab 230607ca46eSDavid Howells struct media_link_desc { 231607ca46eSDavid Howells struct media_pad_desc source; 232607ca46eSDavid Howells struct media_pad_desc sink; 233607ca46eSDavid Howells __u32 flags; 234607ca46eSDavid Howells __u32 reserved[2]; 235607ca46eSDavid Howells }; 236607ca46eSDavid Howells 237607ca46eSDavid Howells struct media_links_enum { 238607ca46eSDavid Howells __u32 entity; 239607ca46eSDavid Howells /* Should have enough room for pads elements */ 240607ca46eSDavid Howells struct media_pad_desc __user *pads; 241607ca46eSDavid Howells /* Should have enough room for links elements */ 242607ca46eSDavid Howells struct media_link_desc __user *links; 243607ca46eSDavid Howells __u32 reserved[4]; 244607ca46eSDavid Howells }; 245607ca46eSDavid Howells 246a1d2510eSMauro Carvalho Chehab /* Interface type ranges */ 247a1d2510eSMauro Carvalho Chehab 248a1d2510eSMauro Carvalho Chehab #define MEDIA_INTF_T_DVB_BASE 0x00000100 249a1d2510eSMauro Carvalho Chehab #define MEDIA_INTF_T_V4L_BASE 0x00000200 250a1d2510eSMauro Carvalho Chehab 251a1d2510eSMauro Carvalho Chehab /* Interface types */ 252a1d2510eSMauro Carvalho Chehab 253a1d2510eSMauro Carvalho Chehab #define MEDIA_INTF_T_DVB_FE (MEDIA_INTF_T_DVB_BASE) 254a1d2510eSMauro Carvalho Chehab #define MEDIA_INTF_T_DVB_DEMUX (MEDIA_INTF_T_DVB_BASE + 1) 255a1d2510eSMauro Carvalho Chehab #define MEDIA_INTF_T_DVB_DVR (MEDIA_INTF_T_DVB_BASE + 2) 256a1d2510eSMauro Carvalho Chehab #define MEDIA_INTF_T_DVB_CA (MEDIA_INTF_T_DVB_BASE + 3) 257a1d2510eSMauro Carvalho Chehab #define MEDIA_INTF_T_DVB_NET (MEDIA_INTF_T_DVB_BASE + 4) 258a1d2510eSMauro Carvalho Chehab 259a1d2510eSMauro Carvalho Chehab #define MEDIA_INTF_T_V4L_VIDEO (MEDIA_INTF_T_V4L_BASE) 260a1d2510eSMauro Carvalho Chehab #define MEDIA_INTF_T_V4L_VBI (MEDIA_INTF_T_V4L_BASE + 1) 261a1d2510eSMauro Carvalho Chehab #define MEDIA_INTF_T_V4L_RADIO (MEDIA_INTF_T_V4L_BASE + 2) 262a1d2510eSMauro Carvalho Chehab #define MEDIA_INTF_T_V4L_SUBDEV (MEDIA_INTF_T_V4L_BASE + 3) 263a1d2510eSMauro Carvalho Chehab #define MEDIA_INTF_T_V4L_SWRADIO (MEDIA_INTF_T_V4L_BASE + 4) 264b2fe22d0SNick Dyer #define MEDIA_INTF_T_V4L_TOUCH (MEDIA_INTF_T_V4L_BASE + 5) 265a1d2510eSMauro Carvalho Chehab 266ed3056f0SHans Verkuil #if defined(__KERNEL__) 267ed3056f0SHans Verkuil 268ed3056f0SHans Verkuil /* 269ed3056f0SHans Verkuil * Connector functions 270ed3056f0SHans Verkuil * 271ed3056f0SHans Verkuil * For now these should not be used in userspace, as some definitions may 272ed3056f0SHans Verkuil * change. 273ed3056f0SHans Verkuil * 274ed3056f0SHans Verkuil * It is the responsibility of the entity drivers to add connectors and links. 275ed3056f0SHans Verkuil */ 276ed3056f0SHans Verkuil #define MEDIA_ENT_F_CONN_RF (MEDIA_ENT_F_BASE + 0x30001) 277ed3056f0SHans Verkuil #define MEDIA_ENT_F_CONN_SVIDEO (MEDIA_ENT_F_BASE + 0x30002) 278ed3056f0SHans Verkuil #define MEDIA_ENT_F_CONN_COMPOSITE (MEDIA_ENT_F_BASE + 0x30003) 279ed3056f0SHans Verkuil 280ed3056f0SHans Verkuil #endif 2815af557a6SShuah Khan 282c398bb64SMauro Carvalho Chehab /* 283c398bb64SMauro Carvalho Chehab * MC next gen API definitions 284c398bb64SMauro Carvalho Chehab */ 285c398bb64SMauro Carvalho Chehab 286588f4ee7SHans Verkuil /* 287588f4ee7SHans Verkuil * Appeared in 4.19.0. 288588f4ee7SHans Verkuil * 289588f4ee7SHans Verkuil * The media_version argument comes from the media_version field in 290588f4ee7SHans Verkuil * struct media_device_info. 291588f4ee7SHans Verkuil */ 292588f4ee7SHans Verkuil #define MEDIA_V2_ENTITY_HAS_FLAGS(media_version) \ 293588f4ee7SHans Verkuil ((media_version) >= ((4 << 16) | (19 << 8) | 0)) 294588f4ee7SHans Verkuil 295c398bb64SMauro Carvalho Chehab struct media_v2_entity { 296c398bb64SMauro Carvalho Chehab __u32 id; 297ed3056f0SHans Verkuil char name[64]; 298d87cdb88SMauro Carvalho Chehab __u32 function; /* Main function of the entity */ 299588f4ee7SHans Verkuil __u32 flags; 300588f4ee7SHans Verkuil __u32 reserved[5]; 301fbe093acSSakari Ailus } __attribute__ ((packed)); 302c398bb64SMauro Carvalho Chehab 303c398bb64SMauro Carvalho Chehab /* Should match the specific fields at media_intf_devnode */ 304c398bb64SMauro Carvalho Chehab struct media_v2_intf_devnode { 305c398bb64SMauro Carvalho Chehab __u32 major; 306c398bb64SMauro Carvalho Chehab __u32 minor; 307fbe093acSSakari Ailus } __attribute__ ((packed)); 308c398bb64SMauro Carvalho Chehab 309c398bb64SMauro Carvalho Chehab struct media_v2_interface { 310c398bb64SMauro Carvalho Chehab __u32 id; 311c398bb64SMauro Carvalho Chehab __u32 intf_type; 312c398bb64SMauro Carvalho Chehab __u32 flags; 313c398bb64SMauro Carvalho Chehab __u32 reserved[9]; 314c398bb64SMauro Carvalho Chehab 315c398bb64SMauro Carvalho Chehab union { 316c398bb64SMauro Carvalho Chehab struct media_v2_intf_devnode devnode; 317c398bb64SMauro Carvalho Chehab __u32 raw[16]; 318c398bb64SMauro Carvalho Chehab }; 319fbe093acSSakari Ailus } __attribute__ ((packed)); 320c398bb64SMauro Carvalho Chehab 32130b914c8SHans Verkuil /* 32230b914c8SHans Verkuil * Appeared in 4.19.0. 32330b914c8SHans Verkuil * 32430b914c8SHans Verkuil * The media_version argument comes from the media_version field in 32530b914c8SHans Verkuil * struct media_device_info. 32630b914c8SHans Verkuil */ 32730b914c8SHans Verkuil #define MEDIA_V2_PAD_HAS_INDEX(media_version) \ 32830b914c8SHans Verkuil ((media_version) >= ((4 << 16) | (19 << 8) | 0)) 32930b914c8SHans Verkuil 330c398bb64SMauro Carvalho Chehab struct media_v2_pad { 331c398bb64SMauro Carvalho Chehab __u32 id; 332c398bb64SMauro Carvalho Chehab __u32 entity_id; 333c398bb64SMauro Carvalho Chehab __u32 flags; 33430b914c8SHans Verkuil __u32 index; 33530b914c8SHans Verkuil __u32 reserved[4]; 336fbe093acSSakari Ailus } __attribute__ ((packed)); 337c398bb64SMauro Carvalho Chehab 338c398bb64SMauro Carvalho Chehab struct media_v2_link { 339c398bb64SMauro Carvalho Chehab __u32 id; 340c398bb64SMauro Carvalho Chehab __u32 source_id; 341c398bb64SMauro Carvalho Chehab __u32 sink_id; 342c398bb64SMauro Carvalho Chehab __u32 flags; 343fbe093acSSakari Ailus __u32 reserved[6]; 344fbe093acSSakari Ailus } __attribute__ ((packed)); 345c398bb64SMauro Carvalho Chehab 346c398bb64SMauro Carvalho Chehab struct media_v2_topology { 347b3b7a9f1SMauro Carvalho Chehab __u64 topology_version; 348c398bb64SMauro Carvalho Chehab 3497c9d6731SMauro Carvalho Chehab __u32 num_entities; 3507c9d6731SMauro Carvalho Chehab __u32 reserved1; 351b3b7a9f1SMauro Carvalho Chehab __u64 ptr_entities; 352c398bb64SMauro Carvalho Chehab 3537c9d6731SMauro Carvalho Chehab __u32 num_interfaces; 3547c9d6731SMauro Carvalho Chehab __u32 reserved2; 355b3b7a9f1SMauro Carvalho Chehab __u64 ptr_interfaces; 356c398bb64SMauro Carvalho Chehab 3577c9d6731SMauro Carvalho Chehab __u32 num_pads; 3587c9d6731SMauro Carvalho Chehab __u32 reserved3; 359b3b7a9f1SMauro Carvalho Chehab __u64 ptr_pads; 360c398bb64SMauro Carvalho Chehab 3617c9d6731SMauro Carvalho Chehab __u32 num_links; 3627c9d6731SMauro Carvalho Chehab __u32 reserved4; 363b3b7a9f1SMauro Carvalho Chehab __u64 ptr_links; 364fbe093acSSakari Ailus } __attribute__ ((packed)); 365c398bb64SMauro Carvalho Chehab 366c398bb64SMauro Carvalho Chehab /* ioctls */ 367a1d2510eSMauro Carvalho Chehab 368607ca46eSDavid Howells #define MEDIA_IOC_DEVICE_INFO _IOWR('|', 0x00, struct media_device_info) 369607ca46eSDavid Howells #define MEDIA_IOC_ENUM_ENTITIES _IOWR('|', 0x01, struct media_entity_desc) 370607ca46eSDavid Howells #define MEDIA_IOC_ENUM_LINKS _IOWR('|', 0x02, struct media_links_enum) 371607ca46eSDavid Howells #define MEDIA_IOC_SETUP_LINK _IOWR('|', 0x03, struct media_link_desc) 372c398bb64SMauro Carvalho Chehab #define MEDIA_IOC_G_TOPOLOGY _IOWR('|', 0x04, struct media_v2_topology) 373607ca46eSDavid Howells 374e1a98c16SHans Verkuil #ifndef __KERNEL__ 375ed3056f0SHans Verkuil 376ed3056f0SHans Verkuil /* 377ed3056f0SHans Verkuil * Legacy symbols used to avoid userspace compilation breakages. 378ed3056f0SHans Verkuil * Do not use any of this in new applications! 379ed3056f0SHans Verkuil * 380ed3056f0SHans Verkuil * Those symbols map the entity function into types and should be 381ed3056f0SHans Verkuil * used only on legacy programs for legacy hardware. Don't rely 382ed3056f0SHans Verkuil * on those for MEDIA_IOC_G_TOPOLOGY. 383ed3056f0SHans Verkuil */ 384ed3056f0SHans Verkuil #define MEDIA_ENT_TYPE_SHIFT 16 385ed3056f0SHans Verkuil #define MEDIA_ENT_TYPE_MASK 0x00ff0000 386ed3056f0SHans Verkuil #define MEDIA_ENT_SUBTYPE_MASK 0x0000ffff 387ed3056f0SHans Verkuil 388ed3056f0SHans Verkuil #define MEDIA_ENT_T_DEVNODE_UNKNOWN (MEDIA_ENT_F_OLD_BASE | \ 389ed3056f0SHans Verkuil MEDIA_ENT_SUBTYPE_MASK) 390ed3056f0SHans Verkuil 391ed3056f0SHans Verkuil #define MEDIA_ENT_T_DEVNODE MEDIA_ENT_F_OLD_BASE 392ed3056f0SHans Verkuil #define MEDIA_ENT_T_DEVNODE_V4L MEDIA_ENT_F_IO_V4L 393ed3056f0SHans Verkuil #define MEDIA_ENT_T_DEVNODE_FB (MEDIA_ENT_F_OLD_BASE + 2) 394ed3056f0SHans Verkuil #define MEDIA_ENT_T_DEVNODE_ALSA (MEDIA_ENT_F_OLD_BASE + 3) 395ed3056f0SHans Verkuil #define MEDIA_ENT_T_DEVNODE_DVB (MEDIA_ENT_F_OLD_BASE + 4) 396ed3056f0SHans Verkuil 397ed3056f0SHans Verkuil #define MEDIA_ENT_T_UNKNOWN MEDIA_ENT_F_UNKNOWN 398ed3056f0SHans Verkuil #define MEDIA_ENT_T_V4L2_VIDEO MEDIA_ENT_F_IO_V4L 399ed3056f0SHans Verkuil #define MEDIA_ENT_T_V4L2_SUBDEV MEDIA_ENT_F_V4L2_SUBDEV_UNKNOWN 400ed3056f0SHans Verkuil #define MEDIA_ENT_T_V4L2_SUBDEV_SENSOR MEDIA_ENT_F_CAM_SENSOR 401ed3056f0SHans Verkuil #define MEDIA_ENT_T_V4L2_SUBDEV_FLASH MEDIA_ENT_F_FLASH 402ed3056f0SHans Verkuil #define MEDIA_ENT_T_V4L2_SUBDEV_LENS MEDIA_ENT_F_LENS 403ed3056f0SHans Verkuil #define MEDIA_ENT_T_V4L2_SUBDEV_DECODER MEDIA_ENT_F_ATV_DECODER 404ed3056f0SHans Verkuil #define MEDIA_ENT_T_V4L2_SUBDEV_TUNER MEDIA_ENT_F_TUNER 405ed3056f0SHans Verkuil 406d272bc92SHans Verkuil #define MEDIA_ENT_F_DTV_DECODER MEDIA_ENT_F_DV_DECODER 407d272bc92SHans Verkuil 408ed3056f0SHans Verkuil /* 409ed3056f0SHans Verkuil * There is still no ALSA support in the media controller. These 410ed3056f0SHans Verkuil * defines should not have been added and we leave them here only 411ed3056f0SHans Verkuil * in case some application tries to use these defines. 412ed3056f0SHans Verkuil */ 413ed3056f0SHans Verkuil #define MEDIA_INTF_T_ALSA_BASE 0x00000300 414ed3056f0SHans Verkuil #define MEDIA_INTF_T_ALSA_PCM_CAPTURE (MEDIA_INTF_T_ALSA_BASE) 415ed3056f0SHans Verkuil #define MEDIA_INTF_T_ALSA_PCM_PLAYBACK (MEDIA_INTF_T_ALSA_BASE + 1) 416ed3056f0SHans Verkuil #define MEDIA_INTF_T_ALSA_CONTROL (MEDIA_INTF_T_ALSA_BASE + 2) 417ed3056f0SHans Verkuil #define MEDIA_INTF_T_ALSA_COMPRESS (MEDIA_INTF_T_ALSA_BASE + 3) 418ed3056f0SHans Verkuil #define MEDIA_INTF_T_ALSA_RAWMIDI (MEDIA_INTF_T_ALSA_BASE + 4) 419ed3056f0SHans Verkuil #define MEDIA_INTF_T_ALSA_HWDEP (MEDIA_INTF_T_ALSA_BASE + 5) 420ed3056f0SHans Verkuil #define MEDIA_INTF_T_ALSA_SEQUENCER (MEDIA_INTF_T_ALSA_BASE + 6) 421ed3056f0SHans Verkuil #define MEDIA_INTF_T_ALSA_TIMER (MEDIA_INTF_T_ALSA_BASE + 7) 422ed3056f0SHans Verkuil 423ed3056f0SHans Verkuil /* Obsolete symbol for media_version, no longer used in the kernel */ 424ed3056f0SHans Verkuil #define MEDIA_API_VERSION KERNEL_VERSION(0, 1, 0) 425ed3056f0SHans Verkuil 426ed3056f0SHans Verkuil #endif 427ed3056f0SHans Verkuil 428607ca46eSDavid Howells #endif /* __LINUX_MEDIA_H */ 429