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