{drivers, lib}: Move low-battery user notification logic outside FSP

This patch refactors low-battery user notification logic (Kconfig,
APIs to check if low-battery rendering is required, low-battery
shutdown is required) outside FSP driver code to ensure in future
non-FSP platforms might still be able to leverage this feature/logics
to render the low-battery indicator icon during boot.

Specifically, it:

- Moves Kconfig options related to low-battery notifications from
  drivers/intel/fsp to lib/
- Relocates the low-battery check and shutdown APIs drivers/intel/fsp
  to bootsplash.h
* Adjusts the vendor driver to utilize the new APIs for low-battery
  rendering decisions.
* Drop the unwanted header file "fsp/api.h" from bmp_logo.c

This change avoids tight coupling of low-battery functionality to FSP,
promoting code reusability across platforms.

BUG=b:400738815
TEST=Able to build and boot google/brox.

Change-Id: Iaa730dac2bb4866183408b6390221f0bb8411a48
Signed-off-by: Subrata Banik <subratabanik@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/86756
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Kapil Porwal <kapilporwal@google.com>
This commit is contained in:
Subrata Banik 2025-03-06 19:00:40 +00:00
commit 7b36319fd9
7 changed files with 65 additions and 65 deletions

View file

@ -22,5 +22,18 @@ void set_bootsplash(unsigned char *framebuffer, unsigned int x_resolution,
const char *bmp_logo_filename(void);
void *bmp_load_logo(size_t *logo_size);
void bmp_release_logo(void);
/*
* Platform specific callbacks for power-off handling.
*
* These callbacks allow the platform to determine if a power-off is
* necessary due to various reasons, such as low battery detection.
*
* Additionally, API to perform platform specific power-off
*/
#if CONFIG(PLATFORM_HAS_LOW_BATTERY_INDICATOR)
bool platform_is_low_battery_shutdown_needed(void);
#else
static inline bool platform_is_low_battery_shutdown_needed(void) { return false; }
#endif
#endif