From 13df9780cb1150a4f5340736bd1861e2d83d55b7 Mon Sep 17 00:00:00 2001 From: Alec Berg Date: Tue, 26 May 2015 18:48:06 -0700 Subject: [PATCH] pd: avoid re-sending discovery VDMs after power swap Avoid re-sending discovery VDMs after power swap from source to sink. BUG=chrome-os-partner:40657 BRANCH=samus TEST=tested connecting samus to samus. tested power swapping back and forth and verify that we don't re-send discovery VDMs. Tested soft reset and verified that we don't re-send discovery VDMs. Tested hard reset and verified that we DO re-send discovery VDMs. Change-Id: Ib48c134f460eb776b7c6f5c1d86a5b56bb08ebcc Signed-off-by: Alec Berg Reviewed-on: https://chromium-review.googlesource.com/273420 Reviewed-by: Todd Broch Reviewed-by: Vincent Palatin --- common/usb_pd_protocol.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/common/usb_pd_protocol.c b/common/usb_pd_protocol.c index 35bb7c0dc6..470287c65d 100644 --- a/common/usb_pd_protocol.c +++ b/common/usb_pd_protocol.c @@ -1855,8 +1855,13 @@ void pd_task(void) typec_set_input_current_limit( port, typec_curr, TYPE_C_VOLTAGE); #endif + /* + * fake set data role swapped flag so we send + * discover identity when we enter SRC_READY + */ pd[port].flags |= PD_FLAGS_CHECK_PR_ROLE | - PD_FLAGS_CHECK_DR_ROLE; + PD_FLAGS_CHECK_DR_ROLE | + PD_FLAGS_DATA_SWAPPED; set_state(port, PD_STATE_SNK_DISCOVERY); timeout = 10*MSEC; hook_call_deferred( @@ -1917,12 +1922,6 @@ void pd_task(void) /* Wait for source cap expired only if we are enabled */ if ((pd[port].last_state != pd[port].task_state) && pd_comm_enabled) { - /* - * fake set data role swapped flag so we send - * discover identity when we enter SRC_READY - */ - pd[port].flags |= PD_FLAGS_DATA_SWAPPED; - /* * If we haven't passed hard reset counter, * start SinkWaitCapTimer, otherwise start