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