summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlec Berg <alecaberg@chromium.org>2014-09-05 21:53:13 -0700
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2014-09-08 23:08:15 +0000
commit234f1956db287e292e00869d0f8edda5d6f20446 (patch)
tree658e6c0b96b0abf1aabb0160224d2b01b3c62e2b
parent406865e98ff0fd6241a15d4bd9668bb454d7ff10 (diff)
downloadchrome-ec-234f1956db287e292e00869d0f8edda5d6f20446.tar.gz
pd: check result of enabling vbus on type-C ports
Add checking the return value of enabling vbus in SRC_DISCONNECTED. If failed to enable vbus, don't transition to SRC_DISCOVERY. This can happen on zinger if zinger is in a fault condition, but once the fault is cleared, we need to be in SRC_DISCONNECTED in order to re-apply vbus. BUG=none BRANCH=none TEST=load onto EVT zinger. without this change, if zinger is plugged into a samus without a battery, when PD MCU is reset, zinger gets stuck in SRC_DISCOVERY with vbus disabled because pd_set_power_supply_ready() returns an error. This means to get power back to samus, we need to unplug and replug raiden. This change fixes the problem. Change-Id: I2ac75c7095b5d819b54b2f25ec974ccfd974e1e2 Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/216608 Reviewed-by: Vic Yang <victoryang@chromium.org> Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
-rw-r--r--common/usb_pd_protocol.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/common/usb_pd_protocol.c b/common/usb_pd_protocol.c
index c2735863f1..c4882892ac 100644
--- a/common/usb_pd_protocol.c
+++ b/common/usb_pd_protocol.c
@@ -1232,7 +1232,14 @@ void pd_task(void)
pd[port].polarity);
#endif
/* Enable VBUS */
- pd_set_power_supply_ready(port);
+ if (pd_set_power_supply_ready(port)) {
+#ifdef CONFIG_USBC_SS_MUX
+ board_set_usb_mux(port, TYPEC_MUX_NONE,
+ pd[port].polarity);
+#endif
+ break;
+ }
+
set_state(port, PD_STATE_SRC_DISCOVERY);
caps_count = 0;
#ifdef CONFIG_USB_PD_DUAL_ROLE