summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorPatryk Duda <pdk@semihalf.com>2020-04-07 13:30:58 +0200
committerCommit Bot <commit-bot@chromium.org>2020-04-07 22:34:40 +0000
commit42b1b6c130c6caaad519fbf6228fd3d5bebee30e (patch)
treee4a73f5c8ff94988f95e821a089628fe15096467 /common
parent09ee5b7820a78ccbdcd7f40a31ab72d91369214c (diff)
downloadchrome-ec-42b1b6c130c6caaad519fbf6228fd3d5bebee30e.tar.gz
TCPMv2: Do not enter Unattached.SRC state when PD_DRP_FORCE_SINK is set
Check DRP state in AttachWait.SNK when any CC pin is not RP. If DRP state is PD_DRP_FORCE_SINK then we are not allowed to enter Unattached.SRC. This was found when running master branch on nocturne. While performing shutdown on chromebook all USB-C ports enters Unattached.SNK, due to reaction on PD_DRP_FORCE_SINK DRP state and PD_EVENT_UPDATE_DUAL_ROLE. From Unattached.SNK state port goes to Attached.SRC again through AttachWait.SNK and then Unattached.SRC. Attached.SRC state enables power on USB-C port, but in this case it is not actually enabled because chipset is in CHIPSET_STATE_ANY_OFF. While booting, device port is still in Attached.SRC state, but with disabled power on USB-C port. As a result USB-C device needs to be replugged in order to get it working again. Approach to fix this is just prevent entering Unattached.SRC when PD_DRP_FORCE_SINK is set (enter Unattached.SNK instead). BUG=b:151301058 BRANCH=none TEST=Run ChromeOS. Plug some USB-C device and make sure device is working. Shutdown and power on board. Check if USB-C device is working. Do not replug it. Signed-off-by: Patryk Duda <pdk@semihalf.com> Change-Id: Ie53ae579147fc15e5dbefd1ec3d03b6ba7b71ddf Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2139756 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Diffstat (limited to 'common')
-rw-r--r--common/usbc/usb_tc_drp_acc_trysrc_sm.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/common/usbc/usb_tc_drp_acc_trysrc_sm.c b/common/usbc/usb_tc_drp_acc_trysrc_sm.c
index 3b310c012e..6a1c452090 100644
--- a/common/usbc/usb_tc_drp_acc_trysrc_sm.c
+++ b/common/usbc/usb_tc_drp_acc_trysrc_sm.c
@@ -1699,8 +1699,10 @@ static void tc_attach_wait_snk_run(const int port)
}
/*
- * A DRP shall transition to Unattached.SNK when the state of both
- * the CC1 and CC2 pins is SNK.Open for at least tPDDebounce.
+ * A DRP shall transition to Unattached.SRC when the state of both
+ * the CC1 and CC2 pins is SNK.Open for at least tPDDebounce, however
+ * when DRP state is PD_DRP_FORCE_SINK the next state should be
+ * Unattached.SNK.
*/
if (new_cc_state == PD_CC_NONE &&
get_time().val > tc[port].pd_debounce) {
@@ -1710,7 +1712,10 @@ static void tc_attach_wait_snk_run(const int port)
}
/* We are detached */
- set_state_tc(port, TC_UNATTACHED_SRC);
+ if (drp_state[port] == PD_DRP_FORCE_SINK)
+ set_state_tc(port, TC_UNATTACHED_SNK);
+ else
+ set_state_tc(port, TC_UNATTACHED_SRC);
return;
}