diff options
author | Won Chung <wonchung@google.com> | 2024-02-14 19:28:59 +0000 |
---|---|---|
committer | Felix Held <felix-coreboot@felixheld.de> | 2024-05-06 11:21:18 +0000 |
commit | ce04bf8c7fda2e992cb405c8b3ccb2895541f65d (patch) | |
tree | 6e242db3b495a3a3e335416f0c3de70cdcf349dc /src/drivers/intel/pmc_mux/conn/conn.c | |
parent | 7b2b57b0b8ae451f80b97582cc6c86004aaab471 (diff) |
drivers/intel/pmc_mux/conn: Copy ACPI _PLD property from USB port to mux
Copy ACPI _PLD values from USB ports to corresponding USB muxes so that
the kernel can create symlinks between Type C connectors and
corresponding USB muxes. This symlink will be used to let userspace be
able to modify the USB role without knowing ACPI topology for the
device.
BUG=b:121287022 b:329657774
TEST=emerge-${BOARD} coreboot then check ACPI table on DUT
Change-Id: If27042cc995ef188f8a3e31444e994318ff98803
Signed-off-by: Won Chung <wonchung@google.com>
Tested-by: Emilie Roberts <hadrosaur@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/81089
Reviewed-by: Eric Lai <ericllai@google.com>
Reviewed-by: Emilie Roberts <hadrosaur@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'src/drivers/intel/pmc_mux/conn/conn.c')
-rw-r--r-- | src/drivers/intel/pmc_mux/conn/conn.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/drivers/intel/pmc_mux/conn/conn.c b/src/drivers/intel/pmc_mux/conn/conn.c index c2c719991b..4b1b08c9aa 100644 --- a/src/drivers/intel/pmc_mux/conn/conn.c +++ b/src/drivers/intel/pmc_mux/conn/conn.c @@ -1,9 +1,11 @@ /* SPDX-License-Identifier: GPL-2.0-or-later */ +#include <acpi/acpi_pld.h> #include <acpi/acpigen.h> #include <boot/coreboot_tables.h> #include <cbmem.h> #include <console/console.h> +#include <drivers/usb/acpi/chip.h> #include <intelblocks/acpi.h> #include "chip.h" @@ -94,12 +96,31 @@ static const char *orientation_to_str(enum type_c_orientation ori) } } +static void get_pld_from_usb_ports(struct acpi_pld *pld, + struct device *usb2_port, struct device *usb3_port) +{ + struct drivers_usb_acpi_config *config = NULL; + + if (usb3_port) + config = usb3_port->chip_info; + else if (usb2_port) + config = usb2_port->chip_info; + + if (config) { + if (config->use_custom_pld) + *pld = config->custom_pld; + else + acpi_pld_fill_usb(pld, config->type, &config->group); + } +} + static void conn_fill_ssdt(const struct device *dev) { struct drivers_intel_pmc_mux_conn_config *config = dev->chip_info; struct acpi_dp *dsd; const char *scope; const char *name; + struct acpi_pld pld = {0}; /* Reference the existing scope and write CONx device */ scope = acpi_device_scope(dev); @@ -131,6 +152,10 @@ static void conn_fill_ssdt(const struct device *dev) acpi_dp_write(dsd); + /* Copy _PLD from USB ports */ + get_pld_from_usb_ports(&pld, config->usb2_port, config->usb3_port); + acpigen_write_pld(&pld); + acpigen_pop_len(); /* CONx Device */ acpigen_pop_len(); /* Scope */ |