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