From ddc1b51b432eaaef67d58b95abb29364caf19fb3 Mon Sep 17 00:00:00 2001 From: Kapil Porwal Date: Mon, 15 Dec 2025 18:47:25 +0530 Subject: [PATCH] mb/google/bluey: Enable PD negotiation in charging modes Implement the qclib_mainboard_override hook to enable Power Delivery negotiation when the system boots into off-mode charging or low battery mode. This ensures proper charging levels are negotiated early in the boot process. BUG=b:457566143 TEST=Verify different boot modes on Google/Quenbi. TEST=Verify that PD negotiation is skipped in normal mode. Change-Id: I6c4b861862d739b002c4043ade21328e02186bbd Signed-off-by: Kapil Porwal Reviewed-on: https://review.coreboot.org/c/coreboot/+/90513 Reviewed-by: Subrata Banik Tested-by: build bot (Jenkins) --- src/mainboard/google/bluey/romstage.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/src/mainboard/google/bluey/romstage.c b/src/mainboard/google/bluey/romstage.c index 657c7ad177..63136a91f1 100644 --- a/src/mainboard/google/bluey/romstage.c +++ b/src/mainboard/google/bluey/romstage.c @@ -39,15 +39,27 @@ bool is_off_mode(void) return false; } -static void set_boot_mode(void) +static enum boot_mode_t set_boot_mode(void) { if (!CONFIG(EC_GOOGLE_CHROMEEC)) - return; + return boot_mode; + enum boot_mode_t boot_mode_new = LB_BOOT_MODE_NORMAL; if (is_off_mode()) - boot_mode = LB_BOOT_MODE_OFFMODE_CHARGING; + boot_mode_new = LB_BOOT_MODE_OFFMODE_CHARGING; else if (google_chromeec_is_below_critical_threshold()) - boot_mode = LB_BOOT_MODE_LOW_BATTERY; + boot_mode_new = LB_BOOT_MODE_LOW_BATTERY; + boot_mode = boot_mode_new; + return boot_mode_new; +} + +int qclib_mainboard_override(struct qclib_cb_if_table *table) +{ + if (set_boot_mode() != LB_BOOT_MODE_NORMAL) + table->global_attributes |= QCLIB_GA_ENABLE_PD_NEGOTIATION; + else + table->global_attributes &= ~QCLIB_GA_ENABLE_PD_NEGOTIATION; + return 0; } void platform_romstage_main(void)