diff options
author | Boris Mittelberg <bmbm@google.com> | 2023-01-03 13:36:04 -0800 |
---|---|---|
committer | Chromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2023-04-25 21:41:37 +0000 |
commit | 31fa7019c684ca60e57996eb1d4425704bd28208 (patch) | |
tree | cdb3280c7f9e8d383855ad8cab40933bf55819c5 | |
parent | f40274a33b56d9baae3707d56ad75ee5a27363cb (diff) | |
download | chrome-ec-31fa7019c684ca60e57996eb1d4425704bd28208.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>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4475136
Commit-Queue: Daisuke Nojiri <dnojiri@chromium.org>
Tested-by: Daisuke Nojiri <dnojiri@chromium.org>
Auto-Submit: Daisuke Nojiri <dnojiri@chromium.org>
-rw-r--r-- | driver/usb_mux.c | 4 | ||||
-rw-r--r-- | include/usb_mux.h | 9 |
2 files changed, 13 insertions, 0 deletions
diff --git a/driver/usb_mux.c b/driver/usb_mux.c index 59747baae8..06cb813247 100644 --- a/driver/usb_mux.c +++ b/driver/usb_mux.c @@ -59,6 +59,10 @@ void usb_mux_set(int port, enum typec_mux mux_mode, CPRINTS( "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); } int usb_mux_get(int port, const char **dp_str, const char **usb_str) diff --git a/include/usb_mux.h b/include/usb_mux.h index a3dc9ac3ea..92ecbdc373 100644 --- a/include/usb_mux.h +++ b/include/usb_mux.h @@ -92,6 +92,15 @@ struct usb_mux { int (*board_init)(const struct usb_mux *mux); /* + * 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. |