162306a36Sopenharmony_ci.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later 262306a36Sopenharmony_ci.. c:namespace:: V4L 362306a36Sopenharmony_ci 462306a36Sopenharmony_ci.. _VIDIOC_SUBDEV_G_FRAME_INTERVAL: 562306a36Sopenharmony_ci 662306a36Sopenharmony_ci******************************************************************** 762306a36Sopenharmony_ciioctl VIDIOC_SUBDEV_G_FRAME_INTERVAL, VIDIOC_SUBDEV_S_FRAME_INTERVAL 862306a36Sopenharmony_ci******************************************************************** 962306a36Sopenharmony_ci 1062306a36Sopenharmony_ciName 1162306a36Sopenharmony_ci==== 1262306a36Sopenharmony_ci 1362306a36Sopenharmony_ciVIDIOC_SUBDEV_G_FRAME_INTERVAL - VIDIOC_SUBDEV_S_FRAME_INTERVAL - Get or set the frame interval on a subdev pad 1462306a36Sopenharmony_ci 1562306a36Sopenharmony_ciSynopsis 1662306a36Sopenharmony_ci======== 1762306a36Sopenharmony_ci 1862306a36Sopenharmony_ci.. c:macro:: VIDIOC_SUBDEV_G_FRAME_INTERVAL 1962306a36Sopenharmony_ci 2062306a36Sopenharmony_ci``int ioctl(int fd, VIDIOC_SUBDEV_G_FRAME_INTERVAL, struct v4l2_subdev_frame_interval *argp)`` 2162306a36Sopenharmony_ci 2262306a36Sopenharmony_ci.. c:macro:: VIDIOC_SUBDEV_S_FRAME_INTERVAL 2362306a36Sopenharmony_ci 2462306a36Sopenharmony_ci``int ioctl(int fd, VIDIOC_SUBDEV_S_FRAME_INTERVAL, struct v4l2_subdev_frame_interval *argp)`` 2562306a36Sopenharmony_ci 2662306a36Sopenharmony_ciArguments 2762306a36Sopenharmony_ci========= 2862306a36Sopenharmony_ci 2962306a36Sopenharmony_ci``fd`` 3062306a36Sopenharmony_ci File descriptor returned by :c:func:`open()`. 3162306a36Sopenharmony_ci 3262306a36Sopenharmony_ci``argp`` 3362306a36Sopenharmony_ci Pointer to struct :c:type:`v4l2_subdev_frame_interval`. 3462306a36Sopenharmony_ci 3562306a36Sopenharmony_ciDescription 3662306a36Sopenharmony_ci=========== 3762306a36Sopenharmony_ci 3862306a36Sopenharmony_ciThese ioctls are used to get and set the frame interval at specific 3962306a36Sopenharmony_cisubdev pads in the image pipeline. The frame interval only makes sense 4062306a36Sopenharmony_cifor sub-devices that can control the frame period on their own. This 4162306a36Sopenharmony_ciincludes, for instance, image sensors and TV tuners. Sub-devices that 4262306a36Sopenharmony_cidon't support frame intervals must not implement these ioctls. 4362306a36Sopenharmony_ci 4462306a36Sopenharmony_ciTo retrieve the current frame interval applications set the ``pad`` 4562306a36Sopenharmony_cifield of a struct 4662306a36Sopenharmony_ci:c:type:`v4l2_subdev_frame_interval` to 4762306a36Sopenharmony_cithe desired pad number as reported by the media controller API. When 4862306a36Sopenharmony_cithey call the ``VIDIOC_SUBDEV_G_FRAME_INTERVAL`` ioctl with a pointer to 4962306a36Sopenharmony_cithis structure the driver fills the members of the ``interval`` field. 5062306a36Sopenharmony_ci 5162306a36Sopenharmony_ciTo change the current frame interval applications set both the ``pad`` 5262306a36Sopenharmony_cifield and all members of the ``interval`` field. When they call the 5362306a36Sopenharmony_ci``VIDIOC_SUBDEV_S_FRAME_INTERVAL`` ioctl with a pointer to this 5462306a36Sopenharmony_cistructure the driver verifies the requested interval, adjusts it based 5562306a36Sopenharmony_cion the hardware capabilities and configures the device. Upon return the 5662306a36Sopenharmony_cistruct 5762306a36Sopenharmony_ci:c:type:`v4l2_subdev_frame_interval` 5862306a36Sopenharmony_cicontains the current frame interval as would be returned by a 5962306a36Sopenharmony_ci``VIDIOC_SUBDEV_G_FRAME_INTERVAL`` call. 6062306a36Sopenharmony_ci 6162306a36Sopenharmony_ciCalling ``VIDIOC_SUBDEV_S_FRAME_INTERVAL`` on a subdev device node that has been 6262306a36Sopenharmony_ciregistered in read-only mode is not allowed. An error is returned and the errno 6362306a36Sopenharmony_civariable is set to ``-EPERM``. 6462306a36Sopenharmony_ci 6562306a36Sopenharmony_ciDrivers must not return an error solely because the requested interval 6662306a36Sopenharmony_cidoesn't match the device capabilities. They must instead modify the 6762306a36Sopenharmony_ciinterval to match what the hardware can provide. The modified interval 6862306a36Sopenharmony_cishould be as close as possible to the original request. 6962306a36Sopenharmony_ci 7062306a36Sopenharmony_ciChanging the frame interval shall never change the format. Changing the 7162306a36Sopenharmony_ciformat, on the other hand, may change the frame interval. 7262306a36Sopenharmony_ci 7362306a36Sopenharmony_ciSub-devices that support the frame interval ioctls should implement them 7462306a36Sopenharmony_cion a single pad only. Their behaviour when supported on multiple pads of 7562306a36Sopenharmony_cithe same sub-device is not defined. 7662306a36Sopenharmony_ci 7762306a36Sopenharmony_ci.. c:type:: v4l2_subdev_frame_interval 7862306a36Sopenharmony_ci 7962306a36Sopenharmony_ci.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.5cm}| 8062306a36Sopenharmony_ci 8162306a36Sopenharmony_ci.. flat-table:: struct v4l2_subdev_frame_interval 8262306a36Sopenharmony_ci :header-rows: 0 8362306a36Sopenharmony_ci :stub-columns: 0 8462306a36Sopenharmony_ci :widths: 1 1 2 8562306a36Sopenharmony_ci 8662306a36Sopenharmony_ci * - __u32 8762306a36Sopenharmony_ci - ``pad`` 8862306a36Sopenharmony_ci - Pad number as reported by the media controller API. 8962306a36Sopenharmony_ci * - struct :c:type:`v4l2_fract` 9062306a36Sopenharmony_ci - ``interval`` 9162306a36Sopenharmony_ci - Period, in seconds, between consecutive video frames. 9262306a36Sopenharmony_ci * - __u32 9362306a36Sopenharmony_ci - ``stream`` 9462306a36Sopenharmony_ci - Stream identifier. 9562306a36Sopenharmony_ci * - __u32 9662306a36Sopenharmony_ci - ``reserved``\ [8] 9762306a36Sopenharmony_ci - Reserved for future extensions. Applications and drivers must set 9862306a36Sopenharmony_ci the array to zero. 9962306a36Sopenharmony_ci 10062306a36Sopenharmony_ciReturn Value 10162306a36Sopenharmony_ci============ 10262306a36Sopenharmony_ci 10362306a36Sopenharmony_ciOn success 0 is returned, on error -1 and the ``errno`` variable is set 10462306a36Sopenharmony_ciappropriately. The generic error codes are described at the 10562306a36Sopenharmony_ci:ref:`Generic Error Codes <gen-errors>` chapter. 10662306a36Sopenharmony_ci 10762306a36Sopenharmony_ciEBUSY 10862306a36Sopenharmony_ci The frame interval can't be changed because the pad is currently 10962306a36Sopenharmony_ci busy. This can be caused, for instance, by an active video stream on 11062306a36Sopenharmony_ci the pad. The ioctl must not be retried without performing another 11162306a36Sopenharmony_ci action to fix the problem first. Only returned by 11262306a36Sopenharmony_ci ``VIDIOC_SUBDEV_S_FRAME_INTERVAL`` 11362306a36Sopenharmony_ci 11462306a36Sopenharmony_ciEINVAL 11562306a36Sopenharmony_ci The struct 11662306a36Sopenharmony_ci :c:type:`v4l2_subdev_frame_interval` 11762306a36Sopenharmony_ci ``pad`` references a non-existing pad, or the pad doesn't support 11862306a36Sopenharmony_ci frame intervals. 11962306a36Sopenharmony_ci 12062306a36Sopenharmony_ciEPERM 12162306a36Sopenharmony_ci The ``VIDIOC_SUBDEV_S_FRAME_INTERVAL`` ioctl has been called on a read-only 12262306a36Sopenharmony_ci subdevice. 123