mb/google/bluey: Restrict low battery LED alert to closed-lid state

Refine the critically low battery alert logic to only trigger when the
lid is closed. This prevents the red LED alert from firing
unnecessarily when the system is open, or ensures it specifically
targets the user notification flow designed for a closed-lid blocked
boot.

This change requires VBOOT_LID_SWITCH to be enabled to correctly
detect the lid state in romstage.

BUG=none
TEST=Verify LED behavior on Google/Quartz with low battery and AC unplugged.

Change-Id: Ibe9e7b3bd46527f72a873f161cc359e0641c35f4
Signed-off-by: Kapil Porwal <kapilporwal@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/91012
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Subrata Banik <subratabanik@google.com>
This commit is contained in:
Kapil Porwal 2026-01-30 19:39:57 +05:30 committed by Subrata Banik
commit b999d71c49

View file

@ -2,6 +2,7 @@
#include <arch/stages.h>
#include "board.h"
#include <bootmode.h>
#include <cbmem.h>
#include <commonlib/bsd/cbmem_id.h>
#include <commonlib/coreboot_tables.h>
@ -109,8 +110,12 @@ static void early_setup_usb(void)
void platform_romstage_main(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);
/* Setup early USB related config */