From 51227a3cca61bc7a81d391ffab46498ce4cf7fa3 Mon Sep 17 00:00:00 2001 From: Shawn Nematbakhsh Date: Tue, 17 Feb 2015 17:09:46 -0800 Subject: [PATCH] charge_manager: Assume all chargers are dedicated when in locked RO In locked RO, the PD state machine is crippled and unable to determine whether a charger is dual-role capable. In order to charge in locked RO, assume that all chargers are dedicated. BUG=None TEST=Manual on samus_pd. Lock system and reboot to RO. Insert Zinger and verify that system charges 3A @ 5V. BRANCH=Samus Change-Id: I88a3ff248914cd95ebce8e9b91de1001c0f78b55 Signed-off-by: Shawn Nematbakhsh Reviewed-on: https://chromium-review.googlesource.com/250650 Reviewed-by: Alec Berg --- common/charge_manager.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/common/charge_manager.c b/common/charge_manager.c index da6b6c985c..b464c8b332 100644 --- a/common/charge_manager.c +++ b/common/charge_manager.c @@ -10,6 +10,7 @@ #include "gpio.h" #include "hooks.h" #include "host_command.h" +#include "system.h" #include "timer.h" #include "usb_pd.h" #include "usb_pd_config.h" @@ -583,6 +584,14 @@ void charge_manager_update_charge(int supplier, void charge_manager_update_dualrole(int port, enum dualrole_capabilities cap) { ASSERT(port >= 0 && port < PD_PORT_COUNT); + + /* + * We have no way of determining the charger dualrole capability in + * locked RO, so just assume we always have a dedicated charger. + */ + if (system_get_image_copy() == SYSTEM_IMAGE_RO && system_is_locked()) + cap = CAP_DEDICATED; + /* Ignore when capability is unchanged */ if (cap != dualrole_capability[port]) { dualrole_capability[port] = cap;