Merge branches 'for-4.8/upstream-fixes', 'for-4.9/alps', 'for-4.9/hid-input', 'for...
[sfrench/cifs-2.6.git] / Documentation / DocBook / media / v4l / vidioc-g-edid.xml
1 <refentry id="vidioc-g-edid">
2   <refmeta>
3     <refentrytitle>ioctl VIDIOC_G_EDID, VIDIOC_S_EDID, VIDIOC_SUBDEV_G_EDID, VIDIOC_SUBDEV_S_EDID</refentrytitle>
4     &manvol;
5   </refmeta>
6
7   <refnamediv>
8     <refname>VIDIOC_G_EDID</refname>
9     <refname>VIDIOC_S_EDID</refname>
10     <refname>VIDIOC_SUBDEV_G_EDID</refname>
11     <refname>VIDIOC_SUBDEV_S_EDID</refname>
12     <refpurpose>Get or set the EDID of a video receiver/transmitter</refpurpose>
13   </refnamediv>
14
15   <refsynopsisdiv>
16     <funcsynopsis>
17       <funcprototype>
18         <funcdef>int <function>ioctl</function></funcdef>
19         <paramdef>int <parameter>fd</parameter></paramdef>
20         <paramdef>int <parameter>request</parameter></paramdef>
21         <paramdef>struct v4l2_edid *<parameter>argp</parameter></paramdef>
22       </funcprototype>
23     </funcsynopsis>
24     <funcsynopsis>
25       <funcprototype>
26         <funcdef>int <function>ioctl</function></funcdef>
27         <paramdef>int <parameter>fd</parameter></paramdef>
28         <paramdef>int <parameter>request</parameter></paramdef>
29         <paramdef>struct v4l2_edid *<parameter>argp</parameter></paramdef>
30       </funcprototype>
31     </funcsynopsis>
32   </refsynopsisdiv>
33
34   <refsect1>
35     <title>Arguments</title>
36
37     <variablelist>
38       <varlistentry>
39         <term><parameter>fd</parameter></term>
40         <listitem>
41           <para>&fd;</para>
42         </listitem>
43       </varlistentry>
44       <varlistentry>
45         <term><parameter>request</parameter></term>
46         <listitem>
47           <para>VIDIOC_G_EDID, VIDIOC_S_EDID, VIDIOC_SUBDEV_G_EDID, VIDIOC_SUBDEV_S_EDID</para>
48         </listitem>
49       </varlistentry>
50       <varlistentry>
51         <term><parameter>argp</parameter></term>
52         <listitem>
53           <para></para>
54         </listitem>
55       </varlistentry>
56     </variablelist>
57   </refsect1>
58
59   <refsect1>
60     <title>Description</title>
61     <para>These ioctls can be used to get or set an EDID associated with an input
62     from a receiver or an output of a transmitter device. They can be
63     used with subdevice nodes (/dev/v4l-subdevX) or with video nodes (/dev/videoX).</para>
64
65     <para>When used with video nodes the <structfield>pad</structfield> field represents the
66     input (for video capture devices) or output (for video output devices) index as
67     is returned by &VIDIOC-ENUMINPUT; and &VIDIOC-ENUMOUTPUT; respectively. When used
68     with subdevice nodes the <structfield>pad</structfield> field represents the
69     input or output pad of the subdevice. If there is no EDID support for the given
70     <structfield>pad</structfield> value, then the &EINVAL; will be returned.</para>
71
72     <para>To get the EDID data the application has to fill in the <structfield>pad</structfield>,
73     <structfield>start_block</structfield>, <structfield>blocks</structfield> and <structfield>edid</structfield>
74     fields, zero the <structfield>reserved</structfield> array and call
75     <constant>VIDIOC_G_EDID</constant>. The current EDID from block
76     <structfield>start_block</structfield> and of size <structfield>blocks</structfield>
77     will be placed in the memory <structfield>edid</structfield> points to. The <structfield>edid</structfield>
78     pointer must point to memory at least <structfield>blocks</structfield>&nbsp;*&nbsp;128 bytes
79     large (the size of one block is 128 bytes).</para>
80
81     <para>If there are fewer blocks than specified, then the driver will set <structfield>blocks</structfield>
82     to the actual number of blocks. If there are no EDID blocks available at all, then the error code
83     ENODATA is set.</para>
84
85     <para>If blocks have to be retrieved from the sink, then this call will block until they
86     have been read.</para>
87
88     <para>If <structfield>start_block</structfield> and <structfield>blocks</structfield> are
89     both set to 0 when <constant>VIDIOC_G_EDID</constant> is called, then the driver will
90     set <structfield>blocks</structfield> to the total number of available EDID blocks
91     and it will return 0 without copying any data. This is an easy way to discover how many
92     EDID blocks there are. Note that if there are no EDID blocks available at all, then
93     the driver will set <structfield>blocks</structfield> to 0 and it returns 0.</para>
94
95     <para>To set the EDID blocks of a receiver the application has to fill in the <structfield>pad</structfield>,
96     <structfield>blocks</structfield> and <structfield>edid</structfield> fields, set
97     <structfield>start_block</structfield> to 0 and zero the <structfield>reserved</structfield> array.
98     It is not possible to set part of an EDID,
99     it is always all or nothing. Setting the EDID data is only valid for receivers as it makes
100     no sense for a transmitter.</para>
101
102     <para>The driver assumes that the full EDID is passed in. If there are more EDID blocks than
103     the hardware can handle then the EDID is not written, but instead the error code E2BIG is set
104     and <structfield>blocks</structfield> is set to the maximum that the hardware supports.
105     If <structfield>start_block</structfield> is any
106     value other than 0 then the error code EINVAL is set.</para>
107
108     <para>To disable an EDID you set <structfield>blocks</structfield> to 0. Depending on the
109     hardware this will drive the hotplug pin low and/or block the source from reading the EDID
110     data in some way. In any case, the end result is the same: the EDID is no longer available.
111     </para>
112
113     <table pgwide="1" frame="none" id="v4l2-edid">
114       <title>struct <structname>v4l2_edid</structname></title>
115       <tgroup cols="3">
116         &cs-str;
117         <tbody valign="top">
118           <row>
119             <entry>__u32</entry>
120             <entry><structfield>pad</structfield></entry>
121             <entry>Pad for which to get/set the EDID blocks. When used with a video device
122             node the pad represents the input or output index as returned by
123             &VIDIOC-ENUMINPUT; and &VIDIOC-ENUMOUTPUT; respectively.</entry>
124           </row>
125           <row>
126             <entry>__u32</entry>
127             <entry><structfield>start_block</structfield></entry>
128             <entry>Read the EDID from starting with this block. Must be 0 when setting
129             the EDID.</entry>
130           </row>
131           <row>
132             <entry>__u32</entry>
133             <entry><structfield>blocks</structfield></entry>
134             <entry>The number of blocks to get or set. Must be less or equal to 256 (the
135             maximum number of blocks as defined by the standard). When you set the EDID and
136             <structfield>blocks</structfield> is 0, then the EDID is disabled or erased.</entry>
137           </row>
138           <row>
139             <entry>__u32</entry>
140             <entry><structfield>reserved</structfield>[5]</entry>
141             <entry>Reserved for future extensions. Applications and drivers must
142             set the array to zero.</entry>
143           </row>
144           <row>
145             <entry>__u8&nbsp;*</entry>
146             <entry><structfield>edid</structfield></entry>
147             <entry>Pointer to memory that contains the EDID. The minimum size is
148             <structfield>blocks</structfield>&nbsp;*&nbsp;128.</entry>
149           </row>
150         </tbody>
151       </tgroup>
152     </table>
153   </refsect1>
154
155   <refsect1>
156     &return-value;
157
158     <variablelist>
159       <varlistentry>
160         <term><errorcode>ENODATA</errorcode></term>
161         <listitem>
162           <para>The EDID data is not available.</para>
163         </listitem>
164       </varlistentry>
165       <varlistentry>
166         <term><errorcode>E2BIG</errorcode></term>
167         <listitem>
168           <para>The EDID data you provided is more than the hardware can handle.</para>
169         </listitem>
170       </varlistentry>
171     </variablelist>
172   </refsect1>
173 </refentry>