1<refentry id="vidioc-g-dv-timings">
2  <refmeta>
3    <refentrytitle>ioctl VIDIOC_G_DV_TIMINGS, VIDIOC_S_DV_TIMINGS</refentrytitle>
4    &manvol;
5  </refmeta>
6
7  <refnamediv>
8    <refname>VIDIOC_G_DV_TIMINGS</refname>
9    <refname>VIDIOC_S_DV_TIMINGS</refname>
10    <refname>VIDIOC_SUBDEV_G_DV_TIMINGS</refname>
11    <refname>VIDIOC_SUBDEV_S_DV_TIMINGS</refname>
12    <refpurpose>Get or set DV timings for input or output</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_dv_timings *<parameter>argp</parameter></paramdef>
22      </funcprototype>
23    </funcsynopsis>
24  </refsynopsisdiv>
25
26  <refsect1>
27    <title>Arguments</title>
28
29    <variablelist>
30      <varlistentry>
31	<term><parameter>fd</parameter></term>
32	<listitem>
33	  <para>&fd;</para>
34	</listitem>
35      </varlistentry>
36      <varlistentry>
37	<term><parameter>request</parameter></term>
38	<listitem>
39	  <para>VIDIOC_G_DV_TIMINGS, VIDIOC_S_DV_TIMINGS, VIDIOC_SUBDEV_G_DV_TIMINGS, VIDIOC_SUBDEV_S_DV_TIMINGS</para>
40	</listitem>
41      </varlistentry>
42      <varlistentry>
43	<term><parameter>argp</parameter></term>
44	<listitem>
45	  <para></para>
46	</listitem>
47      </varlistentry>
48    </variablelist>
49  </refsect1>
50
51  <refsect1>
52    <title>Description</title>
53    <para>To set DV timings for the input or output, applications use the
54<constant>VIDIOC_S_DV_TIMINGS</constant> ioctl and to get the current timings,
55applications use the <constant>VIDIOC_G_DV_TIMINGS</constant> ioctl. The detailed timing
56information is filled in using the structure &v4l2-dv-timings;. These ioctls take
57a pointer to the &v4l2-dv-timings; structure as argument. If the ioctl is not supported
58or the timing values are not correct, the driver returns &EINVAL;.</para>
59<para>The <filename>linux/v4l2-dv-timings.h</filename> header can be used to get the
60timings of the formats in the <xref linkend="cea861" /> and <xref linkend="vesadmt" />
61standards. If the current input or output does not support DV timings (e.g. if
62&VIDIOC-ENUMINPUT; does not set the <constant>V4L2_IN_CAP_DV_TIMINGS</constant> flag), then
63&ENODATA; is returned.</para>
64  </refsect1>
65
66  <refsect1>
67    &return-value;
68
69    <variablelist>
70      <varlistentry>
71	<term><errorcode>EINVAL</errorcode></term>
72	<listitem>
73	  <para>This ioctl is not supported, or the
74<constant>VIDIOC_S_DV_TIMINGS</constant> parameter was unsuitable.</para>
75	</listitem>
76      </varlistentry>
77      <varlistentry>
78	<term><errorcode>ENODATA</errorcode></term>
79	<listitem>
80	  <para>Digital video timings are not supported for this input or output.</para>
81	</listitem>
82      </varlistentry>
83      <varlistentry>
84	<term><errorcode>EBUSY</errorcode></term>
85	<listitem>
86	  <para>The device is busy and therefore can not change the timings.</para>
87	</listitem>
88      </varlistentry>
89    </variablelist>
90
91    <table pgwide="1" frame="none" id="v4l2-bt-timings">
92      <title>struct <structname>v4l2_bt_timings</structname></title>
93      <tgroup cols="3">
94	&cs-str;
95	<tbody valign="top">
96	  <row>
97	    <entry>__u32</entry>
98	    <entry><structfield>width</structfield></entry>
99	    <entry>Width of the active video in pixels.</entry>
100	  </row>
101	  <row>
102	    <entry>__u32</entry>
103	    <entry><structfield>height</structfield></entry>
104	    <entry>Height of the active video frame in lines. So for interlaced formats the
105	    height of the active video in each field is <structfield>height</structfield>/2.</entry>
106	  </row>
107	  <row>
108	    <entry>__u32</entry>
109	    <entry><structfield>interlaced</structfield></entry>
110	    <entry>Progressive (0) or interlaced (1)</entry>
111	  </row>
112	  <row>
113	    <entry>__u32</entry>
114	    <entry><structfield>polarities</structfield></entry>
115	    <entry>This is a bit mask that defines polarities of sync signals.
116bit 0 (V4L2_DV_VSYNC_POS_POL) is for vertical sync polarity and bit 1 (V4L2_DV_HSYNC_POS_POL) is for horizontal sync polarity. If the bit is set
117(1) it is positive polarity and if is cleared (0), it is negative polarity.</entry>
118	  </row>
119	  <row>
120	    <entry>__u64</entry>
121	    <entry><structfield>pixelclock</structfield></entry>
122	    <entry>Pixel clock in Hz. Ex. 74.25MHz->74250000</entry>
123	  </row>
124	  <row>
125	    <entry>__u32</entry>
126	    <entry><structfield>hfrontporch</structfield></entry>
127	    <entry>Horizontal front porch in pixels</entry>
128	  </row>
129	  <row>
130	    <entry>__u32</entry>
131	    <entry><structfield>hsync</structfield></entry>
132	    <entry>Horizontal sync length in pixels</entry>
133	  </row>
134	  <row>
135	    <entry>__u32</entry>
136	    <entry><structfield>hbackporch</structfield></entry>
137	    <entry>Horizontal back porch in pixels</entry>
138	  </row>
139	  <row>
140	    <entry>__u32</entry>
141	    <entry><structfield>vfrontporch</structfield></entry>
142	    <entry>Vertical front porch in lines. For interlaced formats this refers to the
143	    odd field (aka field 1).</entry>
144	  </row>
145	  <row>
146	    <entry>__u32</entry>
147	    <entry><structfield>vsync</structfield></entry>
148	    <entry>Vertical sync length in lines. For interlaced formats this refers to the
149	    odd field (aka field 1).</entry>
150	  </row>
151	  <row>
152	    <entry>__u32</entry>
153	    <entry><structfield>vbackporch</structfield></entry>
154	    <entry>Vertical back porch in lines. For interlaced formats this refers to the
155	    odd field (aka field 1).</entry>
156	  </row>
157	  <row>
158	    <entry>__u32</entry>
159	    <entry><structfield>il_vfrontporch</structfield></entry>
160	    <entry>Vertical front porch in lines for the even field (aka field 2) of
161	    interlaced field formats. Must be 0 for progressive formats.</entry>
162	  </row>
163	  <row>
164	    <entry>__u32</entry>
165	    <entry><structfield>il_vsync</structfield></entry>
166	    <entry>Vertical sync length in lines for the even field (aka field 2) of
167	    interlaced field formats. Must be 0 for progressive formats.</entry>
168	  </row>
169	  <row>
170	    <entry>__u32</entry>
171	    <entry><structfield>il_vbackporch</structfield></entry>
172	    <entry>Vertical back porch in lines for the even field (aka field 2) of
173	    interlaced field formats. Must be 0 for progressive formats.</entry>
174	  </row>
175	  <row>
176	    <entry>__u32</entry>
177	    <entry><structfield>standards</structfield></entry>
178	    <entry>The video standard(s) this format belongs to. This will be filled in by
179	    the driver. Applications must set this to 0. See <xref linkend="dv-bt-standards"/>
180	    for a list of standards.</entry>
181	  </row>
182	  <row>
183	    <entry>__u32</entry>
184	    <entry><structfield>flags</structfield></entry>
185	    <entry>Several flags giving more information about the format.
186	    See <xref linkend="dv-bt-flags"/> for a description of the flags.
187	    </entry>
188	  </row>
189	</tbody>
190      </tgroup>
191    </table>
192
193    <table pgwide="1" frame="none" id="v4l2-dv-timings">
194      <title>struct <structname>v4l2_dv_timings</structname></title>
195      <tgroup cols="4">
196	&cs-str;
197	<tbody valign="top">
198	  <row>
199	    <entry>__u32</entry>
200	    <entry><structfield>type</structfield></entry>
201	    <entry></entry>
202	    <entry>Type of DV timings as listed in <xref linkend="dv-timing-types"/>.</entry>
203	  </row>
204	  <row>
205	    <entry>union</entry>
206	    <entry><structfield></structfield></entry>
207	    <entry></entry>
208	  </row>
209	  <row>
210	    <entry></entry>
211	    <entry>&v4l2-bt-timings;</entry>
212	    <entry><structfield>bt</structfield></entry>
213	    <entry>Timings defined by BT.656/1120 specifications</entry>
214	  </row>
215	  <row>
216	    <entry></entry>
217	    <entry>__u32</entry>
218	    <entry><structfield>reserved</structfield>[32]</entry>
219	    <entry></entry>
220	  </row>
221	</tbody>
222      </tgroup>
223    </table>
224
225    <table pgwide="1" frame="none" id="dv-timing-types">
226      <title>DV Timing types</title>
227      <tgroup cols="3">
228	&cs-str;
229	<tbody valign="top">
230	  <row>
231	    <entry>Timing type</entry>
232	    <entry>value</entry>
233	    <entry>Description</entry>
234	  </row>
235	  <row>
236	    <entry></entry>
237	    <entry></entry>
238	    <entry></entry>
239	  </row>
240	  <row>
241	    <entry>V4L2_DV_BT_656_1120</entry>
242	    <entry>0</entry>
243	    <entry>BT.656/1120 timings</entry>
244	  </row>
245	</tbody>
246      </tgroup>
247    </table>
248    <table pgwide="1" frame="none" id="dv-bt-standards">
249      <title>DV BT Timing standards</title>
250      <tgroup cols="2">
251	&cs-str;
252	<tbody valign="top">
253	  <row>
254	    <entry>Timing standard</entry>
255	    <entry>Description</entry>
256	  </row>
257	  <row>
258	    <entry></entry>
259	    <entry></entry>
260	  </row>
261	  <row>
262	    <entry>V4L2_DV_BT_STD_CEA861</entry>
263	    <entry>The timings follow the CEA-861 Digital TV Profile standard</entry>
264	  </row>
265	  <row>
266	    <entry>V4L2_DV_BT_STD_DMT</entry>
267	    <entry>The timings follow the VESA Discrete Monitor Timings standard</entry>
268	  </row>
269	  <row>
270	    <entry>V4L2_DV_BT_STD_CVT</entry>
271	    <entry>The timings follow the VESA Coordinated Video Timings standard</entry>
272	  </row>
273	  <row>
274	    <entry>V4L2_DV_BT_STD_GTF</entry>
275	    <entry>The timings follow the VESA Generalized Timings Formula standard</entry>
276	  </row>
277	</tbody>
278      </tgroup>
279    </table>
280    <table pgwide="1" frame="none" id="dv-bt-flags">
281      <title>DV BT Timing flags</title>
282      <tgroup cols="2">
283	&cs-str;
284	<tbody valign="top">
285	  <row>
286	    <entry>Flag</entry>
287	    <entry>Description</entry>
288	  </row>
289	  <row>
290	    <entry></entry>
291	    <entry></entry>
292	  </row>
293	  <row>
294	    <entry>V4L2_DV_FL_REDUCED_BLANKING</entry>
295	    <entry>CVT/GTF specific: the timings use reduced blanking (CVT) or the 'Secondary
296GTF' curve (GTF). In both cases the horizontal and/or vertical blanking
297intervals are reduced, allowing a higher resolution over the same
298bandwidth. This is a read-only flag, applications must not set this.
299	    </entry>
300	  </row>
301	  <row>
302	    <entry>V4L2_DV_FL_CAN_REDUCE_FPS</entry>
303	    <entry>CEA-861 specific: set for CEA-861 formats with a framerate that is a multiple
304of six. These formats can be optionally played at 1 / 1.001 speed to
305be compatible with 60 Hz based standards such as NTSC and PAL-M that use a framerate of
30629.97 frames per second. If the transmitter can't generate such frequencies, then the
307flag will also be cleared. This is a read-only flag, applications must not set this.
308	    </entry>
309	  </row>
310	  <row>
311	    <entry>V4L2_DV_FL_REDUCED_FPS</entry>
312	    <entry>CEA-861 specific: only valid for video transmitters, the flag is cleared
313by receivers. It is also only valid for formats with the V4L2_DV_FL_CAN_REDUCE_FPS flag
314set, for other formats the flag will be cleared by the driver.
315
316If the application sets this flag, then the pixelclock used to set up the transmitter is
317divided by 1.001 to make it compatible with NTSC framerates. If the transmitter
318can't generate such frequencies, then the flag will also be cleared.
319	    </entry>
320	  </row>
321	  <row>
322	    <entry>V4L2_DV_FL_HALF_LINE</entry>
323	    <entry>Specific to interlaced formats: if set, then the vertical frontporch
324of field 1 (aka the odd field) is really one half-line longer and the vertical backporch
325of field 2 (aka the even field) is really one half-line shorter, so each field has exactly
326the same number of half-lines. Whether half-lines can be detected or used depends on
327the hardware.
328	    </entry>
329	  </row>
330	  <row>
331	    <entry>V4L2_DV_FL_IS_CE_VIDEO</entry>
332	    <entry>If set, then this is a Consumer Electronics (CE) video format.
333Such formats differ from other formats (commonly called IT formats) in that if
334R'G'B' encoding is used then by default the R'G'B' values use limited range
335(i.e. 16-235) as opposed to full range (i.e. 0-255). All formats defined in CEA-861
336except for the 640x480p59.94 format are CE formats.
337	    </entry>
338	  </row>
339	</tbody>
340      </tgroup>
341    </table>
342  </refsect1>
343</refentry>
344