xref: /openbmc/linux/Documentation/userspace-api/media/mediactl/media-ioc-enum-entities.rst (revision 54f38fcae536ea202ce7d6a359521492fba30c1f)
1*54f38fcaSMauro Carvalho Chehab.. Permission is granted to copy, distribute and/or modify this
2*54f38fcaSMauro Carvalho Chehab.. document under the terms of the GNU Free Documentation License,
3*54f38fcaSMauro Carvalho Chehab.. Version 1.1 or any later version published by the Free Software
4*54f38fcaSMauro Carvalho Chehab.. Foundation, with no Invariant Sections, no Front-Cover Texts
5*54f38fcaSMauro Carvalho Chehab.. and no Back-Cover Texts. A copy of the license is included at
6*54f38fcaSMauro Carvalho Chehab.. Documentation/userspace-api/media/fdl-appendix.rst.
7*54f38fcaSMauro Carvalho Chehab..
8*54f38fcaSMauro Carvalho Chehab.. TODO: replace it to GFDL-1.1-or-later WITH no-invariant-sections
9*54f38fcaSMauro Carvalho Chehab
10*54f38fcaSMauro Carvalho Chehab.. _media_ioc_enum_entities:
11*54f38fcaSMauro Carvalho Chehab
12*54f38fcaSMauro Carvalho Chehab*****************************
13*54f38fcaSMauro Carvalho Chehabioctl MEDIA_IOC_ENUM_ENTITIES
14*54f38fcaSMauro Carvalho Chehab*****************************
15*54f38fcaSMauro Carvalho Chehab
16*54f38fcaSMauro Carvalho ChehabName
17*54f38fcaSMauro Carvalho Chehab====
18*54f38fcaSMauro Carvalho Chehab
19*54f38fcaSMauro Carvalho ChehabMEDIA_IOC_ENUM_ENTITIES - Enumerate entities and their properties
20*54f38fcaSMauro Carvalho Chehab
21*54f38fcaSMauro Carvalho Chehab
22*54f38fcaSMauro Carvalho ChehabSynopsis
23*54f38fcaSMauro Carvalho Chehab========
24*54f38fcaSMauro Carvalho Chehab
25*54f38fcaSMauro Carvalho Chehab.. c:function:: int ioctl( int fd, MEDIA_IOC_ENUM_ENTITIES, struct media_entity_desc *argp )
26*54f38fcaSMauro Carvalho Chehab    :name: MEDIA_IOC_ENUM_ENTITIES
27*54f38fcaSMauro Carvalho Chehab
28*54f38fcaSMauro Carvalho Chehab
29*54f38fcaSMauro Carvalho ChehabArguments
30*54f38fcaSMauro Carvalho Chehab=========
31*54f38fcaSMauro Carvalho Chehab
32*54f38fcaSMauro Carvalho Chehab``fd``
33*54f38fcaSMauro Carvalho Chehab    File descriptor returned by :ref:`open() <media-func-open>`.
34*54f38fcaSMauro Carvalho Chehab
35*54f38fcaSMauro Carvalho Chehab``argp``
36*54f38fcaSMauro Carvalho Chehab    Pointer to struct :c:type:`media_entity_desc`.
37*54f38fcaSMauro Carvalho Chehab
38*54f38fcaSMauro Carvalho Chehab
39*54f38fcaSMauro Carvalho ChehabDescription
40*54f38fcaSMauro Carvalho Chehab===========
41*54f38fcaSMauro Carvalho Chehab
42*54f38fcaSMauro Carvalho ChehabTo query the attributes of an entity, applications set the id field of a
43*54f38fcaSMauro Carvalho Chehabstruct :c:type:`media_entity_desc` structure and
44*54f38fcaSMauro Carvalho Chehabcall the MEDIA_IOC_ENUM_ENTITIES ioctl with a pointer to this
45*54f38fcaSMauro Carvalho Chehabstructure. The driver fills the rest of the structure or returns an
46*54f38fcaSMauro Carvalho ChehabEINVAL error code when the id is invalid.
47*54f38fcaSMauro Carvalho Chehab
48*54f38fcaSMauro Carvalho Chehab.. _media-ent-id-flag-next:
49*54f38fcaSMauro Carvalho Chehab
50*54f38fcaSMauro Carvalho ChehabEntities can be enumerated by or'ing the id with the
51*54f38fcaSMauro Carvalho Chehab``MEDIA_ENT_ID_FLAG_NEXT`` flag. The driver will return information
52*54f38fcaSMauro Carvalho Chehababout the entity with the smallest id strictly larger than the requested
53*54f38fcaSMauro Carvalho Chehabone ('next entity'), or the ``EINVAL`` error code if there is none.
54*54f38fcaSMauro Carvalho Chehab
55*54f38fcaSMauro Carvalho ChehabEntity IDs can be non-contiguous. Applications must *not* try to
56*54f38fcaSMauro Carvalho Chehabenumerate entities by calling MEDIA_IOC_ENUM_ENTITIES with increasing
57*54f38fcaSMauro Carvalho Chehabid's until they get an error.
58*54f38fcaSMauro Carvalho Chehab
59*54f38fcaSMauro Carvalho Chehab
60*54f38fcaSMauro Carvalho Chehab.. c:type:: media_entity_desc
61*54f38fcaSMauro Carvalho Chehab
62*54f38fcaSMauro Carvalho Chehab.. tabularcolumns:: |p{1.5cm}|p{1.7cm}|p{1.6cm}|p{1.5cm}|p{11.2cm}|
63*54f38fcaSMauro Carvalho Chehab
64*54f38fcaSMauro Carvalho Chehab.. flat-table:: struct media_entity_desc
65*54f38fcaSMauro Carvalho Chehab    :header-rows:  0
66*54f38fcaSMauro Carvalho Chehab    :stub-columns: 0
67*54f38fcaSMauro Carvalho Chehab    :widths: 2 2 1 8
68*54f38fcaSMauro Carvalho Chehab
69*54f38fcaSMauro Carvalho Chehab    *  -  __u32
70*54f38fcaSMauro Carvalho Chehab       -  ``id``
71*54f38fcaSMauro Carvalho Chehab       -
72*54f38fcaSMauro Carvalho Chehab       -  Entity ID, set by the application. When the ID is or'ed with
73*54f38fcaSMauro Carvalho Chehab	  ``MEDIA_ENT_ID_FLAG_NEXT``, the driver clears the flag and returns
74*54f38fcaSMauro Carvalho Chehab	  the first entity with a larger ID. Do not expect that the ID will
75*54f38fcaSMauro Carvalho Chehab	  always be the same for each instance of the device. In other words,
76*54f38fcaSMauro Carvalho Chehab	  do not hardcode entity IDs in an application.
77*54f38fcaSMauro Carvalho Chehab
78*54f38fcaSMauro Carvalho Chehab    *  -  char
79*54f38fcaSMauro Carvalho Chehab       -  ``name``\ [32]
80*54f38fcaSMauro Carvalho Chehab       -
81*54f38fcaSMauro Carvalho Chehab       -  Entity name as an UTF-8 NULL-terminated string. This name must be unique
82*54f38fcaSMauro Carvalho Chehab          within the media topology.
83*54f38fcaSMauro Carvalho Chehab
84*54f38fcaSMauro Carvalho Chehab    *  -  __u32
85*54f38fcaSMauro Carvalho Chehab       -  ``type``
86*54f38fcaSMauro Carvalho Chehab       -
87*54f38fcaSMauro Carvalho Chehab       -  Entity type, see :ref:`media-entity-functions` for details.
88*54f38fcaSMauro Carvalho Chehab
89*54f38fcaSMauro Carvalho Chehab    *  -  __u32
90*54f38fcaSMauro Carvalho Chehab       -  ``revision``
91*54f38fcaSMauro Carvalho Chehab       -
92*54f38fcaSMauro Carvalho Chehab       -  Entity revision. Always zero (obsolete)
93*54f38fcaSMauro Carvalho Chehab
94*54f38fcaSMauro Carvalho Chehab    *  -  __u32
95*54f38fcaSMauro Carvalho Chehab       -  ``flags``
96*54f38fcaSMauro Carvalho Chehab       -
97*54f38fcaSMauro Carvalho Chehab       -  Entity flags, see :ref:`media-entity-flag` for details.
98*54f38fcaSMauro Carvalho Chehab
99*54f38fcaSMauro Carvalho Chehab    *  -  __u32
100*54f38fcaSMauro Carvalho Chehab       -  ``group_id``
101*54f38fcaSMauro Carvalho Chehab       -
102*54f38fcaSMauro Carvalho Chehab       -  Entity group ID. Always zero (obsolete)
103*54f38fcaSMauro Carvalho Chehab
104*54f38fcaSMauro Carvalho Chehab    *  -  __u16
105*54f38fcaSMauro Carvalho Chehab       -  ``pads``
106*54f38fcaSMauro Carvalho Chehab       -
107*54f38fcaSMauro Carvalho Chehab       -  Number of pads
108*54f38fcaSMauro Carvalho Chehab
109*54f38fcaSMauro Carvalho Chehab    *  -  __u16
110*54f38fcaSMauro Carvalho Chehab       -  ``links``
111*54f38fcaSMauro Carvalho Chehab       -
112*54f38fcaSMauro Carvalho Chehab       -  Total number of outbound links. Inbound links are not counted in
113*54f38fcaSMauro Carvalho Chehab	  this field.
114*54f38fcaSMauro Carvalho Chehab
115*54f38fcaSMauro Carvalho Chehab    *  -  __u32
116*54f38fcaSMauro Carvalho Chehab       -  ``reserved[4]``
117*54f38fcaSMauro Carvalho Chehab       -
118*54f38fcaSMauro Carvalho Chehab       -  Reserved for future extensions. Drivers and applications must set
119*54f38fcaSMauro Carvalho Chehab          the array to zero.
120*54f38fcaSMauro Carvalho Chehab
121*54f38fcaSMauro Carvalho Chehab    *  -  union {
122*54f38fcaSMauro Carvalho Chehab       -  (anonymous)
123*54f38fcaSMauro Carvalho Chehab
124*54f38fcaSMauro Carvalho Chehab    *  -  struct
125*54f38fcaSMauro Carvalho Chehab       -  ``dev``
126*54f38fcaSMauro Carvalho Chehab       -
127*54f38fcaSMauro Carvalho Chehab       -  Valid for (sub-)devices that create a single device node.
128*54f38fcaSMauro Carvalho Chehab
129*54f38fcaSMauro Carvalho Chehab    *  -
130*54f38fcaSMauro Carvalho Chehab       -  __u32
131*54f38fcaSMauro Carvalho Chehab       -  ``major``
132*54f38fcaSMauro Carvalho Chehab       -  Device node major number.
133*54f38fcaSMauro Carvalho Chehab
134*54f38fcaSMauro Carvalho Chehab    *  -
135*54f38fcaSMauro Carvalho Chehab       -  __u32
136*54f38fcaSMauro Carvalho Chehab       -  ``minor``
137*54f38fcaSMauro Carvalho Chehab       -  Device node minor number.
138*54f38fcaSMauro Carvalho Chehab
139*54f38fcaSMauro Carvalho Chehab    *  -  __u8
140*54f38fcaSMauro Carvalho Chehab       -  ``raw``\ [184]
141*54f38fcaSMauro Carvalho Chehab       -
142*54f38fcaSMauro Carvalho Chehab       -
143*54f38fcaSMauro Carvalho Chehab    *  - }
144*54f38fcaSMauro Carvalho Chehab       -
145*54f38fcaSMauro Carvalho Chehab
146*54f38fcaSMauro Carvalho Chehab
147*54f38fcaSMauro Carvalho ChehabReturn Value
148*54f38fcaSMauro Carvalho Chehab============
149*54f38fcaSMauro Carvalho Chehab
150*54f38fcaSMauro Carvalho ChehabOn success 0 is returned, on error -1 and the ``errno`` variable is set
151*54f38fcaSMauro Carvalho Chehabappropriately. The generic error codes are described at the
152*54f38fcaSMauro Carvalho Chehab:ref:`Generic Error Codes <gen-errors>` chapter.
153*54f38fcaSMauro Carvalho Chehab
154*54f38fcaSMauro Carvalho ChehabEINVAL
155*54f38fcaSMauro Carvalho Chehab    The struct :c:type:`media_entity_desc` ``id``
156*54f38fcaSMauro Carvalho Chehab    references a non-existing entity.
157