coreboot/src/include/bootsplash.h
Subrata Banik 7b36319fd9 {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>
2025-03-08 07:17:32 +00:00

39 lines
1.2 KiB
C

/* SPDX-License-Identifier: GPL-2.0-only */
#ifndef __BOOTSPLASH_H__
#define __BOOTSPLASH_H__
#include <types.h>
/**
* Sets up the framebuffer with the bootsplash.jpg from cbfs.
* Returns 0 on success
* CB_ERR on cbfs errors
* and >0 on jpeg errors.
*/
void set_bootsplash(unsigned char *framebuffer, unsigned int x_resolution,
unsigned int y_resolution, unsigned int bytes_per_line,
unsigned int fb_resolution);
/*
* Allow platform-specific BMP logo overrides via HAVE_CUSTOM_BMP_LOGO config.
* For example: Introduce configurable BMP logo for customization on platforms like ChromeOS
*/
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