summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Mittelberg <bmbm@google.com>2023-01-03 13:36:04 -0800
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2023-01-10 21:01:13 +0000
commit2132a0c4d3190b578e1ac566ba31bad744dda436 (patch)
treebe1879961b952992b0254954a21dc55a575a2711
parentae0217b81fa9d567ae2eac7b6fa83b43412b0454 (diff)
downloadchrome-ec-2132a0c4d3190b578e1ac566ba31bad744dda436.tar.gz
usb_mux: add board_set callback
The callback exists on ToT, it allows to use board-specific callback from usb_mux_set BUG=b:183123775 TEST=manual test on dratini/dragonair Change-Id: I76828f4739f317ae3cb7afa4b7edf16f75031a2e Signed-off-by: Boris Mittelberg <bmbm@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4133689 Reviewed-by: Shelley Chen <shchen@chromium.org> Tested-by: Shelley Chen <shchen@chromium.org> Reviewed-by: Mary Ruthven <mruthven@chromium.org>
-rw-r--r--driver/usb_mux/usb_mux.c4
-rw-r--r--include/usb_mux.h9
2 files changed, 13 insertions, 0 deletions
diff --git a/driver/usb_mux/usb_mux.c b/driver/usb_mux/usb_mux.c
index 122f71d773..42d55b55e0 100644
--- a/driver/usb_mux/usb_mux.c
+++ b/driver/usb_mux/usb_mux.c
@@ -121,6 +121,10 @@ void usb_mux_set(int port, enum typec_mux mux_mode,
"usb/dp mux: port(%d) typec_mux(%d) usb2(%d) polarity(%d)",
port, mux_mode, usb_mode, polarity);
+ /* Apply board specific setting */
+ if (mux->board_set)
+ mux->board_set(port, mux_state);
+
/*
* If we are completely disconnecting the mux, then we should put it in
* its lowest power state.
diff --git a/include/usb_mux.h b/include/usb_mux.h
index 88fb10b549..d5a679d987 100644
--- a/include/usb_mux.h
+++ b/include/usb_mux.h
@@ -117,6 +117,15 @@ struct usb_mux {
int (*board_init)(int port);
/*
+ * USB mux/retimer board specific set mux_state.
+ *
+ * @param me usb_mux
+ * @param mux_state State to set mode to.
+ * @return EC_SUCCESS on success, non-zero error code on failure.
+ */
+ int (*board_set)(int port, mux_state_t mux_state);
+
+ /*
* USB Type-C DP alt mode support. Notify Type-C controller
* there is DP dongle hot-plug.
* TODO: Move this function to usb_mux_driver struct.