mb/google/bluey: Defer display initialization based on boot mode

Currently, display_startup() is called unconditionally during
mainboard_init(). For normal boot paths, this can lead to unnecessary
latency (40ms) issues.

Modify the initialization flow to:
1. Initialize display early only for low-battery or off-mode
   charging paths to ensure the user sees the charging UI.
2. Defer display initialization for all other modes to a new
   mainboard_late_init() function.
3. Use a static flag (display_init_done) to ensure display_startup()
   is only executed once regardless of the entry point.

TEST=Verified bluey still shows charging animation when low on
battery and boots to OS normally. Able to save 40ms of the boot time.

Change-Id: Id6bdda90b7f67c13cd7334ba17131a8243af0cdb
Signed-off-by: Subrata Banik <subratabanik@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/91845
Reviewed-by: Kapil Porwal <kapilporwal@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Subrata Banik 2026-03-25 14:08:14 +05:30
commit b8ed516097

View file

@ -220,7 +220,9 @@ static void mainboard_init(void *chip_info)
configure_parallel_charging();
configure_debug_access_port();
display_startup();
/* Do early display init for low/off-mode charging */
if (get_boot_mode() != LB_BOOT_MODE_NORMAL)
display_startup();
/*
* Low-battery boot indicator is done. Therefore, power off if battery
@ -270,10 +272,13 @@ static void load_qc_se_firmware_late(void)
qupv3_se_fw_load_and_init(QUPV3_2_SE2, SE_PROTOCOL_SPI, MIXED); /* Fingerprint SPI */
}
static void mainboard_enable(struct device *dev)
static void mainboard_late_init(struct device *dev)
{
load_qc_se_firmware_late();
/* Do late display init in normal boot mode */
display_startup();
/* Enable touchpad power */
if (CONFIG_MAINBOARD_GPIO_PIN_FOR_TOUCHPAD_POWER)
gpio_output(GPIO_TP_POWER_EN, 1);
@ -289,6 +294,11 @@ static void mainboard_enable(struct device *dev)
setup_audio();
}
static void mainboard_enable(struct device *dev)
{
dev->ops->init = &mainboard_late_init;
}
struct chip_operations mainboard_ops = {
.enable_dev = mainboard_enable,
.init = mainboard_init,