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