From 46f38d05d6c5d6dc3314723f8aef363707197bd5 Mon Sep 17 00:00:00 2001 From: Subrata Banik Date: Sun, 9 Feb 2025 07:53:42 +0000 Subject: [PATCH] ec/google/chromeec: Implement early power off This commit implements the `google_chromeec_do_early_poweroff` function for the Chrome EC. This allows the system to power off before memory initialization by triggering an EC reset with EC_REBOOT_COLD_AP_OFF. BUG=b:339673254 TEST=Able to build and boot google/brox. Change-Id: Ia53469feb2a020b38a5414728159b09c86c7e32d Signed-off-by: Subrata Banik Reviewed-on: https://review.coreboot.org/c/coreboot/+/86337 Reviewed-by: Karthik Ramasubramanian Tested-by: build bot (Jenkins) Reviewed-by: Caveh Jalali --- src/ec/google/chromeec/ec.c | 7 +++++++ src/ec/google/chromeec/ec.h | 8 ++++++++ 2 files changed, 15 insertions(+) diff --git a/src/ec/google/chromeec/ec.c b/src/ec/google/chromeec/ec.c index 2e8961f5f2..cc581ffb7b 100644 --- a/src/ec/google/chromeec/ec.c +++ b/src/ec/google/chromeec/ec.c @@ -8,6 +8,7 @@ #include #include #include +#include #include #include #include @@ -1669,3 +1670,9 @@ bool google_chromeec_is_battery_present(void) return false; } + +void google_chromeec_do_early_poweroff(void) +{ + google_chromeec_reboot(EC_REBOOT_COLD_AP_OFF, 0); + halt(); +} diff --git a/src/ec/google/chromeec/ec.h b/src/ec/google/chromeec/ec.h index b11b7a834a..08d4f2771d 100644 --- a/src/ec/google/chromeec/ec.h +++ b/src/ec/google/chromeec/ec.h @@ -471,6 +471,14 @@ bool google_chromeec_is_below_critical_threshold(void); */ bool google_chromeec_is_battery_present(void); +/* + * Performs early power off. + * + * This function handles the necessary steps to initiate an early power off + * sequence. + */ +void google_chromeec_do_early_poweroff(void); + /** * Determine if the UCSI stack is currently active. *