| 1 |
|
| 2 |
|
| 3 |
#ifndef EDID_H |
| 4 |
#define EDID_H |
| 5 |
|
| 6 |
#include <stdint.h> |
| 7 |
#include <framebuffer_info.h> |
| 8 |
#include "commonlib/coreboot_tables.h" |
| 9 |
|
| 10 |
enum edid_modes { |
| 11 |
EDID_MODE_640x480_60Hz, |
| 12 |
EDID_MODE_720x480_60Hz, |
| 13 |
EDID_MODE_1280x720_60Hz, |
| 14 |
EDID_MODE_1920x1080_60Hz, |
| 15 |
NUM_KNOWN_MODES, |
| 16 |
|
| 17 |
EDID_MODE_AUTO |
| 18 |
}; |
| 19 |
|
| 20 |
struct edid_mode { |
| 21 |
const char *name; |
| 22 |
unsigned int pixel_clock; |
| 23 |
int lvds_dual_channel; |
| 24 |
unsigned int refresh; |
| 25 |
unsigned int ha; |
| 26 |
unsigned int hbl; |
| 27 |
unsigned int hso; |
| 28 |
unsigned int hspw; |
| 29 |
unsigned int hborder; |
| 30 |
unsigned int va; |
| 31 |
unsigned int vbl; |
| 32 |
unsigned int vso; |
| 33 |
unsigned int vspw; |
| 34 |
unsigned int vborder; |
| 35 |
unsigned char phsync; |
| 36 |
unsigned char pvsync; |
| 37 |
unsigned int x_mm; |
| 38 |
unsigned int y_mm; |
| 39 |
}; |
| 40 |
|
| 41 |
|
| 42 |
|
| 43 |
|
| 44 |
|
| 45 |
|
| 46 |
|
| 47 |
#define EDID_ASCII_STRING_LENGTH 13 |
| 48 |
|
| 49 |
struct edid { |
| 50 |
|
| 51 |
|
| 52 |
|
| 53 |
|
| 54 |
|
| 55 |
|
| 56 |
|
| 57 |
|
| 58 |
unsigned int framebuffer_bits_per_pixel; |
| 59 |
|
| 60 |
|
| 61 |
|
| 62 |
|
| 63 |
unsigned int panel_bits_per_color; |
| 64 |
|
| 65 |
|
| 66 |
|
| 67 |
|
| 68 |
|
| 69 |
|
| 70 |
unsigned int panel_bits_per_pixel; |
| 71 |
|
| 72 |
struct edid_mode mode; |
| 73 |
u8 mode_is_supported[NUM_KNOWN_MODES]; |
| 74 |
unsigned int link_clock; |
| 75 |
|
| 76 |
|
| 77 |
|
| 78 |
|
| 79 |
|
| 80 |
u32 x_resolution; |
| 81 |
u32 y_resolution; |
| 82 |
u32 bytes_per_line; |
| 83 |
|
| 84 |
int hdmi_monitor_detected; |
| 85 |
char ascii_string[EDID_ASCII_STRING_LENGTH + 1]; |
| 86 |
char manufacturer_name[3 + 1]; |
| 87 |
}; |
| 88 |
|
| 89 |
enum edid_status { |
| 90 |
EDID_CONFORMANT, |
| 91 |
EDID_NOT_CONFORMANT, |
| 92 |
EDID_ABSENT, |
| 93 |
}; |
| 94 |
|
| 95 |
|
| 96 |
int decode_edid(unsigned char *edid, int size, struct edid *out); |
| 97 |
void edid_set_framebuffer_bits_per_pixel(struct edid *edid, int fb_bpp, |
| 98 |
int row_byte_alignment); |
| 99 |
int set_display_mode(struct edid *edid, enum edid_modes mode); |
| 100 |
|
| 101 |
#endif |