summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Brockus <dbrockus@google.com>2021-03-02 11:27:50 -0700
committerCommit Bot <commit-bot@chromium.org>2021-03-02 22:10:30 +0000
commit8af602eeee067e045301a4ce82253c6bc703b07f (patch)
tree4faddbf6847db9cba6d9ea40eb003e17c713ea23
parent80ac785011bb593f51884e8ed9517739158e5c87 (diff)
downloadchrome-ec-8af602eeee067e045301a4ce82253c6bc703b07f.tar.gz
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 <dbrockus@google.com> Change-Id: Ifdbd683c9e761a3ccd3d01d648f88b0f47721e0b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2729616 Tested-by: Denis Brockus <dbrockus@chromium.org> Reviewed-by: Diana Z <dzigterman@chromium.org> Commit-Queue: Denis Brockus <dbrockus@chromium.org>
-rw-r--r--common/usbc/usb_pe_drp_sm.c17
1 files 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
@@ -3300,12 +3303,6 @@ static void pe_snk_ready_entry(int port)
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:
* 1) Initialize and run the SinkRequestTimer
@@ -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,