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 /baseboard | |
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 'baseboard')
-rw-r--r-- | baseboard/guybrush/baseboard.c | 8 | ||||
-rw-r--r-- | baseboard/mancomb/baseboard.c | 8 |
2 files changed, 12 insertions, 4 deletions
diff --git a/baseboard/guybrush/baseboard.c b/baseboard/guybrush/baseboard.c index 4383598ff6..675350a022 100644 --- a/baseboard/guybrush/baseboard.c +++ b/baseboard/guybrush/baseboard.c @@ -384,7 +384,7 @@ BUILD_ASSERT(ARRAY_SIZE(pi3usb9201_bc12_chips) == USBC_PORT_COUNT); * not needed as well. usb_mux.c can handle the situation * properly. */ -static int fsusb42umx_set_mux(const struct usb_mux*, mux_state_t); +static int fsusb42umx_set_mux(const struct usb_mux*, mux_state_t, bool *); struct usb_mux_driver usbc0_sbu_mux_driver = { .set = fsusb42umx_set_mux, }; @@ -538,8 +538,12 @@ BUILD_ASSERT(ARRAY_SIZE(fans) == FAN_CH_COUNT); * chip and it needs a board specific driver. * Overall, it will use chained mux framework. */ -static int fsusb42umx_set_mux(const struct usb_mux *me, mux_state_t mux_state) +static int fsusb42umx_set_mux(const struct usb_mux *me, mux_state_t mux_state, + bool *ack_required) { + /* This driver does not use host command ACKs */ + *ack_required = false; + if (mux_state & USB_PD_MUX_POLARITY_INVERTED) ioex_set_level(IOEX_USB_C0_SBU_FLIP, 1); else diff --git a/baseboard/mancomb/baseboard.c b/baseboard/mancomb/baseboard.c index 041b2512dd..b79cf3a3de 100644 --- a/baseboard/mancomb/baseboard.c +++ b/baseboard/mancomb/baseboard.c @@ -341,7 +341,7 @@ BUILD_ASSERT(ARRAY_SIZE(pi3usb9201_bc12_chips) == USBC_PORT_COUNT); * not needed as well. usb_mux.c can handle the situation * properly. */ -static int fsusb42umx_set_mux(const struct usb_mux*, mux_state_t); +static int fsusb42umx_set_mux(const struct usb_mux*, mux_state_t, bool *); const struct usb_mux_driver usbc_sbu_mux_driver = { .set = fsusb42umx_set_mux, }; @@ -447,10 +447,14 @@ BUILD_ASSERT(ARRAY_SIZE(fans) == FAN_CH_COUNT); * chip and it needs a board specific driver. * Overall, it will use chained mux framework. */ -static int fsusb42umx_set_mux(const struct usb_mux *me, mux_state_t mux_state) +static int fsusb42umx_set_mux(const struct usb_mux *me, mux_state_t mux_state, + bool *ack_required) { bool inverted = mux_state & USB_PD_MUX_POLARITY_INVERTED; + /* This driver does not use host command ACKs */ + *ack_required = false; + if (me->usb_port == USBC_PORT_C0) RETURN_ERROR(ioex_set_level(IOEX_USB_C0_SBU_FLIP, inverted)); else if (me->usb_port == USBC_PORT_C1) |