lib: Add support for off-mode charging splash screen

Introduce the infrastructure required to display an off-mode charging
notification. This is used when a device boots due to power cable
insertion but should remain in a charging state rather than booting
the full operating system.

Changes:
- Add BOOTSPLASH_OFF_MODE_CHARGING to bootsplash_type.
- Define platform_is_off_mode_charging_active() with a weak inline
  fallback to allow platforms to signal off-mode charging status.
- Update bmp_logo.c to recognize "off_mode_charging.bmp" and select
  it as the active logo type when charging is active.
- Modify render_bmp.c to handle layout and rendering for the charging
  logo, including support for footer text if enabled.
- Ensure the rendering flow bails out early after displaying the
  charging notification to prevent standard OS boot splash.

BUG=b:473480933
TEST=Able to build google/fatcat.

Change-Id: Ief4c65eaf0178ff3d736363c3e56acfe1adba14a
Signed-off-by: Subrata Banik <subratabanik@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/91106
Reviewed-by: Kapil Porwal <kapilporwal@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Subrata Banik 2026-02-05 14:41:04 +05:30
commit aa16822643
3 changed files with 42 additions and 2 deletions

View file

@ -13,6 +13,8 @@ enum bootsplash_type {
BOOTSPLASH_CENTER,
/* Indicates an optional OEM defined bootsplash logo for footer of the splash screen. */
BOOTSPLASH_FOOTER,
/* Indicates a off-mode charging bootsplash logo. */
BOOTSPLASH_OFF_MODE_CHARGING,
/* It's used to determine the total number of bootsplash types. */
BOOTSPLASH_MAX_NUM,
@ -171,6 +173,29 @@ bool platform_is_low_battery_shutdown_needed(void);
static inline bool platform_is_low_battery_shutdown_needed(void) { return false; }
#endif
/*
* Platform specific callbacks for off-mode bootsplash handling.
*
* These callbacks allow the platform to determine if the device
* has booted in off-mode charging to render the appropriate user
* notification.
*/
#if CONFIG(PLATFORM_HAS_OFF_MODE_CHARGING_INDICATOR)
/*
* platform_is_off_mode_charging_active - Check if off-mode charging is required.
*
* Returns true if the system should stay in a "charging splash" state
* instead of performing a full OS boot or a complete power-off.
*/
bool platform_is_off_mode_charging_active(void);
#else
/* Inline fallback for platforms without off-mode charging support */
static inline bool platform_is_off_mode_charging_active(void)
{
return false;
}
#endif
/*
* VGA Mode 12h (640x480 with 16 colors):
* As per page 13 of https://www.phatcode.net/res/221/files/vbe20.pdf