aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/emgd/emgd/include/edid.h
blob: 7a6d770d71da0c46f2ef1cfd7202c83080a61a66 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
/* -*- pse-c -*-
 *-----------------------------------------------------------------------------
 * Filename: edid.h
 * $Revision: 1.3 $
 *-----------------------------------------------------------------------------
 * Copyright © 2002-2010, Intel Corporation.
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms and conditions of the GNU General Public License,
 * version 2, as published by the Free Software Foundation.
 *
 * This program is distributed in the hope it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
 * more details.
 *
 * You should have received a copy of the GNU General Public License along with
 * this program; if not, write to the Free Software Foundation, Inc.,
 * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
 *
 *-----------------------------------------------------------------------------
 * Description:
 *  Header file for EDID.
 *  Supported EDID versions:
 *  EDID 1.3 (backward compatible with 1.1, 1.2)
 *-----------------------------------------------------------------------------
 */

/*
 * This is a basic EDID parser. It only parses the parts of the EDID that
 * are useful for developing timings and identifying the monitor. Items
 * like monitor serial numbers, chromaticity settings etc. are not useful
 * in the display drivers. There should be a simple interface to provide
 * the complete unparsed EDID to IAL, so that such information can be
 * used by a IAL driver if need be.
 *
 * timings_t: This is a structure that contains one set of display timings.
 *  It is complete in that it contains all 12 timings fields instead of
 *  the popular 8. Some of the "Established" EDID timings require all 12
 *  fields. It also allows for both established flags and driver specific
 *  flags to make it flexible enough to work for most drivers. The
 *  EDID parser will mark the flags with FB_TIMINGS_PREFERRED if they are
 *  found to be listed in the EDID. This does not include modes within
 *  the the sync ranges (if provided), only "Established" "Standard" and
 *  "Detailed" timings.
 *
 * edid_t: This structure will be populated by the EDID parser. There
 *  are three important areas of information that impact display timings.
 *  The h_max,h_min,v_max,v_min represent the range of timings that the
 *  display is capable of accepting. No timings outside this range should
 *  be used by the driver if a range is provided.
 *
 *  Any "Detailed" timings will be fully parsed and returned in
 *  the timings array (only the first 12 are parsed, it is very unlikely
 *  that any EDID exist that contain this many).
 *
 *  Suggested driver behavior when setting display timings would be to
 *  first attempt to use "Detailed" timings provided by the monitor. Then
 *  attempt to use the "Standard" timings that were marked as PREFERRED,
 *  then as a last alternative, use a nonstandard set of timings within
 *  the provided range.
 *
 */

#ifndef _EDID_H
#define _EDID_H

#include <displayid.h>
#include <pd.h>

/* This structure holds all of the parsed EDID information.*/
#define NUM_TIMINGS 12

/* EDID return values */
#define EDID_ERROR_PARSE  1
#define EDID_READ_AGAIN   2

typedef struct _established_timing {
	unsigned long width;
	unsigned long height;
	unsigned long refresh;
} established_timing_t;

typedef struct _edid {
	unsigned char     version;            /* Edid Version */
	unsigned char     revision;           /* Edid Revision */
	char              vendor[4];          /* Vendor Name code */
	unsigned long     product_code;       /* Vendor assigned code */
	unsigned long     serial_number;      /* 32-bit serial number */
	unsigned char     manf_week;          /* Manufactored week number */
	unsigned long     manf_year;          /* Manufactored year */
	unsigned char     standard_color;
	unsigned char     preferred_timing;   /* Use first timing Provided */
	unsigned char     dpms;
	unsigned char     display_type;
	unsigned char     gtf;
	unsigned char     range_set;          /* EDID Contains Valid Range Data */
	timing_range_t    range;
	unsigned char     num_timings;
	pd_timing_t       timings[NUM_TIMINGS];
	char              name[14];
	cea_extension_t	  *cea;				  /* CEA extension based on 861-B */
} edid_t;

/* Functions */
int edid_parse(
		unsigned char *buffer,
		edid_t        *edid,
		pd_timing_t   *timings,
		int           count,
		unsigned char upscale);

void enable_disable_timings(pd_timing_t *timing, unsigned char enable);
void enable_scaled_timings(pd_timing_t *timing, pd_timing_t *dtd,
	unsigned char upscale);
void firmware_dump(unsigned char *buffer, unsigned short size);
void edid_print(edid_t *edid);

int edid_ext_parse(
		unsigned char *buffer,
		edid_t        *edid,
		pd_timing_t   *timings,
		int           count,
		unsigned char upscale);
#endif
/*----------------------------------------------------------------------------
 * File Revision History
 * $Id: edid.h,v 1.3 2010/07/23 16:54:50 bpaauwe Exp $
 * $Source: /nfs/fm/proj/eia/cvsroot/koheo/linux/egd_drm/emgd/include/edid.h,v $
 *----------------------------------------------------------------------------
 */