xref: /OK3568_Linux_fs/kernel/Documentation/userspace-api/media/v4l/vidioc-g-edid.rst (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
2*4882a593Smuzhiyun.. c:namespace:: V4L
3*4882a593Smuzhiyun
4*4882a593Smuzhiyun.. _VIDIOC_G_EDID:
5*4882a593Smuzhiyun
6*4882a593Smuzhiyun******************************************************************************
7*4882a593Smuzhiyunioctl VIDIOC_G_EDID, VIDIOC_S_EDID, VIDIOC_SUBDEV_G_EDID, VIDIOC_SUBDEV_S_EDID
8*4882a593Smuzhiyun******************************************************************************
9*4882a593Smuzhiyun
10*4882a593SmuzhiyunName
11*4882a593Smuzhiyun====
12*4882a593Smuzhiyun
13*4882a593SmuzhiyunVIDIOC_G_EDID - VIDIOC_S_EDID - VIDIOC_SUBDEV_G_EDID - VIDIOC_SUBDEV_S_EDID - Get or set the EDID of a video receiver/transmitter
14*4882a593Smuzhiyun
15*4882a593SmuzhiyunSynopsis
16*4882a593Smuzhiyun========
17*4882a593Smuzhiyun
18*4882a593Smuzhiyun.. c:macro:: VIDIOC_G_EDID
19*4882a593Smuzhiyun
20*4882a593Smuzhiyun``int ioctl(int fd, VIDIOC_G_EDID, struct v4l2_edid *argp)``
21*4882a593Smuzhiyun
22*4882a593Smuzhiyun.. c:macro:: VIDIOC_S_EDID
23*4882a593Smuzhiyun
24*4882a593Smuzhiyun``int ioctl(int fd, VIDIOC_S_EDID, struct v4l2_edid *argp)``
25*4882a593Smuzhiyun
26*4882a593Smuzhiyun.. c:macro:: VIDIOC_SUBDEV_G_EDID
27*4882a593Smuzhiyun
28*4882a593Smuzhiyun``int ioctl(int fd, VIDIOC_SUBDEV_G_EDID, struct v4l2_edid *argp)``
29*4882a593Smuzhiyun
30*4882a593Smuzhiyun.. c:macro:: VIDIOC_SUBDEV_S_EDID
31*4882a593Smuzhiyun
32*4882a593Smuzhiyun``int ioctl(int fd, VIDIOC_SUBDEV_S_EDID, struct v4l2_edid *argp)``
33*4882a593Smuzhiyun
34*4882a593SmuzhiyunArguments
35*4882a593Smuzhiyun=========
36*4882a593Smuzhiyun
37*4882a593Smuzhiyun``fd``
38*4882a593Smuzhiyun    File descriptor returned by :c:func:`open()`.
39*4882a593Smuzhiyun
40*4882a593Smuzhiyun``argp``
41*4882a593Smuzhiyun   Pointer to struct :c:type:`v4l2_edid`.
42*4882a593Smuzhiyun
43*4882a593SmuzhiyunDescription
44*4882a593Smuzhiyun===========
45*4882a593Smuzhiyun
46*4882a593SmuzhiyunThese ioctls can be used to get or set an EDID associated with an input
47*4882a593Smuzhiyunfrom a receiver or an output of a transmitter device. They can be used
48*4882a593Smuzhiyunwith subdevice nodes (/dev/v4l-subdevX) or with video nodes
49*4882a593Smuzhiyun(/dev/videoX).
50*4882a593Smuzhiyun
51*4882a593SmuzhiyunWhen used with video nodes the ``pad`` field represents the input (for
52*4882a593Smuzhiyunvideo capture devices) or output (for video output devices) index as is
53*4882a593Smuzhiyunreturned by :ref:`VIDIOC_ENUMINPUT` and
54*4882a593Smuzhiyun:ref:`VIDIOC_ENUMOUTPUT` respectively. When used
55*4882a593Smuzhiyunwith subdevice nodes the ``pad`` field represents the input or output
56*4882a593Smuzhiyunpad of the subdevice. If there is no EDID support for the given ``pad``
57*4882a593Smuzhiyunvalue, then the ``EINVAL`` error code will be returned.
58*4882a593Smuzhiyun
59*4882a593SmuzhiyunTo get the EDID data the application has to fill in the ``pad``,
60*4882a593Smuzhiyun``start_block``, ``blocks`` and ``edid`` fields, zero the ``reserved``
61*4882a593Smuzhiyunarray and call :ref:`VIDIOC_G_EDID <VIDIOC_G_EDID>`. The current EDID from block
62*4882a593Smuzhiyun``start_block`` and of size ``blocks`` will be placed in the memory
63*4882a593Smuzhiyun``edid`` points to. The ``edid`` pointer must point to memory at least
64*4882a593Smuzhiyun``blocks`` * 128 bytes large (the size of one block is 128 bytes).
65*4882a593Smuzhiyun
66*4882a593SmuzhiyunIf there are fewer blocks than specified, then the driver will set
67*4882a593Smuzhiyun``blocks`` to the actual number of blocks. If there are no EDID blocks
68*4882a593Smuzhiyunavailable at all, then the error code ``ENODATA`` is set.
69*4882a593Smuzhiyun
70*4882a593SmuzhiyunIf blocks have to be retrieved from the sink, then this call will block
71*4882a593Smuzhiyununtil they have been read.
72*4882a593Smuzhiyun
73*4882a593SmuzhiyunIf ``start_block`` and ``blocks`` are both set to 0 when
74*4882a593Smuzhiyun:ref:`VIDIOC_G_EDID <VIDIOC_G_EDID>` is called, then the driver will set ``blocks`` to the
75*4882a593Smuzhiyuntotal number of available EDID blocks and it will return 0 without
76*4882a593Smuzhiyuncopying any data. This is an easy way to discover how many EDID blocks
77*4882a593Smuzhiyunthere are.
78*4882a593Smuzhiyun
79*4882a593Smuzhiyun.. note::
80*4882a593Smuzhiyun
81*4882a593Smuzhiyun   If there are no EDID blocks available at all, then
82*4882a593Smuzhiyun   the driver will set ``blocks`` to 0 and it returns 0.
83*4882a593Smuzhiyun
84*4882a593SmuzhiyunTo set the EDID blocks of a receiver the application has to fill in the
85*4882a593Smuzhiyun``pad``, ``blocks`` and ``edid`` fields, set ``start_block`` to 0 and
86*4882a593Smuzhiyunzero the ``reserved`` array. It is not possible to set part of an EDID,
87*4882a593Smuzhiyunit is always all or nothing. Setting the EDID data is only valid for
88*4882a593Smuzhiyunreceivers as it makes no sense for a transmitter.
89*4882a593Smuzhiyun
90*4882a593SmuzhiyunThe driver assumes that the full EDID is passed in. If there are more
91*4882a593SmuzhiyunEDID blocks than the hardware can handle then the EDID is not written,
92*4882a593Smuzhiyunbut instead the error code ``E2BIG`` is set and ``blocks`` is set to the
93*4882a593Smuzhiyunmaximum that the hardware supports. If ``start_block`` is any value
94*4882a593Smuzhiyunother than 0 then the error code ``EINVAL`` is set.
95*4882a593Smuzhiyun
96*4882a593SmuzhiyunTo disable an EDID you set ``blocks`` to 0. Depending on the hardware
97*4882a593Smuzhiyunthis will drive the hotplug pin low and/or block the source from reading
98*4882a593Smuzhiyunthe EDID data in some way. In any case, the end result is the same: the
99*4882a593SmuzhiyunEDID is no longer available.
100*4882a593Smuzhiyun
101*4882a593Smuzhiyun.. c:type:: v4l2_edid
102*4882a593Smuzhiyun
103*4882a593Smuzhiyun.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}|
104*4882a593Smuzhiyun
105*4882a593Smuzhiyun.. flat-table:: struct v4l2_edid
106*4882a593Smuzhiyun    :header-rows:  0
107*4882a593Smuzhiyun    :stub-columns: 0
108*4882a593Smuzhiyun    :widths:       1 1 2
109*4882a593Smuzhiyun
110*4882a593Smuzhiyun    * - __u32
111*4882a593Smuzhiyun      - ``pad``
112*4882a593Smuzhiyun      - Pad for which to get/set the EDID blocks. When used with a video
113*4882a593Smuzhiyun	device node the pad represents the input or output index as
114*4882a593Smuzhiyun	returned by :ref:`VIDIOC_ENUMINPUT` and
115*4882a593Smuzhiyun	:ref:`VIDIOC_ENUMOUTPUT` respectively.
116*4882a593Smuzhiyun    * - __u32
117*4882a593Smuzhiyun      - ``start_block``
118*4882a593Smuzhiyun      - Read the EDID from starting with this block. Must be 0 when
119*4882a593Smuzhiyun	setting the EDID.
120*4882a593Smuzhiyun    * - __u32
121*4882a593Smuzhiyun      - ``blocks``
122*4882a593Smuzhiyun      - The number of blocks to get or set. Must be less or equal to 256
123*4882a593Smuzhiyun	(the maximum number of blocks as defined by the standard). When
124*4882a593Smuzhiyun	you set the EDID and ``blocks`` is 0, then the EDID is disabled or
125*4882a593Smuzhiyun	erased.
126*4882a593Smuzhiyun    * - __u32
127*4882a593Smuzhiyun      - ``reserved``\ [5]
128*4882a593Smuzhiyun      - Reserved for future extensions. Applications and drivers must set
129*4882a593Smuzhiyun	the array to zero.
130*4882a593Smuzhiyun    * - __u8 *
131*4882a593Smuzhiyun      - ``edid``
132*4882a593Smuzhiyun      - Pointer to memory that contains the EDID. The minimum size is
133*4882a593Smuzhiyun	``blocks`` * 128.
134*4882a593Smuzhiyun
135*4882a593SmuzhiyunReturn Value
136*4882a593Smuzhiyun============
137*4882a593Smuzhiyun
138*4882a593SmuzhiyunOn success 0 is returned, on error -1 and the ``errno`` variable is set
139*4882a593Smuzhiyunappropriately. The generic error codes are described at the
140*4882a593Smuzhiyun:ref:`Generic Error Codes <gen-errors>` chapter.
141*4882a593Smuzhiyun
142*4882a593Smuzhiyun``ENODATA``
143*4882a593Smuzhiyun    The EDID data is not available.
144*4882a593Smuzhiyun
145*4882a593Smuzhiyun``E2BIG``
146*4882a593Smuzhiyun    The EDID data you provided is more than the hardware can handle.
147