Ronald G. Minnich | b3b72f3 | 2013-03-13 14:35:01 -0700 | [diff] [blame] | 1 | /* |
| 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 Georgi | b890a12 | 2015-03-26 15:17:45 +0100 | [diff] [blame] | 17 | * Foundation, Inc. |
Ronald G. Minnich | b3b72f3 | 2013-03-13 14:35:01 -0700 | [diff] [blame] | 18 | */ |
| 19 | |
| 20 | #ifndef EDID_H |
| 21 | #define EDID_H |
| 22 | |
David Hendricks | 7dbf9c6 | 2015-07-30 18:49:48 -0700 | [diff] [blame] | 23 | enum edid_modes { |
| 24 | EDID_MODE_AUTO = 0, |
| 25 | EDID_MODE_640x480_60Hz, |
| 26 | }; |
| 27 | |
| 28 | struct edid_mode { |
| 29 | const char *name; |
| 30 | unsigned int pixel_clock; |
| 31 | unsigned int refresh; |
| 32 | unsigned int ha; |
| 33 | unsigned int hbl; |
| 34 | unsigned int hso; |
| 35 | unsigned int hspw; |
| 36 | unsigned int hborder; |
| 37 | unsigned int va; |
| 38 | unsigned int vbl; |
| 39 | unsigned int vso; |
| 40 | unsigned int vspw; |
| 41 | unsigned int vborder; |
| 42 | unsigned char phsync; |
| 43 | unsigned char pvsync; |
| 44 | unsigned int x_mm; |
| 45 | unsigned int y_mm; |
| 46 | }; |
| 47 | |
Ronald G. Minnich | b3b72f3 | 2013-03-13 14:35:01 -0700 | [diff] [blame] | 48 | /* structure for communicating EDID information from a raw EDID block to |
| 49 | * higher level functions. |
| 50 | * The size of the data types is not critical, so we leave them as |
| 51 | * unsigned int. We can move more into into this struct as needed. |
| 52 | */ |
| 53 | |
| 54 | struct edid { |
Ronald G. Minnich | 9518b56 | 2013-09-19 16:45:22 -0700 | [diff] [blame] | 55 | /* These next three things used to all be called bpp. |
| 56 | * Merriment ensued. The identifier |
| 57 | * 'bpp' is herewith banished from our |
| 58 | * Kingdom. |
| 59 | */ |
| 60 | /* How many bits in the framebuffer per pixel. |
| 61 | * Under all reasonable circumstances, it's 32. |
| 62 | */ |
| 63 | unsigned int framebuffer_bits_per_pixel; |
| 64 | /* On the panel, how many bits per color? |
| 65 | * In almost all cases, it's 6 or 8. |
| 66 | * The standard allows for much more! |
| 67 | */ |
| 68 | unsigned int panel_bits_per_color; |
| 69 | /* On the panel, how many bits per pixel. |
| 70 | * On Planet Earth, there are three colors |
| 71 | * per pixel, but this is convenient to have here |
| 72 | * instead of having 3*panel_bits_per_color |
| 73 | * all over the place. |
| 74 | */ |
| 75 | unsigned int panel_bits_per_pixel; |
Ronald G. Minnich | b3b72f3 | 2013-03-13 14:35:01 -0700 | [diff] [blame] | 76 | /* used to compute timing for graphics chips. */ |
David Hendricks | 7dbf9c6 | 2015-07-30 18:49:48 -0700 | [diff] [blame] | 77 | struct edid_mode mode; |
Furquan Shaikh | 6b19071 | 2013-07-22 16:18:31 -0700 | [diff] [blame] | 78 | unsigned int link_clock; |
Ronald G. Minnich | 4c5b161 | 2013-06-28 14:33:30 -0700 | [diff] [blame] | 79 | /* 3 variables needed for coreboot framebuffer. |
| 80 | * In most cases, they are the same as the ha |
| 81 | * and va variables, but not always, as in the |
| 82 | * case of a 1366 wide display. |
| 83 | */ |
| 84 | u32 x_resolution; |
| 85 | u32 y_resolution; |
| 86 | u32 bytes_per_line; |
Ronald G. Minnich | b3b72f3 | 2013-03-13 14:35:01 -0700 | [diff] [blame] | 87 | }; |
| 88 | |
Ronald G. Minnich | b2893a01 | 2013-04-23 10:59:11 -0700 | [diff] [blame] | 89 | /* Defined in src/lib/edid.c */ |
Ronald G. Minnich | b3b72f3 | 2013-03-13 14:35:01 -0700 | [diff] [blame] | 90 | int decode_edid(unsigned char *edid, int size, struct edid *out); |
Ronald G. Minnich | 78c3e33 | 2013-04-24 09:50:56 -0700 | [diff] [blame] | 91 | void set_vbe_mode_info_valid(struct edid *edid, uintptr_t fb_addr); |
Ronald G. Minnich | b2893a01 | 2013-04-23 10:59:11 -0700 | [diff] [blame] | 92 | |
Ronald G. Minnich | b3b72f3 | 2013-03-13 14:35:01 -0700 | [diff] [blame] | 93 | #endif /* EDID_H */ |