18c2ecf20Sopenharmony_ci/*
28c2ecf20Sopenharmony_ci * drivers/video/edid.h - EDID/DDC Header
38c2ecf20Sopenharmony_ci *
48c2ecf20Sopenharmony_ci * Based on:
58c2ecf20Sopenharmony_ci *   1. XFree86 4.3.0, edid.h
68c2ecf20Sopenharmony_ci *      Copyright 1998 by Egbert Eich <Egbert.Eich@Physik.TU-Darmstadt.DE>
78c2ecf20Sopenharmony_ci *
88c2ecf20Sopenharmony_ci *   2. John Fremlin <vii@users.sourceforge.net> and
98c2ecf20Sopenharmony_ci *      Ani Joshi <ajoshi@unixbox.com>
108c2ecf20Sopenharmony_ci *
118c2ecf20Sopenharmony_ci * DDC is a Trademark of VESA (Video Electronics Standard Association).
128c2ecf20Sopenharmony_ci *
138c2ecf20Sopenharmony_ci * This file is subject to the terms and conditions of the GNU General Public
148c2ecf20Sopenharmony_ci * License.  See the file COPYING in the main directory of this archive
158c2ecf20Sopenharmony_ci * for more details.
168c2ecf20Sopenharmony_ci*/
178c2ecf20Sopenharmony_ci
188c2ecf20Sopenharmony_ci#ifndef __EDID_H__
198c2ecf20Sopenharmony_ci#define __EDID_H__
208c2ecf20Sopenharmony_ci
218c2ecf20Sopenharmony_ci#define EDID_LENGTH				0x80
228c2ecf20Sopenharmony_ci#define EDID_HEADER				0x00
238c2ecf20Sopenharmony_ci#define EDID_HEADER_END				0x07
248c2ecf20Sopenharmony_ci
258c2ecf20Sopenharmony_ci#define ID_MANUFACTURER_NAME			0x08
268c2ecf20Sopenharmony_ci#define ID_MANUFACTURER_NAME_END		0x09
278c2ecf20Sopenharmony_ci#define ID_MODEL				0x0a
288c2ecf20Sopenharmony_ci
298c2ecf20Sopenharmony_ci#define ID_SERIAL_NUMBER			0x0c
308c2ecf20Sopenharmony_ci
318c2ecf20Sopenharmony_ci#define MANUFACTURE_WEEK			0x10
328c2ecf20Sopenharmony_ci#define MANUFACTURE_YEAR			0x11
338c2ecf20Sopenharmony_ci
348c2ecf20Sopenharmony_ci#define EDID_STRUCT_VERSION			0x12
358c2ecf20Sopenharmony_ci#define EDID_STRUCT_REVISION			0x13
368c2ecf20Sopenharmony_ci
378c2ecf20Sopenharmony_ci#define EDID_STRUCT_DISPLAY                     0x14
388c2ecf20Sopenharmony_ci
398c2ecf20Sopenharmony_ci#define DPMS_FLAGS				0x18
408c2ecf20Sopenharmony_ci#define ESTABLISHED_TIMING_1			0x23
418c2ecf20Sopenharmony_ci#define ESTABLISHED_TIMING_2			0x24
428c2ecf20Sopenharmony_ci#define MANUFACTURERS_TIMINGS			0x25
438c2ecf20Sopenharmony_ci
448c2ecf20Sopenharmony_ci/* standard timings supported */
458c2ecf20Sopenharmony_ci#define STD_TIMING                              8
468c2ecf20Sopenharmony_ci#define STD_TIMING_DESCRIPTION_SIZE             2
478c2ecf20Sopenharmony_ci#define STD_TIMING_DESCRIPTIONS_START           0x26
488c2ecf20Sopenharmony_ci
498c2ecf20Sopenharmony_ci#define DETAILED_TIMING_DESCRIPTIONS_START	0x36
508c2ecf20Sopenharmony_ci#define DETAILED_TIMING_DESCRIPTION_SIZE	18
518c2ecf20Sopenharmony_ci#define NO_DETAILED_TIMING_DESCRIPTIONS		4
528c2ecf20Sopenharmony_ci
538c2ecf20Sopenharmony_ci#define DETAILED_TIMING_DESCRIPTION_1		0x36
548c2ecf20Sopenharmony_ci#define DETAILED_TIMING_DESCRIPTION_2		0x48
558c2ecf20Sopenharmony_ci#define DETAILED_TIMING_DESCRIPTION_3		0x5a
568c2ecf20Sopenharmony_ci#define DETAILED_TIMING_DESCRIPTION_4		0x6c
578c2ecf20Sopenharmony_ci
588c2ecf20Sopenharmony_ci#define DESCRIPTOR_DATA				5
598c2ecf20Sopenharmony_ci
608c2ecf20Sopenharmony_ci#define UPPER_NIBBLE( x ) \
618c2ecf20Sopenharmony_ci        (((128|64|32|16) & (x)) >> 4)
628c2ecf20Sopenharmony_ci
638c2ecf20Sopenharmony_ci#define LOWER_NIBBLE( x ) \
648c2ecf20Sopenharmony_ci        ((1|2|4|8) & (x))
658c2ecf20Sopenharmony_ci
668c2ecf20Sopenharmony_ci#define COMBINE_HI_8LO( hi, lo ) \
678c2ecf20Sopenharmony_ci        ( (((unsigned)hi) << 8) | (unsigned)lo )
688c2ecf20Sopenharmony_ci
698c2ecf20Sopenharmony_ci#define COMBINE_HI_4LO( hi, lo ) \
708c2ecf20Sopenharmony_ci        ( (((unsigned)hi) << 4) | (unsigned)lo )
718c2ecf20Sopenharmony_ci
728c2ecf20Sopenharmony_ci#define PIXEL_CLOCK_LO     (unsigned)block[ 0 ]
738c2ecf20Sopenharmony_ci#define PIXEL_CLOCK_HI     (unsigned)block[ 1 ]
748c2ecf20Sopenharmony_ci#define PIXEL_CLOCK	   (COMBINE_HI_8LO( PIXEL_CLOCK_HI,PIXEL_CLOCK_LO )*10000)
758c2ecf20Sopenharmony_ci#define H_ACTIVE_LO        (unsigned)block[ 2 ]
768c2ecf20Sopenharmony_ci#define H_BLANKING_LO      (unsigned)block[ 3 ]
778c2ecf20Sopenharmony_ci#define H_ACTIVE_HI        UPPER_NIBBLE( (unsigned)block[ 4 ] )
788c2ecf20Sopenharmony_ci#define H_ACTIVE           COMBINE_HI_8LO( H_ACTIVE_HI, H_ACTIVE_LO )
798c2ecf20Sopenharmony_ci#define H_BLANKING_HI      LOWER_NIBBLE( (unsigned)block[ 4 ] )
808c2ecf20Sopenharmony_ci#define H_BLANKING         COMBINE_HI_8LO( H_BLANKING_HI, H_BLANKING_LO )
818c2ecf20Sopenharmony_ci
828c2ecf20Sopenharmony_ci#define V_ACTIVE_LO        (unsigned)block[ 5 ]
838c2ecf20Sopenharmony_ci#define V_BLANKING_LO      (unsigned)block[ 6 ]
848c2ecf20Sopenharmony_ci#define V_ACTIVE_HI        UPPER_NIBBLE( (unsigned)block[ 7 ] )
858c2ecf20Sopenharmony_ci#define V_ACTIVE           COMBINE_HI_8LO( V_ACTIVE_HI, V_ACTIVE_LO )
868c2ecf20Sopenharmony_ci#define V_BLANKING_HI      LOWER_NIBBLE( (unsigned)block[ 7 ] )
878c2ecf20Sopenharmony_ci#define V_BLANKING         COMBINE_HI_8LO( V_BLANKING_HI, V_BLANKING_LO )
888c2ecf20Sopenharmony_ci
898c2ecf20Sopenharmony_ci#define H_SYNC_OFFSET_LO   (unsigned)block[ 8 ]
908c2ecf20Sopenharmony_ci#define H_SYNC_WIDTH_LO    (unsigned)block[ 9 ]
918c2ecf20Sopenharmony_ci
928c2ecf20Sopenharmony_ci#define V_SYNC_OFFSET_LO   UPPER_NIBBLE( (unsigned)block[ 10 ] )
938c2ecf20Sopenharmony_ci#define V_SYNC_WIDTH_LO    LOWER_NIBBLE( (unsigned)block[ 10 ] )
948c2ecf20Sopenharmony_ci
958c2ecf20Sopenharmony_ci#define V_SYNC_WIDTH_HI    ((unsigned)block[ 11 ] & (1|2))
968c2ecf20Sopenharmony_ci#define V_SYNC_OFFSET_HI   (((unsigned)block[ 11 ] & (4|8)) >> 2)
978c2ecf20Sopenharmony_ci
988c2ecf20Sopenharmony_ci#define H_SYNC_WIDTH_HI    (((unsigned)block[ 11 ] & (16|32)) >> 4)
998c2ecf20Sopenharmony_ci#define H_SYNC_OFFSET_HI   (((unsigned)block[ 11 ] & (64|128)) >> 6)
1008c2ecf20Sopenharmony_ci
1018c2ecf20Sopenharmony_ci#define V_SYNC_WIDTH       COMBINE_HI_4LO( V_SYNC_WIDTH_HI, V_SYNC_WIDTH_LO )
1028c2ecf20Sopenharmony_ci#define V_SYNC_OFFSET      COMBINE_HI_4LO( V_SYNC_OFFSET_HI, V_SYNC_OFFSET_LO )
1038c2ecf20Sopenharmony_ci
1048c2ecf20Sopenharmony_ci#define H_SYNC_WIDTH       COMBINE_HI_8LO( H_SYNC_WIDTH_HI, H_SYNC_WIDTH_LO )
1058c2ecf20Sopenharmony_ci#define H_SYNC_OFFSET      COMBINE_HI_8LO( H_SYNC_OFFSET_HI, H_SYNC_OFFSET_LO )
1068c2ecf20Sopenharmony_ci
1078c2ecf20Sopenharmony_ci#define H_SIZE_LO          (unsigned)block[ 12 ]
1088c2ecf20Sopenharmony_ci#define V_SIZE_LO          (unsigned)block[ 13 ]
1098c2ecf20Sopenharmony_ci
1108c2ecf20Sopenharmony_ci#define H_SIZE_HI          UPPER_NIBBLE( (unsigned)block[ 14 ] )
1118c2ecf20Sopenharmony_ci#define V_SIZE_HI          LOWER_NIBBLE( (unsigned)block[ 14 ] )
1128c2ecf20Sopenharmony_ci
1138c2ecf20Sopenharmony_ci#define H_SIZE             COMBINE_HI_8LO( H_SIZE_HI, H_SIZE_LO )
1148c2ecf20Sopenharmony_ci#define V_SIZE             COMBINE_HI_8LO( V_SIZE_HI, V_SIZE_LO )
1158c2ecf20Sopenharmony_ci
1168c2ecf20Sopenharmony_ci#define H_BORDER           (unsigned)block[ 15 ]
1178c2ecf20Sopenharmony_ci#define V_BORDER           (unsigned)block[ 16 ]
1188c2ecf20Sopenharmony_ci
1198c2ecf20Sopenharmony_ci#define FLAGS              (unsigned)block[ 17 ]
1208c2ecf20Sopenharmony_ci
1218c2ecf20Sopenharmony_ci#define INTERLACED         (FLAGS&128)
1228c2ecf20Sopenharmony_ci#define SYNC_TYPE          (FLAGS&3<<3)	/* bits 4,3 */
1238c2ecf20Sopenharmony_ci#define SYNC_SEPARATE      (3<<3)
1248c2ecf20Sopenharmony_ci#define HSYNC_POSITIVE     (FLAGS & 4)
1258c2ecf20Sopenharmony_ci#define VSYNC_POSITIVE     (FLAGS & 2)
1268c2ecf20Sopenharmony_ci
1278c2ecf20Sopenharmony_ci#define V_MIN_RATE              block[ 5 ]
1288c2ecf20Sopenharmony_ci#define V_MAX_RATE              block[ 6 ]
1298c2ecf20Sopenharmony_ci#define H_MIN_RATE              block[ 7 ]
1308c2ecf20Sopenharmony_ci#define H_MAX_RATE              block[ 8 ]
1318c2ecf20Sopenharmony_ci#define MAX_PIXEL_CLOCK         (((int)block[ 9 ]) * 10)
1328c2ecf20Sopenharmony_ci#define GTF_SUPPORT		block[10]
1338c2ecf20Sopenharmony_ci
1348c2ecf20Sopenharmony_ci#define DPMS_ACTIVE_OFF		(1 << 5)
1358c2ecf20Sopenharmony_ci#define DPMS_SUSPEND		(1 << 6)
1368c2ecf20Sopenharmony_ci#define DPMS_STANDBY		(1 << 7)
1378c2ecf20Sopenharmony_ci
1388c2ecf20Sopenharmony_ci#endif /* __EDID_H__ */
139