xref: /freebsd/sys/dev/videomode/edidvar.h (revision 5b9c547c)
1 /*	$NetBSD: edidvar.h,v 1.2 2006/05/11 19:05:41 gdamore Exp $	*/
2 /*	$FreeBSD$	*/
3 
4 /*-
5  * Copyright (c) 2006 Itronix Inc.
6  * All rights reserved.
7  *
8  * Written by Garrett D'Amore for Itronix Inc.
9  *
10  * Redistribution and use in source and binary forms, with or without
11  * modification, are permitted provided that the following conditions
12  * are met:
13  * 1. Redistributions of source code must retain the above copyright
14  *    notice, this list of conditions and the following disclaimer.
15  * 2. Redistributions in binary form must reproduce the above copyright
16  *    notice, this list of conditions and the following disclaimer in the
17  *    documentation and/or other materials provided with the distribution.
18  * 3. The name of Itronix Inc. may not be used to endorse
19  *    or promote products derived from this software without specific
20  *    prior written permission.
21  *
22  * THIS SOFTWARE IS PROVIDED BY ITRONIX INC. ``AS IS'' AND ANY EXPRESS
23  * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
24  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25  * ARE DISCLAIMED.  IN NO EVENT SHALL ITRONIX INC. BE LIABLE FOR ANY
26  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
28  * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
29  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
30  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
31  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
32  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33  */
34 
35 #ifndef _DEV_VIDEOMODE_EDIDVAR_H
36 #define _DEV_VIDEOMODE_EDIDVAR_H
37 
38 struct edid_chroma {
39 	uint16_t	ec_redx;
40 	uint16_t	ec_redy;
41 	uint16_t	ec_greenx;
42 	uint16_t	ec_greeny;
43 	uint16_t	ec_bluex;
44 	uint16_t	ec_bluey;
45 	uint16_t	ec_whitex;
46 	uint16_t	ec_whitey;
47 };
48 
49 struct edid_range {
50 	uint16_t	er_min_vfreq;	/* Hz */
51 	uint16_t	er_max_vfreq;	/* Hz */
52 	uint16_t	er_min_hfreq;	/* kHz */
53 	uint16_t	er_max_hfreq;	/* kHz */
54 	uint16_t	er_max_clock;	/* MHz */
55 	int		er_have_gtf2;
56 	uint16_t	er_gtf2_hfreq;
57 	uint16_t	er_gtf2_c;
58 	uint16_t	er_gtf2_m;
59 	uint16_t	er_gtf2_k;
60 	uint16_t	er_gtf2_j;
61 };
62 
63 struct edid_info {
64 	uint8_t		edid_vendor[4];
65 	char		edid_vendorname[16];
66 	char		edid_productname[16];
67 	char		edid_comment[16];
68 	char		edid_serial[16];
69 	uint16_t	edid_product;
70 	uint8_t		edid_version;
71 	uint8_t		edid_revision;
72 	int		edid_year;
73 	int		edid_week;
74 	uint8_t		edid_video_input;	/* see edidregs.h */
75 	uint8_t		edid_max_hsize;		/* in cm */
76 	uint8_t		edid_max_vsize;		/* in cm */
77 	uint8_t		edid_gamma;
78 	uint8_t		edid_features;
79 	uint8_t		edid_ext_block_count;
80 
81 	int			edid_have_range;
82 	struct edid_range	edid_range;
83 
84 	struct edid_chroma	edid_chroma;
85 
86 	/* parsed modes */
87 	struct videomode	*edid_preferred_mode;
88 	int			edid_nmodes;
89 	struct videomode	edid_modes[64];
90 };
91 
92 int edid_is_valid(uint8_t *);
93 int edid_parse(uint8_t *, struct edid_info *);
94 void edid_print(struct edid_info *);
95 
96 #endif /* _DEV_VIDEOMODE_EDIDVAR_H */
97