Subrata Banik has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/86228?usp=email )
Change subject: vc/google/chromeos: Implement platform callback for critical shutdown ......................................................................
vc/google/chromeos: Implement platform callback for critical shutdown
This commit implements the platform_is_critical_shutdown_needed callback for ChromeOS. It checks the Chrome EC for a critically low battery condition. If detected, a short delay is introduced before logging a low battery event and initiating a system poweroff using the poweroff() function. This ensures a clean shutdown due to low battery.
BUG=b:339673254 TEST=Verified low battery boot event logging and controlled shutdown.
Change-Id: I119f80a45c045a6095cae98f179c755a2e948e9c Signed-off-by: Subrata Banik subratabanik@google.com --- M src/vendorcode/google/chromeos/splash.c 1 file changed, 14 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/28/86228/1
diff --git a/src/vendorcode/google/chromeos/splash.c b/src/vendorcode/google/chromeos/splash.c index 0c7cba7..8925721 100644 --- a/src/vendorcode/google/chromeos/splash.c +++ b/src/vendorcode/google/chromeos/splash.c @@ -2,8 +2,22 @@
#include <bootsplash.h> #include <ec/google/chromeec/ec.h> +#include <elog.h> +#include <fsp/api.h> +#include <delay.h> +#include <halt.h> #include <vendorcode/google/chromeos/chromeos.h>
+void platform_is_critical_shutdown_needed(void) +{ + if (CONFIG(EC_GOOGLE_CHROMEEC) && google_chromeec_is_below_critical_threshold()) { + /* Allow user to notice the low battery indicator before poweroff */ + delay(3); + elog_add_event_byte(ELOG_TYPE_LOW_BATTERY_INDICATOR, ELOG_FW_ISSUE_SHUTDOWN); + poweroff(); + } +} + static bool chromeos_render_low_battery_logo(void) { if (!CONFIG(CHROMEOS_LOW_BATTERY_INDICATOR_SCREEN) || !CONFIG(EC_GOOGLE_CHROMEEC))