1.\" $NetBSD: ddc.9,v 1.4 2006/12/23 09:05:20 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 DDC 9 34.Os 35.Sh NAME 36.Nm ddc 37.Nd VESA Display Data Channel V2 38.Sh SYNOPSIS 39.In dev/i2c/ddcvar.h 40.Ft int 41.Fo ddc_read_edid 42.Fa "i2c_tag_t tag" 43.Fa "uint8_t *dest" 44.Fa "size_t len" 45.Fc 46.Sh DESCRIPTION 47The 48.Fn ddc_read_edid 49reads a VESA Extended Display Identification Data block (EDID) via 50VESA Display Data Channel (DDCv2). DDCv2 is a protocol for data exchange 51between display devices (such as monitors and flat panels) and host 52machines using an I2C bus. 53.Pp 54The 55.Fa tag 56argument is a machine-dependent tag used to specify the I2C 57bus on which the DDCv2 device is located. 58The 59.Fa dest 60argument is a pointer to a buffer where the EDID data will be stored. 61The 62.Fa len 63argument is the amount of data to read into the buffer. (The buffer must be 64large enough.) Typically, this value will be 128, which is the size of a 65normal EDID data block. 66.Pp 67Normally the EDID data block will be post-processed with the 68.Fn edid_parse 69function. 70.Sh RETURN VALUES 71The 72.Fn ddc_read_edid 73function returns zero on success, and non-zero otherwise. 74.Sh ENVIRONMENT 75The 76.Fn ddc_read_edid 77function is part of the 78.Xr ddc 4 79driver, and is only included in the kernel if that driver is also included. 80.Sh EXAMPLES 81The following code uses 82.Fn ddc_read_edid 83to retrieve and print information about a monitor: 84.Pp 85.Bd -literal -compact 86 struct edid_info info; 87 i2c_tag_t tag; 88 char buffer[128]; 89 90 ... 91 /* initialize i2c tag... */ 92 ... 93 if ((ddc_read_edid(tag, buffer, 128) == 0) \*[Am]\*[Am] 94 (edid_parse(buffer, \*[Am]info) == 0)) 95 edid_print(info); 96 ... 97.Ed 98.Pp 99Note that this must be called before the PCI bus is attached during 100autoconfiguration. 101.Sh SEE ALSO 102.Xr ddc 4 , 103.Xr edid 9 , 104.Xr iic 9 105.Sh HISTORY 106DDCv2 support was added in 107.Nx 4.0 . 108.Sh AUTHORS 109.An Garrett D'Amore Aq gdamore@NetBSD.org 110