summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlec Berg <alecaberg@chromium.org>2015-01-19 13:24:24 -0800
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2015-01-19 23:37:45 +0000
commita0c5faf1a106bcc3771f63ebda8b1fac1877b95d (patch)
treeac7b52b04dc7932f8073066a9c3dec8ab5da2d59
parent83ef084f95e2dd83bf5f43472fb6f9ebeb57583f (diff)
downloadchrome-ec-a0c5faf1a106bcc3771f63ebda8b1fac1877b95d.tar.gz
pd: fix bug where sysjump could cause PD state to wedge
Fix bug in USB PD initialization after a sysjump. Since the CC pull resistors weren't being initialized after a sysjump, we would sometimes end up stuck in sink debounce state because we would have Rp applied and our initial state of sink disconnected would think that a source was attached. And since we continued to apply Rp, we would never make a connection with a charger, so we would be stuck in sink debounce until a reboot. BUG=chrome-os-partner:35608 BRANCH=samus TEST=load on samus and keep rebooting and sysjumping and making sure that we don't falsely go to the sink debounce state. Change-Id: Ic81fe02be78f3f4ffe00e3e3e378f5befe8545a5 Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/241874 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
-rw-r--r--common/usb_pd_protocol.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/common/usb_pd_protocol.c b/common/usb_pd_protocol.c
index 8b03f38798..bc662abb77 100644
--- a/common/usb_pd_protocol.c
+++ b/common/usb_pd_protocol.c
@@ -1746,6 +1746,14 @@ void pd_task(void)
timestamp_t now;
int caps_count = 0, hard_reset_sent = 0;
+#ifdef CONFIG_USB_PD_DUAL_ROLE
+ /*
+ * Set CC pull resistors, and charge_en and vbus_en GPIOs to match
+ * the initial role.
+ */
+ pd_set_host_mode(port, PD_ROLE_DEFAULT == PD_ROLE_SOURCE);
+#endif
+
/* Initialize TX pins and put them in Hi-Z */
pd_tx_init();