summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShawn Nematbakhsh <shawnn@chromium.org>2015-02-17 17:09:46 -0800
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2015-02-18 04:53:38 +0000
commit51227a3cca61bc7a81d391ffab46498ce4cf7fa3 (patch)
tree5a9c2e3eb24143bfc790d10ba8cde39cef50c805
parentd64bb99149e013a02b0db6ac1313080ad298f2f0 (diff)
downloadchrome-ec-51227a3cca61bc7a81d391ffab46498ce4cf7fa3.tar.gz
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 <shawnn@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/250650 Reviewed-by: Alec Berg <alecaberg@chromium.org>
-rw-r--r--common/charge_manager.c9
1 files changed, 9 insertions, 0 deletions
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;