From d837c80ef2a8c26e281f3dcd4eb42f5c42a0340b Mon Sep 17 00:00:00 2001 From: Shawn Nematbakhsh Date: Thu, 3 Dec 2015 12:29:47 -0800 Subject: [PATCH] pd: Fix unwanted resets on single-role power supplies If we're still in DISCONNECTED or DISCONNECTED_DEBOUNCE state, don't check CC lines to detect a disconnect since CC polarity has not yet been established. BUG=chrome-os-partner:48220 BRANCH=None TEST=Verify PD contact can be negotiated on Snoball with either polarity. Change-Id: Iacde14446c0ff5d2170936b650f56668038f613e Signed-off-by: Shawn Nematbakhsh Reviewed-on: https://chromium-review.googlesource.com/315780 Commit-Ready: Shawn N Tested-by: Shawn N Reviewed-by: Alec Berg Reviewed-by: Shawn N --- common/usb_pd_protocol.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/common/usb_pd_protocol.c b/common/usb_pd_protocol.c index 511c5aba4c..b40ed0e98f 100644 --- a/common/usb_pd_protocol.c +++ b/common/usb_pd_protocol.c @@ -2533,9 +2533,11 @@ void pd_task(void) } } - /* Check for disconnection */ + /* Check for disconnection if we're connected */ + if (!pd_is_connected(port)) + continue; #ifdef CONFIG_USB_PD_DUAL_ROLE - if (!pd_is_connected(port) || pd_is_power_swapping(port)) + if (pd_is_power_swapping(port)) continue; #endif if (pd[port].power_role == PD_ROLE_SOURCE) {