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