diff --git a/src/include/bootsplash.h b/src/include/bootsplash.h index cd02f7382e..67b3a405a1 100644 --- a/src/include/bootsplash.h +++ b/src/include/bootsplash.h @@ -191,8 +191,15 @@ void bmp_release_logo(void); */ #if CONFIG(PLATFORM_HAS_LOW_BATTERY_INDICATOR) bool platform_is_low_battery_shutdown_needed(void); +/* + * Platform hooks for system shutdown due to critical battery levels. + * Provides visual feedback via the Lightbar/LEDs and logs the event + * to non-volatile storage before signaling to cut power. + */ +void platform_handle_emergency_low_battery(void); #else static inline bool platform_is_low_battery_shutdown_needed(void) { return false; } +static inline void platform_handle_emergency_low_battery(void) { /* nop */ } #endif /* diff --git a/src/vendorcode/google/chromeos/battery.c b/src/vendorcode/google/chromeos/battery.c index 438098256b..0e676b3f2a 100644 --- a/src/vendorcode/google/chromeos/battery.c +++ b/src/vendorcode/google/chromeos/battery.c @@ -2,6 +2,8 @@ #include #include +#include +#include /* * Check if low battery shutdown is needed @@ -32,3 +34,25 @@ bool platform_is_low_battery_shutdown_needed(void) return result; } + +/* + * Platform hooks for system shutdown due to critical battery levels. + * Provides visual feedback via the Lightbar/LEDs and logs the event + * to non-volatile storage before signaling to cut power. + */ +void platform_handle_emergency_low_battery(void) +{ + if (!CONFIG(EC_GOOGLE_CHROMEEC)) + return; + + /* Visual alert: Set Lightbar to solid Red */ + google_chromeec_set_lightbar_rgb(0xff, 0xff, 0x00, 0x00); + + /* Record the event for post-mortem diagnostics (stored in CMOS/Flash) */ + elog_add_event_byte(ELOG_TYPE_LOW_BATTERY_INDICATOR, ELOG_FW_ISSUE_SHUTDOWN); + + /* * Pause briefly to ensure the user perceives the LED change and + * the event log is safely committed to storage. + */ + delay(CONFIG_PLATFORM_POST_RENDER_DELAY_SEC); +}