blob: 6aed403a0f997f01f10b01ff1e1e2d36687c746d [file] [log] [blame]
Ronald G. Minnichb3b72f32013-03-13 14:35:01 -07001/*
2 * This file is part of the coreboot project.
3 *
4 * Copyright 2013 Google Inc.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
Patrick Georgib890a122015-03-26 15:17:45 +010017 * Foundation, Inc.
Ronald G. Minnichb3b72f32013-03-13 14:35:01 -070018 */
19
20#ifndef EDID_H
21#define EDID_H
22
David Hendricks7dbf9c62015-07-30 18:49:48 -070023enum edid_modes {
David Hendricks7dbf9c62015-07-30 18:49:48 -070024 EDID_MODE_640x480_60Hz,
David Hendrickse2054102015-08-07 18:41:37 -070025 EDID_MODE_720x480_60Hz,
26 EDID_MODE_1280x720_60Hz,
27 EDID_MODE_1920x1080_60Hz,
28 NUM_KNOWN_MODES,
29
30 EDID_MODE_AUTO
David Hendricks7dbf9c62015-07-30 18:49:48 -070031};
32
33struct edid_mode {
34 const char *name;
35 unsigned int pixel_clock;
Vladimir Serbinenko551cff02015-10-10 23:58:08 +020036 int lvds_dual_channel;
David Hendricks7dbf9c62015-07-30 18:49:48 -070037 unsigned int refresh;
38 unsigned int ha;
39 unsigned int hbl;
40 unsigned int hso;
41 unsigned int hspw;
42 unsigned int hborder;
43 unsigned int va;
44 unsigned int vbl;
45 unsigned int vso;
46 unsigned int vspw;
47 unsigned int vborder;
48 unsigned char phsync;
49 unsigned char pvsync;
50 unsigned int x_mm;
51 unsigned int y_mm;
52};
53
Ronald G. Minnichb3b72f32013-03-13 14:35:01 -070054/* structure for communicating EDID information from a raw EDID block to
55 * higher level functions.
56 * The size of the data types is not critical, so we leave them as
57 * unsigned int. We can move more into into this struct as needed.
58 */
59
60struct edid {
Ronald G. Minnich9518b562013-09-19 16:45:22 -070061 /* These next three things used to all be called bpp.
62 * Merriment ensued. The identifier
63 * 'bpp' is herewith banished from our
64 * Kingdom.
65 */
66 /* How many bits in the framebuffer per pixel.
67 * Under all reasonable circumstances, it's 32.
68 */
69 unsigned int framebuffer_bits_per_pixel;
70 /* On the panel, how many bits per color?
71 * In almost all cases, it's 6 or 8.
72 * The standard allows for much more!
73 */
74 unsigned int panel_bits_per_color;
75 /* On the panel, how many bits per pixel.
76 * On Planet Earth, there are three colors
77 * per pixel, but this is convenient to have here
78 * instead of having 3*panel_bits_per_color
79 * all over the place.
80 */
81 unsigned int panel_bits_per_pixel;
Ronald G. Minnichb3b72f32013-03-13 14:35:01 -070082 /* used to compute timing for graphics chips. */
David Hendricks7dbf9c62015-07-30 18:49:48 -070083 struct edid_mode mode;
David Hendrickse2054102015-08-07 18:41:37 -070084 u8 mode_is_supported[NUM_KNOWN_MODES];
Furquan Shaikh6b190712013-07-22 16:18:31 -070085 unsigned int link_clock;
Ronald G. Minnich4c5b1612013-06-28 14:33:30 -070086 /* 3 variables needed for coreboot framebuffer.
87 * In most cases, they are the same as the ha
88 * and va variables, but not always, as in the
89 * case of a 1366 wide display.
90 */
91 u32 x_resolution;
92 u32 y_resolution;
93 u32 bytes_per_line;
Ronald G. Minnichb3b72f32013-03-13 14:35:01 -070094};
95
Ronald G. Minnichb2893a012013-04-23 10:59:11 -070096/* Defined in src/lib/edid.c */
Ronald G. Minnichb3b72f32013-03-13 14:35:01 -070097int decode_edid(unsigned char *edid, int size, struct edid *out);
Ronald G. Minnich78c3e332013-04-24 09:50:56 -070098void set_vbe_mode_info_valid(struct edid *edid, uintptr_t fb_addr);
David Hendrickse2054102015-08-07 18:41:37 -070099int set_display_mode(struct edid *edid, enum edid_modes mode);
Ronald G. Minnichb2893a012013-04-23 10:59:11 -0700100
Ronald G. Minnichb3b72f32013-03-13 14:35:01 -0700101#endif /* EDID_H */