summaryrefslogtreecommitdiff
path: root/include/usb_mux.h
diff options
context:
space:
mode:
authorDenis Brockus <dbrockus@chromium.org>2019-11-05 14:51:56 -0700
committerCommit Bot <commit-bot@chromium.org>2019-11-14 00:12:44 +0000
commita4972e187c6ce582aa54dbfce6039fd2239e4bbd (patch)
tree2dfffcb6b3b457b8abdbc6f4a0acc267cb9209d2 /include/usb_mux.h
parentf5633029509350cf7254ab14c440d14e8e73f729 (diff)
downloadchrome-ec-a4972e187c6ce582aa54dbfce6039fd2239e4bbd.tar.gz
usbc: retimer pi3dpx1207
BUG=b:139428185 BRANCH=none TEST=verify mode is set correctly when switching devices Change-Id: Ic9d460a94bb8007f17168ac5237a4dcbc24cfb2b Signed-off-by: Denis Brockus <dbrockus@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1900123 Reviewed-by: Edward Hill <ecgh@chromium.org>
Diffstat (limited to 'include/usb_mux.h')
-rw-r--r--include/usb_mux.h56
1 files changed, 56 insertions, 0 deletions
diff --git a/include/usb_mux.h b/include/usb_mux.h
index 88fb10b549..126e7da4fa 100644
--- a/include/usb_mux.h
+++ b/include/usb_mux.h
@@ -139,6 +139,62 @@ void virtual_hpd_update(int port, int hpd_lvl, int hpd_irq);
extern struct usb_mux usb_muxes[];
/*
+ * Retimer driver function pointers
+ *
+ * The retimer driver is driven by calls to the MUX API. These are not
+ * called directly anywhere else in the code.
+ */
+struct usb_retimer_driver {
+ /**
+ * Initialize USB retimer. This is called every time the MUX is
+ * access after being put in a fully disconnected state (low power
+ * mode).
+ *
+ * @param port usb port of redriver (not port_addr)
+ * @return EC_SUCCESS on success, non-zero error code on failure.
+ */
+ int (*init)(int port);
+
+ /**
+ * Set USB retimer state.
+ *
+ * @param port usb port of retimer (not port_addr)
+ * @param mux_state State to set retimer mode to.
+ * @return EC_SUCCESS on success, non-zero error code on failure.
+ */
+ int (*set)(int port, mux_state_t mux_state);
+};
+
+/* Describes a USB retimer present in the system */
+struct usb_retimer {
+ /*
+ * All of the fields are provided on an as needed basis.
+ * If your retimer does not perform I2C operations, then
+ * values would not be set. This includes the driver
+ * field, which would indicate no retimer driver is to
+ * be called. Values that are not specifically popuplated
+ * shall be 0/NULL.
+ */
+
+ /* I2C port and slave address */
+ const int i2c_port;
+ const uint16_t i2c_addr_flags;
+
+ /* GPIOs for enabling the retimer and DP mode */
+ const int gpio_enable;
+ const int gpio_dp_enable;
+
+ /* Driver interfaces for this retimer */
+ const struct usb_retimer_driver *driver;
+};
+
+/*
+ * USB retimers present in system, ordered by PD port #, defined at
+ * board-level
+ */
+extern struct usb_retimer usb_retimers[];
+
+/*
* Helper methods that either use tcpc communication or direct i2c
* communication depending on how the TCPC/MUX device is configured.
*/