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