162306a36Sopenharmony_ci.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
262306a36Sopenharmony_ci.. c:namespace:: V4L
362306a36Sopenharmony_ci
462306a36Sopenharmony_ci.. _VIDIOC_G_EDID:
562306a36Sopenharmony_ci
662306a36Sopenharmony_ci******************************************************************************
762306a36Sopenharmony_ciioctl VIDIOC_G_EDID, VIDIOC_S_EDID, VIDIOC_SUBDEV_G_EDID, VIDIOC_SUBDEV_S_EDID
862306a36Sopenharmony_ci******************************************************************************
962306a36Sopenharmony_ci
1062306a36Sopenharmony_ciName
1162306a36Sopenharmony_ci====
1262306a36Sopenharmony_ci
1362306a36Sopenharmony_ciVIDIOC_G_EDID - VIDIOC_S_EDID - VIDIOC_SUBDEV_G_EDID - VIDIOC_SUBDEV_S_EDID - Get or set the EDID of a video receiver/transmitter
1462306a36Sopenharmony_ci
1562306a36Sopenharmony_ciSynopsis
1662306a36Sopenharmony_ci========
1762306a36Sopenharmony_ci
1862306a36Sopenharmony_ci.. c:macro:: VIDIOC_G_EDID
1962306a36Sopenharmony_ci
2062306a36Sopenharmony_ci``int ioctl(int fd, VIDIOC_G_EDID, struct v4l2_edid *argp)``
2162306a36Sopenharmony_ci
2262306a36Sopenharmony_ci.. c:macro:: VIDIOC_S_EDID
2362306a36Sopenharmony_ci
2462306a36Sopenharmony_ci``int ioctl(int fd, VIDIOC_S_EDID, struct v4l2_edid *argp)``
2562306a36Sopenharmony_ci
2662306a36Sopenharmony_ci.. c:macro:: VIDIOC_SUBDEV_G_EDID
2762306a36Sopenharmony_ci
2862306a36Sopenharmony_ci``int ioctl(int fd, VIDIOC_SUBDEV_G_EDID, struct v4l2_edid *argp)``
2962306a36Sopenharmony_ci
3062306a36Sopenharmony_ci.. c:macro:: VIDIOC_SUBDEV_S_EDID
3162306a36Sopenharmony_ci
3262306a36Sopenharmony_ci``int ioctl(int fd, VIDIOC_SUBDEV_S_EDID, struct v4l2_edid *argp)``
3362306a36Sopenharmony_ci
3462306a36Sopenharmony_ciArguments
3562306a36Sopenharmony_ci=========
3662306a36Sopenharmony_ci
3762306a36Sopenharmony_ci``fd``
3862306a36Sopenharmony_ci    File descriptor returned by :c:func:`open()`.
3962306a36Sopenharmony_ci
4062306a36Sopenharmony_ci``argp``
4162306a36Sopenharmony_ci   Pointer to struct :c:type:`v4l2_edid`.
4262306a36Sopenharmony_ci
4362306a36Sopenharmony_ciDescription
4462306a36Sopenharmony_ci===========
4562306a36Sopenharmony_ci
4662306a36Sopenharmony_ciThese ioctls can be used to get or set an EDID associated with an input
4762306a36Sopenharmony_cifrom a receiver or an output of a transmitter device. They can be used
4862306a36Sopenharmony_ciwith subdevice nodes (/dev/v4l-subdevX) or with video nodes
4962306a36Sopenharmony_ci(/dev/videoX).
5062306a36Sopenharmony_ci
5162306a36Sopenharmony_ciWhen used with video nodes the ``pad`` field represents the input (for
5262306a36Sopenharmony_civideo capture devices) or output (for video output devices) index as is
5362306a36Sopenharmony_cireturned by :ref:`VIDIOC_ENUMINPUT` and
5462306a36Sopenharmony_ci:ref:`VIDIOC_ENUMOUTPUT` respectively. When used
5562306a36Sopenharmony_ciwith subdevice nodes the ``pad`` field represents the input or output
5662306a36Sopenharmony_cipad of the subdevice. If there is no EDID support for the given ``pad``
5762306a36Sopenharmony_civalue, then the ``EINVAL`` error code will be returned.
5862306a36Sopenharmony_ci
5962306a36Sopenharmony_ciTo get the EDID data the application has to fill in the ``pad``,
6062306a36Sopenharmony_ci``start_block``, ``blocks`` and ``edid`` fields, zero the ``reserved``
6162306a36Sopenharmony_ciarray and call :ref:`VIDIOC_G_EDID <VIDIOC_G_EDID>`. The current EDID from block
6262306a36Sopenharmony_ci``start_block`` and of size ``blocks`` will be placed in the memory
6362306a36Sopenharmony_ci``edid`` points to. The ``edid`` pointer must point to memory at least
6462306a36Sopenharmony_ci``blocks`` * 128 bytes large (the size of one block is 128 bytes).
6562306a36Sopenharmony_ci
6662306a36Sopenharmony_ciIf there are fewer blocks than specified, then the driver will set
6762306a36Sopenharmony_ci``blocks`` to the actual number of blocks. If there are no EDID blocks
6862306a36Sopenharmony_ciavailable at all, then the error code ``ENODATA`` is set.
6962306a36Sopenharmony_ci
7062306a36Sopenharmony_ciIf blocks have to be retrieved from the sink, then this call will block
7162306a36Sopenharmony_ciuntil they have been read.
7262306a36Sopenharmony_ci
7362306a36Sopenharmony_ciIf ``start_block`` and ``blocks`` are both set to 0 when
7462306a36Sopenharmony_ci:ref:`VIDIOC_G_EDID <VIDIOC_G_EDID>` is called, then the driver will set ``blocks`` to the
7562306a36Sopenharmony_citotal number of available EDID blocks and it will return 0 without
7662306a36Sopenharmony_cicopying any data. This is an easy way to discover how many EDID blocks
7762306a36Sopenharmony_cithere are.
7862306a36Sopenharmony_ci
7962306a36Sopenharmony_ci.. note::
8062306a36Sopenharmony_ci
8162306a36Sopenharmony_ci   If there are no EDID blocks available at all, then
8262306a36Sopenharmony_ci   the driver will set ``blocks`` to 0 and it returns 0.
8362306a36Sopenharmony_ci
8462306a36Sopenharmony_ciTo set the EDID blocks of a receiver the application has to fill in the
8562306a36Sopenharmony_ci``pad``, ``blocks`` and ``edid`` fields, set ``start_block`` to 0 and
8662306a36Sopenharmony_cizero the ``reserved`` array. It is not possible to set part of an EDID,
8762306a36Sopenharmony_ciit is always all or nothing. Setting the EDID data is only valid for
8862306a36Sopenharmony_cireceivers as it makes no sense for a transmitter.
8962306a36Sopenharmony_ci
9062306a36Sopenharmony_ciThe driver assumes that the full EDID is passed in. If there are more
9162306a36Sopenharmony_ciEDID blocks than the hardware can handle then the EDID is not written,
9262306a36Sopenharmony_cibut instead the error code ``E2BIG`` is set and ``blocks`` is set to the
9362306a36Sopenharmony_cimaximum that the hardware supports. If ``start_block`` is any value
9462306a36Sopenharmony_ciother than 0 then the error code ``EINVAL`` is set.
9562306a36Sopenharmony_ci
9662306a36Sopenharmony_ciTo disable an EDID you set ``blocks`` to 0. Depending on the hardware
9762306a36Sopenharmony_cithis will drive the hotplug pin low and/or block the source from reading
9862306a36Sopenharmony_cithe EDID data in some way. In any case, the end result is the same: the
9962306a36Sopenharmony_ciEDID is no longer available.
10062306a36Sopenharmony_ci
10162306a36Sopenharmony_ci.. c:type:: v4l2_edid
10262306a36Sopenharmony_ci
10362306a36Sopenharmony_ci.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.5cm}|
10462306a36Sopenharmony_ci
10562306a36Sopenharmony_ci.. flat-table:: struct v4l2_edid
10662306a36Sopenharmony_ci    :header-rows:  0
10762306a36Sopenharmony_ci    :stub-columns: 0
10862306a36Sopenharmony_ci    :widths:       1 1 2
10962306a36Sopenharmony_ci
11062306a36Sopenharmony_ci    * - __u32
11162306a36Sopenharmony_ci      - ``pad``
11262306a36Sopenharmony_ci      - Pad for which to get/set the EDID blocks. When used with a video
11362306a36Sopenharmony_ci	device node the pad represents the input or output index as
11462306a36Sopenharmony_ci	returned by :ref:`VIDIOC_ENUMINPUT` and
11562306a36Sopenharmony_ci	:ref:`VIDIOC_ENUMOUTPUT` respectively.
11662306a36Sopenharmony_ci    * - __u32
11762306a36Sopenharmony_ci      - ``start_block``
11862306a36Sopenharmony_ci      - Read the EDID from starting with this block. Must be 0 when
11962306a36Sopenharmony_ci	setting the EDID.
12062306a36Sopenharmony_ci    * - __u32
12162306a36Sopenharmony_ci      - ``blocks``
12262306a36Sopenharmony_ci      - The number of blocks to get or set. Must be less or equal to 256
12362306a36Sopenharmony_ci	(the maximum number of blocks as defined by the standard). When
12462306a36Sopenharmony_ci	you set the EDID and ``blocks`` is 0, then the EDID is disabled or
12562306a36Sopenharmony_ci	erased.
12662306a36Sopenharmony_ci    * - __u32
12762306a36Sopenharmony_ci      - ``reserved``\ [5]
12862306a36Sopenharmony_ci      - Reserved for future extensions. Applications and drivers must set
12962306a36Sopenharmony_ci	the array to zero.
13062306a36Sopenharmony_ci    * - __u8 *
13162306a36Sopenharmony_ci      - ``edid``
13262306a36Sopenharmony_ci      - Pointer to memory that contains the EDID. The minimum size is
13362306a36Sopenharmony_ci	``blocks`` * 128.
13462306a36Sopenharmony_ci
13562306a36Sopenharmony_ciReturn Value
13662306a36Sopenharmony_ci============
13762306a36Sopenharmony_ci
13862306a36Sopenharmony_ciOn success 0 is returned, on error -1 and the ``errno`` variable is set
13962306a36Sopenharmony_ciappropriately. The generic error codes are described at the
14062306a36Sopenharmony_ci:ref:`Generic Error Codes <gen-errors>` chapter.
14162306a36Sopenharmony_ci
14262306a36Sopenharmony_ci``ENODATA``
14362306a36Sopenharmony_ci    The EDID data is not available.
14462306a36Sopenharmony_ci
14562306a36Sopenharmony_ci``E2BIG``
14662306a36Sopenharmony_ci    The EDID data you provided is more than the hardware can handle.
147