diff options
author | Vijay Hiremath <vijay.p.hiremath@intel.com> | 2019-08-06 17:59:15 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2019-08-14 04:24:39 +0000 |
commit | 1da01c3a7a5d57bf3618deba20e424ae409f7d6c (patch) | |
tree | 827d2d732c02573f29fe6f39a9808dc48e96ad4d | |
parent | 03c8f8f86733e2b14bdba5b6644a37fb900c1b3e (diff) | |
download | chrome-ec-1da01c3a7a5d57bf3618deba20e424ae409f7d6c.tar.gz |
usb_mux: Send DP safe mode info to virtual MUX
Before entering into alternate mode, state of the USB-C MUX needs to be
in safe mode so that the USB-C pins cab be re-purposed without getting
damaged or do not damage their Port Partner. Hence, sending the DP
safe mode info to virtual MUX from EC.
BUG=b:139140865
BRANCH=none
TEST=Manually tested on Intel RVP, MUX is able to configure to safe mode
before entering alternate mode.
Change-Id: I3715b5118112b7744407ac5e652f63f6d7cd0a1b
Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1745540
Reviewed-by: Keith Short <keithshort@chromium.org>
-rw-r--r-- | baseboard/intelrvp/usb_pd_policy.c | 4 | ||||
-rw-r--r-- | driver/usb_mux/virtual.c | 3 | ||||
-rw-r--r-- | include/ec_commands.h | 1 | ||||
-rw-r--r-- | include/usb_mux.h | 2 |
4 files changed, 8 insertions, 2 deletions
diff --git a/baseboard/intelrvp/usb_pd_policy.c b/baseboard/intelrvp/usb_pd_policy.c index f1bb4976dc..ddc9097084 100644 --- a/baseboard/intelrvp/usb_pd_policy.c +++ b/baseboard/intelrvp/usb_pd_policy.c @@ -204,7 +204,9 @@ static void svdm_safe_dp_mode(int port) /* make DP interface safe until configure */ dp_flags[port] = 0; dp_status[port] = 0; - usb_mux_set(port, TYPEC_MUX_NONE, + + usb_mux_set(port, IS_ENABLED(CONFIG_USB_MUX_VIRTUAL) ? + TYPEC_MUX_SAFE : TYPEC_MUX_NONE, USB_SWITCH_CONNECT, pd_get_polarity(port)); } diff --git a/driver/usb_mux/virtual.c b/driver/usb_mux/virtual.c index e20e0a2ef7..e012b943f0 100644 --- a/driver/usb_mux/virtual.c +++ b/driver/usb_mux/virtual.c @@ -19,7 +19,8 @@ */ #define USB_PD_MUX_HPD_STATE (USB_PD_MUX_HPD_LVL | USB_PD_MUX_HPD_IRQ) #define USB_PD_MUX_USB_DP_STATE (USB_PD_MUX_USB_ENABLED | \ - USB_PD_MUX_DP_ENABLED | USB_PD_MUX_POLARITY_INVERTED) + USB_PD_MUX_DP_ENABLED | USB_PD_MUX_POLARITY_INVERTED | \ + USB_PD_MUX_SAFE_MODE) static mux_state_t virtual_mux_state[CONFIG_USB_PD_PORT_COUNT]; diff --git a/include/ec_commands.h b/include/ec_commands.h index 7d8ccb8324..d887f86880 100644 --- a/include/ec_commands.h +++ b/include/ec_commands.h @@ -5236,6 +5236,7 @@ struct ec_params_usb_pd_mux_info { #define USB_PD_MUX_POLARITY_INVERTED BIT(2) /* CC line Polarity inverted */ #define USB_PD_MUX_HPD_IRQ BIT(3) /* HPD IRQ is asserted */ #define USB_PD_MUX_HPD_LVL BIT(4) /* HPD level is asserted */ +#define USB_PD_MUX_SAFE_MODE BIT(5) /* DP is in safe mode */ struct ec_response_usb_pd_mux_info { uint8_t flags; /* USB_PD_MUX_*-encoded USB mux state */ diff --git a/include/usb_mux.h b/include/usb_mux.h index 8351bdfe28..21d60337a8 100644 --- a/include/usb_mux.h +++ b/include/usb_mux.h @@ -34,6 +34,7 @@ typedef uint8_t mux_state_t; #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 +#define MUX_SAFE_MODE USB_PD_MUX_SAFE_MODE /* Mux modes, decoded to attributes */ enum typec_mux { @@ -42,6 +43,7 @@ enum typec_mux { TYPEC_MUX_DP = MUX_DP_ENABLED, /* DP only */ TYPEC_MUX_DOCK = MUX_USB_ENABLED | /* Both USB and DP */ MUX_DP_ENABLED, + TYPEC_MUX_SAFE = MUX_SAFE_MODE, /* Safe mode */ }; /* Mux driver function pointers */ |