diff options
author | Vic Yang <victoryang@chromium.org> | 2014-09-22 19:36:58 +0800 |
---|---|---|
committer | chrome-internal-fetch <chrome-internal-fetch@google.com> | 2014-09-23 06:28:58 +0000 |
commit | bf368218e517c47bc5dfe92566431182e55c68b7 (patch) | |
tree | 0808c1f3e9574d23c5202b76779951ebe4b062bf | |
parent | a6c7b82fd97705e4b1ad7c906d295c19ce0ac871 (diff) | |
download | chrome-ec-bf368218e517c47bc5dfe92566431182e55c68b7.tar.gz |
plankton: Do not send soft reset unless already sourcing power
When 5v/12v/20v buttons are pressed, plankton first switchs to source
role, set the requested source cap, and then perform a soft reset.
However, if plankton was sink and just switched to source, the port
partner might not have switched to sink and this leaves the CC line in a
state where communication is not possible. The subsequent soft reset
then fails. If we are not already sourcing power, we actually don't need
a soft reset after changing source cap.
BUG=chrome-os-partner:32163
TEST=Switch from sink to source. Doesn't see "soft reset" in console.
TEST=Switch from 5V to 12V. See "soft reset".
BRANCH=None
Change-Id: Ia4b834c2e7dc1324b9143c46a72938845499e2fb
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/219004
Reviewed-by: Alec Berg <alecaberg@chromium.org>
-rw-r--r-- | board/plankton/board.c | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/board/plankton/board.c b/board/plankton/board.c index b563fdaf74..fb3a2914dc 100644 --- a/board/plankton/board.c +++ b/board/plankton/board.c @@ -36,25 +36,31 @@ enum usbc_action { USBC_ACT_CABLE_FLIP, USBC_ACT_CABLE_POLARITY0, USBC_ACT_CABLE_POLARITY1, + + /* Number of USBC actions */ + USBC_ACT_COUNT +}; + +enum board_src_cap src_cap_mapping[USBC_ACT_COUNT] = +{ + [USBC_ACT_5V_TO_DUT] = SRC_CAP_5V, + [USBC_ACT_12V_TO_DUT] = SRC_CAP_12V, + [USBC_ACT_20V_TO_DUT] = SRC_CAP_20V, }; static void set_usbc_action(enum usbc_action act) { + int need_soft_reset; + switch (act) { case USBC_ACT_5V_TO_DUT: - board_set_source_cap(SRC_CAP_5V); - pd_set_dual_role(PD_DRP_FORCE_SOURCE); - pd_soft_reset(); - break; case USBC_ACT_12V_TO_DUT: - board_set_source_cap(SRC_CAP_12V); - pd_set_dual_role(PD_DRP_FORCE_SOURCE); - pd_soft_reset(); - break; case USBC_ACT_20V_TO_DUT: - board_set_source_cap(SRC_CAP_20V); + need_soft_reset = gpio_get_level(GPIO_VBUS_CHARGER_EN); + board_set_source_cap(src_cap_mapping[act]); pd_set_dual_role(PD_DRP_FORCE_SOURCE); - pd_soft_reset(); + if (need_soft_reset) + pd_soft_reset(); break; case USBC_ACT_DEVICE: pd_set_dual_role(PD_DRP_FORCE_SINK); |