xref: /openbmc/linux/Documentation/userspace-api/media/v4l/vidioc-subdev-enum-frame-interval.rst (revision 9a87ffc99ec8eb8d35eed7c4f816d75f5cc9662e)
1059b1c5bSMauro Carvalho Chehab.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
2407e84cdSMauro Carvalho Chehab.. c:namespace:: V4L
354f38fcaSMauro Carvalho Chehab
454f38fcaSMauro Carvalho Chehab.. _VIDIOC_SUBDEV_ENUM_FRAME_INTERVAL:
554f38fcaSMauro Carvalho Chehab
654f38fcaSMauro Carvalho Chehab***************************************
754f38fcaSMauro Carvalho Chehabioctl VIDIOC_SUBDEV_ENUM_FRAME_INTERVAL
854f38fcaSMauro Carvalho Chehab***************************************
954f38fcaSMauro Carvalho Chehab
1054f38fcaSMauro Carvalho ChehabName
1154f38fcaSMauro Carvalho Chehab====
1254f38fcaSMauro Carvalho Chehab
1354f38fcaSMauro Carvalho ChehabVIDIOC_SUBDEV_ENUM_FRAME_INTERVAL - Enumerate frame intervals
1454f38fcaSMauro Carvalho Chehab
1554f38fcaSMauro Carvalho ChehabSynopsis
1654f38fcaSMauro Carvalho Chehab========
1754f38fcaSMauro Carvalho Chehab
18407e84cdSMauro Carvalho Chehab.. c:macro:: VIDIOC_SUBDEV_ENUM_FRAME_INTERVAL
1954f38fcaSMauro Carvalho Chehab
20407e84cdSMauro Carvalho Chehab``int ioctl(int fd, VIDIOC_SUBDEV_ENUM_FRAME_INTERVAL, struct v4l2_subdev_frame_interval_enum * argp)``
2154f38fcaSMauro Carvalho Chehab
2254f38fcaSMauro Carvalho ChehabArguments
2354f38fcaSMauro Carvalho Chehab=========
2454f38fcaSMauro Carvalho Chehab
2554f38fcaSMauro Carvalho Chehab``fd``
26407e84cdSMauro Carvalho Chehab    File descriptor returned by :c:func:`open()`.
2754f38fcaSMauro Carvalho Chehab
2854f38fcaSMauro Carvalho Chehab``argp``
2954f38fcaSMauro Carvalho Chehab    Pointer to struct :c:type:`v4l2_subdev_frame_interval_enum`.
3054f38fcaSMauro Carvalho Chehab
3154f38fcaSMauro Carvalho ChehabDescription
3254f38fcaSMauro Carvalho Chehab===========
3354f38fcaSMauro Carvalho Chehab
3454f38fcaSMauro Carvalho ChehabThis ioctl lets applications enumerate available frame intervals on a
3554f38fcaSMauro Carvalho Chehabgiven sub-device pad. Frame intervals only makes sense for sub-devices
3654f38fcaSMauro Carvalho Chehabthat can control the frame period on their own. This includes, for
3754f38fcaSMauro Carvalho Chehabinstance, image sensors and TV tuners.
3854f38fcaSMauro Carvalho Chehab
3954f38fcaSMauro Carvalho ChehabFor the common use case of image sensors, the frame intervals available
4054f38fcaSMauro Carvalho Chehabon the sub-device output pad depend on the frame format and size on the
4154f38fcaSMauro Carvalho Chehabsame pad. Applications must thus specify the desired format and size
4254f38fcaSMauro Carvalho Chehabwhen enumerating frame intervals.
4354f38fcaSMauro Carvalho Chehab
4454f38fcaSMauro Carvalho ChehabTo enumerate frame intervals applications initialize the ``index``,
4554f38fcaSMauro Carvalho Chehab``pad``, ``which``, ``code``, ``width`` and ``height`` fields of struct
4654f38fcaSMauro Carvalho Chehab:c:type:`v4l2_subdev_frame_interval_enum`
4754f38fcaSMauro Carvalho Chehaband call the :ref:`VIDIOC_SUBDEV_ENUM_FRAME_INTERVAL` ioctl with a pointer
4854f38fcaSMauro Carvalho Chehabto this structure. Drivers fill the rest of the structure or return an
4954f38fcaSMauro Carvalho ChehabEINVAL error code if one of the input fields is invalid. All frame
5054f38fcaSMauro Carvalho Chehabintervals are enumerable by beginning at index zero and incrementing by
5154f38fcaSMauro Carvalho Chehabone until ``EINVAL`` is returned.
5254f38fcaSMauro Carvalho Chehab
5354f38fcaSMauro Carvalho ChehabAvailable frame intervals may depend on the current 'try' formats at
5454f38fcaSMauro Carvalho Chehabother pads of the sub-device, as well as on the current active links.
5554f38fcaSMauro Carvalho ChehabSee :ref:`VIDIOC_SUBDEV_G_FMT` for more
5654f38fcaSMauro Carvalho Chehabinformation about the try formats.
5754f38fcaSMauro Carvalho Chehab
5854f38fcaSMauro Carvalho ChehabSub-devices that support the frame interval enumeration ioctl should
5954f38fcaSMauro Carvalho Chehabimplemented it on a single pad only. Its behaviour when supported on
6054f38fcaSMauro Carvalho Chehabmultiple pads of the same sub-device is not defined.
6154f38fcaSMauro Carvalho Chehab
6254f38fcaSMauro Carvalho Chehab.. c:type:: v4l2_subdev_frame_interval_enum
6354f38fcaSMauro Carvalho Chehab
64fea13a69SMauro Carvalho Chehab.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.5cm}|
6554f38fcaSMauro Carvalho Chehab
6654f38fcaSMauro Carvalho Chehab.. flat-table:: struct v4l2_subdev_frame_interval_enum
6754f38fcaSMauro Carvalho Chehab    :header-rows:  0
6854f38fcaSMauro Carvalho Chehab    :stub-columns: 0
6954f38fcaSMauro Carvalho Chehab    :widths:       1 1 2
7054f38fcaSMauro Carvalho Chehab
7154f38fcaSMauro Carvalho Chehab    * - __u32
7254f38fcaSMauro Carvalho Chehab      - ``index``
7354f38fcaSMauro Carvalho Chehab      - Number of the format in the enumeration, set by the application.
7454f38fcaSMauro Carvalho Chehab    * - __u32
7554f38fcaSMauro Carvalho Chehab      - ``pad``
7654f38fcaSMauro Carvalho Chehab      - Pad number as reported by the media controller API.
7754f38fcaSMauro Carvalho Chehab    * - __u32
7854f38fcaSMauro Carvalho Chehab      - ``code``
7954f38fcaSMauro Carvalho Chehab      - The media bus format code, as defined in
8054f38fcaSMauro Carvalho Chehab	:ref:`v4l2-mbus-format`.
8154f38fcaSMauro Carvalho Chehab    * - __u32
8254f38fcaSMauro Carvalho Chehab      - ``width``
8354f38fcaSMauro Carvalho Chehab      - Frame width, in pixels.
8454f38fcaSMauro Carvalho Chehab    * - __u32
8554f38fcaSMauro Carvalho Chehab      - ``height``
8654f38fcaSMauro Carvalho Chehab      - Frame height, in pixels.
8754f38fcaSMauro Carvalho Chehab    * - struct :c:type:`v4l2_fract`
8854f38fcaSMauro Carvalho Chehab      - ``interval``
8954f38fcaSMauro Carvalho Chehab      - Period, in seconds, between consecutive video frames.
9054f38fcaSMauro Carvalho Chehab    * - __u32
9154f38fcaSMauro Carvalho Chehab      - ``which``
9254f38fcaSMauro Carvalho Chehab      - Frame intervals to be enumerated, from enum
9354f38fcaSMauro Carvalho Chehab	:ref:`v4l2_subdev_format_whence <v4l2-subdev-format-whence>`.
9454f38fcaSMauro Carvalho Chehab    * - __u32
95*2f91e10eSTomi Valkeinen      - ``stream``
96*2f91e10eSTomi Valkeinen      - Stream identifier.
97*2f91e10eSTomi Valkeinen    * - __u32
98*2f91e10eSTomi Valkeinen      - ``reserved``\ [7]
9954f38fcaSMauro Carvalho Chehab      - Reserved for future extensions. Applications and drivers must set
10054f38fcaSMauro Carvalho Chehab	the array to zero.
10154f38fcaSMauro Carvalho Chehab
10254f38fcaSMauro Carvalho ChehabReturn Value
10354f38fcaSMauro Carvalho Chehab============
10454f38fcaSMauro Carvalho Chehab
10554f38fcaSMauro Carvalho ChehabOn success 0 is returned, on error -1 and the ``errno`` variable is set
10654f38fcaSMauro Carvalho Chehabappropriately. The generic error codes are described at the
10754f38fcaSMauro Carvalho Chehab:ref:`Generic Error Codes <gen-errors>` chapter.
10854f38fcaSMauro Carvalho Chehab
10954f38fcaSMauro Carvalho ChehabEINVAL
11054f38fcaSMauro Carvalho Chehab    The struct
11154f38fcaSMauro Carvalho Chehab    :c:type:`v4l2_subdev_frame_interval_enum`
11254f38fcaSMauro Carvalho Chehab    ``pad`` references a non-existing pad, one of the ``code``,
11354f38fcaSMauro Carvalho Chehab    ``width`` or ``height`` fields are invalid for the given pad or the
11454f38fcaSMauro Carvalho Chehab    ``index`` field is out of bounds.
115