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