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>
This commit is contained in:
Shawn Nematbakhsh
2015-02-17 17:09:46 -08:00
committed by ChromeOS Commit Bot
parent d64bb99149
commit 51227a3cca

View File

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