1.\" $NetBSD: ddc.9,v 1.8 2017/07/03 21:28:48 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). 51DDCv2 is a protocol for data exchange between display devices (such 52as monitors and flat panels) and host machines 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. 64(The buffer must be large enough.) 65Typically, this value will be 128, which is the size of a normal 66EDID data block. 67.Pp 68Normally the EDID data block will be post-processed with the 69.Fn edid_parse 70function. 71.Sh RETURN VALUES 72The 73.Fn ddc_read_edid 74function returns zero on success, and non-zero otherwise. 75.Sh ENVIRONMENT 76The 77.Fn ddc_read_edid 78function is part of the 79.Xr ddc 4 80driver, and is only included in the kernel if that driver is also included. 81.Sh EXAMPLES 82The following code uses 83.Fn ddc_read_edid 84to retrieve and print information about a monitor: 85.Pp 86.Bd -literal -compact 87 struct edid_info info; 88 i2c_tag_t tag; 89 char buffer[128]; 90 91 ... 92 /* initialize i2c tag... */ 93 ... 94 if ((ddc_read_edid(tag, buffer, 128) == 0) && 95 (edid_parse(buffer, &info) == 0)) 96 edid_print(info); 97 ... 98.Ed 99.Pp 100Note that this must be called before the PCI bus is attached during 101autoconfiguration. 102.Sh SEE ALSO 103.Xr ddc 4 , 104.Xr edid 9 , 105.Xr iic 9 106.Sh HISTORY 107DDCv2 support was added in 108.Nx 4.0 . 109.Sh AUTHORS 110.An Garrett D'Amore Aq Mt gdamore@NetBSD.org 111