coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
edid.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 
3 #ifndef EDID_H
4 #define EDID_H
5 
6 #include <stdint.h>
7 #include <framebuffer_info.h>
9 
10 enum edid_modes {
16 
18 };
19 
20 struct edid_mode {
21  const char *name;
22  unsigned int pixel_clock;
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 /* structure for communicating EDID information from a raw EDID block to
42  * higher level functions.
43  * The size of the data types is not critical, so we leave them as
44  * unsigned int. We can move more into this struct as needed.
45  */
46 
47 #define EDID_ASCII_STRING_LENGTH 13
48 
49 struct edid {
50  /* These next three things used to all be called bpp.
51  * Merriment ensued. The identifier
52  * 'bpp' is herewith banished from our
53  * Kingdom.
54  */
55  /* How many bits in the framebuffer per pixel.
56  * Under all reasonable circumstances, it's 32.
57  */
59  /* On the panel, how many bits per color?
60  * In almost all cases, it's 6 or 8.
61  * The standard allows for much more!
62  */
63  unsigned int panel_bits_per_color;
64  /* On the panel, how many bits per pixel.
65  * On Planet Earth, there are three colors
66  * per pixel, but this is convenient to have here
67  * instead of having 3*panel_bits_per_color
68  * all over the place.
69  */
70  unsigned int panel_bits_per_pixel;
71  /* used to compute timing for graphics chips. */
72  struct edid_mode mode;
74  unsigned int link_clock;
75  /* 3 variables needed for coreboot framebuffer.
76  * In most cases, they are the same as the ha
77  * and va variables, but not always, as in the
78  * case of a 1366 wide display.
79  */
83 
86  char manufacturer_name[3 + 1];
87 };
88 
93 };
94 
95 /* Defined in src/lib/edid.c */
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 /* EDID_H */
edid_status
Definition: edid.h:89
@ EDID_ABSENT
Definition: edid.h:92
@ EDID_NOT_CONFORMANT
Definition: edid.h:91
@ EDID_CONFORMANT
Definition: edid.h:90
void edid_set_framebuffer_bits_per_pixel(struct edid *edid, int fb_bpp, int row_byte_alignment)
Definition: edid.c:1667
int set_display_mode(struct edid *edid, enum edid_modes mode)
Definition: edid.c:1081
#define EDID_ASCII_STRING_LENGTH
Definition: edid.h:47
edid_modes
Definition: edid.h:10
@ EDID_MODE_640x480_60Hz
Definition: edid.h:11
@ EDID_MODE_1920x1080_60Hz
Definition: edid.h:14
@ EDID_MODE_1280x720_60Hz
Definition: edid.h:13
@ EDID_MODE_AUTO
Definition: edid.h:17
@ NUM_KNOWN_MODES
Definition: edid.h:15
@ EDID_MODE_720x480_60Hz
Definition: edid.h:12
int decode_edid(unsigned char *edid, int size, struct edid *out)
Definition: edid.c:1104
uint32_t u32
Definition: stdint.h:51
uint8_t u8
Definition: stdint.h:45
Definition: edid.h:20
unsigned int refresh
Definition: edid.h:24
unsigned int hbl
Definition: edid.h:26
int lvds_dual_channel
Definition: edid.h:23
unsigned int va
Definition: edid.h:30
unsigned int vspw
Definition: edid.h:33
unsigned int x_mm
Definition: edid.h:37
unsigned char phsync
Definition: edid.h:35
unsigned int ha
Definition: edid.h:25
unsigned int hborder
Definition: edid.h:29
unsigned int vso
Definition: edid.h:32
unsigned int hso
Definition: edid.h:27
unsigned char pvsync
Definition: edid.h:36
const char * name
Definition: edid.h:21
unsigned int pixel_clock
Definition: edid.h:22
unsigned int hspw
Definition: edid.h:28
unsigned int vbl
Definition: edid.h:31
unsigned int y_mm
Definition: edid.h:38
unsigned int vborder
Definition: edid.h:34
Definition: edid.h:49
char ascii_string[EDID_ASCII_STRING_LENGTH+1]
Definition: edid.h:85
u8 mode_is_supported[NUM_KNOWN_MODES]
Definition: edid.h:73
u32 bytes_per_line
Definition: edid.h:82
char manufacturer_name[3+1]
Definition: edid.h:86
unsigned int panel_bits_per_pixel
Definition: edid.h:70
unsigned int link_clock
Definition: edid.h:74
unsigned int framebuffer_bits_per_pixel
Definition: edid.h:58
int hdmi_monitor_detected
Definition: edid.h:84
u32 x_resolution
Definition: edid.h:80
struct edid_mode mode
Definition: edid.h:72
unsigned int panel_bits_per_color
Definition: edid.h:63
u32 y_resolution
Definition: edid.h:81