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>
This commit is contained in:
Alec Berg
2015-01-19 13:24:24 -08:00
committed by ChromeOS Commit Bot
parent 83ef084f95
commit a0c5faf1a1

View File

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