From 8af602eeee067e045301a4ce82253c6bc703b07f Mon Sep 17 00:00:00 2001 From: Denis Brockus Date: Tue, 2 Mar 2021 11:27:50 -0700 Subject: TCPMv2: PE_TIMER_SINK_REQUEST should not disable on exit or re-entry of SnkReady BUG=b:181343741 BRANCH=none TEST=Check SINK attach Signed-off-by: Denis Brockus Change-Id: Ifdbd683c9e761a3ccd3d01d648f88b0f47721e0b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2729616 Tested-by: Denis Brockus Reviewed-by: Diana Z Commit-Queue: Denis Brockus --- common/usbc/usb_pe_drp_sm.c | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/common/usbc/usb_pe_drp_sm.c b/common/usbc/usb_pe_drp_sm.c index 4f7044b7ec..b5f9391ec5 100644 --- a/common/usbc/usb_pe_drp_sm.c +++ b/common/usbc/usb_pe_drp_sm.c @@ -740,6 +740,7 @@ static void pe_init(int port) pe[port].dpm_request = 0; pe[port].dpm_curr_request = 0; pd_timer_disable(port, PE_TIMER_NO_RESPONSE); + pd_timer_disable(port, PE_TIMER_SINK_REQUEST); pd_timer_disable(port, PE_TIMER_SOURCE_CAP); pd_timer_disable(port, PE_TIMER_WAIT_AND_ADD_JITTER); pe[port].data_role = pd_get_data_role(port); @@ -3150,6 +3151,8 @@ static void pe_snk_select_capability_run(int port) if (type == PD_CTRL_WAIT) PE_SET_FLAG(port, PE_FLAGS_WAIT); + pd_timer_disable(port, PE_TIMER_SINK_REQUEST); + /* * We had a previous explicit contract, so * transition to PE_SNK_Ready @@ -3299,12 +3302,6 @@ static void pe_snk_ready_entry(int port) /* Clear DPM Current Request */ pe[port].dpm_curr_request = 0; - /* - * TODO(b:181343741) The PE_TIMER_SINK_REQUEST should not be disabled - * and re-enabled on transition to/from SNK_READY unless this is the - * initial time in. Leaving for a message or other normal handling - * should not reset the timer - */ /* * On entry to the PE_SNK_Ready state as the result of a wait, * then do the following: @@ -3315,6 +3312,7 @@ static void pe_snk_ready_entry(int port) pd_timer_enable(port, PE_TIMER_SINK_REQUEST, PD_T_SINK_REQUEST); } + /* * Wait and add jitter if we are operating in PD2.0 mode and no messages * have been sent since enter this state. @@ -3460,6 +3458,7 @@ static void pe_snk_ready_run(int port) pd_timer_disable(port, PE_TIMER_WAIT_AND_ADD_JITTER); if (pd_timer_is_expired(port, PE_TIMER_SINK_REQUEST)) { + pd_timer_disable(port, PE_TIMER_SINK_REQUEST); set_state_pe(port, PE_SNK_SELECT_CAPABILITY); return; } @@ -3483,11 +3482,6 @@ static void pe_snk_ready_run(int port) } } -static void pe_snk_ready_exit(int port) -{ - pd_timer_disable(port, PE_TIMER_SINK_REQUEST); -} - /** * PE_SNK_Hard_Reset */ @@ -6894,7 +6888,6 @@ static __const_data const struct usb_state pe_states[] = { [PE_SNK_READY] = { .entry = pe_snk_ready_entry, .run = pe_snk_ready_run, - .exit = pe_snk_ready_exit, }, [PE_SNK_HARD_RESET] = { .entry = pe_snk_hard_reset_entry, -- cgit v1.2.1