Merge tag 'lkdtm-v4.8-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/kees...
[cascardo/linux.git] / Documentation / media / uapi / v4l / vidioc-subdev-enum-frame-interval.rst
1 .. -*- coding: utf-8; mode: rst -*-
2
3 .. _VIDIOC_SUBDEV_ENUM_FRAME_INTERVAL:
4
5 ***************************************
6 ioctl VIDIOC_SUBDEV_ENUM_FRAME_INTERVAL
7 ***************************************
8
9 Name
10 ====
11
12 VIDIOC_SUBDEV_ENUM_FRAME_INTERVAL - Enumerate frame intervals
13
14
15 Synopsis
16 ========
17
18 .. cpp:function:: int ioctl( int fd, int request, struct v4l2_subdev_frame_interval_enum * argp )
19
20
21 Arguments
22 =========
23
24 ``fd``
25     File descriptor returned by :ref:`open() <func-open>`.
26
27 ``request``
28     VIDIOC_SUBDEV_ENUM_FRAME_INTERVAL
29
30 ``argp``
31
32
33 Description
34 ===========
35
36 This ioctl lets applications enumerate available frame intervals on a
37 given sub-device pad. Frame intervals only makes sense for sub-devices
38 that can control the frame period on their own. This includes, for
39 instance, image sensors and TV tuners.
40
41 For the common use case of image sensors, the frame intervals available
42 on the sub-device output pad depend on the frame format and size on the
43 same pad. Applications must thus specify the desired format and size
44 when enumerating frame intervals.
45
46 To enumerate frame intervals applications initialize the ``index``,
47 ``pad``, ``which``, ``code``, ``width`` and ``height`` fields of struct
48 :ref:`v4l2_subdev_frame_interval_enum <v4l2-subdev-frame-interval-enum>`
49 and call the :ref:`VIDIOC_SUBDEV_ENUM_FRAME_INTERVAL` ioctl with a pointer
50 to this structure. Drivers fill the rest of the structure or return an
51 EINVAL error code if one of the input fields is invalid. All frame
52 intervals are enumerable by beginning at index zero and incrementing by
53 one until ``EINVAL`` is returned.
54
55 Available frame intervals may depend on the current 'try' formats at
56 other pads of the sub-device, as well as on the current active links.
57 See :ref:`VIDIOC_SUBDEV_G_FMT` for more
58 information about the try formats.
59
60 Sub-devices that support the frame interval enumeration ioctl should
61 implemented it on a single pad only. Its behaviour when supported on
62 multiple pads of the same sub-device is not defined.
63
64
65 .. _v4l2-subdev-frame-interval-enum:
66
67 .. flat-table:: struct v4l2_subdev_frame_interval_enum
68     :header-rows:  0
69     :stub-columns: 0
70     :widths:       1 1 2
71
72
73     -  .. row 1
74
75        -  __u32
76
77        -  ``index``
78
79        -  Number of the format in the enumeration, set by the application.
80
81     -  .. row 2
82
83        -  __u32
84
85        -  ``pad``
86
87        -  Pad number as reported by the media controller API.
88
89     -  .. row 3
90
91        -  __u32
92
93        -  ``code``
94
95        -  The media bus format code, as defined in
96           :ref:`v4l2-mbus-format`.
97
98     -  .. row 4
99
100        -  __u32
101
102        -  ``width``
103
104        -  Frame width, in pixels.
105
106     -  .. row 5
107
108        -  __u32
109
110        -  ``height``
111
112        -  Frame height, in pixels.
113
114     -  .. row 6
115
116        -  struct :ref:`v4l2_fract <v4l2-fract>`
117
118        -  ``interval``
119
120        -  Period, in seconds, between consecutive video frames.
121
122     -  .. row 7
123
124        -  __u32
125
126        -  ``which``
127
128        -  Frame intervals to be enumerated, from enum
129           :ref:`v4l2_subdev_format_whence <v4l2-subdev-format-whence>`.
130
131     -  .. row 8
132
133        -  __u32
134
135        -  ``reserved``\ [8]
136
137        -  Reserved for future extensions. Applications and drivers must set
138           the array to zero.
139
140
141 Return Value
142 ============
143
144 On success 0 is returned, on error -1 and the ``errno`` variable is set
145 appropriately. The generic error codes are described at the
146 :ref:`Generic Error Codes <gen-errors>` chapter.
147
148 EINVAL
149     The struct
150     :ref:`v4l2_subdev_frame_interval_enum <v4l2-subdev-frame-interval-enum>`
151     ``pad`` references a non-existing pad, one of the ``code``,
152     ``width`` or ``height`` fields are invalid for the given pad or the
153     ``index`` field is out of bounds.