From 48097a17f151bf3843bd921391125ba8de56ac65 Mon Sep 17 00:00:00 2001 From: Pavan Holla Date: Thu, 18 Apr 2024 14:34:35 +0000 Subject: ec/google/chromeec: Do not fill TypeC ACPI device when UCSI is enabled Do not fill the ACPI table entry associated with the cros_ec_typec driver once we switch to the UCSI kernel driver. Skip the ACPI entry if EC implements the UCSI_PPM feature, and the CBI flag to enable UCSI is set. BUG=b:333078787 TEST=emerge-brox coreboot chromeos-bootimage Cq-Depend: chromium:5416841 Change-Id: I67dff6445aa7ba3ba48a04d1df3541f880d09d0a Signed-off-by: Pavan Holla Reviewed-on: https://review.coreboot.org/c/coreboot/+/81967 Tested-by: build bot (Jenkins) Reviewed-by: Caveh Jalali Reviewed-by: Paul Menzel --- src/ec/google/chromeec/ec.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'src/ec/google/chromeec/ec.c') diff --git a/src/ec/google/chromeec/ec.c b/src/ec/google/chromeec/ec.c index 8fdfbfbb28..a32b2a54a4 100644 --- a/src/ec/google/chromeec/ec.c +++ b/src/ec/google/chromeec/ec.c @@ -723,6 +723,31 @@ int google_chromeec_cbi_get_ssfc(uint32_t *ssfc) return cbi_get_uint32(ssfc, CBI_TAG_SSFC); } +bool google_chromeec_get_ucsi_enabled(void) +{ + int rv; + union ec_common_control cc; + + rv = google_chromeec_check_feature(EC_FEATURE_UCSI_PPM); + if (rv < 0) { + printk(BIOS_INFO, "Cannot check if EC_FEATURE_UCSI_PPM is available: status = %d\n", rv); + return false; + } + + if (rv == 0) + return false; + + /* Check if PPM is enabled at runtime. */ + cc.ucsi_enabled = 0; + rv = cbi_get_uint32(&cc.raw_value, CBI_TAG_COMMON_CONTROL); + if (rv < 0) { + printk(BIOS_DEBUG, "Cannot get tag CBI_TAG_COMMON_CONTROL from CBI: status = %d\n", rv); + return false; + } + + return (cc.ucsi_enabled != 0); +} + static int cbi_get_string(char *buf, size_t bufsize, uint32_t tag) { struct ec_params_get_cbi params = { -- cgit v1.2.3