Jameson Thies has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/84404?usp=email )
Change subject: chromeec/ec_acpi: Define ACPI devices for USB-C ports using UCSI ......................................................................
chromeec/ec_acpi: Define ACPI devices for USB-C ports using UCSI
Add support to define ACPI devices for USB-C ports using UCSI. When defining the typec configuration do not set mux/retimer information. cros_ec_ucsi does not support setting USB muxes.
BUG=b:349822718 TEST=emerge-brox coreboot chromeos-bootimage. Boot to OS on brox, confirmed that there we ACPI devices for each USB-C port and cros_ec_ucsi correctly matched the ACPI devices.
Change-Id: Ie7c281fe2a7fab705d3c238dcc4be68c93afd652 Signed-off-by: Jameson Thies jthies@google.com --- M src/ec/google/chromeec/ec_acpi.c 1 file changed, 43 insertions(+), 13 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/04/84404/1
diff --git a/src/ec/google/chromeec/ec_acpi.c b/src/ec/google/chromeec/ec_acpi.c index 1c97dcc..e94a685 100644 --- a/src/ec/google/chromeec/ec_acpi.c +++ b/src/ec/google/chromeec/ec_acpi.c @@ -18,6 +18,12 @@ #define GOOGLE_CHROMEEC_USBC_DEVICE_HID "GOOG0014" #define GOOGLE_CHROMEEC_USBC_DEVICE_NAME "USBC"
+/* + * Boards using UCSI need the USB-C ports to match with cros_ec_ucsi, not + * cros-ec-typec. + */ +#define GOOGLE_CHROMEEC_USBC_UCSI_DEVICE_HID "GOOG0021" + const char *google_chromeec_acpi_name(const struct device *dev) { /* @@ -154,13 +160,13 @@ struct device *usb2_port; struct device *usb3_port; struct device *usb4_port; + struct device *orientation_switch; + struct device *usb_role_switch; + struct device *mode_switch; + struct device *retimer_switch; struct acpi_pld pld = {0}; uint32_t pcap_mask = 0; - - /* UCSI implementations do not require an ACPI device with mux info since the - linux kernel doesn't set the muxes. */ - if (google_chromeec_get_ucsi_enabled()) - return; + bool ucsi_platform = google_chromeec_get_ucsi_enabled();
rv = google_chromeec_get_num_pd_ports(&num_ports); if (rv || num_ports == 0) @@ -173,9 +179,18 @@
acpigen_write_scope(acpi_device_path(dev)); acpigen_write_device(GOOGLE_CHROMEEC_USBC_DEVICE_NAME); - acpigen_write_name_string("_HID", GOOGLE_CHROMEEC_USBC_DEVICE_HID); - acpigen_write_name_string("_DDN", "ChromeOS EC Embedded Controller " - "USB Type-C Control"); + + if (ucsi_platform) { + acpigen_write_name_string("_HID", + GOOGLE_CHROMEEC_USBC_UCSI_DEVICE_HID); + acpigen_write_name_string("_DDN", "ChromeOS EC UCSI USB Type-C " + "Control"); + } else { + acpigen_write_name_string("_HID", + GOOGLE_CHROMEEC_USBC_DEVICE_HID); + acpigen_write_name_string("_DDN", "ChromeOS EC Embedded " + "Controller USB Type-C Control"); + }
for (i = 0; i < num_ports; ++i) { rv = google_chromeec_get_pd_port_caps(i, &port_caps); @@ -185,10 +200,25 @@ usb2_port = NULL; usb3_port = NULL; usb4_port = NULL; - get_usb_port_references(i, &usb2_port, &usb3_port, &usb4_port); + orientation_switch = NULL; + usb_role_switch = NULL; + mode_switch = NULL; + retimer_switch = NULL;
+ get_usb_port_references(i, &usb2_port, &usb3_port, &usb4_port); get_pld_from_usb_ports(&pld, usb2_port, usb3_port, usb4_port);
+ /* + * The UCSI driver does not set muxes. Only include mux + * information on non-UCSI platforms. + */ + if (!ucsi_platform) { + orientation_switch = config->mux_conn[i]; + usb_role_switch = config->mux_conn[i]; + mode_switch = config->mux_conn[i]; + retimer_switch = config->retimer_conn[i]; + } + struct typec_connector_class_config typec_config = { .power_role = (enum usb_typec_power_role)port_caps.power_role_cap, .try_power_role = @@ -197,10 +227,10 @@ .usb2_port = usb2_port, .usb3_port = usb3_port, .usb4_port = usb4_port, - .orientation_switch = config->mux_conn[i], - .usb_role_switch = config->mux_conn[i], - .mode_switch = config->mux_conn[i], - .retimer_switch = config->retimer_conn[i], + .orientation_switch = orientation_switch, + .usb_role_switch = usb_role_switch, + .mode_switch = mode_switch, + .retimer_switch = retimer_switch, .pld = &pld, };