drivers/gfx/generic: Add display type field

Add an enum for the Display Type, which if set, can be used to generate
the Device ID value dynamically when the addr field is not set. This
will allow devicetree entries to specify the display type instead of
a hex value for the address which requires referencing the ACPI spec
to decode.

For an internal panel connected to the first port on the graphics chip,
currently an addr value of 0x80010400 is specified. Replacing the
'addr' field with the 'type' field and setting it to 'panel' will
generate the same DID value.

Change-Id: Id0294a14606b410a13fa22eeb240df9e409a7ca3
Signed-off-by: Matt DeVillier <matt.devillier@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/80199
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Eric Lai <ericllai@google.com>
Reviewed-by: Felix Singer <service+coreboot-gerrit@felixsinger.de>
This commit is contained in:
Matt DeVillier 2024-01-26 14:57:11 -06:00 committed by Felix Singer
parent 99e46b004c
commit 32d679e8a4
2 changed files with 24 additions and 2 deletions

View File

@ -6,6 +6,17 @@
#include <acpi/acpi_device.h>
#include <acpi/acpi_pld.h>
/* ACPI spec 6.5 table B-2, Display Output Device */
#define DOD_FW_DETECT BIT(16) /* Platform boot firmware can detect the device. */
#define DOD_DID_STD BIT(31) /* DID Scheme: Use standard bit-field definitions */
enum display_type {
other = 0,
vga = 1, /* VGA, CRT, VESA monitor */
tv = 2, /* TV/HDTV or analog monitor */
ext = 3, /* External digital monitor (DVI, HDMI, DP) */
panel = 4, /* Internal/integrated digital flat panel */
};
/* Config for electronic privacy screen */
struct drivers_gfx_generic_privacy_screen_config {
/* Is privacy screen available on this graphics device */
@ -32,7 +43,10 @@ struct drivers_gfx_generic_device_config {
const char *name;
/* Value to use for _HID Name, will take precedence over _ADR */
const char *hid;
/* The address of the output device. See section A.3.2 */
/* The display type of the output device. See definition above */
enum display_type type;
/* The address of the output device.
Will be dynamically generated if not set and display_type is set */
unsigned int addr;
/* Electronic privacy screen specific config */
struct drivers_gfx_generic_privacy_screen_config privacy;

View File

@ -114,8 +114,16 @@ static void gfx_fill_ssdt_generator(const struct device *dev)
acpigen_write_method("_DOD", 0);
acpigen_emit_byte(RETURN_OP);
acpigen_write_package(config->device_count);
for (i = 0; i < config->device_count; i++)
for (i = 0; i < config->device_count; i++) {
/* Generate the Device ID if addr = 0 and type != 0 */
if (!config->device[i].addr && config->device[i].type)
/* Though not strictly necessary, set the display index and
port attachment to the device index, to ensure uniqueness */
config->device[i].addr = DOD_DID_STD | DOD_FW_DETECT | \
(config->device[i].type << 8) | \
(i << 4) | (i);
acpigen_write_dword(config->device[i].addr);
}
acpigen_pop_len(); /* End Package. */
acpigen_pop_len(); /* End Method. */