18c2ecf20Sopenharmony_ci.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
28c2ecf20Sopenharmony_ci.. c:namespace:: V4L
38c2ecf20Sopenharmony_ci
48c2ecf20Sopenharmony_ci.. _VIDIOC_SUBDEV_ENUM_MBUS_CODE:
58c2ecf20Sopenharmony_ci
68c2ecf20Sopenharmony_ci**********************************
78c2ecf20Sopenharmony_ciioctl VIDIOC_SUBDEV_ENUM_MBUS_CODE
88c2ecf20Sopenharmony_ci**********************************
98c2ecf20Sopenharmony_ci
108c2ecf20Sopenharmony_ciName
118c2ecf20Sopenharmony_ci====
128c2ecf20Sopenharmony_ci
138c2ecf20Sopenharmony_ciVIDIOC_SUBDEV_ENUM_MBUS_CODE - Enumerate media bus formats
148c2ecf20Sopenharmony_ci
158c2ecf20Sopenharmony_ciSynopsis
168c2ecf20Sopenharmony_ci========
178c2ecf20Sopenharmony_ci
188c2ecf20Sopenharmony_ci.. c:macro:: VIDIOC_SUBDEV_ENUM_MBUS_CODE
198c2ecf20Sopenharmony_ci
208c2ecf20Sopenharmony_ci``int ioctl(int fd, VIDIOC_SUBDEV_ENUM_MBUS_CODE, struct v4l2_subdev_mbus_code_enum * argp)``
218c2ecf20Sopenharmony_ci
228c2ecf20Sopenharmony_ciArguments
238c2ecf20Sopenharmony_ci=========
248c2ecf20Sopenharmony_ci
258c2ecf20Sopenharmony_ci``fd``
268c2ecf20Sopenharmony_ci    File descriptor returned by :c:func:`open()`.
278c2ecf20Sopenharmony_ci
288c2ecf20Sopenharmony_ci``argp``
298c2ecf20Sopenharmony_ci    Pointer to struct :c:type:`v4l2_subdev_mbus_code_enum`.
308c2ecf20Sopenharmony_ci
318c2ecf20Sopenharmony_ciDescription
328c2ecf20Sopenharmony_ci===========
338c2ecf20Sopenharmony_ci
348c2ecf20Sopenharmony_ciTo enumerate media bus formats available at a given sub-device pad
358c2ecf20Sopenharmony_ciapplications initialize the ``pad``, ``which`` and ``index`` fields of
368c2ecf20Sopenharmony_cistruct
378c2ecf20Sopenharmony_ci:c:type:`v4l2_subdev_mbus_code_enum` and
388c2ecf20Sopenharmony_cicall the :ref:`VIDIOC_SUBDEV_ENUM_MBUS_CODE` ioctl with a pointer to this
398c2ecf20Sopenharmony_cistructure. Drivers fill the rest of the structure or return an ``EINVAL``
408c2ecf20Sopenharmony_cierror code if either the ``pad`` or ``index`` are invalid. All media bus
418c2ecf20Sopenharmony_ciformats are enumerable by beginning at index zero and incrementing by
428c2ecf20Sopenharmony_cione until ``EINVAL`` is returned.
438c2ecf20Sopenharmony_ci
448c2ecf20Sopenharmony_ciAvailable media bus formats may depend on the current 'try' formats at
458c2ecf20Sopenharmony_ciother pads of the sub-device, as well as on the current active links.
468c2ecf20Sopenharmony_ciSee :ref:`VIDIOC_SUBDEV_G_FMT` for more
478c2ecf20Sopenharmony_ciinformation about the try formats.
488c2ecf20Sopenharmony_ci
498c2ecf20Sopenharmony_ci.. c:type:: v4l2_subdev_mbus_code_enum
508c2ecf20Sopenharmony_ci
518c2ecf20Sopenharmony_ci.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}|
528c2ecf20Sopenharmony_ci
538c2ecf20Sopenharmony_ci.. flat-table:: struct v4l2_subdev_mbus_code_enum
548c2ecf20Sopenharmony_ci    :header-rows:  0
558c2ecf20Sopenharmony_ci    :stub-columns: 0
568c2ecf20Sopenharmony_ci    :widths:       1 1 2
578c2ecf20Sopenharmony_ci
588c2ecf20Sopenharmony_ci    * - __u32
598c2ecf20Sopenharmony_ci      - ``pad``
608c2ecf20Sopenharmony_ci      - Pad number as reported by the media controller API.
618c2ecf20Sopenharmony_ci    * - __u32
628c2ecf20Sopenharmony_ci      - ``index``
638c2ecf20Sopenharmony_ci      - Number of the format in the enumeration, set by the application.
648c2ecf20Sopenharmony_ci    * - __u32
658c2ecf20Sopenharmony_ci      - ``code``
668c2ecf20Sopenharmony_ci      - The media bus format code, as defined in
678c2ecf20Sopenharmony_ci	:ref:`v4l2-mbus-format`.
688c2ecf20Sopenharmony_ci    * - __u32
698c2ecf20Sopenharmony_ci      - ``which``
708c2ecf20Sopenharmony_ci      - Media bus format codes to be enumerated, from enum
718c2ecf20Sopenharmony_ci	:ref:`v4l2_subdev_format_whence <v4l2-subdev-format-whence>`.
728c2ecf20Sopenharmony_ci    * - __u32
738c2ecf20Sopenharmony_ci      - ``flags``
748c2ecf20Sopenharmony_ci      - See :ref:`v4l2-subdev-mbus-code-flags`
758c2ecf20Sopenharmony_ci    * - __u32
768c2ecf20Sopenharmony_ci      - ``reserved``\ [7]
778c2ecf20Sopenharmony_ci      - Reserved for future extensions. Applications and drivers must set
788c2ecf20Sopenharmony_ci	the array to zero.
798c2ecf20Sopenharmony_ci
808c2ecf20Sopenharmony_ci
818c2ecf20Sopenharmony_ci
828c2ecf20Sopenharmony_ci.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{7.7cm}|
838c2ecf20Sopenharmony_ci
848c2ecf20Sopenharmony_ci.. _v4l2-subdev-mbus-code-flags:
858c2ecf20Sopenharmony_ci
868c2ecf20Sopenharmony_ci.. flat-table:: Subdev Media Bus Code Enumerate Flags
878c2ecf20Sopenharmony_ci    :header-rows:  0
888c2ecf20Sopenharmony_ci    :stub-columns: 0
898c2ecf20Sopenharmony_ci    :widths:       1 1 2
908c2ecf20Sopenharmony_ci
918c2ecf20Sopenharmony_ci    * - V4L2_SUBDEV_MBUS_CODE_CSC_COLORSPACE
928c2ecf20Sopenharmony_ci      - 0x00000001
938c2ecf20Sopenharmony_ci      - The driver allows the application to try to change the default colorspace
948c2ecf20Sopenharmony_ci	encoding. The application can ask to configure the colorspace of the
958c2ecf20Sopenharmony_ci	subdevice when calling the :ref:`VIDIOC_SUBDEV_S_FMT <VIDIOC_SUBDEV_G_FMT>`
968c2ecf20Sopenharmony_ci	ioctl with :ref:`V4L2_MBUS_FRAMEFMT_SET_CSC <mbus-framefmt-set-csc>` set.
978c2ecf20Sopenharmony_ci	See :ref:`v4l2-mbus-format` on how to do this.
988c2ecf20Sopenharmony_ci    * - V4L2_SUBDEV_MBUS_CODE_CSC_XFER_FUNC
998c2ecf20Sopenharmony_ci      - 0x00000002
1008c2ecf20Sopenharmony_ci      - The driver allows the application to try to change the default transform function.
1018c2ecf20Sopenharmony_ci	The application can ask to configure the transform function of
1028c2ecf20Sopenharmony_ci	the subdevice when calling the :ref:`VIDIOC_SUBDEV_S_FMT <VIDIOC_SUBDEV_G_FMT>`
1038c2ecf20Sopenharmony_ci	ioctl with :ref:`V4L2_MBUS_FRAMEFMT_SET_CSC <mbus-framefmt-set-csc>` set.
1048c2ecf20Sopenharmony_ci	See :ref:`v4l2-mbus-format` on how to do this.
1058c2ecf20Sopenharmony_ci    * - V4L2_SUBDEV_MBUS_CODE_CSC_YCBCR_ENC
1068c2ecf20Sopenharmony_ci      - 0x00000004
1078c2ecf20Sopenharmony_ci      - The driver allows the application to try to change the default Y'CbCr
1088c2ecf20Sopenharmony_ci	encoding. The application can ask to configure the Y'CbCr encoding of the
1098c2ecf20Sopenharmony_ci	subdevice when calling the :ref:`VIDIOC_SUBDEV_S_FMT <VIDIOC_SUBDEV_G_FMT>`
1108c2ecf20Sopenharmony_ci	ioctl with :ref:`V4L2_MBUS_FRAMEFMT_SET_CSC <mbus-framefmt-set-csc>` set.
1118c2ecf20Sopenharmony_ci	See :ref:`v4l2-mbus-format` on how to do this.
1128c2ecf20Sopenharmony_ci    * - V4L2_SUBDEV_MBUS_CODE_CSC_HSV_ENC
1138c2ecf20Sopenharmony_ci      - 0x00000004
1148c2ecf20Sopenharmony_ci      - The driver allows the application to try to change the default HSV
1158c2ecf20Sopenharmony_ci	encoding. The application can ask to configure the HSV encoding of the
1168c2ecf20Sopenharmony_ci	subdevice when calling the :ref:`VIDIOC_SUBDEV_S_FMT <VIDIOC_SUBDEV_G_FMT>`
1178c2ecf20Sopenharmony_ci	ioctl with :ref:`V4L2_MBUS_FRAMEFMT_SET_CSC <mbus-framefmt-set-csc>` set.
1188c2ecf20Sopenharmony_ci	See :ref:`v4l2-mbus-format` on how to do this.
1198c2ecf20Sopenharmony_ci    * - V4L2_SUBDEV_MBUS_CODE_CSC_QUANTIZATION
1208c2ecf20Sopenharmony_ci      - 0x00000008
1218c2ecf20Sopenharmony_ci      - The driver allows the application to try to change the default
1228c2ecf20Sopenharmony_ci	quantization. The application can ask to configure the quantization of
1238c2ecf20Sopenharmony_ci	the subdevice when calling the :ref:`VIDIOC_SUBDEV_S_FMT <VIDIOC_SUBDEV_G_FMT>`
1248c2ecf20Sopenharmony_ci	ioctl with :ref:`V4L2_MBUS_FRAMEFMT_SET_CSC <mbus-framefmt-set-csc>` set.
1258c2ecf20Sopenharmony_ci	See :ref:`v4l2-mbus-format` on how to do this.
1268c2ecf20Sopenharmony_ci
1278c2ecf20Sopenharmony_ciReturn Value
1288c2ecf20Sopenharmony_ci============
1298c2ecf20Sopenharmony_ci
1308c2ecf20Sopenharmony_ciOn success 0 is returned, on error -1 and the ``errno`` variable is set
1318c2ecf20Sopenharmony_ciappropriately. The generic error codes are described at the
1328c2ecf20Sopenharmony_ci:ref:`Generic Error Codes <gen-errors>` chapter.
1338c2ecf20Sopenharmony_ci
1348c2ecf20Sopenharmony_ciEINVAL
1358c2ecf20Sopenharmony_ci    The struct
1368c2ecf20Sopenharmony_ci    :c:type:`v4l2_subdev_mbus_code_enum`
1378c2ecf20Sopenharmony_ci    ``pad`` references a non-existing pad, or the ``index`` field is out
1388c2ecf20Sopenharmony_ci    of bounds.
139