mb/google/bluey: Use common platform hook for emergency shutdown

Refactor trigger_critical_battery_shutdown() to use the newly
implemented platform_handle_emergency_low_battery() hook.

This removes duplicate logic from the Bluey mainboard directory and
ensures consistency with the ChromeOS common battery handling code
for visual alerts and ELOG recording.

BUG=none
BRANCH=none
TEST=Build and boot on Bluey; verify emergency shutdown still
triggers red LEDs and logs ELOG events correctly.

Change-Id: I28da29eb3f0033abe524f7ee12d6b823392e9766
Signed-off-by: Subrata Banik <subratabanik@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/91410
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Kapil Porwal <kapilporwal@google.com>
This commit is contained in:
Subrata Banik 2026-02-24 12:39:06 +05:30
commit a96f1a464b

View file

@ -2,6 +2,7 @@
#include <boot/coreboot_tables.h>
#include <bootmode.h>
#include <bootsplash.h>
#include <bootstate.h>
#include <cbmem.h>
#include <commonlib/bsd/cbmem_id.h>
@ -11,7 +12,6 @@
#include <device/device.h>
#include <device/i2c_simple.h>
#include <ec/google/chromeec/ec.h>
#include <elog.h>
#include <gpio.h>
#include <soc/clock.h>
#include <soc/pcie.h>
@ -159,14 +159,7 @@ static void trigger_critical_battery_shutdown(void)
if (!CONFIG(EC_GOOGLE_CHROMEEC))
return;
/* Set LED to Red to alert the user visually */
google_chromeec_set_lightbar_rgb(0xff, 0xff, 0x00, 0x00);
/* Log the event to CMOS/Flash for post-mortem analysis */
elog_add_event_byte(ELOG_TYPE_LOW_BATTERY_INDICATOR, ELOG_FW_ISSUE_SHUTDOWN);
/* Allow time for the log to flush and the user to see the LED change */
delay(CONFIG_PLATFORM_POST_RENDER_DELAY_SEC);
platform_handle_emergency_low_battery();
google_chromeec_ap_poweroff();
}