Documentation: Fix sphinx configuration
[coreboot.git] / src / include / edid.h
blob7536a66119a197daf275629880a51b4df8e77255
1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #ifndef EDID_H
4 #define EDID_H
6 #include <stdint.h>
7 #include "commonlib/coreboot_tables.h"
9 enum edid_modes {
10 EDID_MODE_640x480_60Hz,
11 EDID_MODE_720x480_60Hz,
12 EDID_MODE_1280x720_60Hz,
13 EDID_MODE_1920x1080_60Hz,
14 NUM_KNOWN_MODES,
16 EDID_MODE_AUTO
19 struct edid_mode {
20 const char *name;
21 unsigned int pixel_clock;
22 int lvds_dual_channel;
23 unsigned int refresh;
24 unsigned int ha;
25 unsigned int hbl;
26 unsigned int hso;
27 unsigned int hspw;
28 unsigned int hborder;
29 unsigned int va;
30 unsigned int vbl;
31 unsigned int vso;
32 unsigned int vspw;
33 unsigned int vborder;
34 unsigned char phsync;
35 unsigned char pvsync;
36 unsigned int x_mm;
37 unsigned int y_mm;
40 /* structure for communicating EDID information from a raw EDID block to
41 * higher level functions.
42 * The size of the data types is not critical, so we leave them as
43 * unsigned int. We can move more into into this struct as needed.
46 #define EDID_ASCII_STRING_LENGTH 13
48 struct edid {
49 /* These next three things used to all be called bpp.
50 * Merriment ensued. The identifier
51 * 'bpp' is herewith banished from our
52 * Kingdom.
54 /* How many bits in the framebuffer per pixel.
55 * Under all reasonable circumstances, it's 32.
57 unsigned int framebuffer_bits_per_pixel;
58 /* On the panel, how many bits per color?
59 * In almost all cases, it's 6 or 8.
60 * The standard allows for much more!
62 unsigned int panel_bits_per_color;
63 /* On the panel, how many bits per pixel.
64 * On Planet Earth, there are three colors
65 * per pixel, but this is convenient to have here
66 * instead of having 3*panel_bits_per_color
67 * all over the place.
69 unsigned int panel_bits_per_pixel;
70 /* used to compute timing for graphics chips. */
71 struct edid_mode mode;
72 u8 mode_is_supported[NUM_KNOWN_MODES];
73 unsigned int link_clock;
74 /* 3 variables needed for coreboot framebuffer.
75 * In most cases, they are the same as the ha
76 * and va variables, but not always, as in the
77 * case of a 1366 wide display.
79 u32 x_resolution;
80 u32 y_resolution;
81 u32 bytes_per_line;
83 int hdmi_monitor_detected;
84 char ascii_string[EDID_ASCII_STRING_LENGTH + 1];
85 char manufacturer_name[3 + 1];
88 enum edid_status {
89 EDID_CONFORMANT,
90 EDID_NOT_CONFORMANT,
91 EDID_ABSENT,
94 /* Defined in src/lib/edid.c */
95 int decode_edid(unsigned char *edid, int size, struct edid *out);
96 void edid_set_framebuffer_bits_per_pixel(struct edid *edid, int fb_bpp,
97 int row_byte_alignment);
98 void set_vbe_mode_info_valid(const struct edid *edid, uintptr_t fb_addr);
99 void set_vbe_framebuffer_orientation(enum lb_fb_orientation orientation);
100 int set_display_mode(struct edid *edid, enum edid_modes mode);
102 #endif /* EDID_H */