diff --git a/src/drivers/intel/fsp2_0/Kconfig b/src/drivers/intel/fsp2_0/Kconfig index ffe0778971..942591585d 100644 --- a/src/drivers/intel/fsp2_0/Kconfig +++ b/src/drivers/intel/fsp2_0/Kconfig @@ -475,53 +475,4 @@ 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/drivers/intel/fsp2_0/include/fsp/api.h b/src/drivers/intel/fsp2_0/include/fsp/api.h index d159b71e02..0cbefbe9ae 100644 --- a/src/drivers/intel/fsp2_0/include/fsp/api.h +++ b/src/drivers/intel/fsp2_0/include/fsp/api.h @@ -50,20 +50,6 @@ void platform_fsp_silicon_init_params_cb(FSPS_UPD *supd); /* Callbacks for SoC/Mainboard specific overrides */ void platform_fsp_memory_multi_phase_init_cb(uint32_t phase_index); void platform_fsp_silicon_multi_phase_init_cb(uint32_t phase_index); -/* - * 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 - /* * Displays an early shutdown notification to the user. * diff --git a/src/drivers/intel/fsp2_0/memory_init.c b/src/drivers/intel/fsp2_0/memory_init.c index 38627c6b06..f6945a2313 100644 --- a/src/drivers/intel/fsp2_0/memory_init.c +++ b/src/drivers/intel/fsp2_0/memory_init.c @@ -4,6 +4,7 @@ #include #include #include +#include #include #include #include diff --git a/src/include/bootsplash.h b/src/include/bootsplash.h index 372e8c2062..7a57cd91f4 100644 --- a/src/include/bootsplash.h +++ b/src/include/bootsplash.h @@ -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 diff --git a/src/lib/Kconfig b/src/lib/Kconfig index dce3c44b5b..be3a19866f 100644 --- a/src/lib/Kconfig +++ b/src/lib/Kconfig @@ -204,6 +204,56 @@ config BMP_LOGO_FILE_NAME depends on BMP_LOGO default "3rdparty/blobs/mainboard/\$(MAINBOARDDIR)/logo.bmp" +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_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. + +if PLATFORM_HAS_LOW_BATTERY_INDICATOR + +config PLATFORM_LOW_BATTERY_SHUTDOWN_DELAY_SEC + int + default 5 + 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 PLATFORM_HAS_EARLY_LOW_BATTERY_INDICATOR + bool "Display low battery indicator in romstage" + depends on 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" + default "3rdparty/blobs/mainboard/\$(MAINBOARDDIR)/low_battery.bmp" +endif + endmenu config HAVE_EARLY_POWEROFF_SUPPORT diff --git a/src/lib/bmp_logo.c b/src/lib/bmp_logo.c index 6e3267ee87..bc636a6755 100644 --- a/src/lib/bmp_logo.c +++ b/src/lib/bmp_logo.c @@ -4,7 +4,6 @@ #include #include #include -#include #include #include diff --git a/src/vendorcode/google/chromeos/battery.c b/src/vendorcode/google/chromeos/battery.c index febc4dcc02..438098256b 100644 --- a/src/vendorcode/google/chromeos/battery.c +++ b/src/vendorcode/google/chromeos/battery.c @@ -1,7 +1,7 @@ /* SPDX-License-Identifier: GPL-2.0-only */ #include -#include +#include /* * Check if low battery shutdown is needed