diff options
author | Peter Marheine <pmarheine@chromium.org> | 2020-01-03 11:31:16 +1100 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-01-03 08:12:36 +0000 |
commit | 0db9aae29d938a1109f49f8073eabf90619ee864 (patch) | |
tree | b22102db3432114759c490bfbad9b68570b03e91 | |
parent | a9614406afd08f7725a87fb35a9c2e6014b0cc44 (diff) | |
download | chrome-ec-0db9aae29d938a1109f49f8073eabf90619ee864.tar.gz |
puff: accept switch to CHARGE_PORT_NONE
The charge manager requires that we accept such a transition, even
though it doesn't really make sense for a batteryless board. This is
okay because it only requests this change if the only available charging
port doesn't support PD, which means we definitely don't have enough
power to boot the AP.
BRANCH=none
TEST=hardware no longer resets endlessly when plugged into non-PD source
BUG=b:146515963,b:143975429
Change-Id: I45da0cd16949f9f73ede19a411694c132248b99d
Signed-off-by: Peter Marheine <pmarheine@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1985725
Reviewed-by: Andrew McRae <amcrae@chromium.org>
-rw-r--r-- | board/puff/board.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/board/puff/board.c b/board/puff/board.c index 8d275adb15..80ebedf7c2 100644 --- a/board/puff/board.c +++ b/board/puff/board.c @@ -456,12 +456,22 @@ void board_reset_pd_mcu(void) int board_set_active_charge_port(int port) { - const int active_port = charge_manager_get_active_charge_port(); + CPRINTS("Requested charge port change to %d", port); + + /* + * The charge manager may ask us to switch to no charger if we're + * running off USB-C only but upstream doesn't support PD. It requires + * that we accept this switch otherwise it triggers an assert and EC + * reset; it's not possible to boot the AP anyway, but we want to avoid + * resetting the EC so we can continue to do the "low power" LED blink. + */ + if (port == CHARGE_PORT_NONE) + return EC_SUCCESS; if (port < 0 || CHARGE_PORT_COUNT <= port) return EC_ERROR_INVAL; - if (port == active_port) + if (port == charge_manager_get_active_charge_port()) return EC_SUCCESS; /* Don't charge from a source port */ |