xref: /netbsd-src/share/man/man9/edid.9 (revision a4ddc2c8fb9af816efe3b1c375a5530aef0e89e9)
1.\"	$NetBSD: edid.9,v 1.5 2013/03/06 22:18:29 wiz Exp $
2.\"
3.\" Copyright 2006 Itronix Inc.
4.\" All rights reserved.
5.\"
6.\" Written by Garrett D'Amore for Itronix Inc.
7.\"
8.\" Redistribution and use in source and binary forms, with or without
9.\" modification, are permitted provided that the following conditions
10.\" are met:
11.\" 1. Redistributions of source code must retain the above copyright
12.\"    notice, this list of conditions and the following disclaimer.
13.\" 2. Redistributions in binary form must reproduce the above copyright
14.\"    notice, this list of conditions and the following disclaimer in the
15.\"    documentation and/or other materials provided with the distribution.
16.\" 3. The name of Intronix Inc. may not be used to endorse
17.\"    or promote products derived from this software without specific prior
18.\"    written permission.
19.\"
20.\" THIS SOFTWARE IS PROVIDED BY INTRONIX INC. ``AS IS'' AND
21.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
22.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23.\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL ITRONIX INC.  BE LIABLE FOR ANY
24.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30.\" POSSIBILITY OF SUCH DAMAGE.
31.\"
32.Dd May 11, 2006
33.Dt EDID 9
34.Os
35.Sh NAME
36.Nm edid
37.Nd VESA Extended Display Identification Data
38.Sh SYNOPSIS
39.In dev/videomode/edidvar.h
40.In dev/videomode/edidreg.h
41.Ft int
42.Fo edid_is_valid
43.Fa "uint8_t *data"
44.Fc
45.Ft int
46.Fo edid_parse
47.Fa "uint8_t *data"
48.Fa "struct edid_info *info"
49.Fc
50.Ft void
51.Fo edid_print
52.Fa "struct edid_info *info"
53.Fc
54.Sh DESCRIPTION
55These
56functions provide support parsing the Extended Display Identification Data
57which describes a display device such as a monitor or flat panel display.
58.Pp
59The
60.Fn edid_is_valid
61function simply tests if the EDID block in
62.Fa data
63contains valid data.
64This test includes a verification of the checksum,
65and that valid vendor and product idenfication data is present.
66The data block contain at least 128 bytes.
67.Pp
68The
69.Fn edid_parse
70function parses the supplied
71.Fa data
72block (which again, must be at least 128 bytes), writing the relevant
73data into the structure pointed to by
74.Fa info .
75.Pp
76The
77.Fn edid_print
78function prints the data in the given
79.Fa info
80structure to the console device.
81.Pp
82.\" XXX
83.\" XXX It sure would be nice to have documentation about the details of the
84.\" XXX edid_info structure itself.  This takes more time, though, and
85.\" XXX hopefully someone else will write it up.  In the meantime, the code
86.\" XXX references should be useful.
87.\" XXX
88.Sh RETURN VALUES
89The
90.Fn edid_is_valid
91function returns 0 if the data block is valid, and
92.Er EINVAL
93otherwise.
94The
95.Fn edid_parse
96function returns zero if the data was successfully parsed, and
97non-zero otherwise.
98.Sh CODE REFERENCES
99The EDID subsystem is implemented within the file
100.Pa sys/dev/videomode/edid.c .
101.Pp
102The EDID subsystem also makes use of VESA Generalized Timing Formula located
103located in
104.Pa sys/dev/videomode/vesagtf.c
105and the generic videomode database located in
106.Pa sys/dev/videomode/videomode.c .
107.Sh EXAMPLES
108The following code uses these functions
109to retrieve and print information about a monitor:
110.Pp
111.Bd -literal -compact
112	struct edid_info info;
113	i2c_tag_t        tag;
114	char		 buffer[128];
115
116	...
117	/* initialize i2c tag... */
118	...
119	if ((ddc_read_edid(tag, buffer, 128) == 0) &&
120	    (edid_parse(buffer, &info) == 0))
121		edid_print(info);
122	...
123.Ed
124.Sh SEE ALSO
125.Xr ddc 9 ,
126.Xr iic 9
127.Sh HISTORY
128These routines were added in
129.Nx 4.0 .
130.Sh AUTHORS
131.An Garrett D'Amore Aq gdamore@NetBSD.org
132