Merge branch 'for-linus-4.21-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git...
[sfrench/cifs-2.6.git] / Documentation / media / uapi / v4l / vidioc-subdev-enum-frame-interval.rst
1 .. Permission is granted to copy, distribute and/or modify this
2 .. document under the terms of the GNU Free Documentation License,
3 .. Version 1.1 or any later version published by the Free Software
4 .. Foundation, with no Invariant Sections, no Front-Cover Texts
5 .. and no Back-Cover Texts. A copy of the license is included at
6 .. Documentation/media/uapi/fdl-appendix.rst.
7 ..
8 .. TODO: replace it to GFDL-1.1-or-later WITH no-invariant-sections
9
10 .. _VIDIOC_SUBDEV_ENUM_FRAME_INTERVAL:
11
12 ***************************************
13 ioctl VIDIOC_SUBDEV_ENUM_FRAME_INTERVAL
14 ***************************************
15
16 Name
17 ====
18
19 VIDIOC_SUBDEV_ENUM_FRAME_INTERVAL - Enumerate frame intervals
20
21
22 Synopsis
23 ========
24
25 .. c:function:: int ioctl( int fd, VIDIOC_SUBDEV_ENUM_FRAME_INTERVAL, struct v4l2_subdev_frame_interval_enum * argp )
26     :name: VIDIOC_SUBDEV_ENUM_FRAME_INTERVAL
27
28
29 Arguments
30 =========
31
32 ``fd``
33     File descriptor returned by :ref:`open() <func-open>`.
34
35 ``argp``
36     Pointer to struct :c:type:`v4l2_subdev_frame_interval_enum`.
37
38
39 Description
40 ===========
41
42 This ioctl lets applications enumerate available frame intervals on a
43 given sub-device pad. Frame intervals only makes sense for sub-devices
44 that can control the frame period on their own. This includes, for
45 instance, image sensors and TV tuners.
46
47 For the common use case of image sensors, the frame intervals available
48 on the sub-device output pad depend on the frame format and size on the
49 same pad. Applications must thus specify the desired format and size
50 when enumerating frame intervals.
51
52 To enumerate frame intervals applications initialize the ``index``,
53 ``pad``, ``which``, ``code``, ``width`` and ``height`` fields of struct
54 :c:type:`v4l2_subdev_frame_interval_enum`
55 and call the :ref:`VIDIOC_SUBDEV_ENUM_FRAME_INTERVAL` ioctl with a pointer
56 to this structure. Drivers fill the rest of the structure or return an
57 EINVAL error code if one of the input fields is invalid. All frame
58 intervals are enumerable by beginning at index zero and incrementing by
59 one until ``EINVAL`` is returned.
60
61 Available frame intervals may depend on the current 'try' formats at
62 other pads of the sub-device, as well as on the current active links.
63 See :ref:`VIDIOC_SUBDEV_G_FMT` for more
64 information about the try formats.
65
66 Sub-devices that support the frame interval enumeration ioctl should
67 implemented it on a single pad only. Its behaviour when supported on
68 multiple pads of the same sub-device is not defined.
69
70 .. c:type:: v4l2_subdev_frame_interval_enum
71
72 .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}|
73
74 .. flat-table:: struct v4l2_subdev_frame_interval_enum
75     :header-rows:  0
76     :stub-columns: 0
77     :widths:       1 1 2
78
79     * - __u32
80       - ``index``
81       - Number of the format in the enumeration, set by the application.
82     * - __u32
83       - ``pad``
84       - Pad number as reported by the media controller API.
85     * - __u32
86       - ``code``
87       - The media bus format code, as defined in
88         :ref:`v4l2-mbus-format`.
89     * - __u32
90       - ``width``
91       - Frame width, in pixels.
92     * - __u32
93       - ``height``
94       - Frame height, in pixels.
95     * - struct :c:type:`v4l2_fract`
96       - ``interval``
97       - Period, in seconds, between consecutive video frames.
98     * - __u32
99       - ``which``
100       - Frame intervals to be enumerated, from enum
101         :ref:`v4l2_subdev_format_whence <v4l2-subdev-format-whence>`.
102     * - __u32
103       - ``reserved``\ [8]
104       - Reserved for future extensions. Applications and drivers must set
105         the array to zero.
106
107
108 Return Value
109 ============
110
111 On success 0 is returned, on error -1 and the ``errno`` variable is set
112 appropriately. The generic error codes are described at the
113 :ref:`Generic Error Codes <gen-errors>` chapter.
114
115 EINVAL
116     The struct
117     :c:type:`v4l2_subdev_frame_interval_enum`
118     ``pad`` references a non-existing pad, one of the ``code``,
119     ``width`` or ``height`` fields are invalid for the given pad or the
120     ``index`` field is out of bounds.