Merge branch 'drm-next-4.7' of git://people.freedesktop.org/~agd5f/linux into drm...
[cascardo/linux.git] / Documentation / DocBook / media / v4l / vidioc-subdev-g-frame-interval.xml
1 <refentry id="vidioc-subdev-g-frame-interval">
2   <refmeta>
3     <refentrytitle>ioctl VIDIOC_SUBDEV_G_FRAME_INTERVAL, VIDIOC_SUBDEV_S_FRAME_INTERVAL</refentrytitle>
4     &manvol;
5   </refmeta>
6
7   <refnamediv>
8     <refname>VIDIOC_SUBDEV_G_FRAME_INTERVAL</refname>
9     <refname>VIDIOC_SUBDEV_S_FRAME_INTERVAL</refname>
10     <refpurpose>Get or set the frame interval on a subdev pad</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_subdev_frame_interval *<parameter>argp</parameter>
20         </paramdef>
21       </funcprototype>
22     </funcsynopsis>
23   </refsynopsisdiv>
24
25   <refsect1>
26     <title>Arguments</title>
27
28     <variablelist>
29       <varlistentry>
30         <term><parameter>fd</parameter></term>
31         <listitem>
32           <para>&fd;</para>
33         </listitem>
34       </varlistentry>
35       <varlistentry>
36         <term><parameter>request</parameter></term>
37         <listitem>
38           <para>VIDIOC_SUBDEV_G_FRAME_INTERVAL, VIDIOC_SUBDEV_S_FRAME_INTERVAL</para>
39         </listitem>
40       </varlistentry>
41       <varlistentry>
42         <term><parameter>argp</parameter></term>
43         <listitem>
44           <para></para>
45         </listitem>
46       </varlistentry>
47     </variablelist>
48   </refsect1>
49
50   <refsect1>
51     <title>Description</title>
52
53     <para>These ioctls are used to get and set the frame interval at specific
54     subdev pads in the image pipeline. The frame interval only makes sense for
55     sub-devices that can control the frame period on their own. This includes,
56     for instance, image sensors and TV tuners. Sub-devices that don't support
57     frame intervals must not implement these ioctls.</para>
58
59     <para>To retrieve the current frame interval applications set the
60     <structfield>pad</structfield> field of a &v4l2-subdev-frame-interval; to
61     the desired pad number as reported by the media controller API. When they
62     call the <constant>VIDIOC_SUBDEV_G_FRAME_INTERVAL</constant> ioctl with a
63     pointer to this structure the driver fills the members of the
64     <structfield>interval</structfield> field.</para>
65
66     <para>To change the current frame interval applications set both the
67     <structfield>pad</structfield> field and all members of the
68     <structfield>interval</structfield> field. When they call the
69     <constant>VIDIOC_SUBDEV_S_FRAME_INTERVAL</constant> ioctl with a pointer to
70     this structure the driver verifies the requested interval, adjusts it based
71     on the hardware capabilities and configures the device. Upon return the
72     &v4l2-subdev-frame-interval; contains the current frame interval as would be
73     returned by a <constant>VIDIOC_SUBDEV_G_FRAME_INTERVAL</constant> call.
74     </para>
75
76     <para>Drivers must not return an error solely because the requested interval
77     doesn't match the device capabilities. They must instead modify the interval
78     to match what the hardware can provide. The modified interval should be as
79     close as possible to the original request.</para>
80
81     <para>Sub-devices that support the frame interval ioctls should implement
82     them on a single pad only. Their behaviour when supported on multiple pads
83     of the same sub-device is not defined.</para>
84
85     <table pgwide="1" frame="none" id="v4l2-subdev-frame-interval">
86       <title>struct <structname>v4l2_subdev_frame_interval</structname></title>
87       <tgroup cols="3">
88         &cs-str;
89         <tbody valign="top">
90           <row>
91             <entry>__u32</entry>
92             <entry><structfield>pad</structfield></entry>
93             <entry>Pad number as reported by the media controller API.</entry>
94           </row>
95           <row>
96             <entry>&v4l2-fract;</entry>
97             <entry><structfield>interval</structfield></entry>
98             <entry>Period, in seconds, between consecutive video frames.</entry>
99           </row>
100           <row>
101             <entry>__u32</entry>
102             <entry><structfield>reserved</structfield>[9]</entry>
103             <entry>Reserved for future extensions. Applications and drivers must
104             set the array to zero.</entry>
105           </row>
106         </tbody>
107       </tgroup>
108     </table>
109   </refsect1>
110
111   <refsect1>
112     &return-value;
113
114     <variablelist>
115       <varlistentry>
116         <term><errorcode>EBUSY</errorcode></term>
117         <listitem>
118           <para>The frame interval can't be changed because the pad is currently
119           busy. This can be caused, for instance, by an active video stream on
120           the pad. The ioctl must not be retried without performing another
121           action to fix the problem first. Only returned by
122           <constant>VIDIOC_SUBDEV_S_FRAME_INTERVAL</constant></para>
123         </listitem>
124       </varlistentry>
125       <varlistentry>
126         <term><errorcode>EINVAL</errorcode></term>
127         <listitem>
128           <para>The &v4l2-subdev-frame-interval; <structfield>pad</structfield>
129           references a non-existing pad, or the pad doesn't support frame
130           intervals.</para>
131         </listitem>
132       </varlistentry>
133     </variablelist>
134   </refsect1>
135 </refentry>