From 1c8a058c08e14af06579d2a7c9a9ae093038a48d Mon Sep 17 00:00:00 2001 From: Subrata Banik Date: Tue, 11 Feb 2025 15:16:31 +0000 Subject: [PATCH] drivers/intel/fsp2_0: Add low battery indicator screen This commit adds low battery indicator bitmap into CBFS. This screen is displayed when the system detects a critically low battery condition. The screen displays a logo and can be configured with a custom path. An option to display an early low battery indicator in text mode is also included. This early indicator can defer the firmware update. This feature is controlled by the PLATFORM_HAS_LOW_BATTERY_INDICATOR Kconfig option. BUG=b:339673254 TEST=Able to see low-battery user notification in text mode before memory init. Verified low-battery boot event listed in the eventlog. Change-Id: I711c53455639b449fe85903139bbc06cdab08d09 Signed-off-by: Subrata Banik Reviewed-on: https://review.coreboot.org/c/coreboot/+/86225 Tested-by: build bot (Jenkins) Reviewed-by: Julius Werner Reviewed-by: Karthik Ramasubramanian --- src/drivers/intel/fsp2_0/Kconfig | 49 ++++++++++++++++++++++++++++++++ src/lib/Makefile.mk | 3 ++ 2 files changed, 52 insertions(+) diff --git a/src/drivers/intel/fsp2_0/Kconfig b/src/drivers/intel/fsp2_0/Kconfig index c5c485bad2..42551503ff 100644 --- a/src/drivers/intel/fsp2_0/Kconfig +++ b/src/drivers/intel/fsp2_0/Kconfig @@ -522,4 +522,53 @@ config BUILDING_WITH_DEBUG_FSP Enable this option if you are using a debug build of the FSP (Firmware Support Package) in your project. +config PLATFORM_HAS_LOW_BATTERY_INDICATOR + bool "Display low battery indicator" + depends on BMP_LOGO + help + If enabled, this option displays a low battery indicator screen. This screen can be + used to warn the user that the battery is low and that they should plug in the device. + + This option requires that the system have a display and that the BMP_LOGO option is + enabled. + +config PLATFORM_LOW_BATTERY_SHUTDOWN_DELAY_SEC + int + default 5 + depends on PLATFORM_HAS_LOW_BATTERY_INDICATOR + help + Delay, in seconds, before system shutdown due to low battery. + This delay allows the user to observe the low-battery indicator. + The default value of 5 seconds aligns with standard user experience (UX) practices. + Platforms may override this value based on specific product requirements. + +config HAVE_ESOL_SUPPORT_FOR_LOW_BATTERY_INDICATOR + bool + depends on FSP_UGOP_EARLY_SIGN_OF_LIFE || MAINBOARD_HAS_EARLY_LIBGFXINIT + help + Enable low-battery indicator support in eSOL. + + This option should be selected if the eSOL feature (using either libgfxinit or FSP uGOP) + supports displaying a low-battery indicator. + + Platforms selecting `MAINBOARD_HAS_EARLY_LIBGFXINIT` can default enable this option. + + For platforms using FSP uGOP, this option should only be enabled if uGOP has implemented + the necessary low-battery handling. This allows platforms to control low-battery + indicator support based on uGOP readiness. + +config PLATFORM_HAS_EARLY_LOW_BATTERY_INDICATOR + bool "Display low battery indicator in romstage" + depends on PLATFORM_HAS_LOW_BATTERY_INDICATOR && HAVE_ESOL_SUPPORT_FOR_LOW_BATTERY_INDICATOR + help + If enabled, this option displays a low battery indicator during romstage (before memory + is available) in text mode in the firmware and defer the firmware update. This screen + can be used to warn the user that the battery is low and that they should plug in the + device. + +config PLATFORM_LOW_BATTERY_INDICATOR_LOGO_PATH + string "Path to low battery logo file" + depends on PLATFORM_HAS_LOW_BATTERY_INDICATOR + default "3rdparty/blobs/mainboard/\$(MAINBOARDDIR)/low_battery.bmp" + endif diff --git a/src/lib/Makefile.mk b/src/lib/Makefile.mk index 93e76d4af3..5e1e81a5d0 100644 --- a/src/lib/Makefile.mk +++ b/src/lib/Makefile.mk @@ -440,3 +440,6 @@ ifneq ($(CONFIG_HAVE_CUSTOM_BMP_LOGO),y) $(eval $(call add_bmp_logo_file_to_cbfs,CONFIG_BMP_LOGO, logo.bmp,\ CONFIG_FSP2_0_LOGO_FILE_NAME)) endif + +$(eval $(call add_bmp_logo_file_to_cbfs,CONFIG_PLATFORM_HAS_LOW_BATTERY_INDICATOR, \ + low_battery.bmp,CONFIG_PLATFORM_LOW_BATTERY_INDICATOR_LOGO_PATH))