summaryrefslogtreecommitdiff
path: root/include/usb_mux.h
diff options
context:
space:
mode:
authorShawn Nematbakhsh <shawnn@chromium.org>2016-06-22 17:55:38 -0700
committerchrome-bot <chrome-bot@chromium.org>2016-06-24 17:23:14 -0700
commit203063609b52f4125ee91c474cf5f58178572050 (patch)
treecf8560d8304a59b558efca9eb90649019b7dbba4 /include/usb_mux.h
parent3bc0223b48a73a9fcc70cdbec886f22dd6c35cd3 (diff)
downloadchrome-ec-203063609b52f4125ee91c474cf5f58178572050.tar.gz
usb_mux: Add support for host-controlled 'virtual' USB mux
For designs where the host SOC is responsible for setting the USB-C SS mux, the EC must track the desired mux state and inform the host when the desired state changes. Then, the host must ask the EC for the new desired state and set the mux accordingly. BUG=chrome-os-partner:52639 BRANCH=None TEST=Manual on gru with subsequent commit. Attach USB dongle in port 1 and DP dongle in port 0, then verify `ectool usbpdmuxinfo` output: Port 0: DP Port 1: USB Flip DP dongle and verify output changes: Port 0: DP INV Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Change-Id: I6a99ce93a76c3197f9195cfaa25c5217d09aeb75 Reviewed-on: https://chromium-review.googlesource.com/355281 Commit-Ready: Shawn N <shawnn@chromium.org> Tested-by: Shawn N <shawnn@chromium.org> Reviewed-by: Shawn N <shawnn@chromium.org>
Diffstat (limited to 'include/usb_mux.h')
-rw-r--r--include/usb_mux.h9
1 files changed, 6 insertions, 3 deletions
diff --git a/include/usb_mux.h b/include/usb_mux.h
index 52917efb45..daad2792de 100644
--- a/include/usb_mux.h
+++ b/include/usb_mux.h
@@ -8,6 +8,7 @@
#ifndef __CROS_EC_USB_MUX_H
#define __CROS_EC_USB_MUX_H
+#include "ec_commands.h"
#include "usb_charge.h"
#include "usb_pd.h"
@@ -15,9 +16,10 @@
typedef uint8_t mux_state_t;
/* Mux state attributes */
-#define MUX_USB_ENABLED (1 << 0) /* USB is enabled */
-#define MUX_DP_ENABLED (1 << 1) /* DP is enabled */
-#define MUX_POLARITY_INVERTED (1 << 2) /* Polarity is inverted */
+/* TODO: Directly use USB_PD_MUX_* everywhere and remove these 3 defines */
+#define MUX_USB_ENABLED USB_PD_MUX_USB_ENABLED
+#define MUX_DP_ENABLED USB_PD_MUX_DP_ENABLED
+#define MUX_POLARITY_INVERTED USB_PD_MUX_POLARITY_INVERTED
/* Mux modes, decoded to attributes */
enum typec_mux {
@@ -87,6 +89,7 @@ struct usb_mux {
extern const struct usb_mux_driver pi3usb30532_usb_mux_driver;
extern const struct usb_mux_driver ps8740_usb_mux_driver;
extern const struct usb_mux_driver tcpm_usb_mux_driver;
+extern const struct usb_mux_driver virtual_usb_mux_driver;
/* USB muxes present in system, ordered by PD port #, defined at board-level */
extern struct usb_mux usb_muxes[];