xref: /openbmc/linux/drivers/video/fbdev/edid.h (revision f7018c21)
1 /*
2  * drivers/video/edid.h - EDID/DDC Header
3  *
4  * Based on:
5  *   1. XFree86 4.3.0, edid.h
6  *      Copyright 1998 by Egbert Eich <Egbert.Eich@Physik.TU-Darmstadt.DE>
7  *
8  *   2. John Fremlin <vii@users.sourceforge.net> and
9  *      Ani Joshi <ajoshi@unixbox.com>
10  *
11  * DDC is a Trademark of VESA (Video Electronics Standard Association).
12  *
13  * This file is subject to the terms and conditions of the GNU General Public
14  * License.  See the file COPYING in the main directory of this archive
15  * for more details.
16 */
17 
18 #ifndef __EDID_H__
19 #define __EDID_H__
20 
21 #define EDID_LENGTH				0x80
22 #define EDID_HEADER				0x00
23 #define EDID_HEADER_END				0x07
24 
25 #define ID_MANUFACTURER_NAME			0x08
26 #define ID_MANUFACTURER_NAME_END		0x09
27 #define ID_MODEL				0x0a
28 
29 #define ID_SERIAL_NUMBER			0x0c
30 
31 #define MANUFACTURE_WEEK			0x10
32 #define MANUFACTURE_YEAR			0x11
33 
34 #define EDID_STRUCT_VERSION			0x12
35 #define EDID_STRUCT_REVISION			0x13
36 
37 #define EDID_STRUCT_DISPLAY                     0x14
38 
39 #define DPMS_FLAGS				0x18
40 #define ESTABLISHED_TIMING_1			0x23
41 #define ESTABLISHED_TIMING_2			0x24
42 #define MANUFACTURERS_TIMINGS			0x25
43 
44 /* standard timings supported */
45 #define STD_TIMING                              8
46 #define STD_TIMING_DESCRIPTION_SIZE             2
47 #define STD_TIMING_DESCRIPTIONS_START           0x26
48 
49 #define DETAILED_TIMING_DESCRIPTIONS_START	0x36
50 #define DETAILED_TIMING_DESCRIPTION_SIZE	18
51 #define NO_DETAILED_TIMING_DESCRIPTIONS		4
52 
53 #define DETAILED_TIMING_DESCRIPTION_1		0x36
54 #define DETAILED_TIMING_DESCRIPTION_2		0x48
55 #define DETAILED_TIMING_DESCRIPTION_3		0x5a
56 #define DETAILED_TIMING_DESCRIPTION_4		0x6c
57 
58 #define DESCRIPTOR_DATA				5
59 
60 #define UPPER_NIBBLE( x ) \
61         (((128|64|32|16) & (x)) >> 4)
62 
63 #define LOWER_NIBBLE( x ) \
64         ((1|2|4|8) & (x))
65 
66 #define COMBINE_HI_8LO( hi, lo ) \
67         ( (((unsigned)hi) << 8) | (unsigned)lo )
68 
69 #define COMBINE_HI_4LO( hi, lo ) \
70         ( (((unsigned)hi) << 4) | (unsigned)lo )
71 
72 #define PIXEL_CLOCK_LO     (unsigned)block[ 0 ]
73 #define PIXEL_CLOCK_HI     (unsigned)block[ 1 ]
74 #define PIXEL_CLOCK	   (COMBINE_HI_8LO( PIXEL_CLOCK_HI,PIXEL_CLOCK_LO )*10000)
75 #define H_ACTIVE_LO        (unsigned)block[ 2 ]
76 #define H_BLANKING_LO      (unsigned)block[ 3 ]
77 #define H_ACTIVE_HI        UPPER_NIBBLE( (unsigned)block[ 4 ] )
78 #define H_ACTIVE           COMBINE_HI_8LO( H_ACTIVE_HI, H_ACTIVE_LO )
79 #define H_BLANKING_HI      LOWER_NIBBLE( (unsigned)block[ 4 ] )
80 #define H_BLANKING         COMBINE_HI_8LO( H_BLANKING_HI, H_BLANKING_LO )
81 
82 #define V_ACTIVE_LO        (unsigned)block[ 5 ]
83 #define V_BLANKING_LO      (unsigned)block[ 6 ]
84 #define V_ACTIVE_HI        UPPER_NIBBLE( (unsigned)block[ 7 ] )
85 #define V_ACTIVE           COMBINE_HI_8LO( V_ACTIVE_HI, V_ACTIVE_LO )
86 #define V_BLANKING_HI      LOWER_NIBBLE( (unsigned)block[ 7 ] )
87 #define V_BLANKING         COMBINE_HI_8LO( V_BLANKING_HI, V_BLANKING_LO )
88 
89 #define H_SYNC_OFFSET_LO   (unsigned)block[ 8 ]
90 #define H_SYNC_WIDTH_LO    (unsigned)block[ 9 ]
91 
92 #define V_SYNC_OFFSET_LO   UPPER_NIBBLE( (unsigned)block[ 10 ] )
93 #define V_SYNC_WIDTH_LO    LOWER_NIBBLE( (unsigned)block[ 10 ] )
94 
95 #define V_SYNC_WIDTH_HI    ((unsigned)block[ 11 ] & (1|2))
96 #define V_SYNC_OFFSET_HI   (((unsigned)block[ 11 ] & (4|8)) >> 2)
97 
98 #define H_SYNC_WIDTH_HI    (((unsigned)block[ 11 ] & (16|32)) >> 4)
99 #define H_SYNC_OFFSET_HI   (((unsigned)block[ 11 ] & (64|128)) >> 6)
100 
101 #define V_SYNC_WIDTH       COMBINE_HI_4LO( V_SYNC_WIDTH_HI, V_SYNC_WIDTH_LO )
102 #define V_SYNC_OFFSET      COMBINE_HI_4LO( V_SYNC_OFFSET_HI, V_SYNC_OFFSET_LO )
103 
104 #define H_SYNC_WIDTH       COMBINE_HI_8LO( H_SYNC_WIDTH_HI, H_SYNC_WIDTH_LO )
105 #define H_SYNC_OFFSET      COMBINE_HI_8LO( H_SYNC_OFFSET_HI, H_SYNC_OFFSET_LO )
106 
107 #define H_SIZE_LO          (unsigned)block[ 12 ]
108 #define V_SIZE_LO          (unsigned)block[ 13 ]
109 
110 #define H_SIZE_HI          UPPER_NIBBLE( (unsigned)block[ 14 ] )
111 #define V_SIZE_HI          LOWER_NIBBLE( (unsigned)block[ 14 ] )
112 
113 #define H_SIZE             COMBINE_HI_8LO( H_SIZE_HI, H_SIZE_LO )
114 #define V_SIZE             COMBINE_HI_8LO( V_SIZE_HI, V_SIZE_LO )
115 
116 #define H_BORDER           (unsigned)block[ 15 ]
117 #define V_BORDER           (unsigned)block[ 16 ]
118 
119 #define FLAGS              (unsigned)block[ 17 ]
120 
121 #define INTERLACED         (FLAGS&128)
122 #define SYNC_TYPE          (FLAGS&3<<3)	/* bits 4,3 */
123 #define SYNC_SEPARATE      (3<<3)
124 #define HSYNC_POSITIVE     (FLAGS & 4)
125 #define VSYNC_POSITIVE     (FLAGS & 2)
126 
127 #define V_MIN_RATE              block[ 5 ]
128 #define V_MAX_RATE              block[ 6 ]
129 #define H_MIN_RATE              block[ 7 ]
130 #define H_MAX_RATE              block[ 8 ]
131 #define MAX_PIXEL_CLOCK         (((int)block[ 9 ]) * 10)
132 #define GTF_SUPPORT		block[10]
133 
134 #define DPMS_ACTIVE_OFF		(1 << 5)
135 #define DPMS_SUSPEND		(1 << 6)
136 #define DPMS_STANDBY		(1 << 7)
137 
138 #endif /* __EDID_H__ */
139