From ce431ac056863ecf4d7a76c362a41c1f0b409ff1 Mon Sep 17 00:00:00 2001 From: Subrata Banik Date: Wed, 4 Feb 2026 21:04:00 +0530 Subject: [PATCH] vc/google/chromeos: Implement splash text for low-battery/off-mode boot This patch adds platform-level support for dynamic splash screen text rendering on ChromeOS devices. This implementation interfaces with the ChromeEC to retrieve battery state-of-charge and charging status, formatting these into human-readable strings during the bootsplash stage. TEST=Able to build and boot google/fatcat. Change-Id: I5dc57d60cd6be0dc9c79668a8b1560d421e4d6cc Signed-off-by: Subrata Banik Reviewed-on: https://review.coreboot.org/c/coreboot/+/91095 Reviewed-by: Kapil Porwal Tested-by: build bot (Jenkins) --- src/vendorcode/google/chromeos/Makefile.mk | 1 + src/vendorcode/google/chromeos/splash_text.c | 41 ++++++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100644 src/vendorcode/google/chromeos/splash_text.c diff --git a/src/vendorcode/google/chromeos/Makefile.mk b/src/vendorcode/google/chromeos/Makefile.mk index cfb4af45de..644003e603 100644 --- a/src/vendorcode/google/chromeos/Makefile.mk +++ b/src/vendorcode/google/chromeos/Makefile.mk @@ -24,6 +24,7 @@ romstage-$(CONFIG_CHROMEOS_DRAM_PART_NUMBER_IN_CBI) += dram_part_num_override.c ramstage-$(CONFIG_PLATFORM_HAS_LOW_BATTERY_INDICATOR) += battery.c ramstage-$(CONFIG_CHROMEOS_FW_SPLASH_SCREEN) += splash.c +ramstage-$(CONFIG_FRAMEBUFFER_SPLASH_TEXT) += splash_text.c ramstage-$(CONFIG_CHROMEOS_PVMFW_CBMEM) += pvmfw_cbmem.c # Add logo to the cbfs image diff --git a/src/vendorcode/google/chromeos/splash_text.c b/src/vendorcode/google/chromeos/splash_text.c new file mode 100644 index 0000000000..bad33f3b49 --- /dev/null +++ b/src/vendorcode/google/chromeos/splash_text.c @@ -0,0 +1,41 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#include +#include +#include +#include +#include + +static bool get_battery_status_msg(char *msg, size_t msg_max) +{ + uint32_t batt_pct; + + if (google_chromeec_read_batt_state_of_charge(&batt_pct)) { + printk(BIOS_WARNING, "Failed to get battery level\n"); + return false; + } + + if (google_chromeec_is_critically_low_on_battery()) { + snprintf(msg, msg_max, "%u%%", batt_pct); + } else if (google_chromeec_is_charger_present()) { + if (batt_pct == 100) + snprintf(msg, msg_max, "Charged"); + else + snprintf(msg, msg_max, "Charging: %u%%", batt_pct); + } + + return true; +} + +bool platform_get_splash_text(enum bootsplash_type logo_type, char *msg, size_t msg_max) +{ + if (!CONFIG(EC_GOOGLE_CHROMEEC) || !msg || msg_max == 0) + return false; + + memset(msg, 0, msg_max); + + if (logo_type == BOOTSPLASH_LOW_BATTERY || logo_type == BOOTSPLASH_OFF_MODE_CHARGING) + return get_battery_status_msg(msg, msg_max); + + return false; +}