18c2ecf20Sopenharmony_ci.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
28c2ecf20Sopenharmony_ci.. c:namespace:: V4L
38c2ecf20Sopenharmony_ci
48c2ecf20Sopenharmony_ci.. _VIDIOC_G_EDID:
58c2ecf20Sopenharmony_ci
68c2ecf20Sopenharmony_ci******************************************************************************
78c2ecf20Sopenharmony_ciioctl VIDIOC_G_EDID, VIDIOC_S_EDID, VIDIOC_SUBDEV_G_EDID, VIDIOC_SUBDEV_S_EDID
88c2ecf20Sopenharmony_ci******************************************************************************
98c2ecf20Sopenharmony_ci
108c2ecf20Sopenharmony_ciName
118c2ecf20Sopenharmony_ci====
128c2ecf20Sopenharmony_ci
138c2ecf20Sopenharmony_ciVIDIOC_G_EDID - VIDIOC_S_EDID - VIDIOC_SUBDEV_G_EDID - VIDIOC_SUBDEV_S_EDID - Get or set the EDID of a video receiver/transmitter
148c2ecf20Sopenharmony_ci
158c2ecf20Sopenharmony_ciSynopsis
168c2ecf20Sopenharmony_ci========
178c2ecf20Sopenharmony_ci
188c2ecf20Sopenharmony_ci.. c:macro:: VIDIOC_G_EDID
198c2ecf20Sopenharmony_ci
208c2ecf20Sopenharmony_ci``int ioctl(int fd, VIDIOC_G_EDID, struct v4l2_edid *argp)``
218c2ecf20Sopenharmony_ci
228c2ecf20Sopenharmony_ci.. c:macro:: VIDIOC_S_EDID
238c2ecf20Sopenharmony_ci
248c2ecf20Sopenharmony_ci``int ioctl(int fd, VIDIOC_S_EDID, struct v4l2_edid *argp)``
258c2ecf20Sopenharmony_ci
268c2ecf20Sopenharmony_ci.. c:macro:: VIDIOC_SUBDEV_G_EDID
278c2ecf20Sopenharmony_ci
288c2ecf20Sopenharmony_ci``int ioctl(int fd, VIDIOC_SUBDEV_G_EDID, struct v4l2_edid *argp)``
298c2ecf20Sopenharmony_ci
308c2ecf20Sopenharmony_ci.. c:macro:: VIDIOC_SUBDEV_S_EDID
318c2ecf20Sopenharmony_ci
328c2ecf20Sopenharmony_ci``int ioctl(int fd, VIDIOC_SUBDEV_S_EDID, struct v4l2_edid *argp)``
338c2ecf20Sopenharmony_ci
348c2ecf20Sopenharmony_ciArguments
358c2ecf20Sopenharmony_ci=========
368c2ecf20Sopenharmony_ci
378c2ecf20Sopenharmony_ci``fd``
388c2ecf20Sopenharmony_ci    File descriptor returned by :c:func:`open()`.
398c2ecf20Sopenharmony_ci
408c2ecf20Sopenharmony_ci``argp``
418c2ecf20Sopenharmony_ci   Pointer to struct :c:type:`v4l2_edid`.
428c2ecf20Sopenharmony_ci
438c2ecf20Sopenharmony_ciDescription
448c2ecf20Sopenharmony_ci===========
458c2ecf20Sopenharmony_ci
468c2ecf20Sopenharmony_ciThese ioctls can be used to get or set an EDID associated with an input
478c2ecf20Sopenharmony_cifrom a receiver or an output of a transmitter device. They can be used
488c2ecf20Sopenharmony_ciwith subdevice nodes (/dev/v4l-subdevX) or with video nodes
498c2ecf20Sopenharmony_ci(/dev/videoX).
508c2ecf20Sopenharmony_ci
518c2ecf20Sopenharmony_ciWhen used with video nodes the ``pad`` field represents the input (for
528c2ecf20Sopenharmony_civideo capture devices) or output (for video output devices) index as is
538c2ecf20Sopenharmony_cireturned by :ref:`VIDIOC_ENUMINPUT` and
548c2ecf20Sopenharmony_ci:ref:`VIDIOC_ENUMOUTPUT` respectively. When used
558c2ecf20Sopenharmony_ciwith subdevice nodes the ``pad`` field represents the input or output
568c2ecf20Sopenharmony_cipad of the subdevice. If there is no EDID support for the given ``pad``
578c2ecf20Sopenharmony_civalue, then the ``EINVAL`` error code will be returned.
588c2ecf20Sopenharmony_ci
598c2ecf20Sopenharmony_ciTo get the EDID data the application has to fill in the ``pad``,
608c2ecf20Sopenharmony_ci``start_block``, ``blocks`` and ``edid`` fields, zero the ``reserved``
618c2ecf20Sopenharmony_ciarray and call :ref:`VIDIOC_G_EDID <VIDIOC_G_EDID>`. The current EDID from block
628c2ecf20Sopenharmony_ci``start_block`` and of size ``blocks`` will be placed in the memory
638c2ecf20Sopenharmony_ci``edid`` points to. The ``edid`` pointer must point to memory at least
648c2ecf20Sopenharmony_ci``blocks`` * 128 bytes large (the size of one block is 128 bytes).
658c2ecf20Sopenharmony_ci
668c2ecf20Sopenharmony_ciIf there are fewer blocks than specified, then the driver will set
678c2ecf20Sopenharmony_ci``blocks`` to the actual number of blocks. If there are no EDID blocks
688c2ecf20Sopenharmony_ciavailable at all, then the error code ``ENODATA`` is set.
698c2ecf20Sopenharmony_ci
708c2ecf20Sopenharmony_ciIf blocks have to be retrieved from the sink, then this call will block
718c2ecf20Sopenharmony_ciuntil they have been read.
728c2ecf20Sopenharmony_ci
738c2ecf20Sopenharmony_ciIf ``start_block`` and ``blocks`` are both set to 0 when
748c2ecf20Sopenharmony_ci:ref:`VIDIOC_G_EDID <VIDIOC_G_EDID>` is called, then the driver will set ``blocks`` to the
758c2ecf20Sopenharmony_citotal number of available EDID blocks and it will return 0 without
768c2ecf20Sopenharmony_cicopying any data. This is an easy way to discover how many EDID blocks
778c2ecf20Sopenharmony_cithere are.
788c2ecf20Sopenharmony_ci
798c2ecf20Sopenharmony_ci.. note::
808c2ecf20Sopenharmony_ci
818c2ecf20Sopenharmony_ci   If there are no EDID blocks available at all, then
828c2ecf20Sopenharmony_ci   the driver will set ``blocks`` to 0 and it returns 0.
838c2ecf20Sopenharmony_ci
848c2ecf20Sopenharmony_ciTo set the EDID blocks of a receiver the application has to fill in the
858c2ecf20Sopenharmony_ci``pad``, ``blocks`` and ``edid`` fields, set ``start_block`` to 0 and
868c2ecf20Sopenharmony_cizero the ``reserved`` array. It is not possible to set part of an EDID,
878c2ecf20Sopenharmony_ciit is always all or nothing. Setting the EDID data is only valid for
888c2ecf20Sopenharmony_cireceivers as it makes no sense for a transmitter.
898c2ecf20Sopenharmony_ci
908c2ecf20Sopenharmony_ciThe driver assumes that the full EDID is passed in. If there are more
918c2ecf20Sopenharmony_ciEDID blocks than the hardware can handle then the EDID is not written,
928c2ecf20Sopenharmony_cibut instead the error code ``E2BIG`` is set and ``blocks`` is set to the
938c2ecf20Sopenharmony_cimaximum that the hardware supports. If ``start_block`` is any value
948c2ecf20Sopenharmony_ciother than 0 then the error code ``EINVAL`` is set.
958c2ecf20Sopenharmony_ci
968c2ecf20Sopenharmony_ciTo disable an EDID you set ``blocks`` to 0. Depending on the hardware
978c2ecf20Sopenharmony_cithis will drive the hotplug pin low and/or block the source from reading
988c2ecf20Sopenharmony_cithe EDID data in some way. In any case, the end result is the same: the
998c2ecf20Sopenharmony_ciEDID is no longer available.
1008c2ecf20Sopenharmony_ci
1018c2ecf20Sopenharmony_ci.. c:type:: v4l2_edid
1028c2ecf20Sopenharmony_ci
1038c2ecf20Sopenharmony_ci.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}|
1048c2ecf20Sopenharmony_ci
1058c2ecf20Sopenharmony_ci.. flat-table:: struct v4l2_edid
1068c2ecf20Sopenharmony_ci    :header-rows:  0
1078c2ecf20Sopenharmony_ci    :stub-columns: 0
1088c2ecf20Sopenharmony_ci    :widths:       1 1 2
1098c2ecf20Sopenharmony_ci
1108c2ecf20Sopenharmony_ci    * - __u32
1118c2ecf20Sopenharmony_ci      - ``pad``
1128c2ecf20Sopenharmony_ci      - Pad for which to get/set the EDID blocks. When used with a video
1138c2ecf20Sopenharmony_ci	device node the pad represents the input or output index as
1148c2ecf20Sopenharmony_ci	returned by :ref:`VIDIOC_ENUMINPUT` and
1158c2ecf20Sopenharmony_ci	:ref:`VIDIOC_ENUMOUTPUT` respectively.
1168c2ecf20Sopenharmony_ci    * - __u32
1178c2ecf20Sopenharmony_ci      - ``start_block``
1188c2ecf20Sopenharmony_ci      - Read the EDID from starting with this block. Must be 0 when
1198c2ecf20Sopenharmony_ci	setting the EDID.
1208c2ecf20Sopenharmony_ci    * - __u32
1218c2ecf20Sopenharmony_ci      - ``blocks``
1228c2ecf20Sopenharmony_ci      - The number of blocks to get or set. Must be less or equal to 256
1238c2ecf20Sopenharmony_ci	(the maximum number of blocks as defined by the standard). When
1248c2ecf20Sopenharmony_ci	you set the EDID and ``blocks`` is 0, then the EDID is disabled or
1258c2ecf20Sopenharmony_ci	erased.
1268c2ecf20Sopenharmony_ci    * - __u32
1278c2ecf20Sopenharmony_ci      - ``reserved``\ [5]
1288c2ecf20Sopenharmony_ci      - Reserved for future extensions. Applications and drivers must set
1298c2ecf20Sopenharmony_ci	the array to zero.
1308c2ecf20Sopenharmony_ci    * - __u8 *
1318c2ecf20Sopenharmony_ci      - ``edid``
1328c2ecf20Sopenharmony_ci      - Pointer to memory that contains the EDID. The minimum size is
1338c2ecf20Sopenharmony_ci	``blocks`` * 128.
1348c2ecf20Sopenharmony_ci
1358c2ecf20Sopenharmony_ciReturn Value
1368c2ecf20Sopenharmony_ci============
1378c2ecf20Sopenharmony_ci
1388c2ecf20Sopenharmony_ciOn success 0 is returned, on error -1 and the ``errno`` variable is set
1398c2ecf20Sopenharmony_ciappropriately. The generic error codes are described at the
1408c2ecf20Sopenharmony_ci:ref:`Generic Error Codes <gen-errors>` chapter.
1418c2ecf20Sopenharmony_ci
1428c2ecf20Sopenharmony_ci``ENODATA``
1438c2ecf20Sopenharmony_ci    The EDID data is not available.
1448c2ecf20Sopenharmony_ci
1458c2ecf20Sopenharmony_ci``E2BIG``
1468c2ecf20Sopenharmony_ci    The EDID data you provided is more than the hardware can handle.
147