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_MBUS_CODE:
554f38fcaSMauro Carvalho Chehab
654f38fcaSMauro Carvalho Chehab**********************************
754f38fcaSMauro Carvalho Chehabioctl VIDIOC_SUBDEV_ENUM_MBUS_CODE
854f38fcaSMauro Carvalho Chehab**********************************
954f38fcaSMauro Carvalho Chehab
1054f38fcaSMauro Carvalho ChehabName
1154f38fcaSMauro Carvalho Chehab====
1254f38fcaSMauro Carvalho Chehab
1354f38fcaSMauro Carvalho ChehabVIDIOC_SUBDEV_ENUM_MBUS_CODE - Enumerate media bus formats
1454f38fcaSMauro Carvalho Chehab
1554f38fcaSMauro Carvalho ChehabSynopsis
1654f38fcaSMauro Carvalho Chehab========
1754f38fcaSMauro Carvalho Chehab
18407e84cdSMauro Carvalho Chehab.. c:macro:: VIDIOC_SUBDEV_ENUM_MBUS_CODE
1954f38fcaSMauro Carvalho Chehab
20407e84cdSMauro Carvalho Chehab``int ioctl(int fd, VIDIOC_SUBDEV_ENUM_MBUS_CODE, struct v4l2_subdev_mbus_code_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_mbus_code_enum`.
3054f38fcaSMauro Carvalho Chehab
3154f38fcaSMauro Carvalho ChehabDescription
3254f38fcaSMauro Carvalho Chehab===========
3354f38fcaSMauro Carvalho Chehab
34*5a26272fSDorota CzaplejewiczThis call is used by the application to access the enumeration
35*5a26272fSDorota Czaplejewiczof media bus formats for the selected pad.
36*5a26272fSDorota Czaplejewicz
37*5a26272fSDorota CzaplejewiczThe enumerations are defined by the driver, and indexed using the ``index`` field
38*5a26272fSDorota Czaplejewiczof struct :c:type:`v4l2_subdev_mbus_code_enum`.
39*5a26272fSDorota CzaplejewiczEach enumeration starts with the ``index`` of 0, and
40*5a26272fSDorota Czaplejewiczthe lowest invalid index marks the end of enumeration.
41*5a26272fSDorota Czaplejewicz
42*5a26272fSDorota CzaplejewiczTherefore, to enumerate media bus formats available at a given sub-device pad,
43*5a26272fSDorota Czaplejewiczinitialize the ``pad``, and ``which`` fields to desired values,
44*5a26272fSDorota Czaplejewiczand set ``index`` to 0.
45*5a26272fSDorota CzaplejewiczThen call the :ref:`VIDIOC_SUBDEV_ENUM_MBUS_CODE` ioctl
46*5a26272fSDorota Czaplejewiczwith a pointer to this structure.
47*5a26272fSDorota Czaplejewicz
48*5a26272fSDorota CzaplejewiczA successful call will return with the ``code`` field filled in
49*5a26272fSDorota Czaplejewiczwith a mbus code value.
50*5a26272fSDorota CzaplejewiczRepeat with increasing ``index`` until ``EINVAL`` is received.
51*5a26272fSDorota Czaplejewicz``EINVAL`` means that either ``pad`` is invalid,
52*5a26272fSDorota Czaplejewiczor that there are no more codes available at this pad.
53*5a26272fSDorota Czaplejewicz
54*5a26272fSDorota CzaplejewiczThe driver must not return the same value of ``code`` for different indices
55*5a26272fSDorota Czaplejewiczat the same pad.
5654f38fcaSMauro Carvalho Chehab
5754f38fcaSMauro Carvalho ChehabAvailable media bus formats may depend on the current 'try' formats at
5854f38fcaSMauro Carvalho Chehabother pads of the sub-device, as well as on the current active links.
5954f38fcaSMauro Carvalho ChehabSee :ref:`VIDIOC_SUBDEV_G_FMT` for more
6054f38fcaSMauro Carvalho Chehabinformation about the try formats.
6154f38fcaSMauro Carvalho Chehab
6254f38fcaSMauro Carvalho Chehab.. c:type:: v4l2_subdev_mbus_code_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_mbus_code_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      - ``pad``
73*5a26272fSDorota Czaplejewicz      - Pad number as reported by the media controller API. Filled in by the
74*5a26272fSDorota Czaplejewicz        application.
7554f38fcaSMauro Carvalho Chehab    * - __u32
7654f38fcaSMauro Carvalho Chehab      - ``index``
77*5a26272fSDorota Czaplejewicz      - Index of the mbus code in the enumeration belonging to the given pad.
78*5a26272fSDorota Czaplejewicz        Filled in by the application.
7954f38fcaSMauro Carvalho Chehab    * - __u32
8054f38fcaSMauro Carvalho Chehab      - ``code``
8154f38fcaSMauro Carvalho Chehab      - The media bus format code, as defined in
82*5a26272fSDorota Czaplejewicz	:ref:`v4l2-mbus-format`. Filled in by the driver.
8354f38fcaSMauro Carvalho Chehab    * - __u32
8454f38fcaSMauro Carvalho Chehab      - ``which``
8554f38fcaSMauro Carvalho Chehab      - Media bus format codes to be enumerated, from enum
8654f38fcaSMauro Carvalho Chehab	:ref:`v4l2_subdev_format_whence <v4l2-subdev-format-whence>`.
8754f38fcaSMauro Carvalho Chehab    * - __u32
8862aacfa9SDafna Hirschfeld      - ``flags``
8962aacfa9SDafna Hirschfeld      - See :ref:`v4l2-subdev-mbus-code-flags`
9062aacfa9SDafna Hirschfeld    * - __u32
912f91e10eSTomi Valkeinen      - ``stream``
922f91e10eSTomi Valkeinen      - Stream identifier.
932f91e10eSTomi Valkeinen    * - __u32
942f91e10eSTomi Valkeinen      - ``reserved``\ [6]
9554f38fcaSMauro Carvalho Chehab      - Reserved for future extensions. Applications and drivers must set
9654f38fcaSMauro Carvalho Chehab	the array to zero.
9754f38fcaSMauro Carvalho Chehab
9854f38fcaSMauro Carvalho Chehab
9962aacfa9SDafna Hirschfeld
100fea13a69SMauro Carvalho Chehab.. raw:: latex
101fea13a69SMauro Carvalho Chehab
102fea13a69SMauro Carvalho Chehab   \footnotesize
103fea13a69SMauro Carvalho Chehab
104fea13a69SMauro Carvalho Chehab.. tabularcolumns:: |p{8.8cm}|p{2.2cm}|p{6.3cm}|
105fea13a69SMauro Carvalho Chehab
106c4a1bff9SMauro Carvalho Chehab.. _v4l2-subdev-mbus-code-flags:
107c4a1bff9SMauro Carvalho Chehab
10862aacfa9SDafna Hirschfeld.. flat-table:: Subdev Media Bus Code Enumerate Flags
10962aacfa9SDafna Hirschfeld    :header-rows:  0
11062aacfa9SDafna Hirschfeld    :stub-columns: 0
11162aacfa9SDafna Hirschfeld    :widths:       1 1 2
11262aacfa9SDafna Hirschfeld
11362aacfa9SDafna Hirschfeld    * - V4L2_SUBDEV_MBUS_CODE_CSC_COLORSPACE
11462aacfa9SDafna Hirschfeld      - 0x00000001
11562aacfa9SDafna Hirschfeld      - The driver allows the application to try to change the default colorspace
11662aacfa9SDafna Hirschfeld	encoding. The application can ask to configure the colorspace of the
11762aacfa9SDafna Hirschfeld	subdevice when calling the :ref:`VIDIOC_SUBDEV_S_FMT <VIDIOC_SUBDEV_G_FMT>`
11862aacfa9SDafna Hirschfeld	ioctl with :ref:`V4L2_MBUS_FRAMEFMT_SET_CSC <mbus-framefmt-set-csc>` set.
11962aacfa9SDafna Hirschfeld	See :ref:`v4l2-mbus-format` on how to do this.
12062aacfa9SDafna Hirschfeld    * - V4L2_SUBDEV_MBUS_CODE_CSC_XFER_FUNC
12162aacfa9SDafna Hirschfeld      - 0x00000002
12262aacfa9SDafna Hirschfeld      - The driver allows the application to try to change the default transform function.
12362aacfa9SDafna Hirschfeld	The application can ask to configure the transform function of
12462aacfa9SDafna Hirschfeld	the subdevice when calling the :ref:`VIDIOC_SUBDEV_S_FMT <VIDIOC_SUBDEV_G_FMT>`
12562aacfa9SDafna Hirschfeld	ioctl with :ref:`V4L2_MBUS_FRAMEFMT_SET_CSC <mbus-framefmt-set-csc>` set.
12662aacfa9SDafna Hirschfeld	See :ref:`v4l2-mbus-format` on how to do this.
12762aacfa9SDafna Hirschfeld    * - V4L2_SUBDEV_MBUS_CODE_CSC_YCBCR_ENC
12862aacfa9SDafna Hirschfeld      - 0x00000004
12962aacfa9SDafna Hirschfeld      - The driver allows the application to try to change the default Y'CbCr
13062aacfa9SDafna Hirschfeld	encoding. The application can ask to configure the Y'CbCr encoding of the
13162aacfa9SDafna Hirschfeld	subdevice when calling the :ref:`VIDIOC_SUBDEV_S_FMT <VIDIOC_SUBDEV_G_FMT>`
13262aacfa9SDafna Hirschfeld	ioctl with :ref:`V4L2_MBUS_FRAMEFMT_SET_CSC <mbus-framefmt-set-csc>` set.
13362aacfa9SDafna Hirschfeld	See :ref:`v4l2-mbus-format` on how to do this.
13462aacfa9SDafna Hirschfeld    * - V4L2_SUBDEV_MBUS_CODE_CSC_HSV_ENC
13562aacfa9SDafna Hirschfeld      - 0x00000004
13662aacfa9SDafna Hirschfeld      - The driver allows the application to try to change the default HSV
13762aacfa9SDafna Hirschfeld	encoding. The application can ask to configure the HSV encoding of the
13862aacfa9SDafna Hirschfeld	subdevice when calling the :ref:`VIDIOC_SUBDEV_S_FMT <VIDIOC_SUBDEV_G_FMT>`
13962aacfa9SDafna Hirschfeld	ioctl with :ref:`V4L2_MBUS_FRAMEFMT_SET_CSC <mbus-framefmt-set-csc>` set.
14062aacfa9SDafna Hirschfeld	See :ref:`v4l2-mbus-format` on how to do this.
14162aacfa9SDafna Hirschfeld    * - V4L2_SUBDEV_MBUS_CODE_CSC_QUANTIZATION
14262aacfa9SDafna Hirschfeld      - 0x00000008
14362aacfa9SDafna Hirschfeld      - The driver allows the application to try to change the default
14462aacfa9SDafna Hirschfeld	quantization. The application can ask to configure the quantization of
14562aacfa9SDafna Hirschfeld	the subdevice when calling the :ref:`VIDIOC_SUBDEV_S_FMT <VIDIOC_SUBDEV_G_FMT>`
14662aacfa9SDafna Hirschfeld	ioctl with :ref:`V4L2_MBUS_FRAMEFMT_SET_CSC <mbus-framefmt-set-csc>` set.
14762aacfa9SDafna Hirschfeld	See :ref:`v4l2-mbus-format` on how to do this.
14862aacfa9SDafna Hirschfeld
149fea13a69SMauro Carvalho Chehab.. raw:: latex
150fea13a69SMauro Carvalho Chehab
151fea13a69SMauro Carvalho Chehab   \normalsize
152fea13a69SMauro Carvalho Chehab
15354f38fcaSMauro Carvalho ChehabReturn Value
15454f38fcaSMauro Carvalho Chehab============
15554f38fcaSMauro Carvalho Chehab
15654f38fcaSMauro Carvalho ChehabOn success 0 is returned, on error -1 and the ``errno`` variable is set
15754f38fcaSMauro Carvalho Chehabappropriately. The generic error codes are described at the
15854f38fcaSMauro Carvalho Chehab:ref:`Generic Error Codes <gen-errors>` chapter.
15954f38fcaSMauro Carvalho Chehab
16054f38fcaSMauro Carvalho ChehabEINVAL
16154f38fcaSMauro Carvalho Chehab    The struct
16254f38fcaSMauro Carvalho Chehab    :c:type:`v4l2_subdev_mbus_code_enum`
16354f38fcaSMauro Carvalho Chehab    ``pad`` references a non-existing pad, or the ``index`` field is out
16454f38fcaSMauro Carvalho Chehab    of bounds.
165