xref: /linux/Documentation/userspace-api/media/v4l/vidioc-subdev-enum-mbus-code.rst (revision 407e84cd1e9a802df1955e281d8956439abc499b)
1059b1c5bSMauro Carvalho Chehab.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
2*407e84cdSMauro 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
18*407e84cdSMauro Carvalho Chehab.. c:macro:: VIDIOC_SUBDEV_ENUM_MBUS_CODE
1954f38fcaSMauro Carvalho Chehab
20*407e84cdSMauro 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``
26*407e84cdSMauro 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
3454f38fcaSMauro Carvalho ChehabTo enumerate media bus formats available at a given sub-device pad
3554f38fcaSMauro Carvalho Chehabapplications initialize the ``pad``, ``which`` and ``index`` fields of
3654f38fcaSMauro Carvalho Chehabstruct
3754f38fcaSMauro Carvalho Chehab:c:type:`v4l2_subdev_mbus_code_enum` and
3854f38fcaSMauro Carvalho Chehabcall the :ref:`VIDIOC_SUBDEV_ENUM_MBUS_CODE` ioctl with a pointer to this
3954f38fcaSMauro Carvalho Chehabstructure. Drivers fill the rest of the structure or return an ``EINVAL``
4054f38fcaSMauro Carvalho Chehaberror code if either the ``pad`` or ``index`` are invalid. All media bus
4154f38fcaSMauro Carvalho Chehabformats are enumerable by beginning at index zero and incrementing by
4254f38fcaSMauro Carvalho Chehabone until ``EINVAL`` is returned.
4354f38fcaSMauro Carvalho Chehab
4454f38fcaSMauro Carvalho ChehabAvailable media bus formats may depend on the current 'try' formats at
4554f38fcaSMauro Carvalho Chehabother pads of the sub-device, as well as on the current active links.
4654f38fcaSMauro Carvalho ChehabSee :ref:`VIDIOC_SUBDEV_G_FMT` for more
4754f38fcaSMauro Carvalho Chehabinformation about the try formats.
4854f38fcaSMauro Carvalho Chehab
4954f38fcaSMauro Carvalho Chehab.. c:type:: v4l2_subdev_mbus_code_enum
5054f38fcaSMauro Carvalho Chehab
5154f38fcaSMauro Carvalho Chehab.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}|
5254f38fcaSMauro Carvalho Chehab
5354f38fcaSMauro Carvalho Chehab.. flat-table:: struct v4l2_subdev_mbus_code_enum
5454f38fcaSMauro Carvalho Chehab    :header-rows:  0
5554f38fcaSMauro Carvalho Chehab    :stub-columns: 0
5654f38fcaSMauro Carvalho Chehab    :widths:       1 1 2
5754f38fcaSMauro Carvalho Chehab
5854f38fcaSMauro Carvalho Chehab    * - __u32
5954f38fcaSMauro Carvalho Chehab      - ``pad``
6054f38fcaSMauro Carvalho Chehab      - Pad number as reported by the media controller API.
6154f38fcaSMauro Carvalho Chehab    * - __u32
6254f38fcaSMauro Carvalho Chehab      - ``index``
6354f38fcaSMauro Carvalho Chehab      - Number of the format in the enumeration, set by the application.
6454f38fcaSMauro Carvalho Chehab    * - __u32
6554f38fcaSMauro Carvalho Chehab      - ``code``
6654f38fcaSMauro Carvalho Chehab      - The media bus format code, as defined in
6754f38fcaSMauro Carvalho Chehab	:ref:`v4l2-mbus-format`.
6854f38fcaSMauro Carvalho Chehab    * - __u32
6954f38fcaSMauro Carvalho Chehab      - ``which``
7054f38fcaSMauro Carvalho Chehab      - Media bus format codes to be enumerated, from enum
7154f38fcaSMauro Carvalho Chehab	:ref:`v4l2_subdev_format_whence <v4l2-subdev-format-whence>`.
7254f38fcaSMauro Carvalho Chehab    * - __u32
7362aacfa9SDafna Hirschfeld      - ``flags``
7462aacfa9SDafna Hirschfeld      - See :ref:`v4l2-subdev-mbus-code-flags`
7562aacfa9SDafna Hirschfeld    * - __u32
7662aacfa9SDafna Hirschfeld      - ``reserved``\ [7]
7754f38fcaSMauro Carvalho Chehab      - Reserved for future extensions. Applications and drivers must set
7854f38fcaSMauro Carvalho Chehab	the array to zero.
7954f38fcaSMauro Carvalho Chehab
8054f38fcaSMauro Carvalho Chehab
8162aacfa9SDafna Hirschfeld
8262aacfa9SDafna Hirschfeld.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{7.7cm}|
8362aacfa9SDafna Hirschfeld
8462aacfa9SDafna Hirschfeld.. _v4l2-subdev-mbus-code-flags:
8562aacfa9SDafna Hirschfeld
8662aacfa9SDafna Hirschfeld.. flat-table:: Subdev Media Bus Code Enumerate Flags
8762aacfa9SDafna Hirschfeld    :header-rows:  0
8862aacfa9SDafna Hirschfeld    :stub-columns: 0
8962aacfa9SDafna Hirschfeld    :widths:       1 1 2
9062aacfa9SDafna Hirschfeld
9162aacfa9SDafna Hirschfeld    * - V4L2_SUBDEV_MBUS_CODE_CSC_COLORSPACE
9262aacfa9SDafna Hirschfeld      - 0x00000001
9362aacfa9SDafna Hirschfeld      - The driver allows the application to try to change the default colorspace
9462aacfa9SDafna Hirschfeld	encoding. The application can ask to configure the colorspace of the
9562aacfa9SDafna Hirschfeld	subdevice when calling the :ref:`VIDIOC_SUBDEV_S_FMT <VIDIOC_SUBDEV_G_FMT>`
9662aacfa9SDafna Hirschfeld	ioctl with :ref:`V4L2_MBUS_FRAMEFMT_SET_CSC <mbus-framefmt-set-csc>` set.
9762aacfa9SDafna Hirschfeld	See :ref:`v4l2-mbus-format` on how to do this.
9862aacfa9SDafna Hirschfeld    * - V4L2_SUBDEV_MBUS_CODE_CSC_XFER_FUNC
9962aacfa9SDafna Hirschfeld      - 0x00000002
10062aacfa9SDafna Hirschfeld      - The driver allows the application to try to change the default transform function.
10162aacfa9SDafna Hirschfeld	The application can ask to configure the transform function of
10262aacfa9SDafna Hirschfeld	the subdevice when calling the :ref:`VIDIOC_SUBDEV_S_FMT <VIDIOC_SUBDEV_G_FMT>`
10362aacfa9SDafna Hirschfeld	ioctl with :ref:`V4L2_MBUS_FRAMEFMT_SET_CSC <mbus-framefmt-set-csc>` set.
10462aacfa9SDafna Hirschfeld	See :ref:`v4l2-mbus-format` on how to do this.
10562aacfa9SDafna Hirschfeld    * - V4L2_SUBDEV_MBUS_CODE_CSC_YCBCR_ENC
10662aacfa9SDafna Hirschfeld      - 0x00000004
10762aacfa9SDafna Hirschfeld      - The driver allows the application to try to change the default Y'CbCr
10862aacfa9SDafna Hirschfeld	encoding. The application can ask to configure the Y'CbCr encoding of the
10962aacfa9SDafna Hirschfeld	subdevice when calling the :ref:`VIDIOC_SUBDEV_S_FMT <VIDIOC_SUBDEV_G_FMT>`
11062aacfa9SDafna Hirschfeld	ioctl with :ref:`V4L2_MBUS_FRAMEFMT_SET_CSC <mbus-framefmt-set-csc>` set.
11162aacfa9SDafna Hirschfeld	See :ref:`v4l2-mbus-format` on how to do this.
11262aacfa9SDafna Hirschfeld    * - V4L2_SUBDEV_MBUS_CODE_CSC_HSV_ENC
11362aacfa9SDafna Hirschfeld      - 0x00000004
11462aacfa9SDafna Hirschfeld      - The driver allows the application to try to change the default HSV
11562aacfa9SDafna Hirschfeld	encoding. The application can ask to configure the HSV encoding of the
11662aacfa9SDafna Hirschfeld	subdevice when calling the :ref:`VIDIOC_SUBDEV_S_FMT <VIDIOC_SUBDEV_G_FMT>`
11762aacfa9SDafna Hirschfeld	ioctl with :ref:`V4L2_MBUS_FRAMEFMT_SET_CSC <mbus-framefmt-set-csc>` set.
11862aacfa9SDafna Hirschfeld	See :ref:`v4l2-mbus-format` on how to do this.
11962aacfa9SDafna Hirschfeld    * - V4L2_SUBDEV_MBUS_CODE_CSC_QUANTIZATION
12062aacfa9SDafna Hirschfeld      - 0x00000008
12162aacfa9SDafna Hirschfeld      - The driver allows the application to try to change the default
12262aacfa9SDafna Hirschfeld	quantization. The application can ask to configure the quantization of
12362aacfa9SDafna Hirschfeld	the subdevice when calling the :ref:`VIDIOC_SUBDEV_S_FMT <VIDIOC_SUBDEV_G_FMT>`
12462aacfa9SDafna Hirschfeld	ioctl with :ref:`V4L2_MBUS_FRAMEFMT_SET_CSC <mbus-framefmt-set-csc>` set.
12562aacfa9SDafna Hirschfeld	See :ref:`v4l2-mbus-format` on how to do this.
12662aacfa9SDafna Hirschfeld
12754f38fcaSMauro Carvalho ChehabReturn Value
12854f38fcaSMauro Carvalho Chehab============
12954f38fcaSMauro Carvalho Chehab
13054f38fcaSMauro Carvalho ChehabOn success 0 is returned, on error -1 and the ``errno`` variable is set
13154f38fcaSMauro Carvalho Chehabappropriately. The generic error codes are described at the
13254f38fcaSMauro Carvalho Chehab:ref:`Generic Error Codes <gen-errors>` chapter.
13354f38fcaSMauro Carvalho Chehab
13454f38fcaSMauro Carvalho ChehabEINVAL
13554f38fcaSMauro Carvalho Chehab    The struct
13654f38fcaSMauro Carvalho Chehab    :c:type:`v4l2_subdev_mbus_code_enum`
13754f38fcaSMauro Carvalho Chehab    ``pad`` references a non-existing pad, or the ``index`` field is out
13854f38fcaSMauro Carvalho Chehab    of bounds.
139