summaryrefslogtreecommitdiff
path: root/driver
diff options
context:
space:
mode:
authorCaveh Jalali <caveh@chromium.org>2022-08-09 02:54:32 -0700
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2022-08-12 21:15:25 +0000
commita0befd973ce613e65c474efd365a73eb54f1d911 (patch)
tree03145764d68a01c1be33b70b419f60d9c8393d63 /driver
parent6e832755e66110947f9dd29686163dc108ba40a6 (diff)
downloadchrome-ec-a0befd973ce613e65c474efd365a73eb54f1d911.tar.gz
drivers/usb_mux: Allow inverted polarity on muxes
This adds a feature for USB-C muxes to be inverted with respect to cable orientation. This effectively adds support for the case where CC1/CC2 are swapped. BRANCH=none BUG=b:240938782 TEST=USB3 and DP works on ghost MLB port with rest of patchset Change-Id: I1441810754078c51ff46f84106aa33e8eb813eb0 Signed-off-by: Caveh Jalali <caveh@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3818926 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Commit-Queue: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Boris Mittelberg <bmbm@google.com>
Diffstat (limited to 'driver')
-rw-r--r--driver/usb_mux/usb_mux.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/driver/usb_mux/usb_mux.c b/driver/usb_mux/usb_mux.c
index 723ad5711f..bde575bf7e 100644
--- a/driver/usb_mux/usb_mux.c
+++ b/driver/usb_mux/usb_mux.c
@@ -318,6 +318,10 @@ static int configure_mux(int port, int index, enum mux_config_type config,
if (mux_ptr->flags & USB_MUX_FLAG_SET_WITHOUT_FLIP)
lcl_state &= ~USB_PD_MUX_POLARITY_INVERTED;
+ if ((lcl_state != USB_PD_MUX_NONE) &&
+ (mux_ptr->flags & USB_MUX_FLAG_POLARITY_INVERTED))
+ lcl_state ^= USB_PD_MUX_POLARITY_INVERTED;
+
if (drv && drv->set) {
rv = drv->set(mux_ptr, lcl_state,
&ack_required);