xref: /netbsd-src/share/man/man9/edid.9 (revision b1c86f5f087524e68db12794ee9c3e3da1ab17a0)
1.\"	$NetBSD: edid.9,v 1.3 2010/01/23 10:38:17 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.  This test includes a verification of the checksum,
64and that valid vendor and product idenfication data is present.  The data
65block contain at least 128 bytes.
66.Pp
67The
68.Fn edid_parse
69function parses the supplied
70.Fa data
71block (which again, must be at least 128 bytes), writing the relevant
72data into the structure pointed to by
73.Fa info .
74.Pp
75The
76.Fn edid_print
77function prints the data in the given
78.Fa info
79structure to the console device.
80.Pp
81.\" XXX
82.\" XXX It sure would be nice to have documentation about the details of the
83.\" XXX edid_info structure itself.  This takes more time, though, and
84.\" XXX hopefully someone else will write it up.  In the meantime, the code
85.\" XXX references should be useful.
86.\" XXX
87.Sh RETURN VALUES
88The
89.Fn edid_is_valid
90function returns 0 if the data block is valid, and
91.Er EINVAL
92otherwise.
93The
94.Fn edid_parse
95function returns zero if the data was successfully parsed, and
96non-zero otherwise.
97.Sh CODE REFERENCES
98This section describes places within the
99.Nx
100source tree where actual code implementing or using the
101EDID subsystem can be found.
102All pathnames are relative to
103.Pa /usr/src .
104.Pp
105The EDID subsystem is implemented within the file
106.Pa sys/dev/videomode/edid.c .
107.Pp
108The EDID subsystem also makes use of VESA Generalized Timing Formula located
109located in
110.Pa sys/dev/videomode/vesagtf.c
111and the generic videomode database located in
112.Pa sys/dev/videomode/videomode.c .
113.Sh EXAMPLES
114The following code uses these functions
115to retrieve and print information about a monitor:
116.Pp
117.Bd -literal -compact
118	struct edid_info info;
119	i2c_tag_t        tag;
120	char		 buffer[128];
121
122	...
123	/* initialize i2c tag... */
124	...
125	if ((ddc_read_edid(tag, buffer, 128) == 0) &&
126	    (edid_parse(buffer, &info) == 0))
127		edid_print(info);
128	...
129.Ed
130.Sh SEE ALSO
131.Xr ddc 9 ,
132.Xr iic 9
133.Sh HISTORY
134These routines were added in
135.Nx 4.0 .
136.Sh AUTHORS
137.An Garrett D'Amore Aq gdamore@NetBSD.org
138