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 <kapilporwal@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/90513
Reviewed-by: Subrata Banik <subratabanik@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Kapil Porwal 2025-12-15 18:47:25 +05:30 committed by Subrata Banik
commit ddc1b51b43

View file

@ -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)