1<refentry id="vidioc-g-edid">
2  <refmeta>
3    <refentrytitle>ioctl VIDIOC_G_EDID, VIDIOC_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 and call <constant>VIDIOC_G_EDID</constant>. The current EDID from block
75    <structfield>start_block</structfield> and of size <structfield>blocks</structfield>
76    will be placed in the memory <structfield>edid</structfield> points to. The <structfield>edid</structfield>
77    pointer must point to memory at least <structfield>blocks</structfield>&nbsp;*&nbsp;128 bytes
78    large (the size of one block is 128 bytes).</para>
79
80    <para>If there are fewer blocks than specified, then the driver will set <structfield>blocks</structfield>
81    to the actual number of blocks. If there are no EDID blocks available at all, then the error code
82    ENODATA is set.</para>
83
84    <para>If blocks have to be retrieved from the sink, then this call will block until they
85    have been read.</para>
86
87    <para>If <structfield>start_block</structfield> and <structfield>blocks</structfield> are
88    both set to 0 when <constant>VIDIOC_G_EDID</constant> is called, then the driver will
89    set <structfield>blocks</structfield> to the total number of available EDID blocks
90    and it will return 0 without copying any data. This is an easy way to discover how many
91    EDID blocks there are. Note that if there are no EDID blocks available at all, then
92    the driver will set <structfield>blocks</structfield> to 0 and it returns 0.</para>
93
94    <para>To set the EDID blocks of a receiver the application has to fill in the <structfield>pad</structfield>,
95    <structfield>blocks</structfield> and <structfield>edid</structfield> fields and set
96    <structfield>start_block</structfield> to 0. It is not possible to set part of an EDID,
97    it is always all or nothing. Setting the EDID data is only valid for receivers as it makes
98    no sense for a transmitter.</para>
99
100    <para>The driver assumes that the full EDID is passed in. If there are more EDID blocks than
101    the hardware can handle then the EDID is not written, but instead the error code E2BIG is set
102    and <structfield>blocks</structfield> is set to the maximum that the hardware supports.
103    If <structfield>start_block</structfield> is any
104    value other than 0 then the error code EINVAL is set.</para>
105
106    <para>To disable an EDID you set <structfield>blocks</structfield> to 0. Depending on the
107    hardware this will drive the hotplug pin low and/or block the source from reading the EDID
108    data in some way. In any case, the end result is the same: the EDID is no longer available.
109    </para>
110
111    <table pgwide="1" frame="none" id="v4l2-edid">
112      <title>struct <structname>v4l2_edid</structname></title>
113      <tgroup cols="3">
114        &cs-str;
115	<tbody valign="top">
116	  <row>
117	    <entry>__u32</entry>
118	    <entry><structfield>pad</structfield></entry>
119	    <entry>Pad for which to get/set the EDID blocks. When used with a video device
120	    node the pad represents the input or output index as returned by
121	    &VIDIOC-ENUMINPUT; and &VIDIOC-ENUMOUTPUT; respectively.</entry>
122	  </row>
123	  <row>
124	    <entry>__u32</entry>
125	    <entry><structfield>start_block</structfield></entry>
126	    <entry>Read the EDID from starting with this block. Must be 0 when setting
127	    the EDID.</entry>
128	  </row>
129	  <row>
130	    <entry>__u32</entry>
131	    <entry><structfield>blocks</structfield></entry>
132	    <entry>The number of blocks to get or set. Must be less or equal to 256 (the
133	    maximum number of blocks as defined by the standard). When you set the EDID and
134	    <structfield>blocks</structfield> is 0, then the EDID is disabled or erased.</entry>
135	  </row>
136	  <row>
137	    <entry>__u32</entry>
138	    <entry><structfield>reserved</structfield>[5]</entry>
139	    <entry>Reserved for future extensions. Applications and drivers must
140	    set the array to zero.</entry>
141	  </row>
142	  <row>
143	    <entry>__u8&nbsp;*</entry>
144	    <entry><structfield>edid</structfield></entry>
145	    <entry>Pointer to memory that contains the EDID. The minimum size is
146	    <structfield>blocks</structfield>&nbsp;*&nbsp;128.</entry>
147	  </row>
148	</tbody>
149      </tgroup>
150    </table>
151  </refsect1>
152
153  <refsect1>
154    &return-value;
155
156    <variablelist>
157      <varlistentry>
158	<term><errorcode>ENODATA</errorcode></term>
159	<listitem>
160	  <para>The EDID data is not available.</para>
161	</listitem>
162      </varlistentry>
163      <varlistentry>
164	<term><errorcode>E2BIG</errorcode></term>
165	<listitem>
166	  <para>The EDID data you provided is more than the hardware can handle.</para>
167	</listitem>
168      </varlistentry>
169    </variablelist>
170  </refsect1>
171</refentry>
172