From ce04bf8c7fda2e992cb405c8b3ccb2895541f65d Mon Sep 17 00:00:00 2001 From: Won Chung Date: Wed, 14 Feb 2024 19:28:59 +0000 Subject: 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 Tested-by: Emilie Roberts Reviewed-on: https://review.coreboot.org/c/coreboot/+/81089 Reviewed-by: Eric Lai Reviewed-by: Emilie Roberts Tested-by: build bot (Jenkins) --- src/drivers/intel/pmc_mux/conn/conn.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) 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 #include #include #include #include +#include #include #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 */ -- cgit v1.2.3