mb/google/fatcat: Refine low battery LED alert conditions

Update platform_romstage_pre_mem() to only trigger the red LED alert
when the lid is closed.

Previously, the critical low battery alert would trigger regardless of
the lid state. Checking the lid switch ensures the visual alert is
targeted at "closed-lid" scenarios where the user needs a physical
indicator of a power-critical state that prevents booting.

Change-Id: I9833fb26df9c31989abec142536e1fe7efb93c10
Signed-off-by: Subrata Banik <subratabanik@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/91007
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Kapil Porwal <kapilporwal@google.com>
This commit is contained in:
Subrata Banik 2026-01-30 15:04:26 +05:30
commit 9263722f41

View file

@ -2,6 +2,7 @@
#include <arch/romstage.h>
#include <baseboard/variants.h>
#include <bootmode.h>
#include <ec/google/chromeec/ec.h>
#include <fsp/api.h>
#include <soc/romstage.h>
@ -48,7 +49,11 @@ void mainboard_memory_init_params(FSPM_UPD *memupd)
void platform_romstage_pre_mem(void)
{
/* Set LED to Red to alert the user visually */
if (CONFIG(EC_GOOGLE_CHROMEEC) && google_chromeec_is_critically_low_on_battery())
/*
* Only alert the user (set LED to red in color) if the lid is closed and the battery
* is critically low without AC power.
*/
if (CONFIG(EC_GOOGLE_CHROMEEC) && CONFIG(VBOOT_LID_SWITCH) && !get_lid_switch() &&
google_chromeec_is_critically_low_on_battery())
google_chromeec_set_lightbar_rgb(0xff, 0xff, 0x00, 0x00);
}