summaryrefslogtreecommitdiff
path: root/driver/usb_mux
diff options
context:
space:
mode:
authorDiana Z <dzigterman@chromium.org>2022-09-17 22:21:09 -0600
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2022-09-19 20:00:57 +0000
commit6278fe9df729c6816eafbea2169968170ac2a714 (patch)
tree7a3719d72eaf2f9eb2a314f593c9736dcbb44a51 /driver/usb_mux
parenta83d94399b79a91421034ee37bfc22dad05c8013 (diff)
downloadchrome-ec-6278fe9df729c6816eafbea2169968170ac2a714.tar.gz
USB Mux: Unify drivers for safe mode
When safe mode was first introduced, it was added only to drivers on the boards with virtual muxes and the mode wasn't sent to other drivers. Since safe mode is defined as an input for the mux API, ensure all drivers can handle this input. For now, set up all drivers which did not have handling to handle it the same as None, which was previously sent to them. LOW_COVERAGE_REASON=20 of the changed drivers have no emulators BRANCH=None BUG=b:234772074 TEST=make -j buildall; search for all files containing a usb_mux_driver without any reference to USB_PD_MUX_SAFE_MODE and ensure they are correct to not reference it Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: Ib927057bbf1638d09000bdad98bc096a6e103611 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3902611 Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com> Reviewed-by: Abe Levkoy <alevkoy@chromium.org> Commit-Queue: Abe Levkoy <alevkoy@chromium.org>
Diffstat (limited to 'driver/usb_mux')
-rw-r--r--driver/usb_mux/amd_fp5.c4
-rw-r--r--driver/usb_mux/amd_fp6.c4
-rw-r--r--driver/usb_mux/anx3443.c4
-rw-r--r--driver/usb_mux/anx7440.c4
-rw-r--r--driver/usb_mux/anx7451.c4
-rw-r--r--driver/usb_mux/it5205.c4
-rw-r--r--driver/usb_mux/pi3usb3x532.c4
-rw-r--r--driver/usb_mux/ps8740.c4
-rw-r--r--driver/usb_mux/ps8743.c4
-rw-r--r--driver/usb_mux/ps8822.c4
-rw-r--r--driver/usb_mux/tusb1064.c4
11 files changed, 44 insertions, 0 deletions
diff --git a/driver/usb_mux/amd_fp5.c b/driver/usb_mux/amd_fp5.c
index fc41a9c17e..ca042b0fa0 100644
--- a/driver/usb_mux/amd_fp5.c
+++ b/driver/usb_mux/amd_fp5.c
@@ -49,6 +49,10 @@ static int amd_fp5_set_mux(const struct usb_mux *me, mux_state_t mux_state,
/* This driver does not use host command ACKs */
*ack_required = false;
+ /* This driver treats safe mode as none */
+ if (mux_state == USB_PD_MUX_SAFE_MODE)
+ mux_state = USB_PD_MUX_NONE;
+
saved_mux_state[me->usb_port] = mux_state;
/*
diff --git a/driver/usb_mux/amd_fp6.c b/driver/usb_mux/amd_fp6.c
index 1fcbacb19d..a776a696f7 100644
--- a/driver/usb_mux/amd_fp6.c
+++ b/driver/usb_mux/amd_fp6.c
@@ -141,6 +141,10 @@ static int amd_fp6_set_mux(const struct usb_mux *me, mux_state_t mux_state,
/* This driver does not use host command ACKs */
*ack_required = false;
+ /* This driver treats safe mode as none */
+ if (mux_state == USB_PD_MUX_SAFE_MODE)
+ mux_state = USB_PD_MUX_NONE;
+
if (mux_state == USB_PD_MUX_NONE)
/*
* LOW_POWER must be set when connection mode is
diff --git a/driver/usb_mux/anx3443.c b/driver/usb_mux/anx3443.c
index c0a7ff498c..f3b0b08afd 100644
--- a/driver/usb_mux/anx3443.c
+++ b/driver/usb_mux/anx3443.c
@@ -96,6 +96,10 @@ static int anx3443_set_mux(const struct usb_mux *me, mux_state_t mux_state,
/* This driver does not use host command ACKs */
*ack_required = false;
+ /* This driver treats safe mode as none */
+ if (mux_state == USB_PD_MUX_SAFE_MODE)
+ mux_state = USB_PD_MUX_NONE;
+
saved_mux_state[me->usb_port].mux_state = mux_state;
/* To disable both DP and USB the mux must be powered off. */
diff --git a/driver/usb_mux/anx7440.c b/driver/usb_mux/anx7440.c
index 83d17fab4b..456eaaa407 100644
--- a/driver/usb_mux/anx7440.c
+++ b/driver/usb_mux/anx7440.c
@@ -68,6 +68,10 @@ static int anx7440_set_mux(const struct usb_mux *me, mux_state_t mux_state,
/* This driver does not use host command ACKs */
*ack_required = false;
+ /* This driver treats safe mode as none */
+ if (mux_state == USB_PD_MUX_SAFE_MODE)
+ mux_state = USB_PD_MUX_NONE;
+
res = anx7440_read(me, ANX7440_REG_CHIP_CTRL, &reg);
if (res)
return res;
diff --git a/driver/usb_mux/anx7451.c b/driver/usb_mux/anx7451.c
index ea3cc5cb58..b974128740 100644
--- a/driver/usb_mux/anx7451.c
+++ b/driver/usb_mux/anx7451.c
@@ -96,6 +96,10 @@ static int anx7451_set_mux(const struct usb_mux *me, mux_state_t mux_state,
/* This driver does not use host command ACKs */
*ack_required = false;
+ /* This driver treats safe mode as none */
+ if (mux_state == USB_PD_MUX_SAFE_MODE)
+ mux_state = USB_PD_MUX_NONE;
+
/*
* Mux is not powered in Z1, and will start up in USB mode. Ensure any
* mux sets when off get run again so we don't leave the retimer on with
diff --git a/driver/usb_mux/it5205.c b/driver/usb_mux/it5205.c
index 7330582b03..de3d950c86 100644
--- a/driver/usb_mux/it5205.c
+++ b/driver/usb_mux/it5205.c
@@ -99,6 +99,10 @@ static int it5205_set_mux(const struct usb_mux *me, mux_state_t mux_state,
/* This driver does not use host command ACKs */
*ack_required = false;
+ /* This driver treats safe mode as none */
+ if (mux_state == USB_PD_MUX_SAFE_MODE)
+ mux_state = USB_PD_MUX_NONE;
+
switch (mux_state & MUX_STATE_DP_USB_MASK) {
case USB_PD_MUX_USB_ENABLED:
reg = IT5205_USB;
diff --git a/driver/usb_mux/pi3usb3x532.c b/driver/usb_mux/pi3usb3x532.c
index 55063ed6d0..54eff928b7 100644
--- a/driver/usb_mux/pi3usb3x532.c
+++ b/driver/usb_mux/pi3usb3x532.c
@@ -88,6 +88,10 @@ static int pi3usb3x532_set_mux(const struct usb_mux *me, mux_state_t mux_state,
/* This driver does not use host command ACKs */
*ack_required = false;
+ /* This driver treats safe mode as none */
+ if (mux_state == USB_PD_MUX_SAFE_MODE)
+ mux_state = USB_PD_MUX_NONE;
+
if (mux_state & USB_PD_MUX_USB_ENABLED)
reg |= PI3USB3X532_MODE_USB;
if (mux_state & USB_PD_MUX_DP_ENABLED)
diff --git a/driver/usb_mux/ps8740.c b/driver/usb_mux/ps8740.c
index 0c129cc9a8..557c4f1976 100644
--- a/driver/usb_mux/ps8740.c
+++ b/driver/usb_mux/ps8740.c
@@ -76,6 +76,10 @@ static int ps8740_set_mux(const struct usb_mux *me, mux_state_t mux_state,
/* This driver does not use host command ACKs */
*ack_required = false;
+ /* This driver treats safe mode as none */
+ if (mux_state == USB_PD_MUX_SAFE_MODE)
+ mux_state = USB_PD_MUX_NONE;
+
if (mux_state & USB_PD_MUX_USB_ENABLED)
reg |= PS8740_MODE_USB_ENABLED;
if (mux_state & USB_PD_MUX_DP_ENABLED)
diff --git a/driver/usb_mux/ps8743.c b/driver/usb_mux/ps8743.c
index bebcf53248..86f0a7f9b2 100644
--- a/driver/usb_mux/ps8743.c
+++ b/driver/usb_mux/ps8743.c
@@ -125,6 +125,10 @@ static int ps8743_set_mux(const struct usb_mux *me, mux_state_t mux_state,
/* This driver does not use host command ACKs */
*ack_required = false;
+ /* This driver treats safe mode as none */
+ if (mux_state == USB_PD_MUX_SAFE_MODE)
+ mux_state = USB_PD_MUX_NONE;
+
if (mux_state & USB_PD_MUX_USB_ENABLED)
reg |= PS8743_MODE_USB_ENABLE;
else
diff --git a/driver/usb_mux/ps8822.c b/driver/usb_mux/ps8822.c
index 1e931fd340..d3ea76965d 100644
--- a/driver/usb_mux/ps8822.c
+++ b/driver/usb_mux/ps8822.c
@@ -83,6 +83,10 @@ static int ps8822_set_mux(const struct usb_mux *me, mux_state_t mux_state,
/* This driver does not use host command ACKs */
*ack_required = false;
+ /* This driver treats safe mode as none */
+ if (mux_state == USB_PD_MUX_SAFE_MODE)
+ mux_state = USB_PD_MUX_NONE;
+
rv = ps8822_read(me, PS8822_REG_PAGE0, PS8822_REG_MODE, &reg);
if (rv)
return rv;
diff --git a/driver/usb_mux/tusb1064.c b/driver/usb_mux/tusb1064.c
index e4f54402c7..7fd6cfe561 100644
--- a/driver/usb_mux/tusb1064.c
+++ b/driver/usb_mux/tusb1064.c
@@ -96,6 +96,10 @@ static int tusb1064_set_mux(const struct usb_mux *me, mux_state_t mux_state,
int rv;
int mask;
+ /* This driver treats safe mode as none */
+ if (mux_state == USB_PD_MUX_SAFE_MODE)
+ mux_state = USB_PD_MUX_NONE;
+
rv = tusb1064_read(me, TUSB1064_REG_GENERAL, &reg);
if (rv)
return rv;