mb/google/bluey: Rename LB_BOOT_MODE_LOW_BATTERY for clarity

The current LB_BOOT_MODE_LOW_BATTERY actually implies a state where the
battery is below the critical threshold but a charger is attached,
allowing the system to boot into a charging-only or limited state.

Update the enum name to LB_BOOT_MODE_LOW_BATTERY_CHARGING across
coreboot tables and libpayload to better reflect this hardware state.

Changes:
- Rename boot mode enums in commonlib and libpayload.
- Update bluey mainboard logic to use the more descriptive name.
- Refactor is_low_power_boot() to is_low_power_boot_with_charger()
  to improve code readability.
- Ensure the charger-present condition is explicitly checked in
  romstage when setting the boot mode.

TEST=Verify bluey boots into off-mode charging and low-battery
charging modes correctly.

Change-Id: I2478c7519c781a8b5af78445899b7f9bf412cf42
Signed-off-by: Subrata Banik <subratabanik@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/90845
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Kapil Porwal <kapilporwal@google.com>
Reviewed-by: Jayvik Desai <jayvik@google.com>
This commit is contained in:
Subrata Banik 2026-01-21 15:36:50 +05:30
commit 219b6c8438
4 changed files with 22 additions and 13 deletions

View file

@ -456,8 +456,11 @@ struct cb_panel_poweroff {
};
enum boot_mode_t {
/* Regular boot scenarios */
CB_BOOT_MODE_NORMAL,
CB_BOOT_MODE_LOW_BATTERY,
/* Device is booting in low-batter w/ charger attached */
CB_BOOT_MODE_LOW_BATTERY_CHARGING,
/* Device is booting in due to charger insertion */
CB_BOOT_MODE_OFFMODE_CHARGING,
};

View file

@ -639,8 +639,11 @@ struct lb_panel_poweroff {
};
enum boot_mode_t {
/* Regular boot scenarios */
LB_BOOT_MODE_NORMAL,
LB_BOOT_MODE_LOW_BATTERY,
/* Device is booting in low-batter w/ charger attached */
LB_BOOT_MODE_LOW_BATTERY_CHARGING,
/* Device is booting in due to charger insertion */
LB_BOOT_MODE_OFFMODE_CHARGING,
};

View file

@ -63,13 +63,15 @@ static enum boot_mode_t get_boot_mode(void)
return boot_mode;
}
static bool is_low_power_boot(void)
static bool is_low_power_boot_with_charger(void)
{
bool ret = false;
enum boot_mode_t boot_mode = get_boot_mode();
if ((boot_mode == LB_BOOT_MODE_LOW_BATTERY) ||
if ((boot_mode == LB_BOOT_MODE_LOW_BATTERY_CHARGING) ||
(boot_mode == LB_BOOT_MODE_OFFMODE_CHARGING))
return true;
return false;
ret = true;
return ret;
}
static void enable_usb_camera(void)
@ -99,7 +101,7 @@ static void setup_usb(void)
static void setup_usb_late(void *unused)
{
/* Skip USB initialization if boot mode is "low-battery" or "off-mode charging"*/
if (is_low_power_boot())
if (is_low_power_boot_with_charger())
return;
setup_usb_host0();
@ -119,15 +121,15 @@ void lb_add_boot_mode(struct lb_header *header)
mode->size = sizeof(*mode);
mode->boot_mode = get_boot_mode();
/* Enable charging only during off-mode or low-battery mode and charger present */
if (is_low_power_boot() && google_chromeec_is_charger_present())
/* Enable charging only during off-mode or low-battery mode with charger present */
if (is_low_power_boot_with_charger())
enable_slow_battery_charging();
}
bool mainboard_needs_pcie_init(void)
{
/* Skip PCIe initialization if boot mode is "low-battery" or "off-mode charging"*/
if (is_low_power_boot())
if (is_low_power_boot_with_charger())
return false;
return true;
@ -152,7 +154,7 @@ static void mainboard_init(struct device *dev)
configure_parallel_charging();
/* Skip mainboard initialization if boot mode is "low-battery" or "off-mode charging"*/
if (is_low_power_boot())
if (is_low_power_boot_with_charger())
return;
gpi_firmware_load(QUP_0_GSI_BASE);

View file

@ -39,8 +39,9 @@ static enum boot_mode_t set_boot_mode(void)
enum boot_mode_t boot_mode_new = LB_BOOT_MODE_NORMAL;
if (is_off_mode())
boot_mode_new = LB_BOOT_MODE_OFFMODE_CHARGING;
else if (google_chromeec_is_below_critical_threshold())
boot_mode_new = LB_BOOT_MODE_LOW_BATTERY;
else if (google_chromeec_is_below_critical_threshold() &&
google_chromeec_is_charger_present())
boot_mode_new = LB_BOOT_MODE_LOW_BATTERY_CHARGING;
boot_mode = boot_mode_new;
return boot_mode_new;
}