0001 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
0002 .. c:namespace:: V4L
0003
0004 .. _VIDIOC_SUBDEV_ENUM_MBUS_CODE:
0005
0006 **********************************
0007 ioctl VIDIOC_SUBDEV_ENUM_MBUS_CODE
0008 **********************************
0009
0010 Name
0011 ====
0012
0013 VIDIOC_SUBDEV_ENUM_MBUS_CODE - Enumerate media bus formats
0014
0015 Synopsis
0016 ========
0017
0018 .. c:macro:: VIDIOC_SUBDEV_ENUM_MBUS_CODE
0019
0020 ``int ioctl(int fd, VIDIOC_SUBDEV_ENUM_MBUS_CODE, struct v4l2_subdev_mbus_code_enum * argp)``
0021
0022 Arguments
0023 =========
0024
0025 ``fd``
0026 File descriptor returned by :c:func:`open()`.
0027
0028 ``argp``
0029 Pointer to struct :c:type:`v4l2_subdev_mbus_code_enum`.
0030
0031 Description
0032 ===========
0033
0034 To enumerate media bus formats available at a given sub-device pad
0035 applications initialize the ``pad``, ``which`` and ``index`` fields of
0036 struct
0037 :c:type:`v4l2_subdev_mbus_code_enum` and
0038 call the :ref:`VIDIOC_SUBDEV_ENUM_MBUS_CODE` ioctl with a pointer to this
0039 structure. Drivers fill the rest of the structure or return an ``EINVAL``
0040 error code if either the ``pad`` or ``index`` are invalid. All media bus
0041 formats are enumerable by beginning at index zero and incrementing by
0042 one until ``EINVAL`` is returned.
0043
0044 Available media bus formats may depend on the current 'try' formats at
0045 other pads of the sub-device, as well as on the current active links.
0046 See :ref:`VIDIOC_SUBDEV_G_FMT` for more
0047 information about the try formats.
0048
0049 .. c:type:: v4l2_subdev_mbus_code_enum
0050
0051 .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.5cm}|
0052
0053 .. flat-table:: struct v4l2_subdev_mbus_code_enum
0054 :header-rows: 0
0055 :stub-columns: 0
0056 :widths: 1 1 2
0057
0058 * - __u32
0059 - ``pad``
0060 - Pad number as reported by the media controller API.
0061 * - __u32
0062 - ``index``
0063 - Number of the format in the enumeration, set by the application.
0064 * - __u32
0065 - ``code``
0066 - The media bus format code, as defined in
0067 :ref:`v4l2-mbus-format`.
0068 * - __u32
0069 - ``which``
0070 - Media bus format codes to be enumerated, from enum
0071 :ref:`v4l2_subdev_format_whence <v4l2-subdev-format-whence>`.
0072 * - __u32
0073 - ``flags``
0074 - See :ref:`v4l2-subdev-mbus-code-flags`
0075 * - __u32
0076 - ``reserved``\ [7]
0077 - Reserved for future extensions. Applications and drivers must set
0078 the array to zero.
0079
0080
0081
0082 .. raw:: latex
0083
0084 \footnotesize
0085
0086 .. tabularcolumns:: |p{8.8cm}|p{2.2cm}|p{6.3cm}|
0087
0088 .. _v4l2-subdev-mbus-code-flags:
0089
0090 .. flat-table:: Subdev Media Bus Code Enumerate Flags
0091 :header-rows: 0
0092 :stub-columns: 0
0093 :widths: 1 1 2
0094
0095 * - V4L2_SUBDEV_MBUS_CODE_CSC_COLORSPACE
0096 - 0x00000001
0097 - The driver allows the application to try to change the default colorspace
0098 encoding. The application can ask to configure the colorspace of the
0099 subdevice when calling the :ref:`VIDIOC_SUBDEV_S_FMT <VIDIOC_SUBDEV_G_FMT>`
0100 ioctl with :ref:`V4L2_MBUS_FRAMEFMT_SET_CSC <mbus-framefmt-set-csc>` set.
0101 See :ref:`v4l2-mbus-format` on how to do this.
0102 * - V4L2_SUBDEV_MBUS_CODE_CSC_XFER_FUNC
0103 - 0x00000002
0104 - The driver allows the application to try to change the default transform function.
0105 The application can ask to configure the transform function of
0106 the subdevice when calling the :ref:`VIDIOC_SUBDEV_S_FMT <VIDIOC_SUBDEV_G_FMT>`
0107 ioctl with :ref:`V4L2_MBUS_FRAMEFMT_SET_CSC <mbus-framefmt-set-csc>` set.
0108 See :ref:`v4l2-mbus-format` on how to do this.
0109 * - V4L2_SUBDEV_MBUS_CODE_CSC_YCBCR_ENC
0110 - 0x00000004
0111 - The driver allows the application to try to change the default Y'CbCr
0112 encoding. The application can ask to configure the Y'CbCr encoding of the
0113 subdevice when calling the :ref:`VIDIOC_SUBDEV_S_FMT <VIDIOC_SUBDEV_G_FMT>`
0114 ioctl with :ref:`V4L2_MBUS_FRAMEFMT_SET_CSC <mbus-framefmt-set-csc>` set.
0115 See :ref:`v4l2-mbus-format` on how to do this.
0116 * - V4L2_SUBDEV_MBUS_CODE_CSC_HSV_ENC
0117 - 0x00000004
0118 - The driver allows the application to try to change the default HSV
0119 encoding. The application can ask to configure the HSV encoding of the
0120 subdevice when calling the :ref:`VIDIOC_SUBDEV_S_FMT <VIDIOC_SUBDEV_G_FMT>`
0121 ioctl with :ref:`V4L2_MBUS_FRAMEFMT_SET_CSC <mbus-framefmt-set-csc>` set.
0122 See :ref:`v4l2-mbus-format` on how to do this.
0123 * - V4L2_SUBDEV_MBUS_CODE_CSC_QUANTIZATION
0124 - 0x00000008
0125 - The driver allows the application to try to change the default
0126 quantization. The application can ask to configure the quantization of
0127 the subdevice when calling the :ref:`VIDIOC_SUBDEV_S_FMT <VIDIOC_SUBDEV_G_FMT>`
0128 ioctl with :ref:`V4L2_MBUS_FRAMEFMT_SET_CSC <mbus-framefmt-set-csc>` set.
0129 See :ref:`v4l2-mbus-format` on how to do this.
0130
0131 .. raw:: latex
0132
0133 \normalsize
0134
0135 Return Value
0136 ============
0137
0138 On success 0 is returned, on error -1 and the ``errno`` variable is set
0139 appropriately. The generic error codes are described at the
0140 :ref:`Generic Error Codes <gen-errors>` chapter.
0141
0142 EINVAL
0143 The struct
0144 :c:type:`v4l2_subdev_mbus_code_enum`
0145 ``pad`` references a non-existing pad, or the ``index`` field is out
0146 of bounds.