mb/google/bluey: Consider vboot modes for PD negotiation

This change introduces a check to ensure Power Delivery (PD)
negotiation is enabled when the device is in a specific vboot state.

PD negotiation will now be enabled if:
1. It is explicitly required by the hardware sync logic.
2. The device is in Developer Mode.
3. The device is in Recovery Mode.
4. A recovery request is pending.

This ensures that charging and PD sync are prioritized during
critical recovery and development paths.

This patch ensures the factory process remains powered by enabling
early charging based on the specific vboot mode.

In normal user scenarios, early charging is bypassed to allow higher
-level software to manage power negotiation according to standard
policy.

BUG=b:481546101
TEST=Build and boot on google/quartz. Verified PD negotiation is
active in developer/recovery mode.

Change-Id: I44b2ebd4fe3eec78a6df235df6282264dd97341f
Signed-off-by: Subrata Banik <subratabanik@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/91096
Reviewed-by: Kapil Porwal <kapilporwal@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Jayvik Desai <jayvik@google.com>
Reviewed-by: Pranava Y N <pranavayn@google.com>
This commit is contained in:
Subrata Banik 2026-02-04 19:11:36 +00:00
commit 0da04cf675

View file

@ -8,6 +8,7 @@
#include <commonlib/coreboot_tables.h>
#include <ec/google/chromeec/ec.h>
#include <gpio.h>
#include <security/vboot/vboot_common.h>
#include <soc/aop_common.h>
#include <soc/pmic.h>
#include <soc/qclib_common.h>
@ -74,12 +75,27 @@ static bool is_pd_sync_required(void)
return false;
}
/* Check if it is okay to enable PD sync. */
static bool vboot_can_enable_pd_sync(void)
{
if (!CONFIG(VBOOT))
return false;
/* Always enable if in developer or recovery mode */
if (vboot_developer_mode_enabled() || vboot_recovery_mode_enabled() ||
vboot_check_recovery_request())
return true;
/* Otherwise disable */
return false;
}
int qclib_mainboard_override(struct qclib_cb_if_table *table)
{
if (!CONFIG(EC_GOOGLE_CHROMEEC))
return 0;
if (is_pd_sync_required())
if (is_pd_sync_required() || vboot_can_enable_pd_sync())
table->global_attributes |= QCLIB_GA_ENABLE_PD_NEGOTIATION;
else
table->global_attributes &= ~QCLIB_GA_ENABLE_PD_NEGOTIATION;