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 | |
| 23 | /* structure for communicating EDID information from a raw EDID block to |
| 24 | * higher level functions. |
| 25 | * The size of the data types is not critical, so we leave them as |
| 26 | * unsigned int. We can move more into into this struct as needed. |
| 27 | */ |
| 28 | |
| 29 | struct edid { |
| 30 | char manuf_name[4]; |
| 31 | unsigned int model; |
| 32 | unsigned int serial; |
| 33 | unsigned int year; |
| 34 | unsigned int week; |
| 35 | unsigned int version[2]; |
| 36 | unsigned int nonconformant; |
| 37 | unsigned int type; |
Ronald G. Minnich | 9518b56 | 2013-09-19 16:45:22 -0700 | [diff] [blame] | 38 | /* These next three things used to all be called bpp. |
| 39 | * Merriment ensued. The identifier |
| 40 | * 'bpp' is herewith banished from our |
| 41 | * Kingdom. |
| 42 | */ |
| 43 | /* How many bits in the framebuffer per pixel. |
| 44 | * Under all reasonable circumstances, it's 32. |
| 45 | */ |
| 46 | unsigned int framebuffer_bits_per_pixel; |
| 47 | /* On the panel, how many bits per color? |
| 48 | * In almost all cases, it's 6 or 8. |
| 49 | * The standard allows for much more! |
| 50 | */ |
| 51 | unsigned int panel_bits_per_color; |
| 52 | /* On the panel, how many bits per pixel. |
| 53 | * On Planet Earth, there are three colors |
| 54 | * per pixel, but this is convenient to have here |
| 55 | * instead of having 3*panel_bits_per_color |
| 56 | * all over the place. |
| 57 | */ |
| 58 | unsigned int panel_bits_per_pixel; |
Ronald G. Minnich | b2893a01 | 2013-04-23 10:59:11 -0700 | [diff] [blame] | 59 | unsigned int xres; |
| 60 | unsigned int yres; |
Ronald G. Minnich | b3b72f3 | 2013-03-13 14:35:01 -0700 | [diff] [blame] | 61 | unsigned int voltage; |
| 62 | unsigned int sync; |
| 63 | unsigned int xsize_cm; |
| 64 | unsigned int ysize_cm; |
| 65 | /* used to compute timing for graphics chips. */ |
| 66 | unsigned char phsync; |
| 67 | unsigned char pvsync; |
Furquan Shaikh | aa04ed6 | 2013-07-23 15:53:02 -0700 | [diff] [blame] | 68 | unsigned int x_mm; |
| 69 | unsigned int y_mm; |
Furquan Shaikh | 6b19071 | 2013-07-22 16:18:31 -0700 | [diff] [blame] | 70 | unsigned int pixel_clock; |
| 71 | unsigned int link_clock; |
Ronald G. Minnich | b3b72f3 | 2013-03-13 14:35:01 -0700 | [diff] [blame] | 72 | unsigned int ha; |
| 73 | unsigned int hbl; |
| 74 | unsigned int hso; |
| 75 | unsigned int hspw; |
| 76 | unsigned int hborder; |
| 77 | unsigned int va; |
| 78 | unsigned int vbl; |
| 79 | unsigned int vso; |
| 80 | unsigned int vspw; |
| 81 | unsigned int vborder; |
Ronald G. Minnich | 4c5b161 | 2013-06-28 14:33:30 -0700 | [diff] [blame] | 82 | /* 3 variables needed for coreboot framebuffer. |
| 83 | * In most cases, they are the same as the ha |
| 84 | * and va variables, but not always, as in the |
| 85 | * case of a 1366 wide display. |
| 86 | */ |
| 87 | u32 x_resolution; |
| 88 | u32 y_resolution; |
| 89 | u32 bytes_per_line; |
Ronald G. Minnich | b3b72f3 | 2013-03-13 14:35:01 -0700 | [diff] [blame] | 90 | /* it is unlikely we need these things. */ |
| 91 | /* if one of these is non-zero, use that one. */ |
Patrick Georgi | be71ee5d | 2014-12-15 22:52:14 +0100 | [diff] [blame] | 92 | /* they're aspect * 10 to provide some additional resolution */ |
Ronald G. Minnich | b3b72f3 | 2013-03-13 14:35:01 -0700 | [diff] [blame] | 93 | unsigned int aspect_landscape; |
| 94 | unsigned int aspect_portrait; |
| 95 | const char *range_class; |
| 96 | const char *syncmethod; |
| 97 | const char *stereo; |
| 98 | }; |
| 99 | |
Ronald G. Minnich | b2893a01 | 2013-04-23 10:59:11 -0700 | [diff] [blame] | 100 | /* Defined in src/lib/edid.c */ |
Ronald G. Minnich | b3b72f3 | 2013-03-13 14:35:01 -0700 | [diff] [blame] | 101 | int decode_edid(unsigned char *edid, int size, struct edid *out); |
Ronald G. Minnich | 78c3e33 | 2013-04-24 09:50:56 -0700 | [diff] [blame] | 102 | 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] | 103 | |
Ronald G. Minnich | b3b72f3 | 2013-03-13 14:35:01 -0700 | [diff] [blame] | 104 | #endif /* EDID_H */ |