xref: /linux/Documentation/userspace-api/media/v4l/vidioc-subdev-enum-mbus-code.rst (revision fea13a6935c79896a53a8ede32b0b6f6bce5042c)
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
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
51*fea13a69SMauro Carvalho Chehab.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.5cm}|
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.. _v4l2-subdev-mbus-code-flags:
8362aacfa9SDafna Hirschfeld
84*fea13a69SMauro Carvalho Chehab.. raw:: latex
85*fea13a69SMauro Carvalho Chehab
86*fea13a69SMauro Carvalho Chehab   \footnotesize
87*fea13a69SMauro Carvalho Chehab
88*fea13a69SMauro Carvalho Chehab.. tabularcolumns:: |p{8.8cm}|p{2.2cm}|p{6.3cm}|
89*fea13a69SMauro Carvalho Chehab
9062aacfa9SDafna Hirschfeld.. flat-table:: Subdev Media Bus Code Enumerate Flags
9162aacfa9SDafna Hirschfeld    :header-rows:  0
9262aacfa9SDafna Hirschfeld    :stub-columns: 0
9362aacfa9SDafna Hirschfeld    :widths:       1 1 2
9462aacfa9SDafna Hirschfeld
9562aacfa9SDafna Hirschfeld    * - V4L2_SUBDEV_MBUS_CODE_CSC_COLORSPACE
9662aacfa9SDafna Hirschfeld      - 0x00000001
9762aacfa9SDafna Hirschfeld      - The driver allows the application to try to change the default colorspace
9862aacfa9SDafna Hirschfeld	encoding. The application can ask to configure the colorspace of the
9962aacfa9SDafna Hirschfeld	subdevice when calling the :ref:`VIDIOC_SUBDEV_S_FMT <VIDIOC_SUBDEV_G_FMT>`
10062aacfa9SDafna Hirschfeld	ioctl with :ref:`V4L2_MBUS_FRAMEFMT_SET_CSC <mbus-framefmt-set-csc>` set.
10162aacfa9SDafna Hirschfeld	See :ref:`v4l2-mbus-format` on how to do this.
10262aacfa9SDafna Hirschfeld    * - V4L2_SUBDEV_MBUS_CODE_CSC_XFER_FUNC
10362aacfa9SDafna Hirschfeld      - 0x00000002
10462aacfa9SDafna Hirschfeld      - The driver allows the application to try to change the default transform function.
10562aacfa9SDafna Hirschfeld	The application can ask to configure the transform function of
10662aacfa9SDafna Hirschfeld	the subdevice when calling the :ref:`VIDIOC_SUBDEV_S_FMT <VIDIOC_SUBDEV_G_FMT>`
10762aacfa9SDafna Hirschfeld	ioctl with :ref:`V4L2_MBUS_FRAMEFMT_SET_CSC <mbus-framefmt-set-csc>` set.
10862aacfa9SDafna Hirschfeld	See :ref:`v4l2-mbus-format` on how to do this.
10962aacfa9SDafna Hirschfeld    * - V4L2_SUBDEV_MBUS_CODE_CSC_YCBCR_ENC
11062aacfa9SDafna Hirschfeld      - 0x00000004
11162aacfa9SDafna Hirschfeld      - The driver allows the application to try to change the default Y'CbCr
11262aacfa9SDafna Hirschfeld	encoding. The application can ask to configure the Y'CbCr encoding of the
11362aacfa9SDafna Hirschfeld	subdevice when calling the :ref:`VIDIOC_SUBDEV_S_FMT <VIDIOC_SUBDEV_G_FMT>`
11462aacfa9SDafna Hirschfeld	ioctl with :ref:`V4L2_MBUS_FRAMEFMT_SET_CSC <mbus-framefmt-set-csc>` set.
11562aacfa9SDafna Hirschfeld	See :ref:`v4l2-mbus-format` on how to do this.
11662aacfa9SDafna Hirschfeld    * - V4L2_SUBDEV_MBUS_CODE_CSC_HSV_ENC
11762aacfa9SDafna Hirschfeld      - 0x00000004
11862aacfa9SDafna Hirschfeld      - The driver allows the application to try to change the default HSV
11962aacfa9SDafna Hirschfeld	encoding. The application can ask to configure the HSV encoding of the
12062aacfa9SDafna Hirschfeld	subdevice when calling the :ref:`VIDIOC_SUBDEV_S_FMT <VIDIOC_SUBDEV_G_FMT>`
12162aacfa9SDafna Hirschfeld	ioctl with :ref:`V4L2_MBUS_FRAMEFMT_SET_CSC <mbus-framefmt-set-csc>` set.
12262aacfa9SDafna Hirschfeld	See :ref:`v4l2-mbus-format` on how to do this.
12362aacfa9SDafna Hirschfeld    * - V4L2_SUBDEV_MBUS_CODE_CSC_QUANTIZATION
12462aacfa9SDafna Hirschfeld      - 0x00000008
12562aacfa9SDafna Hirschfeld      - The driver allows the application to try to change the default
12662aacfa9SDafna Hirschfeld	quantization. The application can ask to configure the quantization of
12762aacfa9SDafna Hirschfeld	the subdevice when calling the :ref:`VIDIOC_SUBDEV_S_FMT <VIDIOC_SUBDEV_G_FMT>`
12862aacfa9SDafna Hirschfeld	ioctl with :ref:`V4L2_MBUS_FRAMEFMT_SET_CSC <mbus-framefmt-set-csc>` set.
12962aacfa9SDafna Hirschfeld	See :ref:`v4l2-mbus-format` on how to do this.
13062aacfa9SDafna Hirschfeld
131*fea13a69SMauro Carvalho Chehab.. raw:: latex
132*fea13a69SMauro Carvalho Chehab
133*fea13a69SMauro Carvalho Chehab   \normalsize
134*fea13a69SMauro Carvalho Chehab
13554f38fcaSMauro Carvalho ChehabReturn Value
13654f38fcaSMauro Carvalho Chehab============
13754f38fcaSMauro Carvalho Chehab
13854f38fcaSMauro Carvalho ChehabOn success 0 is returned, on error -1 and the ``errno`` variable is set
13954f38fcaSMauro Carvalho Chehabappropriately. The generic error codes are described at the
14054f38fcaSMauro Carvalho Chehab:ref:`Generic Error Codes <gen-errors>` chapter.
14154f38fcaSMauro Carvalho Chehab
14254f38fcaSMauro Carvalho ChehabEINVAL
14354f38fcaSMauro Carvalho Chehab    The struct
14454f38fcaSMauro Carvalho Chehab    :c:type:`v4l2_subdev_mbus_code_enum`
14554f38fcaSMauro Carvalho Chehab    ``pad`` references a non-existing pad, or the ``index`` field is out
14654f38fcaSMauro Carvalho Chehab    of bounds.
147