summaryrefslogtreecommitdiff
path: root/driver
diff options
context:
space:
mode:
authorDiana Z <dzigterman@chromium.org>2021-11-15 11:13:05 -0700
committerCommit Bot <commit-bot@chromium.org>2021-11-16 23:54:17 +0000
commit005245c18dda9ad54cbf8ab879f26c30c6465093 (patch)
treeac956f4d0a76c3230403c5c9cbc6299bb932d107 /driver
parent1f9d5ce1ae5a95662b00de2458f32c2e55eeee16 (diff)
downloadchrome-ec-005245c18dda9ad54cbf8ab879f26c30c6465093.tar.gz
Virtual mux: Clear HPD state when DP inactive
The HPD state is meaningless if DP is no longer active, so only preserve HPD if DP is still set on the mux. BRANCH=None BUG=b:205812849 TEST=on voxel, ensure HPD state is cleared on BB retimer and virtual mux at the same time when we start mode exit Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: I58d37c781e5c926731080c483c8e9dd9d481ce9c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3283197 Reviewed-by: Keith Short <keithshort@chromium.org>
Diffstat (limited to 'driver')
-rw-r--r--driver/usb_mux/virtual.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/driver/usb_mux/virtual.c b/driver/usb_mux/virtual.c
index dbece4faf9..4388bb485a 100644
--- a/driver/usb_mux/virtual.c
+++ b/driver/usb_mux/virtual.c
@@ -81,10 +81,17 @@ static int virtual_set_mux(const struct usb_mux *me, mux_state_t mux_state,
bool *ack_required)
{
int port = me->usb_port;
+ mux_state_t new_mux_state;
- /* Current USB & DP mux status + existing HPD related mux status */
- mux_state_t new_mux_state = (mux_state & ~USB_PD_MUX_HPD_STATE) |
- (virtual_mux_state[port] & USB_PD_MUX_HPD_STATE);
+ /*
+ * Current USB & DP mux status + existing HPD related mux status if DP
+ * is still active. Otherwise, don't preserve HPD state.
+ */
+ if (mux_state & USB_PD_MUX_DP_ENABLED)
+ new_mux_state = (mux_state & ~USB_PD_MUX_HPD_STATE) |
+ (virtual_mux_state[port] & USB_PD_MUX_HPD_STATE);
+ else
+ new_mux_state = mux_state;
virtual_mux_update_state(port, new_mux_state, ack_required);