xref: /linux/Documentation/userspace-api/media/v4l/vidioc-g-edid.rst (revision 8be98d2f2a0a262f8bf8a0bc1fdf522b3c7aab17)
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_G_EDID:
554f38fcaSMauro Carvalho Chehab
654f38fcaSMauro Carvalho Chehab******************************************************************************
754f38fcaSMauro Carvalho Chehabioctl VIDIOC_G_EDID, VIDIOC_S_EDID, VIDIOC_SUBDEV_G_EDID, VIDIOC_SUBDEV_S_EDID
854f38fcaSMauro Carvalho Chehab******************************************************************************
954f38fcaSMauro Carvalho Chehab
1054f38fcaSMauro Carvalho ChehabName
1154f38fcaSMauro Carvalho Chehab====
1254f38fcaSMauro Carvalho Chehab
1354f38fcaSMauro Carvalho ChehabVIDIOC_G_EDID - VIDIOC_S_EDID - VIDIOC_SUBDEV_G_EDID - VIDIOC_SUBDEV_S_EDID - Get or set the EDID of a video receiver/transmitter
1454f38fcaSMauro Carvalho Chehab
1554f38fcaSMauro Carvalho ChehabSynopsis
1654f38fcaSMauro Carvalho Chehab========
1754f38fcaSMauro Carvalho Chehab
18407e84cdSMauro Carvalho Chehab.. c:macro:: VIDIOC_G_EDID
1954f38fcaSMauro Carvalho Chehab
20407e84cdSMauro Carvalho Chehab``int ioctl(int fd, VIDIOC_G_EDID, struct v4l2_edid *argp)``
2154f38fcaSMauro Carvalho Chehab
22407e84cdSMauro Carvalho Chehab.. c:macro:: VIDIOC_S_EDID
2354f38fcaSMauro Carvalho Chehab
24407e84cdSMauro Carvalho Chehab``int ioctl(int fd, VIDIOC_S_EDID, struct v4l2_edid *argp)``
2554f38fcaSMauro Carvalho Chehab
26407e84cdSMauro Carvalho Chehab.. c:macro:: VIDIOC_SUBDEV_G_EDID
2754f38fcaSMauro Carvalho Chehab
28407e84cdSMauro Carvalho Chehab``int ioctl(int fd, VIDIOC_SUBDEV_G_EDID, struct v4l2_edid *argp)``
29407e84cdSMauro Carvalho Chehab
30407e84cdSMauro Carvalho Chehab.. c:macro:: VIDIOC_SUBDEV_S_EDID
31407e84cdSMauro Carvalho Chehab
32407e84cdSMauro Carvalho Chehab``int ioctl(int fd, VIDIOC_SUBDEV_S_EDID, struct v4l2_edid *argp)``
3354f38fcaSMauro Carvalho Chehab
3454f38fcaSMauro Carvalho ChehabArguments
3554f38fcaSMauro Carvalho Chehab=========
3654f38fcaSMauro Carvalho Chehab
3754f38fcaSMauro Carvalho Chehab``fd``
38407e84cdSMauro Carvalho Chehab    File descriptor returned by :c:func:`open()`.
3954f38fcaSMauro Carvalho Chehab
4054f38fcaSMauro Carvalho Chehab``argp``
4154f38fcaSMauro Carvalho Chehab   Pointer to struct :c:type:`v4l2_edid`.
4254f38fcaSMauro Carvalho Chehab
4354f38fcaSMauro Carvalho ChehabDescription
4454f38fcaSMauro Carvalho Chehab===========
4554f38fcaSMauro Carvalho Chehab
4654f38fcaSMauro Carvalho ChehabThese ioctls can be used to get or set an EDID associated with an input
4754f38fcaSMauro Carvalho Chehabfrom a receiver or an output of a transmitter device. They can be used
4854f38fcaSMauro Carvalho Chehabwith subdevice nodes (/dev/v4l-subdevX) or with video nodes
4954f38fcaSMauro Carvalho Chehab(/dev/videoX).
5054f38fcaSMauro Carvalho Chehab
5154f38fcaSMauro Carvalho ChehabWhen used with video nodes the ``pad`` field represents the input (for
5254f38fcaSMauro Carvalho Chehabvideo capture devices) or output (for video output devices) index as is
5354f38fcaSMauro Carvalho Chehabreturned by :ref:`VIDIOC_ENUMINPUT` and
5454f38fcaSMauro Carvalho Chehab:ref:`VIDIOC_ENUMOUTPUT` respectively. When used
5554f38fcaSMauro Carvalho Chehabwith subdevice nodes the ``pad`` field represents the input or output
5654f38fcaSMauro Carvalho Chehabpad of the subdevice. If there is no EDID support for the given ``pad``
5754f38fcaSMauro Carvalho Chehabvalue, then the ``EINVAL`` error code will be returned.
5854f38fcaSMauro Carvalho Chehab
5954f38fcaSMauro Carvalho ChehabTo get the EDID data the application has to fill in the ``pad``,
6054f38fcaSMauro Carvalho Chehab``start_block``, ``blocks`` and ``edid`` fields, zero the ``reserved``
6154f38fcaSMauro Carvalho Chehabarray and call :ref:`VIDIOC_G_EDID <VIDIOC_G_EDID>`. The current EDID from block
6254f38fcaSMauro Carvalho Chehab``start_block`` and of size ``blocks`` will be placed in the memory
6354f38fcaSMauro Carvalho Chehab``edid`` points to. The ``edid`` pointer must point to memory at least
6454f38fcaSMauro Carvalho Chehab``blocks`` * 128 bytes large (the size of one block is 128 bytes).
6554f38fcaSMauro Carvalho Chehab
6654f38fcaSMauro Carvalho ChehabIf there are fewer blocks than specified, then the driver will set
6754f38fcaSMauro Carvalho Chehab``blocks`` to the actual number of blocks. If there are no EDID blocks
6854f38fcaSMauro Carvalho Chehabavailable at all, then the error code ``ENODATA`` is set.
6954f38fcaSMauro Carvalho Chehab
7054f38fcaSMauro Carvalho ChehabIf blocks have to be retrieved from the sink, then this call will block
7154f38fcaSMauro Carvalho Chehabuntil they have been read.
7254f38fcaSMauro Carvalho Chehab
7354f38fcaSMauro Carvalho ChehabIf ``start_block`` and ``blocks`` are both set to 0 when
7454f38fcaSMauro Carvalho Chehab:ref:`VIDIOC_G_EDID <VIDIOC_G_EDID>` is called, then the driver will set ``blocks`` to the
7554f38fcaSMauro Carvalho Chehabtotal number of available EDID blocks and it will return 0 without
7654f38fcaSMauro Carvalho Chehabcopying any data. This is an easy way to discover how many EDID blocks
7754f38fcaSMauro Carvalho Chehabthere are.
7854f38fcaSMauro Carvalho Chehab
7954f38fcaSMauro Carvalho Chehab.. note::
8054f38fcaSMauro Carvalho Chehab
8154f38fcaSMauro Carvalho Chehab   If there are no EDID blocks available at all, then
8254f38fcaSMauro Carvalho Chehab   the driver will set ``blocks`` to 0 and it returns 0.
8354f38fcaSMauro Carvalho Chehab
8454f38fcaSMauro Carvalho ChehabTo set the EDID blocks of a receiver the application has to fill in the
8554f38fcaSMauro Carvalho Chehab``pad``, ``blocks`` and ``edid`` fields, set ``start_block`` to 0 and
8654f38fcaSMauro Carvalho Chehabzero the ``reserved`` array. It is not possible to set part of an EDID,
8754f38fcaSMauro Carvalho Chehabit is always all or nothing. Setting the EDID data is only valid for
8854f38fcaSMauro Carvalho Chehabreceivers as it makes no sense for a transmitter.
8954f38fcaSMauro Carvalho Chehab
9054f38fcaSMauro Carvalho ChehabThe driver assumes that the full EDID is passed in. If there are more
9154f38fcaSMauro Carvalho ChehabEDID blocks than the hardware can handle then the EDID is not written,
9254f38fcaSMauro Carvalho Chehabbut instead the error code ``E2BIG`` is set and ``blocks`` is set to the
9354f38fcaSMauro Carvalho Chehabmaximum that the hardware supports. If ``start_block`` is any value
9454f38fcaSMauro Carvalho Chehabother than 0 then the error code ``EINVAL`` is set.
9554f38fcaSMauro Carvalho Chehab
9654f38fcaSMauro Carvalho ChehabTo disable an EDID you set ``blocks`` to 0. Depending on the hardware
9754f38fcaSMauro Carvalho Chehabthis will drive the hotplug pin low and/or block the source from reading
9854f38fcaSMauro Carvalho Chehabthe EDID data in some way. In any case, the end result is the same: the
9954f38fcaSMauro Carvalho ChehabEDID is no longer available.
10054f38fcaSMauro Carvalho Chehab
10154f38fcaSMauro Carvalho Chehab.. c:type:: v4l2_edid
10254f38fcaSMauro Carvalho Chehab
103*fea13a69SMauro Carvalho Chehab.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.5cm}|
10454f38fcaSMauro Carvalho Chehab
10554f38fcaSMauro Carvalho Chehab.. flat-table:: struct v4l2_edid
10654f38fcaSMauro Carvalho Chehab    :header-rows:  0
10754f38fcaSMauro Carvalho Chehab    :stub-columns: 0
10854f38fcaSMauro Carvalho Chehab    :widths:       1 1 2
10954f38fcaSMauro Carvalho Chehab
11054f38fcaSMauro Carvalho Chehab    * - __u32
11154f38fcaSMauro Carvalho Chehab      - ``pad``
11254f38fcaSMauro Carvalho Chehab      - Pad for which to get/set the EDID blocks. When used with a video
11354f38fcaSMauro Carvalho Chehab	device node the pad represents the input or output index as
11454f38fcaSMauro Carvalho Chehab	returned by :ref:`VIDIOC_ENUMINPUT` and
11554f38fcaSMauro Carvalho Chehab	:ref:`VIDIOC_ENUMOUTPUT` respectively.
11654f38fcaSMauro Carvalho Chehab    * - __u32
11754f38fcaSMauro Carvalho Chehab      - ``start_block``
11854f38fcaSMauro Carvalho Chehab      - Read the EDID from starting with this block. Must be 0 when
11954f38fcaSMauro Carvalho Chehab	setting the EDID.
12054f38fcaSMauro Carvalho Chehab    * - __u32
12154f38fcaSMauro Carvalho Chehab      - ``blocks``
12254f38fcaSMauro Carvalho Chehab      - The number of blocks to get or set. Must be less or equal to 256
12354f38fcaSMauro Carvalho Chehab	(the maximum number of blocks as defined by the standard). When
12454f38fcaSMauro Carvalho Chehab	you set the EDID and ``blocks`` is 0, then the EDID is disabled or
12554f38fcaSMauro Carvalho Chehab	erased.
12654f38fcaSMauro Carvalho Chehab    * - __u32
12754f38fcaSMauro Carvalho Chehab      - ``reserved``\ [5]
12854f38fcaSMauro Carvalho Chehab      - Reserved for future extensions. Applications and drivers must set
12954f38fcaSMauro Carvalho Chehab	the array to zero.
13054f38fcaSMauro Carvalho Chehab    * - __u8 *
13154f38fcaSMauro Carvalho Chehab      - ``edid``
13254f38fcaSMauro Carvalho Chehab      - Pointer to memory that contains the EDID. The minimum size is
13354f38fcaSMauro Carvalho Chehab	``blocks`` * 128.
13454f38fcaSMauro 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 Chehab``ENODATA``
14354f38fcaSMauro Carvalho Chehab    The EDID data is not available.
14454f38fcaSMauro Carvalho Chehab
14554f38fcaSMauro Carvalho Chehab``E2BIG``
14654f38fcaSMauro Carvalho Chehab    The EDID data you provided is more than the hardware can handle.
147