diff options
author | Diana Z <dzigterman@chromium.org> | 2021-07-21 09:56:40 -0600 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-08-14 06:06:39 +0000 |
commit | ab1cdf1648d390619848f4f4f901b14aeee75244 (patch) | |
tree | 74b814ec98390eabb46c4a012adbc501c70e9df2 /driver/usb_mux/tusb1064.c | |
parent | 80b43435ca89510e985481b725a470566fb65a05 (diff) | |
download | chrome-ec-ab1cdf1648d390619848f4f4f901b14aeee75244.tar.gz |
USB MUX: Generalize mux ACK
Currently, only the virtual mux driver uses the mux ACK feature, but the
actual wait for the host command ACK is a part of the usb_mux general
code. Generalize this mux ACK wait so it's available if needed in the
future for more muxes.
Additionally, moving this wait out of the mux set will allow us to lock
the muxes intelligently between tasks, without keeping the muxes locked
during the inactive ACK wait.
BRANCH=None
BUG=b:172222942,b:186777984
TEST=tast typec.Mode*.manual on voxel
Signed-off-by: Diana Z <dzigterman@chromium.org>
Change-Id: I61a043425a482cc6f3170548c888d91ec20c2a82
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3078411
Reviewed-by: Keith Short <keithshort@chromium.org>
Diffstat (limited to 'driver/usb_mux/tusb1064.c')
-rw-r--r-- | driver/usb_mux/tusb1064.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/driver/usb_mux/tusb1064.c b/driver/usb_mux/tusb1064.c index 6bbf323b3c..1c0f0e4701 100644 --- a/driver/usb_mux/tusb1064.c +++ b/driver/usb_mux/tusb1064.c @@ -32,10 +32,14 @@ static int tusb1064_write(const struct usb_mux *me, uint8_t reg, uint8_t val) } /* Writes control register to set switch mode */ -static int tusb1064_set_mux(const struct usb_mux *me, mux_state_t mux_state) +static int tusb1064_set_mux(const struct usb_mux *me, mux_state_t mux_state, + bool *ack_required) { int reg = REG_GENERAL_STATIC_BITS; + /* This driver does not use host command ACKs */ + *ack_required = false; + if (mux_state & USB_PD_MUX_USB_ENABLED) reg |= REG_GENERAL_CTLSEL_USB3; if (mux_state & USB_PD_MUX_DP_ENABLED) @@ -72,6 +76,7 @@ static int tusb1064_init(const struct usb_mux *me) { int res; uint8_t reg; + bool unused; /* Default to "Floating Pin" DP Equalization */ reg = TUSB1064_DP1EQ(TUSB1064_DP_EQ_RX_10_0_DB) | @@ -86,8 +91,12 @@ static int tusb1064_init(const struct usb_mux *me) if (res) return res; + /* + * Note that bypassing the usb_mux API is okay for internal driver calls + * since the task calling init already holds this port's mux lock. + */ /* Disconnect USB3.1 and DP */ - res = tusb1064_set_mux(me, USB_PD_MUX_NONE); + res = tusb1064_set_mux(me, USB_PD_MUX_NONE, &unused); if (res) return res; |