Merge tag 'driver-core-4.21-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git...
[sfrench/cifs-2.6.git] / Documentation / media / uapi / v4l / vidioc-subdev-g-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_G_FRAME_INTERVAL:
11
12 ********************************************************************
13 ioctl VIDIOC_SUBDEV_G_FRAME_INTERVAL, VIDIOC_SUBDEV_S_FRAME_INTERVAL
14 ********************************************************************
15
16 Name
17 ====
18
19 VIDIOC_SUBDEV_G_FRAME_INTERVAL - VIDIOC_SUBDEV_S_FRAME_INTERVAL - Get or set the frame interval on a subdev pad
20
21
22 Synopsis
23 ========
24
25 .. c:function:: int ioctl( int fd, VIDIOC_SUBDEV_G_FRAME_INTERVAL, struct v4l2_subdev_frame_interval *argp )
26     :name: VIDIOC_SUBDEV_G_FRAME_INTERVAL
27
28 .. c:function:: int ioctl( int fd, VIDIOC_SUBDEV_S_FRAME_INTERVAL, struct v4l2_subdev_frame_interval *argp )
29     :name: VIDIOC_SUBDEV_S_FRAME_INTERVAL
30
31
32 Arguments
33 =========
34
35 ``fd``
36     File descriptor returned by :ref:`open() <func-open>`.
37
38 ``argp``
39     Pointer to struct :c:type:`v4l2_subdev_frame_interval`.
40
41
42 Description
43 ===========
44
45 These ioctls are used to get and set the frame interval at specific
46 subdev pads in the image pipeline. The frame interval only makes sense
47 for sub-devices that can control the frame period on their own. This
48 includes, for instance, image sensors and TV tuners. Sub-devices that
49 don't support frame intervals must not implement these ioctls.
50
51 To retrieve the current frame interval applications set the ``pad``
52 field of a struct
53 :c:type:`v4l2_subdev_frame_interval` to
54 the desired pad number as reported by the media controller API. When
55 they call the ``VIDIOC_SUBDEV_G_FRAME_INTERVAL`` ioctl with a pointer to
56 this structure the driver fills the members of the ``interval`` field.
57
58 To change the current frame interval applications set both the ``pad``
59 field and all members of the ``interval`` field. When they call the
60 ``VIDIOC_SUBDEV_S_FRAME_INTERVAL`` ioctl with a pointer to this
61 structure the driver verifies the requested interval, adjusts it based
62 on the hardware capabilities and configures the device. Upon return the
63 struct
64 :c:type:`v4l2_subdev_frame_interval`
65 contains the current frame interval as would be returned by a
66 ``VIDIOC_SUBDEV_G_FRAME_INTERVAL`` call.
67
68 Drivers must not return an error solely because the requested interval
69 doesn't match the device capabilities. They must instead modify the
70 interval to match what the hardware can provide. The modified interval
71 should be as close as possible to the original request.
72
73 Changing the frame interval shall never change the format. Changing the
74 format, on the other hand, may change the frame interval.
75
76 Sub-devices that support the frame interval ioctls should implement them
77 on a single pad only. Their behaviour when supported on multiple pads of
78 the same sub-device is not defined.
79
80
81 .. c:type:: v4l2_subdev_frame_interval
82
83 .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}|
84
85 .. flat-table:: struct v4l2_subdev_frame_interval
86     :header-rows:  0
87     :stub-columns: 0
88     :widths:       1 1 2
89
90     * - __u32
91       - ``pad``
92       - Pad number as reported by the media controller API.
93     * - struct :c:type:`v4l2_fract`
94       - ``interval``
95       - Period, in seconds, between consecutive video frames.
96     * - __u32
97       - ``reserved``\ [9]
98       - Reserved for future extensions. Applications and drivers must set
99         the array to zero.
100
101
102 Return Value
103 ============
104
105 On success 0 is returned, on error -1 and the ``errno`` variable is set
106 appropriately. The generic error codes are described at the
107 :ref:`Generic Error Codes <gen-errors>` chapter.
108
109 EBUSY
110     The frame interval can't be changed because the pad is currently
111     busy. This can be caused, for instance, by an active video stream on
112     the pad. The ioctl must not be retried without performing another
113     action to fix the problem first. Only returned by
114     ``VIDIOC_SUBDEV_S_FRAME_INTERVAL``
115
116 EINVAL
117     The struct
118     :c:type:`v4l2_subdev_frame_interval`
119     ``pad`` references a non-existing pad, or the pad doesn't support
120     frame intervals.