diff options
author | Tim Wawrzynczak <twawrzynczak@chromium.org> | 2020-05-18 13:45:43 -0600 |
---|---|---|
committer | Duncan Laurie <dlaurie@chromium.org> | 2020-05-28 23:54:28 +0000 |
commit | 6046739b9d349d43f6d064660aaf9df49a99cc5f (patch) | |
tree | 727dd3309d4a0d918e0c332deb75ab885f0510bb /src/ec | |
parent | c7854b064f7d245f8f25c95f8775c0cfd66f086f (diff) | |
download | coreboot-6046739b9d349d43f6d064660aaf9df49a99cc5f.tar.xz |
ec/google/chromeec: Add new *-switch properties to USBC.CONx devices
The Linux ChromeOS EC driver now looks for 3 new properties under each
USBC.CONx device contained within the ChromeOS EC device. These
properties are just a reference to the device that controls the
switches for USB 2/3 muxing, SBU lines, and CC lines. It uses the new
function, soc_get_pmc_mux_device() to retrieve the device.
Change-Id: I03cd83f9b2901b5583053fac8ab6eab64717a07d
Signed-off-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/40618
Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'src/ec')
-rw-r--r-- | src/ec/google/chromeec/ec_acpi.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/ec/google/chromeec/ec_acpi.c b/src/ec/google/chromeec/ec_acpi.c index 7b859e95af..d87a49c88d 100644 --- a/src/ec/google/chromeec/ec_acpi.c +++ b/src/ec/google/chromeec/ec_acpi.c @@ -19,6 +19,14 @@ #define GOOGLE_CHROMEEC_USBC_DEVICE_HID "GOOG0014" #define GOOGLE_CHROMEEC_USBC_DEVICE_NAME "USBC" +/* Avoid adding a false dependency on an SoC or intel/common */ +extern const struct device *soc_get_pmc_mux_device(int port_number); + +__weak const struct device *soc_get_pmc_mux_device(int port_number) +{ + return NULL; +} + const char *google_chromeec_acpi_name(const struct device *dev) { /* @@ -186,6 +194,30 @@ static void add_usb_port_references(struct acpi_dp *dsd, int port_number) } } +/* + * Another helper for fill_ssdt_typec_device(). For each port, this one adds references to the + * ACPI device which control the orientation, USB data role and data muxing. + */ +static void add_switch_references(struct acpi_dp *dsd, int port_number) +{ + const struct device *dev; + const char *path; + + dev = soc_get_pmc_mux_device(port_number); + if (!dev) { + printk(BIOS_ERR, "ERROR: %s: No SOC PMC MUX device found", __func__); + return; + } + + path = acpi_device_path(dev); + if (!path) + return; + + acpi_dp_add_reference(dsd, "orientation-switch", path); + acpi_dp_add_reference(dsd, "usb-role-switch", path); + acpi_dp_add_reference(dsd, "mode-switch", path); +} + static void fill_ssdt_typec_device(const struct device *dev) { struct usb_pd_port_caps port_caps; @@ -218,6 +250,7 @@ static void fill_ssdt_typec_device(const struct device *dev) acpi_dp_add_integer(dsd, "port-number", i); add_port_caps(dsd, &port_caps); add_usb_port_references(dsd, i); + add_switch_references(dsd, i); acpi_dp_write(dsd); acpigen_pop_len(); /* Device CONx */ |