mb/google/bluey: Differentiate low battery boot modes
Currently, the system does not explicitly distinguish between a low
battery boot with a charger and one without. This is critical for
deciding whether to allow the boot to proceed or to protect the
battery.
This patch:
1. Re-introduces LB_BOOT_MODE_LOW_BATTERY to represent a critical
battery state without a charger present.
2. Refactors set_boot_mode() to accommodate off-mode charging and
evaluating battery health (low-batter w/ or w/o charger present)..
TEST=Verified on Bluey:
- Boot with charger + low battery enters LOW_BATTERY_CHARGING.
- Boot without charger + low battery enters LOW_BATTERY..
- Boot with normal battery enters NORMAL mode.
Change-Id: I2c9fa7eb61d1bbd6f9379c81577aee53ab6a0761
Signed-off-by: Subrata Banik <subratabanik@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/90849
Reviewed-by: Kapil Porwal <kapilporwal@google.com>
Reviewed-by: Jayvik Desai <jayvik@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
parent
219b6c8438
commit
772270c2c1
3 changed files with 16 additions and 5 deletions
|
|
@ -458,6 +458,8 @@ struct cb_panel_poweroff {
|
|||
enum boot_mode_t {
|
||||
/* Regular boot scenarios */
|
||||
CB_BOOT_MODE_NORMAL,
|
||||
/* Device is booting in low-batter w/o charger attached */
|
||||
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 */
|
||||
|
|
|
|||
|
|
@ -641,6 +641,8 @@ struct lb_panel_poweroff {
|
|||
enum boot_mode_t {
|
||||
/* Regular boot scenarios */
|
||||
LB_BOOT_MODE_NORMAL,
|
||||
/* Device is booting in low-batter w/o charger attached */
|
||||
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 */
|
||||
|
|
|
|||
|
|
@ -36,12 +36,19 @@ static enum boot_mode_t set_boot_mode(void)
|
|||
if (!CONFIG(EC_GOOGLE_CHROMEEC))
|
||||
return boot_mode;
|
||||
|
||||
enum boot_mode_t boot_mode_new = LB_BOOT_MODE_NORMAL;
|
||||
if (is_off_mode())
|
||||
enum boot_mode_t boot_mode_new;
|
||||
|
||||
if (is_off_mode()) {
|
||||
boot_mode_new = LB_BOOT_MODE_OFFMODE_CHARGING;
|
||||
else if (google_chromeec_is_below_critical_threshold() &&
|
||||
google_chromeec_is_charger_present())
|
||||
boot_mode_new = LB_BOOT_MODE_LOW_BATTERY_CHARGING;
|
||||
} else if (google_chromeec_is_below_critical_threshold()) {
|
||||
if (google_chromeec_is_charger_present())
|
||||
boot_mode_new = LB_BOOT_MODE_LOW_BATTERY_CHARGING;
|
||||
else
|
||||
boot_mode_new = LB_BOOT_MODE_LOW_BATTERY;
|
||||
} else {
|
||||
boot_mode_new = LB_BOOT_MODE_NORMAL;
|
||||
}
|
||||
|
||||
boot_mode = boot_mode_new;
|
||||
return boot_mode_new;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue