18c2ecf20Sopenharmony_ci.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later 28c2ecf20Sopenharmony_ci.. c:namespace:: V4L 38c2ecf20Sopenharmony_ci 48c2ecf20Sopenharmony_ci.. _VIDIOC_SUBDEV_G_FRAME_INTERVAL: 58c2ecf20Sopenharmony_ci 68c2ecf20Sopenharmony_ci******************************************************************** 78c2ecf20Sopenharmony_ciioctl VIDIOC_SUBDEV_G_FRAME_INTERVAL, VIDIOC_SUBDEV_S_FRAME_INTERVAL 88c2ecf20Sopenharmony_ci******************************************************************** 98c2ecf20Sopenharmony_ci 108c2ecf20Sopenharmony_ciName 118c2ecf20Sopenharmony_ci==== 128c2ecf20Sopenharmony_ci 138c2ecf20Sopenharmony_ciVIDIOC_SUBDEV_G_FRAME_INTERVAL - VIDIOC_SUBDEV_S_FRAME_INTERVAL - Get or set the frame interval on a subdev pad 148c2ecf20Sopenharmony_ci 158c2ecf20Sopenharmony_ciSynopsis 168c2ecf20Sopenharmony_ci======== 178c2ecf20Sopenharmony_ci 188c2ecf20Sopenharmony_ci.. c:macro:: VIDIOC_SUBDEV_G_FRAME_INTERVAL 198c2ecf20Sopenharmony_ci 208c2ecf20Sopenharmony_ci``int ioctl(int fd, VIDIOC_SUBDEV_G_FRAME_INTERVAL, struct v4l2_subdev_frame_interval *argp)`` 218c2ecf20Sopenharmony_ci 228c2ecf20Sopenharmony_ci.. c:macro:: VIDIOC_SUBDEV_S_FRAME_INTERVAL 238c2ecf20Sopenharmony_ci 248c2ecf20Sopenharmony_ci``int ioctl(int fd, VIDIOC_SUBDEV_S_FRAME_INTERVAL, struct v4l2_subdev_frame_interval *argp)`` 258c2ecf20Sopenharmony_ci 268c2ecf20Sopenharmony_ciArguments 278c2ecf20Sopenharmony_ci========= 288c2ecf20Sopenharmony_ci 298c2ecf20Sopenharmony_ci``fd`` 308c2ecf20Sopenharmony_ci File descriptor returned by :c:func:`open()`. 318c2ecf20Sopenharmony_ci 328c2ecf20Sopenharmony_ci``argp`` 338c2ecf20Sopenharmony_ci Pointer to struct :c:type:`v4l2_subdev_frame_interval`. 348c2ecf20Sopenharmony_ci 358c2ecf20Sopenharmony_ciDescription 368c2ecf20Sopenharmony_ci=========== 378c2ecf20Sopenharmony_ci 388c2ecf20Sopenharmony_ciThese ioctls are used to get and set the frame interval at specific 398c2ecf20Sopenharmony_cisubdev pads in the image pipeline. The frame interval only makes sense 408c2ecf20Sopenharmony_cifor sub-devices that can control the frame period on their own. This 418c2ecf20Sopenharmony_ciincludes, for instance, image sensors and TV tuners. Sub-devices that 428c2ecf20Sopenharmony_cidon't support frame intervals must not implement these ioctls. 438c2ecf20Sopenharmony_ci 448c2ecf20Sopenharmony_ciTo retrieve the current frame interval applications set the ``pad`` 458c2ecf20Sopenharmony_cifield of a struct 468c2ecf20Sopenharmony_ci:c:type:`v4l2_subdev_frame_interval` to 478c2ecf20Sopenharmony_cithe desired pad number as reported by the media controller API. When 488c2ecf20Sopenharmony_cithey call the ``VIDIOC_SUBDEV_G_FRAME_INTERVAL`` ioctl with a pointer to 498c2ecf20Sopenharmony_cithis structure the driver fills the members of the ``interval`` field. 508c2ecf20Sopenharmony_ci 518c2ecf20Sopenharmony_ciTo change the current frame interval applications set both the ``pad`` 528c2ecf20Sopenharmony_cifield and all members of the ``interval`` field. When they call the 538c2ecf20Sopenharmony_ci``VIDIOC_SUBDEV_S_FRAME_INTERVAL`` ioctl with a pointer to this 548c2ecf20Sopenharmony_cistructure the driver verifies the requested interval, adjusts it based 558c2ecf20Sopenharmony_cion the hardware capabilities and configures the device. Upon return the 568c2ecf20Sopenharmony_cistruct 578c2ecf20Sopenharmony_ci:c:type:`v4l2_subdev_frame_interval` 588c2ecf20Sopenharmony_cicontains the current frame interval as would be returned by a 598c2ecf20Sopenharmony_ci``VIDIOC_SUBDEV_G_FRAME_INTERVAL`` call. 608c2ecf20Sopenharmony_ci 618c2ecf20Sopenharmony_ciCalling ``VIDIOC_SUBDEV_S_FRAME_INTERVAL`` on a subdev device node that has been 628c2ecf20Sopenharmony_ciregistered in read-only mode is not allowed. An error is returned and the errno 638c2ecf20Sopenharmony_civariable is set to ``-EPERM``. 648c2ecf20Sopenharmony_ci 658c2ecf20Sopenharmony_ciDrivers must not return an error solely because the requested interval 668c2ecf20Sopenharmony_cidoesn't match the device capabilities. They must instead modify the 678c2ecf20Sopenharmony_ciinterval to match what the hardware can provide. The modified interval 688c2ecf20Sopenharmony_cishould be as close as possible to the original request. 698c2ecf20Sopenharmony_ci 708c2ecf20Sopenharmony_ciChanging the frame interval shall never change the format. Changing the 718c2ecf20Sopenharmony_ciformat, on the other hand, may change the frame interval. 728c2ecf20Sopenharmony_ci 738c2ecf20Sopenharmony_ciSub-devices that support the frame interval ioctls should implement them 748c2ecf20Sopenharmony_cion a single pad only. Their behaviour when supported on multiple pads of 758c2ecf20Sopenharmony_cithe same sub-device is not defined. 768c2ecf20Sopenharmony_ci 778c2ecf20Sopenharmony_ci.. c:type:: v4l2_subdev_frame_interval 788c2ecf20Sopenharmony_ci 798c2ecf20Sopenharmony_ci.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| 808c2ecf20Sopenharmony_ci 818c2ecf20Sopenharmony_ci.. flat-table:: struct v4l2_subdev_frame_interval 828c2ecf20Sopenharmony_ci :header-rows: 0 838c2ecf20Sopenharmony_ci :stub-columns: 0 848c2ecf20Sopenharmony_ci :widths: 1 1 2 858c2ecf20Sopenharmony_ci 868c2ecf20Sopenharmony_ci * - __u32 878c2ecf20Sopenharmony_ci - ``pad`` 888c2ecf20Sopenharmony_ci - Pad number as reported by the media controller API. 898c2ecf20Sopenharmony_ci * - struct :c:type:`v4l2_fract` 908c2ecf20Sopenharmony_ci - ``interval`` 918c2ecf20Sopenharmony_ci - Period, in seconds, between consecutive video frames. 928c2ecf20Sopenharmony_ci * - __u32 938c2ecf20Sopenharmony_ci - ``reserved``\ [9] 948c2ecf20Sopenharmony_ci - Reserved for future extensions. Applications and drivers must set 958c2ecf20Sopenharmony_ci the array to zero. 968c2ecf20Sopenharmony_ci 978c2ecf20Sopenharmony_ciReturn Value 988c2ecf20Sopenharmony_ci============ 998c2ecf20Sopenharmony_ci 1008c2ecf20Sopenharmony_ciOn success 0 is returned, on error -1 and the ``errno`` variable is set 1018c2ecf20Sopenharmony_ciappropriately. The generic error codes are described at the 1028c2ecf20Sopenharmony_ci:ref:`Generic Error Codes <gen-errors>` chapter. 1038c2ecf20Sopenharmony_ci 1048c2ecf20Sopenharmony_ciEBUSY 1058c2ecf20Sopenharmony_ci The frame interval can't be changed because the pad is currently 1068c2ecf20Sopenharmony_ci busy. This can be caused, for instance, by an active video stream on 1078c2ecf20Sopenharmony_ci the pad. The ioctl must not be retried without performing another 1088c2ecf20Sopenharmony_ci action to fix the problem first. Only returned by 1098c2ecf20Sopenharmony_ci ``VIDIOC_SUBDEV_S_FRAME_INTERVAL`` 1108c2ecf20Sopenharmony_ci 1118c2ecf20Sopenharmony_ciEINVAL 1128c2ecf20Sopenharmony_ci The struct 1138c2ecf20Sopenharmony_ci :c:type:`v4l2_subdev_frame_interval` 1148c2ecf20Sopenharmony_ci ``pad`` references a non-existing pad, or the pad doesn't support 1158c2ecf20Sopenharmony_ci frame intervals. 1168c2ecf20Sopenharmony_ci 1178c2ecf20Sopenharmony_ciEPERM 1188c2ecf20Sopenharmony_ci The ``VIDIOC_SUBDEV_S_FRAME_INTERVAL`` ioctl has been called on a read-only 1198c2ecf20Sopenharmony_ci subdevice. 120