summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAyushee Shah <ayushee.shah@intel.com>2021-04-28 13:16:12 -0700
committerCommit Bot <commit-bot@chromium.org>2021-05-01 04:29:43 +0000
commit633d179e08a8deab525ed9ae2aa1d1cd9f68544d (patch)
treec8beb5dd952a6a34b6db893578d4542ebc748750
parentf7c8903f40a2f3fac1ccc23e6d8737414f6e5f4d (diff)
downloadchrome-ec-633d179e08a8deab525ed9ae2aa1d1cd9f68544d.tar.gz
virtual mux: Wait for mux config ACK from AP on disconnect
While switching from DP to Thunderbolt mode, EC sends a mux disconnect followed by a USB mux connect. Since these events are one behind the other, AP might miss the disconnect mux event. Hence, this CL waits for an ACK from AP, to synchronize the disconnect mux event between AP and EC. BUG=b:186609339 BRANCH=None TEST=1.Both the monitors behind the Tortilla based dock enumerate after coldboot. 2.Checked Disconnect-Connect with TBT/USB4 device in S0ix, they enumerate fine on full resume. 3.Checked coldboot with non-Tortilla based dock based dock. it enumerates fine. Signed-off-by: Ayushee Shah <ayushee.shah@intel.com> Change-Id: Ib32c3426c2b52b1af582729453d748902447900c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2857374 Reviewed-by: Keith Short <keithshort@chromium.org> (cherry picked from commit 3b156ad3993b99eb9ec056a1d4e60d04525faa77) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2863947 Commit-Queue: Keith Short <keithshort@chromium.org> Tested-by: Keith Short <keithshort@chromium.org>
-rw-r--r--driver/usb_mux/virtual.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/driver/usb_mux/virtual.c b/driver/usb_mux/virtual.c
index f507078e75..9fbcbd2643 100644
--- a/driver/usb_mux/virtual.c
+++ b/driver/usb_mux/virtual.c
@@ -43,18 +43,24 @@ static inline void virtual_mux_update_state(int port, mux_state_t mux_state)
/*
* EC waits for the ACK from kernel indicating that TCSS Mux
* configuration is completed. This mechanism is implemented for
- * entering and exiting the safe mode. This is needed to remove
- * timing senstivity between BB retimer and TCSS Mux to allow better
- * synchronization between them and thereby remain in the same state
- * for achieving proper safe state terminations.
+ * entering, exiting the safe mode and entering the disconnect mode
+ * This is needed to remove timing senstivity between BB retimer and
+ * TCSS Mux to allow better synchronization between them and thereby
+ * remain in the same state for achieving proper safe state
+ * terminations.
*
* Note: While the EC waits for the ACK, the value of usb_mux_get
* won't match the most recently set value with usb_mux_set.
*/
+
+ /* TODO(b/186777984): Wait for an ACK for all mux state change */
+
if ((!(previous_mux_state & USB_PD_MUX_SAFE_MODE) &&
(mux_state & USB_PD_MUX_SAFE_MODE)) ||
((previous_mux_state & USB_PD_MUX_SAFE_MODE) &&
- !(mux_state & USB_PD_MUX_SAFE_MODE))) {
+ !(mux_state & USB_PD_MUX_SAFE_MODE)) ||
+ ((previous_mux_state != USB_PD_MUX_NONE) &&
+ (mux_state == USB_PD_MUX_NONE))) {
/* This should only be called from the PD task */
assert(port == TASK_ID_TO_PD_PORT(task_get_current()));