blob: 4b1b4bc78bfea7ebb31a9a3db61f09719cc9255f [file] [log] [blame]
b.liue9582032025-04-17 19:18:16 +08001.. 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********************************************************************
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
68Drivers must not return an error solely because the requested interval
69doesn't match the device capabilities. They must instead modify the
70interval to match what the hardware can provide. The modified interval
71should be as close as possible to the original request.
72
73Changing the frame interval shall never change the format. Changing the
74format, on the other hand, may change the frame interval.
75
76Sub-devices that support the frame interval ioctls should implement them
77on a single pad only. Their behaviour when supported on multiple pads of
78the 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
102Return Value
103============
104
105On success 0 is returned, on error -1 and the ``errno`` variable is set
106appropriately. The generic error codes are described at the
107:ref:`Generic Error Codes <gen-errors>` chapter.
108
109EBUSY
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
116EINVAL
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.