diff options
Diffstat (limited to 'extras/recipes-kernel/linux/linux-omap/media/0029-v4l-v4l2_subdev-userspace-frame-interval-API.patch')
-rw-r--r-- | extras/recipes-kernel/linux/linux-omap/media/0029-v4l-v4l2_subdev-userspace-frame-interval-API.patch | 479 |
1 files changed, 479 insertions, 0 deletions
diff --git a/extras/recipes-kernel/linux/linux-omap/media/0029-v4l-v4l2_subdev-userspace-frame-interval-API.patch b/extras/recipes-kernel/linux/linux-omap/media/0029-v4l-v4l2_subdev-userspace-frame-interval-API.patch new file mode 100644 index 00000000..8de33fdb --- /dev/null +++ b/extras/recipes-kernel/linux/linux-omap/media/0029-v4l-v4l2_subdev-userspace-frame-interval-API.patch | |||
@@ -0,0 +1,479 @@ | |||
1 | From b137f96a198afb39c8457e2c5d28c1c4bca129a3 Mon Sep 17 00:00:00 2001 | ||
2 | From: Laurent Pinchart <laurent.pinchart@ideasonboard.com> | ||
3 | Date: Wed, 5 May 2010 16:38:35 +0200 | ||
4 | Subject: [PATCH 29/43] v4l: v4l2_subdev userspace frame interval API | ||
5 | |||
6 | The three new ioctl VIDIOC_SUBDEV_ENUM_FRAME_INTERVAL, | ||
7 | VIDIOC_SUBDEV_G_FRAME_INTERVAL and VIDIOC_SUBDEV_S_FRAME_INTERVAL can be | ||
8 | used to enumerate and configure a subdev's frame rate from userspace. | ||
9 | |||
10 | Two new video::g/s_frame_interval subdev operations are introduced to | ||
11 | support those ioctls. The existing video::g/s_parm operations are | ||
12 | deprecated and shouldn't be used anymore. | ||
13 | |||
14 | Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> | ||
15 | Signed-off-by: Sakari Ailus <sakari.ailus@maxwell.research.nokia.com> | ||
16 | --- | ||
17 | Documentation/DocBook/media-entities.tmpl | 6 + | ||
18 | Documentation/DocBook/v4l/v4l2.xml | 2 + | ||
19 | .../v4l/vidioc-subdev-enum-frame-interval.xml | 146 ++++++++++++++++++++ | ||
20 | .../DocBook/v4l/vidioc-subdev-g-frame-interval.xml | 135 ++++++++++++++++++ | ||
21 | drivers/media/video/v4l2-subdev.c | 16 ++ | ||
22 | include/linux/v4l2-subdev.h | 36 +++++ | ||
23 | include/media/v4l2-subdev.h | 7 + | ||
24 | 7 files changed, 348 insertions(+), 0 deletions(-) | ||
25 | create mode 100644 Documentation/DocBook/v4l/vidioc-subdev-enum-frame-interval.xml | ||
26 | create mode 100644 Documentation/DocBook/v4l/vidioc-subdev-g-frame-interval.xml | ||
27 | |||
28 | diff --git a/Documentation/DocBook/media-entities.tmpl b/Documentation/DocBook/media-entities.tmpl | ||
29 | index 538f8fe..4af3c2e 100644 | ||
30 | --- a/Documentation/DocBook/media-entities.tmpl | ||
31 | +++ b/Documentation/DocBook/media-entities.tmpl | ||
32 | @@ -89,7 +89,9 @@ | ||
33 | <!ENTITY VIDIOC-SUBDEV-ENUM-FRAME-SIZE "<link linkend='vidioc-subdev-enum-frame-size'><constant>VIDIOC_SUBDEV_ENUM_FRAME_SIZE</constant></link>"> | ||
34 | <!ENTITY VIDIOC-SUBDEV-ENUM-MBUS-CODE "<link linkend='vidioc-subdev-enum-mbus-code'><constant>VIDIOC_SUBDEV_ENUM_MBUS_CODE</constant></link>"> | ||
35 | <!ENTITY VIDIOC-SUBDEV-G-FMT "<link linkend='vidioc-subdev-g-fmt'><constant>VIDIOC_SUBDEV_G_FMT</constant></link>"> | ||
36 | +<!ENTITY VIDIOC-SUBDEV-G-FRAME-INTERVAL "<link linkend='vidioc-subdev-g-frame-interval'><constant>VIDIOC_SUBDEV_G_FRAME_INTERVAL</constant></link>"> | ||
37 | <!ENTITY VIDIOC-SUBDEV-S-FMT "<link linkend='vidioc-subdev-g-fmt'><constant>VIDIOC_SUBDEV_S_FMT</constant></link>"> | ||
38 | +<!ENTITY VIDIOC-SUBDEV-S-FRAME-INTERVAL "<link linkend='vidioc-subdev-g-frame-interval'><constant>VIDIOC_SUBDEV_S_FRAME_INTERVAL</constant></link>"> | ||
39 | <!ENTITY VIDIOC-TRY-ENCODER-CMD "<link linkend='vidioc-encoder-cmd'><constant>VIDIOC_TRY_ENCODER_CMD</constant></link>"> | ||
40 | <!ENTITY VIDIOC-TRY-EXT-CTRLS "<link linkend='vidioc-g-ext-ctrls'><constant>VIDIOC_TRY_EXT_CTRLS</constant></link>"> | ||
41 | <!ENTITY VIDIOC-TRY-FMT "<link linkend='vidioc-g-fmt'><constant>VIDIOC_TRY_FMT</constant></link>"> | ||
42 | @@ -190,6 +192,8 @@ | ||
43 | <!ENTITY v4l2-sliced-vbi-cap "struct <link linkend='v4l2-sliced-vbi-cap'>v4l2_sliced_vbi_cap</link>"> | ||
44 | <!ENTITY v4l2-sliced-vbi-data "struct <link linkend='v4l2-sliced-vbi-data'>v4l2_sliced_vbi_data</link>"> | ||
45 | <!ENTITY v4l2-sliced-vbi-format "struct <link linkend='v4l2-sliced-vbi-format'>v4l2_sliced_vbi_format</link>"> | ||
46 | +<!ENTITY v4l2-subdev-frame-interval "struct <link linkend='v4l2-subdev-frame-interval'>v4l2_subdev_frame_interval</link>"> | ||
47 | +<!ENTITY v4l2-subdev-frame-interval-enum "struct <link linkend='v4l2-subdev-frame-interval-enum'>v4l2_subdev_frame_interval_enum</link>"> | ||
48 | <!ENTITY v4l2-subdev-frame-size-enum "struct <link linkend='v4l2-subdev-frame-size-enum'>v4l2_subdev_frame_size_enum</link>"> | ||
49 | <!ENTITY v4l2-subdev-format "struct <link linkend='v4l2-subdev-format'>v4l2_subdev_format</link>"> | ||
50 | <!ENTITY v4l2-subdev-mbus-code-enum "struct <link linkend='v4l2-subdev-mbus-code-enum'>v4l2_subdev_mbus_code_enum</link>"> | ||
51 | @@ -325,10 +329,12 @@ | ||
52 | <!ENTITY sub-reqbufs SYSTEM "v4l/vidioc-reqbufs.xml"> | ||
53 | <!ENTITY sub-s-hw-freq-seek SYSTEM "v4l/vidioc-s-hw-freq-seek.xml"> | ||
54 | <!ENTITY sub-streamon SYSTEM "v4l/vidioc-streamon.xml"> | ||
55 | +<!ENTITY sub-subdev-enum-frame-interval SYSTEM "v4l/vidioc-subdev-enum-frame-interval.xml"> | ||
56 | <!ENTITY sub-subdev-enum-frame-size SYSTEM "v4l/vidioc-subdev-enum-frame-size.xml"> | ||
57 | <!ENTITY sub-subdev-enum-mbus-code SYSTEM "v4l/vidioc-subdev-enum-mbus-code.xml"> | ||
58 | <!ENTITY sub-subdev-formats SYSTEM "v4l/subdev-formats.xml"> | ||
59 | <!ENTITY sub-subdev-g-fmt SYSTEM "v4l/vidioc-subdev-g-fmt.xml"> | ||
60 | +<!ENTITY sub-subdev-g-frame-interval SYSTEM "v4l/vidioc-subdev-g-frame-interval.xml"> | ||
61 | <!ENTITY sub-capture-c SYSTEM "v4l/capture.c.xml"> | ||
62 | <!ENTITY sub-keytable-c SYSTEM "v4l/keytable.c.xml"> | ||
63 | <!ENTITY sub-v4l2grab-c SYSTEM "v4l/v4l2grab.c.xml"> | ||
64 | diff --git a/Documentation/DocBook/v4l/v4l2.xml b/Documentation/DocBook/v4l/v4l2.xml | ||
65 | index 695e3bf..e6225e0 100644 | ||
66 | --- a/Documentation/DocBook/v4l/v4l2.xml | ||
67 | +++ b/Documentation/DocBook/v4l/v4l2.xml | ||
68 | @@ -478,9 +478,11 @@ and discussions on the V4L mailing list.</revremark> | ||
69 | &sub-reqbufs; | ||
70 | &sub-s-hw-freq-seek; | ||
71 | &sub-streamon; | ||
72 | + &sub-subdev-enum-frame-interval; | ||
73 | &sub-subdev-enum-frame-size; | ||
74 | &sub-subdev-enum-mbus-code; | ||
75 | &sub-subdev-g-fmt; | ||
76 | + &sub-subdev-g-frame-interval; | ||
77 | &sub-subscribe-event; | ||
78 | <!-- End of ioctls. --> | ||
79 | &sub-mmap; | ||
80 | diff --git a/Documentation/DocBook/v4l/vidioc-subdev-enum-frame-interval.xml b/Documentation/DocBook/v4l/vidioc-subdev-enum-frame-interval.xml | ||
81 | new file mode 100644 | ||
82 | index 0000000..bcea9d4 | ||
83 | --- /dev/null | ||
84 | +++ b/Documentation/DocBook/v4l/vidioc-subdev-enum-frame-interval.xml | ||
85 | @@ -0,0 +1,146 @@ | ||
86 | +<refentry id="vidioc-subdev-enum-frame-interval"> | ||
87 | + <refmeta> | ||
88 | + <refentrytitle>ioctl VIDIOC_SUBDEV_ENUM_FRAME_INTERVAL</refentrytitle> | ||
89 | + &manvol; | ||
90 | + </refmeta> | ||
91 | + | ||
92 | + <refnamediv> | ||
93 | + <refname>VIDIOC_SUBDEV_ENUM_FRAME_INTERVAL</refname> | ||
94 | + <refpurpose>Enumerate frame intervals</refpurpose> | ||
95 | + </refnamediv> | ||
96 | + | ||
97 | + <refsynopsisdiv> | ||
98 | + <funcsynopsis> | ||
99 | + <funcprototype> | ||
100 | + <funcdef>int <function>ioctl</function></funcdef> | ||
101 | + <paramdef>int <parameter>fd</parameter></paramdef> | ||
102 | + <paramdef>int <parameter>request</parameter></paramdef> | ||
103 | + <paramdef>struct v4l2_subdev_frame_interval_enum * | ||
104 | + <parameter>argp</parameter></paramdef> | ||
105 | + </funcprototype> | ||
106 | + </funcsynopsis> | ||
107 | + </refsynopsisdiv> | ||
108 | + | ||
109 | + <refsect1> | ||
110 | + <title>Arguments</title> | ||
111 | + | ||
112 | + <variablelist> | ||
113 | + <varlistentry> | ||
114 | + <term><parameter>fd</parameter></term> | ||
115 | + <listitem> | ||
116 | + <para>&fd;</para> | ||
117 | + </listitem> | ||
118 | + </varlistentry> | ||
119 | + <varlistentry> | ||
120 | + <term><parameter>request</parameter></term> | ||
121 | + <listitem> | ||
122 | + <para>VIDIOC_SUBDEV_ENUM_FRAME_INTERVAL</para> | ||
123 | + </listitem> | ||
124 | + </varlistentry> | ||
125 | + <varlistentry> | ||
126 | + <term><parameter>argp</parameter></term> | ||
127 | + <listitem> | ||
128 | + <para></para> | ||
129 | + </listitem> | ||
130 | + </varlistentry> | ||
131 | + </variablelist> | ||
132 | + </refsect1> | ||
133 | + | ||
134 | + <refsect1> | ||
135 | + <title>Description</title> | ||
136 | + | ||
137 | + <para>This ioctl lets applications enumerate available frame intervals on a | ||
138 | + given sub-device pad. Frame intervals only makes sense for sub-devices that | ||
139 | + can control the frame period on their own. This includes, for instance, | ||
140 | + image sensors and TV tuners.</para> | ||
141 | + | ||
142 | + <para>For the common use case of image sensors, the frame intervals | ||
143 | + available on the sub-device output pad depend on the frame format and size | ||
144 | + on the same pad. Applications must thus specify the desired format and size | ||
145 | + when enumerating frame intervals.</para> | ||
146 | + | ||
147 | + <para>To enumerate frame intervals applications initialize the | ||
148 | + <structfield>index</structfield>, <structfield>pad</structfield>, | ||
149 | + <structfield>code</structfield>, <structfield>width</structfield> and | ||
150 | + <structfield>height</structfield> fields of | ||
151 | + &v4l2-subdev-frame-interval-enum; and call the | ||
152 | + <constant>VIDIOC_SUBDEV_ENUM_FRAME_INTERVAL</constant> ioctl with a pointer | ||
153 | + to this structure. Drivers fill the rest of the structure or return | ||
154 | + an &EINVAL; if one of the input fields is invalid. All frame intervals are | ||
155 | + enumerable by beginning at index zero and incrementing by one until | ||
156 | + <errorcode>EINVAL</errorcode> is returned.</para> | ||
157 | + | ||
158 | + <para>Available frame intervals may depend on the current 'try' formats | ||
159 | + at other pads of the sub-device, as well as on the current active links. See | ||
160 | + &VIDIOC-SUBDEV-G-FMT; for more information about the try formats.</para> | ||
161 | + | ||
162 | + <para>Sub-devices that support the frame interval enumeration ioctl should | ||
163 | + implemented it on a single pad only. Its behaviour when supported on | ||
164 | + multiple pads of the same sub-device is not defined.</para> | ||
165 | + | ||
166 | + <table pgwide="1" frame="none" id="v4l2-subdev-frame-interval-enum"> | ||
167 | + <title>struct <structname>v4l2_subdev_frame_interval_enum</structname></title> | ||
168 | + <tgroup cols="3"> | ||
169 | + &cs-str; | ||
170 | + <tbody valign="top"> | ||
171 | + <row> | ||
172 | + <entry>__u32</entry> | ||
173 | + <entry><structfield>index</structfield></entry> | ||
174 | + <entry>Number of the format in the enumeration, set by the | ||
175 | + application.</entry> | ||
176 | + </row> | ||
177 | + <row> | ||
178 | + <entry>__u32</entry> | ||
179 | + <entry><structfield>pad</structfield></entry> | ||
180 | + <entry>Pad number as reported by the media controller API.</entry> | ||
181 | + </row> | ||
182 | + <row> | ||
183 | + <entry>__u32</entry> | ||
184 | + <entry><structfield>code</structfield></entry> | ||
185 | + <entry>The media bus format code, as defined in | ||
186 | + <xref linkend="v4l2-mbus-format" />.</entry> | ||
187 | + </row> | ||
188 | + <row> | ||
189 | + <entry>__u32</entry> | ||
190 | + <entry><structfield>width</structfield></entry> | ||
191 | + <entry>Frame width, in pixels.</entry> | ||
192 | + </row> | ||
193 | + <row> | ||
194 | + <entry>__u32</entry> | ||
195 | + <entry><structfield>height</structfield></entry> | ||
196 | + <entry>Frame height, in pixels.</entry> | ||
197 | + </row> | ||
198 | + <row> | ||
199 | + <entry>&v4l2-fract;</entry> | ||
200 | + <entry><structfield>interval</structfield></entry> | ||
201 | + <entry>Period, in seconds, between consecutive video frames.</entry> | ||
202 | + </row> | ||
203 | + <row> | ||
204 | + <entry>__u32</entry> | ||
205 | + <entry><structfield>reserved</structfield>[9]</entry> | ||
206 | + <entry>Reserved for future extensions. Applications and drivers must | ||
207 | + set the array to zero.</entry> | ||
208 | + </row> | ||
209 | + </tbody> | ||
210 | + </tgroup> | ||
211 | + </table> | ||
212 | + </refsect1> | ||
213 | + | ||
214 | + <refsect1> | ||
215 | + &return-value; | ||
216 | + | ||
217 | + <variablelist> | ||
218 | + <varlistentry> | ||
219 | + <term><errorcode>EINVAL</errorcode></term> | ||
220 | + <listitem> | ||
221 | + <para>The &v4l2-subdev-frame-interval-enum; | ||
222 | + <structfield>pad</structfield> references a non-existing pad, one of | ||
223 | + the <structfield>code</structfield>, <structfield>width</structfield> | ||
224 | + or <structfield>height</structfield> fields are invalid for the given | ||
225 | + pad or the <structfield>index</structfield> field is out of bounds. | ||
226 | + </para> | ||
227 | + </listitem> | ||
228 | + </varlistentry> | ||
229 | + </variablelist> | ||
230 | + </refsect1> | ||
231 | +</refentry> | ||
232 | diff --git a/Documentation/DocBook/v4l/vidioc-subdev-g-frame-interval.xml b/Documentation/DocBook/v4l/vidioc-subdev-g-frame-interval.xml | ||
233 | new file mode 100644 | ||
234 | index 0000000..848ec78 | ||
235 | --- /dev/null | ||
236 | +++ b/Documentation/DocBook/v4l/vidioc-subdev-g-frame-interval.xml | ||
237 | @@ -0,0 +1,135 @@ | ||
238 | +<refentry id="vidioc-subdev-g-frame-interval"> | ||
239 | + <refmeta> | ||
240 | + <refentrytitle>ioctl VIDIOC_SUBDEV_G_FRAME_INTERVAL, VIDIOC_SUBDEV_S_FRAME_INTERVAL</refentrytitle> | ||
241 | + &manvol; | ||
242 | + </refmeta> | ||
243 | + | ||
244 | + <refnamediv> | ||
245 | + <refname>VIDIOC_SUBDEV_G_FRAME_INTERVAL</refname> | ||
246 | + <refname>VIDIOC_SUBDEV_S_FRAME_INTERVAL</refname> | ||
247 | + <refpurpose>Get or set the frame interval on a subdev pad</refpurpose> | ||
248 | + </refnamediv> | ||
249 | + | ||
250 | + <refsynopsisdiv> | ||
251 | + <funcsynopsis> | ||
252 | + <funcprototype> | ||
253 | + <funcdef>int <function>ioctl</function></funcdef> | ||
254 | + <paramdef>int <parameter>fd</parameter></paramdef> | ||
255 | + <paramdef>int <parameter>request</parameter></paramdef> | ||
256 | + <paramdef>struct v4l2_subdev_frame_interval *<parameter>argp</parameter> | ||
257 | + </paramdef> | ||
258 | + </funcprototype> | ||
259 | + </funcsynopsis> | ||
260 | + </refsynopsisdiv> | ||
261 | + | ||
262 | + <refsect1> | ||
263 | + <title>Arguments</title> | ||
264 | + | ||
265 | + <variablelist> | ||
266 | + <varlistentry> | ||
267 | + <term><parameter>fd</parameter></term> | ||
268 | + <listitem> | ||
269 | + <para>&fd;</para> | ||
270 | + </listitem> | ||
271 | + </varlistentry> | ||
272 | + <varlistentry> | ||
273 | + <term><parameter>request</parameter></term> | ||
274 | + <listitem> | ||
275 | + <para>VIDIOC_SUBDEV_G_FRAME_INTERVAL, VIDIOC_SUBDEV_S_FRAME_INTERVAL</para> | ||
276 | + </listitem> | ||
277 | + </varlistentry> | ||
278 | + <varlistentry> | ||
279 | + <term><parameter>argp</parameter></term> | ||
280 | + <listitem> | ||
281 | + <para></para> | ||
282 | + </listitem> | ||
283 | + </varlistentry> | ||
284 | + </variablelist> | ||
285 | + </refsect1> | ||
286 | + | ||
287 | + <refsect1> | ||
288 | + <title>Description</title> | ||
289 | + | ||
290 | + <para>These ioctls are used to get and set the frame interval at specific | ||
291 | + subdev pads in the image pipeline. The frame interval only makes sense for | ||
292 | + sub-devices that can control the frame period on their own. This includes, | ||
293 | + for instance, image sensors and TV tuners. Sub-devices that don't support | ||
294 | + frame intervals must not implement these ioctls.</para> | ||
295 | + | ||
296 | + <para>To retrieve the current frame interval applications set the | ||
297 | + <structfield>pad</structfield> field of a &v4l2-subdev-frame-interval; to | ||
298 | + the desired pad number as reported by the media controller API. When they | ||
299 | + call the <constant>VIDIOC_SUBDEV_G_FRAME_INTERVAL</constant> ioctl with a | ||
300 | + pointer to this structure the driver fills the members of the | ||
301 | + <structfield>interval</structfield> field.</para> | ||
302 | + | ||
303 | + <para>To change the current frame interval applications set both the | ||
304 | + <structfield>pad</structfield> field and all members of the | ||
305 | + <structfield>interval</structfield> field. When they call the | ||
306 | + <constant>VIDIOC_SUBDEV_S_FRAME_INTERVAL</constant> ioctl with a pointer to | ||
307 | + this structure the driver verifies the requested interval, adjusts it based | ||
308 | + on the hardware capabilities and configures the device. Upon return the | ||
309 | + &v4l2-subdev-frame-interval; contains the current frame interval as would be | ||
310 | + returned by a <constant>VIDIOC_SUBDEV_G_FRAME_INTERVAL</constant> call. | ||
311 | + </para> | ||
312 | + | ||
313 | + <para>Drivers must not return an error solely because the requested interval | ||
314 | + doesn't match the device capabilities. They must instead modify the interval | ||
315 | + to match what the hardware can provide. The modified interval should be as | ||
316 | + close as possible to the original request.</para> | ||
317 | + | ||
318 | + <para>Sub-devices that support the frame interval ioctls should implement | ||
319 | + them on a single pad only. Their behaviour when supported on multiple pads | ||
320 | + of the same sub-device is not defined.</para> | ||
321 | + | ||
322 | + <table pgwide="1" frame="none" id="v4l2-subdev-frame-interval"> | ||
323 | + <title>struct <structname>v4l2_subdev_frame_interval</structname></title> | ||
324 | + <tgroup cols="3"> | ||
325 | + &cs-str; | ||
326 | + <tbody valign="top"> | ||
327 | + <row> | ||
328 | + <entry>__u32</entry> | ||
329 | + <entry><structfield>pad</structfield></entry> | ||
330 | + <entry>Pad number as reported by the media controller API.</entry> | ||
331 | + </row> | ||
332 | + <row> | ||
333 | + <entry>&v4l2-fract;</entry> | ||
334 | + <entry><structfield>interval</structfield></entry> | ||
335 | + <entry>Period, in seconds, between consecutive video frames.</entry> | ||
336 | + </row> | ||
337 | + <row> | ||
338 | + <entry>__u32</entry> | ||
339 | + <entry><structfield>reserved</structfield>[9]</entry> | ||
340 | + <entry>Reserved for future extensions. Applications and drivers must | ||
341 | + set the array to zero.</entry> | ||
342 | + </row> | ||
343 | + </tbody> | ||
344 | + </tgroup> | ||
345 | + </table> | ||
346 | + </refsect1> | ||
347 | + | ||
348 | + <refsect1> | ||
349 | + &return-value; | ||
350 | + | ||
351 | + <variablelist> | ||
352 | + <varlistentry> | ||
353 | + <term><errorcode>EBUSY</errorcode></term> | ||
354 | + <listitem> | ||
355 | + <para>The frame interval can't be changed because the pad is currently | ||
356 | + busy. This can be caused, for instance, by an active video stream on | ||
357 | + the pad. The ioctl must not be retried without performing another | ||
358 | + action to fix the problem first. Only returned by | ||
359 | + <constant>VIDIOC_SUBDEV_S_FRAME_INTERVAL</constant></para> | ||
360 | + </listitem> | ||
361 | + </varlistentry> | ||
362 | + <varlistentry> | ||
363 | + <term><errorcode>EINVAL</errorcode></term> | ||
364 | + <listitem> | ||
365 | + <para>The &v4l2-subdev-frame-interval; <structfield>pad</structfield> | ||
366 | + references a non-existing pad, or the pad doesn't support frame | ||
367 | + intervals.</para> | ||
368 | + </listitem> | ||
369 | + </varlistentry> | ||
370 | + </variablelist> | ||
371 | + </refsect1> | ||
372 | +</refentry> | ||
373 | diff --git a/drivers/media/video/v4l2-subdev.c b/drivers/media/video/v4l2-subdev.c | ||
374 | index 73aae00..316a08a 100644 | ||
375 | --- a/drivers/media/video/v4l2-subdev.c | ||
376 | +++ b/drivers/media/video/v4l2-subdev.c | ||
377 | @@ -232,6 +232,22 @@ static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg) | ||
378 | return v4l2_subdev_call(sd, pad, enum_frame_size, subdev_fh, | ||
379 | fse); | ||
380 | } | ||
381 | + | ||
382 | + case VIDIOC_SUBDEV_G_FRAME_INTERVAL: | ||
383 | + return v4l2_subdev_call(sd, video, g_frame_interval, arg); | ||
384 | + | ||
385 | + case VIDIOC_SUBDEV_S_FRAME_INTERVAL: | ||
386 | + return v4l2_subdev_call(sd, video, s_frame_interval, arg); | ||
387 | + | ||
388 | + case VIDIOC_SUBDEV_ENUM_FRAME_INTERVAL: { | ||
389 | + struct v4l2_subdev_frame_interval_enum *fie = arg; | ||
390 | + | ||
391 | + if (fie->pad >= sd->entity.num_pads) | ||
392 | + return -EINVAL; | ||
393 | + | ||
394 | + return v4l2_subdev_call(sd, pad, enum_frame_interval, subdev_fh, | ||
395 | + fie); | ||
396 | + } | ||
397 | #endif | ||
398 | default: | ||
399 | return -ENOIOCTLCMD; | ||
400 | diff --git a/include/linux/v4l2-subdev.h b/include/linux/v4l2-subdev.h | ||
401 | index 38d0eda..bf9f3e9 100644 | ||
402 | --- a/include/linux/v4l2-subdev.h | ||
403 | +++ b/include/linux/v4l2-subdev.h | ||
404 | @@ -80,11 +80,47 @@ struct v4l2_subdev_frame_size_enum { | ||
405 | __u32 reserved[9]; | ||
406 | }; | ||
407 | |||
408 | +/** | ||
409 | + * struct v4l2_subdev_frame_interval - Pad-level frame rate | ||
410 | + * @pad: pad number, as reported by the media API | ||
411 | + * @interval: frame interval in seconds | ||
412 | + */ | ||
413 | +struct v4l2_subdev_frame_interval { | ||
414 | + __u32 pad; | ||
415 | + struct v4l2_fract interval; | ||
416 | + __u32 reserved[9]; | ||
417 | +}; | ||
418 | + | ||
419 | +/** | ||
420 | + * struct v4l2_subdev_frame_interval_enum - Frame interval enumeration | ||
421 | + * @pad: pad number, as reported by the media API | ||
422 | + * @index: frame interval index during enumeration | ||
423 | + * @code: format code (from enum v4l2_mbus_pixelcode) | ||
424 | + * @width: frame width in pixels | ||
425 | + * @height: frame height in pixels | ||
426 | + * @interval: frame interval in seconds | ||
427 | + */ | ||
428 | +struct v4l2_subdev_frame_interval_enum { | ||
429 | + __u32 index; | ||
430 | + __u32 pad; | ||
431 | + __u32 code; | ||
432 | + __u32 width; | ||
433 | + __u32 height; | ||
434 | + struct v4l2_fract interval; | ||
435 | + __u32 reserved[9]; | ||
436 | +}; | ||
437 | + | ||
438 | #define VIDIOC_SUBDEV_G_FMT _IOWR('V', 4, struct v4l2_subdev_format) | ||
439 | #define VIDIOC_SUBDEV_S_FMT _IOWR('V', 5, struct v4l2_subdev_format) | ||
440 | +#define VIDIOC_SUBDEV_G_FRAME_INTERVAL \ | ||
441 | + _IOWR('V', 21, struct v4l2_subdev_frame_interval) | ||
442 | +#define VIDIOC_SUBDEV_S_FRAME_INTERVAL \ | ||
443 | + _IOWR('V', 22, struct v4l2_subdev_frame_interval) | ||
444 | #define VIDIOC_SUBDEV_ENUM_MBUS_CODE \ | ||
445 | _IOWR('V', 2, struct v4l2_subdev_mbus_code_enum) | ||
446 | #define VIDIOC_SUBDEV_ENUM_FRAME_SIZE \ | ||
447 | _IOWR('V', 74, struct v4l2_subdev_frame_size_enum) | ||
448 | +#define VIDIOC_SUBDEV_ENUM_FRAME_INTERVAL \ | ||
449 | + _IOWR('V', 75, struct v4l2_subdev_frame_interval_enum) | ||
450 | |||
451 | #endif | ||
452 | diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h | ||
453 | index f5611c2..9c8bcd3 100644 | ||
454 | --- a/include/media/v4l2-subdev.h | ||
455 | +++ b/include/media/v4l2-subdev.h | ||
456 | @@ -281,6 +281,10 @@ struct v4l2_subdev_video_ops { | ||
457 | int (*s_crop)(struct v4l2_subdev *sd, struct v4l2_crop *crop); | ||
458 | int (*g_parm)(struct v4l2_subdev *sd, struct v4l2_streamparm *param); | ||
459 | int (*s_parm)(struct v4l2_subdev *sd, struct v4l2_streamparm *param); | ||
460 | + int (*g_frame_interval)(struct v4l2_subdev *sd, | ||
461 | + struct v4l2_subdev_frame_interval *interval); | ||
462 | + int (*s_frame_interval)(struct v4l2_subdev *sd, | ||
463 | + struct v4l2_subdev_frame_interval *interval); | ||
464 | int (*enum_framesizes)(struct v4l2_subdev *sd, struct v4l2_frmsizeenum *fsize); | ||
465 | int (*enum_frameintervals)(struct v4l2_subdev *sd, struct v4l2_frmivalenum *fival); | ||
466 | int (*enum_dv_presets) (struct v4l2_subdev *sd, | ||
467 | @@ -431,6 +435,9 @@ struct v4l2_subdev_pad_ops { | ||
468 | int (*enum_frame_size)(struct v4l2_subdev *sd, | ||
469 | struct v4l2_subdev_fh *fh, | ||
470 | struct v4l2_subdev_frame_size_enum *fse); | ||
471 | + int (*enum_frame_interval)(struct v4l2_subdev *sd, | ||
472 | + struct v4l2_subdev_fh *fh, | ||
473 | + struct v4l2_subdev_frame_interval_enum *fie); | ||
474 | int (*get_fmt)(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh, | ||
475 | struct v4l2_subdev_format *format); | ||
476 | int (*set_fmt)(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh, | ||
477 | -- | ||
478 | 1.6.6.1 | ||
479 | |||