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