summaryrefslogtreecommitdiff
path: root/driver/usb_mux/anx3443.c
diff options
context:
space:
mode:
authorDiana Z <dzigterman@chromium.org>2021-07-21 09:56:40 -0600
committerCommit Bot <commit-bot@chromium.org>2021-08-14 06:06:39 +0000
commitab1cdf1648d390619848f4f4f901b14aeee75244 (patch)
tree74b814ec98390eabb46c4a012adbc501c70e9df2 /driver/usb_mux/anx3443.c
parent80b43435ca89510e985481b725a470566fb65a05 (diff)
downloadchrome-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/anx3443.c')
-rw-r--r--driver/usb_mux/anx3443.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/driver/usb_mux/anx3443.c b/driver/usb_mux/anx3443.c
index dc7fd3a3c0..2e57f4d30c 100644
--- a/driver/usb_mux/anx3443.c
+++ b/driver/usb_mux/anx3443.c
@@ -76,10 +76,14 @@ static int anx3443_wake_up(const struct usb_mux *me)
return EC_SUCCESS;
}
-static int anx3443_set_mux(const struct usb_mux *me, mux_state_t mux_state)
+static int anx3443_set_mux(const struct usb_mux *me, mux_state_t mux_state,
+ bool *ack_required)
{
int reg;
+ /* This driver does not use host command ACKs */
+ *ack_required = false;
+
/* Mux is not powered in Z1 */
if (chipset_in_state(CHIPSET_STATE_HARD_OFF))
return (mux_state == USB_PD_MUX_NONE) ? EC_SUCCESS
@@ -129,6 +133,7 @@ static int anx3443_get_mux(const struct usb_mux *me, mux_state_t *mux_state)
static int anx3443_init(const struct usb_mux *me)
{
uint64_t now;
+ bool unused;
/*
* ANX3443 requires 30ms to power on. EC and ANX3443 are on the same
@@ -140,8 +145,12 @@ static int anx3443_init(const struct usb_mux *me)
RETURN_ERROR(anx3443_wake_up(me));
+ /*
+ * 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.
+ */
/* Default to USB mode */
- RETURN_ERROR(anx3443_set_mux(me, USB_PD_MUX_USB_ENABLED));
+ RETURN_ERROR(anx3443_set_mux(me, USB_PD_MUX_USB_ENABLED, &unused));
return EC_SUCCESS;
}