From fe506bfe8494cbfddaa83406deafc4bcc85f600b Mon Sep 17 00:00:00 2001 From: Subrata Banik Date: Sat, 28 Feb 2026 19:39:31 +0530 Subject: [PATCH] ec/google/chromeec: Add Kconfig for AP-controlled LED sync Introduce EC_GOOGLE_CHROMEEC_LED_CONTROL to allow boards to opt-in to manual LED/lightbar synchronization. This ensures that the AP firmware can coordinate the lightbar state with boot animations or specific power states (like critical battery alerts) without forcing the logic on all ChromeEC-based platforms. On Bluey, the lightbar logic is refactored into a helper function `platform_init_lightbar()` to improve readability and is now gated by the new Kconfig. Similar gating is applied to Fatcat's romstage. Summary of changes: - Add EC_GOOGLE_CHROMEEC_LED_CONTROL Kconfig option. - Bluey: Refactor lightbar init into a helper and gate by Kconfig. - Fatcat: Gate early lightbar initialization by Kconfig. Change-Id: I6b0294b73b8b9929a6be0e15bf64f7e688b7da8c Signed-off-by: Subrata Banik Reviewed-on: https://review.coreboot.org/c/coreboot/+/91477 Tested-by: build bot (Jenkins) Reviewed-by: Kapil Porwal --- src/ec/google/chromeec/Kconfig | 6 ++++++ src/mainboard/google/bluey/mainboard.c | 2 +- src/mainboard/google/bluey/romstage.c | 17 ++++++++++++----- src/mainboard/google/fatcat/romstage.c | 2 +- 4 files changed, 20 insertions(+), 7 deletions(-) diff --git a/src/ec/google/chromeec/Kconfig b/src/ec/google/chromeec/Kconfig index b09c64a88c..081f7cb754 100644 --- a/src/ec/google/chromeec/Kconfig +++ b/src/ec/google/chromeec/Kconfig @@ -261,6 +261,12 @@ config EC_GOOGLE_CHROMEEC_BATTERY_SOC_DYNAMIC which retrieves cached telemetry from the EC rather than triggering a synchronous bus transaction to the battery. +config EC_GOOGLE_CHROMEEC_LED_CONTROL + bool + help + Enable manual AP control over ChromeEC LEDs/lightbars to ensure + visual continuity with AP-side boot animations. + endif # EC_GOOGLE_CHROMEEC source "src/ec/google/chromeec/*/Kconfig" diff --git a/src/mainboard/google/bluey/mainboard.c b/src/mainboard/google/bluey/mainboard.c index 30cf5b13d8..223daf89c8 100644 --- a/src/mainboard/google/bluey/mainboard.c +++ b/src/mainboard/google/bluey/mainboard.c @@ -182,7 +182,7 @@ static void mainboard_init(struct device *dev) * This maintains visual consistency between the built-in display * indicators and the external lightbar. */ - if (CONFIG(EC_GOOGLE_CHROMEEC)) + if (CONFIG(EC_GOOGLE_CHROMEEC_LED_CONTROL)) google_chromeec_lightbar_off(); /* Boot to charging applet */ diff --git a/src/mainboard/google/bluey/romstage.c b/src/mainboard/google/bluey/romstage.c index a415228e8b..891809f045 100644 --- a/src/mainboard/google/bluey/romstage.c +++ b/src/mainboard/google/bluey/romstage.c @@ -124,23 +124,30 @@ static void early_setup_usb(void) early_setup_usb_typec(); } -void platform_romstage_main(void) +static void platform_init_lightbar(void) { + if (!CONFIG(EC_GOOGLE_CHROMEEC_LED_CONTROL)) + return; + /* * Early initialization of the Chrome EC lightbar. * Ensures visual continuity if the AP firmware disabled the lightbar * in a previous boot without a subsequent EC reset. */ - if (CONFIG(EC_GOOGLE_CHROMEEC)) - google_chromeec_lightbar_on(); + google_chromeec_lightbar_on(); /* * Only alert the user (set LED to red in color) if the lid is closed and the battery * is critically low without AC power. */ - if (CONFIG(EC_GOOGLE_CHROMEEC) && CONFIG(VBOOT_LID_SWITCH) && !get_lid_switch() && - google_chromeec_is_critically_low_on_battery()) + if (CONFIG(VBOOT_LID_SWITCH) && !get_lid_switch() && + google_chromeec_is_critically_low_on_battery()) google_chromeec_set_lightbar_rgb(0xff, 0xff, 0x00, 0x00); +} + +void platform_romstage_main(void) +{ + platform_init_lightbar(); /* Setup early USB related config */ early_setup_usb(); diff --git a/src/mainboard/google/fatcat/romstage.c b/src/mainboard/google/fatcat/romstage.c index 5098cd3d8b..04b39c58c4 100644 --- a/src/mainboard/google/fatcat/romstage.c +++ b/src/mainboard/google/fatcat/romstage.c @@ -53,7 +53,7 @@ void platform_romstage_pre_mem(void) * Ensures visual continuity if the AP firmware disabled the lightbar * in a previous boot without a subsequent EC reset. */ - if (CONFIG(EC_GOOGLE_CHROMEEC)) + if (CONFIG(EC_GOOGLE_CHROMEEC_LED_CONTROL)) google_chromeec_lightbar_on(); /*