Merge remote-tracking branches 'regulator/topic/discharge', 'regulator/topic/fan53555...
[cascardo/linux.git] / Documentation / DocBook / media / v4l / media-ioc-g-topology.xml
1 <refentry id="media-g-topology">
2   <refmeta>
3     <refentrytitle>ioctl MEDIA_IOC_G_TOPOLOGY</refentrytitle>
4     &manvol;
5   </refmeta>
6
7   <refnamediv>
8     <refname>MEDIA_IOC_G_TOPOLOGY</refname>
9     <refpurpose>Enumerate the graph topology and graph element properties</refpurpose>
10   </refnamediv>
11
12   <refsynopsisdiv>
13     <funcsynopsis>
14       <funcprototype>
15         <funcdef>int <function>ioctl</function></funcdef>
16         <paramdef>int <parameter>fd</parameter></paramdef>
17         <paramdef>int <parameter>request</parameter></paramdef>
18         <paramdef>struct media_v2_topology *<parameter>argp</parameter></paramdef>
19       </funcprototype>
20     </funcsynopsis>
21   </refsynopsisdiv>
22
23   <refsect1>
24     <title>Arguments</title>
25
26     <variablelist>
27       <varlistentry>
28         <term><parameter>fd</parameter></term>
29         <listitem>
30           <para>File descriptor returned by
31           <link linkend='media-func-open'><function>open()</function></link>.</para>
32         </listitem>
33       </varlistentry>
34       <varlistentry>
35         <term><parameter>request</parameter></term>
36         <listitem>
37           <para>MEDIA_IOC_G_TOPOLOGY</para>
38         </listitem>
39       </varlistentry>
40       <varlistentry>
41         <term><parameter>argp</parameter></term>
42         <listitem>
43           <para></para>
44         </listitem>
45       </varlistentry>
46     </variablelist>
47   </refsect1>
48
49   <refsect1>
50     <title>Description</title>
51
52     <para><emphasis role="bold">NOTE:</emphasis> This new ioctl is programmed to be added on Kernel 4.6. Its definition/arguments may change until its final version.</para>
53
54     <para>The typical usage of this ioctl is to call it twice.
55     On the first call, the structure defined at &media-v2-topology; should
56     be zeroed. At return, if no errors happen, this ioctl will return the
57     <constant>topology_version</constant> and the total number of entities,
58     interfaces, pads and links.</para>
59     <para>Before the second call, the userspace should allocate arrays to
60     store the graph elements that are desired, putting the pointers to them
61     at the ptr_entities, ptr_interfaces, ptr_links and/or ptr_pads, keeping
62     the other values untouched.</para>
63     <para>If the <constant>topology_version</constant> remains the same, the
64     ioctl should fill the desired arrays with the media graph elements.</para>
65
66     <table pgwide="1" frame="none" id="media-v2-topology">
67       <title>struct <structname>media_v2_topology</structname></title>
68       <tgroup cols="5">
69         <colspec colname="c1" />
70         <colspec colname="c2" />
71         <colspec colname="c3" />
72         <colspec colname="c4" />
73         <colspec colname="c5" />
74         <tbody valign="top">
75           <row>
76             <entry>__u64</entry>
77             <entry><structfield>topology_version</structfield></entry>
78             <entry></entry>
79             <entry></entry>
80             <entry>Version of the media graph topology. When the graph is
81                     created, this field starts with zero. Every time a graph
82                     element is added or removed, this field is
83                     incremented.</entry>
84           </row>
85           <row>
86             <entry>__u64</entry>
87             <entry><structfield>num_entities</structfield></entry>
88             <entry></entry>
89             <entry></entry>
90             <entry>Number of entities in the graph</entry>
91           </row>
92           <row>
93             <entry>__u64</entry>
94             <entry><structfield>ptr_entities</structfield></entry>
95             <entry></entry>
96             <entry></entry>
97             <entry>A pointer to a memory area where the entities array
98                    will be stored, converted to a 64-bits integer.
99                    It can be zero. if zero, the ioctl won't store the
100                    entities. It will just update
101                    <constant>num_entities</constant></entry>
102           </row>
103           <row>
104             <entry>__u64</entry>
105             <entry><structfield>num_interfaces</structfield></entry>
106             <entry></entry>
107             <entry></entry>
108             <entry>Number of interfaces in the graph</entry>
109           </row>
110           <row>
111             <entry>__u64</entry>
112             <entry><structfield>ptr_interfaces</structfield></entry>
113             <entry></entry>
114             <entry></entry>
115             <entry>A pointer to a memory area where the interfaces array
116                    will be stored, converted to a 64-bits integer.
117                    It can be zero. if zero, the ioctl won't store the
118                    interfaces. It will just update
119                    <constant>num_interfaces</constant></entry>
120           </row>
121           <row>
122             <entry>__u64</entry>
123             <entry><structfield>num_pads</structfield></entry>
124             <entry></entry>
125             <entry></entry>
126             <entry>Total number of pads in the graph</entry>
127           </row>
128           <row>
129             <entry>__u64</entry>
130             <entry><structfield>ptr_pads</structfield></entry>
131             <entry></entry>
132             <entry></entry>
133             <entry>A pointer to a memory area where the pads array
134                    will be stored, converted to a 64-bits integer.
135                    It can be zero. if zero, the ioctl won't store the
136                    pads. It will just update
137                    <constant>num_pads</constant></entry>
138           </row>
139           <row>
140             <entry>__u64</entry>
141             <entry><structfield>num_links</structfield></entry>
142             <entry></entry>
143             <entry></entry>
144             <entry>Total number of data and interface links in the graph</entry>
145           </row>
146           <row>
147             <entry>__u64</entry>
148             <entry><structfield>ptr_links</structfield></entry>
149             <entry></entry>
150             <entry></entry>
151             <entry>A pointer to a memory area where the links array
152                    will be stored, converted to a 64-bits integer.
153                    It can be zero. if zero, the ioctl won't store the
154                    links. It will just update
155                    <constant>num_links</constant></entry>
156           </row>
157         </tbody>
158       </tgroup>
159     </table>
160
161     <table pgwide="1" frame="none" id="media-v2-entity">
162       <title>struct <structname>media_v2_entity</structname></title>
163       <tgroup cols="5">
164         <colspec colname="c1" />
165         <colspec colname="c2" />
166         <colspec colname="c3" />
167         <colspec colname="c4" />
168         <colspec colname="c5" />
169         <tbody valign="top">
170           <row>
171             <entry>__u32</entry>
172             <entry><structfield>id</structfield></entry>
173             <entry></entry>
174             <entry></entry>
175             <entry>Unique ID for the entity.</entry>
176           </row>
177           <row>
178             <entry>char</entry>
179             <entry><structfield>name</structfield>[64]</entry>
180             <entry></entry>
181             <entry></entry>
182             <entry>Entity name as an UTF-8 NULL-terminated string.</entry>
183           </row>
184           <row>
185             <entry>__u32</entry>
186             <entry><structfield>function</structfield></entry>
187             <entry></entry>
188             <entry></entry>
189             <entry>Entity main function, see <xref linkend="media-entity-type" /> for details.</entry>
190           </row>
191           <row>
192             <entry>__u32</entry>
193             <entry><structfield>reserved</structfield>[12]</entry>
194             <entry>Reserved for future extensions. Drivers and applications must
195             set this array to zero.</entry>
196           </row>
197         </tbody>
198       </tgroup>
199     </table>
200
201     <table pgwide="1" frame="none" id="media-v2-interface">
202       <title>struct <structname>media_v2_interface</structname></title>
203       <tgroup cols="5">
204         <colspec colname="c1" />
205         <colspec colname="c2" />
206         <colspec colname="c3" />
207         <colspec colname="c4" />
208         <colspec colname="c5" />
209         <tbody valign="top">
210           <row>
211             <entry>__u32</entry>
212             <entry><structfield>id</structfield></entry>
213             <entry></entry>
214             <entry></entry>
215             <entry>Unique ID for the interface.</entry>
216           </row>
217           <row>
218             <entry>__u32</entry>
219             <entry><structfield>intf_type</structfield></entry>
220             <entry></entry>
221             <entry></entry>
222             <entry>Interface type, see <xref linkend="media-intf-type" /> for details.</entry>
223           </row>
224           <row>
225             <entry>__u32</entry>
226             <entry><structfield>flags</structfield></entry>
227             <entry></entry>
228             <entry></entry>
229             <entry>Interface flags. Currently unused.</entry>
230           </row>
231           <row>
232             <entry>__u32</entry>
233             <entry><structfield>reserved</structfield>[9]</entry>
234             <entry></entry>
235             <entry></entry>
236             <entry>Reserved for future extensions. Drivers and applications must
237             set this array to zero.</entry>
238           </row>
239           <row>
240             <entry>struct media_v2_intf_devnode</entry>
241             <entry><structfield>devnode</structfield></entry>
242             <entry></entry>
243             <entry></entry>
244             <entry>Used only for device node interfaces. See <xref linkend="media-v2-intf-devnode" /> for details..</entry>
245           </row>
246         </tbody>
247       </tgroup>
248     </table>
249
250     <table pgwide="1" frame="none" id="media-v2-intf-devnode">
251       <title>struct <structname>media_v2_interface</structname></title>
252       <tgroup cols="5">
253         <colspec colname="c1" />
254         <colspec colname="c2" />
255         <colspec colname="c3" />
256         <colspec colname="c4" />
257         <colspec colname="c5" />
258         <tbody valign="top">
259           <row>
260             <entry>__u32</entry>
261             <entry><structfield>major</structfield></entry>
262             <entry></entry>
263             <entry></entry>
264             <entry>Device node major number.</entry>
265           </row>
266           <row>
267             <entry>__u32</entry>
268             <entry><structfield>minor</structfield></entry>
269             <entry></entry>
270             <entry></entry>
271             <entry>Device node minor number.</entry>
272           </row>
273         </tbody>
274       </tgroup>
275     </table>
276
277     <table pgwide="1" frame="none" id="media-v2-pad">
278       <title>struct <structname>media_v2_pad</structname></title>
279       <tgroup cols="5">
280         <colspec colname="c1" />
281         <colspec colname="c2" />
282         <colspec colname="c3" />
283         <colspec colname="c4" />
284         <colspec colname="c5" />
285         <tbody valign="top">
286           <row>
287             <entry>__u32</entry>
288             <entry><structfield>id</structfield></entry>
289             <entry></entry>
290             <entry></entry>
291             <entry>Unique ID for the pad.</entry>
292           </row>
293           <row>
294             <entry>__u32</entry>
295             <entry><structfield>entity_id</structfield></entry>
296             <entry></entry>
297             <entry></entry>
298             <entry>Unique ID for the entity where this pad belongs.</entry>
299           </row>
300           <row>
301             <entry>__u32</entry>
302             <entry><structfield>flags</structfield></entry>
303             <entry></entry>
304             <entry></entry>
305             <entry>Pad flags, see <xref linkend="media-pad-flag" /> for more details.</entry>
306           </row>
307           <row>
308             <entry>__u32</entry>
309             <entry><structfield>reserved</structfield>[9]</entry>
310             <entry></entry>
311             <entry></entry>
312             <entry>Reserved for future extensions. Drivers and applications must
313             set this array to zero.</entry>
314           </row>
315         </tbody>
316       </tgroup>
317     </table>
318
319     <table pgwide="1" frame="none" id="media-v2-link">
320       <title>struct <structname>media_v2_pad</structname></title>
321       <tgroup cols="5">
322         <colspec colname="c1" />
323         <colspec colname="c2" />
324         <colspec colname="c3" />
325         <colspec colname="c4" />
326         <colspec colname="c5" />
327         <tbody valign="top">
328           <row>
329             <entry>__u32</entry>
330             <entry><structfield>id</structfield></entry>
331             <entry></entry>
332             <entry></entry>
333             <entry>Unique ID for the pad.</entry>
334           </row>
335           <row>
336             <entry>__u32</entry>
337             <entry><structfield>source_id</structfield></entry>
338             <entry></entry>
339             <entry></entry>
340             <entry>
341                <para>On pad to pad links: unique ID for the source pad.</para>
342                <para>On interface to entity links: unique ID for the interface.</para>
343             </entry>
344           </row>
345           <row>
346             <entry>__u32</entry>
347             <entry><structfield>sink_id</structfield></entry>
348             <entry></entry>
349             <entry></entry>
350             <entry>
351                <para>On pad to pad links: unique ID for the sink pad.</para>
352                <para>On interface to entity links: unique ID for the entity.</para>
353             </entry>
354           </row>
355           <row>
356             <entry>__u32</entry>
357             <entry><structfield>flags</structfield></entry>
358             <entry></entry>
359             <entry></entry>
360             <entry>Link flags, see <xref linkend="media-link-flag" /> for more details.</entry>
361           </row>
362           <row>
363             <entry>__u32</entry>
364             <entry><structfield>reserved</structfield>[5]</entry>
365             <entry></entry>
366             <entry></entry>
367             <entry>Reserved for future extensions. Drivers and applications must
368             set this array to zero.</entry>
369           </row>
370         </tbody>
371       </tgroup>
372     </table>
373
374   </refsect1>
375
376   <refsect1>
377     &return-value;
378
379     <variablelist>
380       <varlistentry>
381         <term><errorcode>ENOSPC</errorcode></term>
382         <listitem>
383           <para>This is returned when either one or more of the num_entities,
384           num_interfaces, num_links or num_pads are non-zero and are smaller
385           than the actual number of elements inside the graph. This may happen
386           if the <constant>topology_version</constant> changed when compared
387           to the last time this ioctl was called. Userspace should usually
388           free the area for the pointers, zero the struct elements and call
389           this ioctl again.</para>
390         </listitem>
391       </varlistentry>
392     </variablelist>
393   </refsect1>
394 </refentry>