summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--common/usb_common.c13
-rw-r--r--common/usb_pd_alt_mode_dfp.c20
-rw-r--r--common/usbc/usb_mode.c1
-rw-r--r--include/usb_common.h11
-rw-r--r--include/usb_pd.h7
5 files changed, 26 insertions, 26 deletions
diff --git a/common/usb_common.c b/common/usb_common.c
index ea884193f8..f640b9d0fd 100644
--- a/common/usb_common.c
+++ b/common/usb_common.c
@@ -430,6 +430,19 @@ void set_usb_mux_with_current_data_role(int port)
}
}
+void usb_mux_set_safe_mode(int port)
+{
+ if (IS_ENABLED(CONFIG_USBC_SS_MUX)) {
+ usb_mux_set(port, IS_ENABLED(CONFIG_USB_MUX_VIRTUAL) ?
+ USB_PD_MUX_SAFE_MODE : USB_PD_MUX_NONE,
+ USB_SWITCH_CONNECT, pd_get_polarity(port));
+ }
+
+ /* Isolate the SBU lines. */
+ if (IS_ENABLED(CONFIG_USBC_PPC_SBU))
+ ppc_set_sbu(port, 0);
+}
+
static void pd_send_hard_reset(int port)
{
task_set_event(PD_PORT_TO_TASK_ID(port), PD_EVENT_SEND_HARD_RESET, 0);
diff --git a/common/usb_pd_alt_mode_dfp.c b/common/usb_pd_alt_mode_dfp.c
index 0cd5b2821e..614776768e 100644
--- a/common/usb_pd_alt_mode_dfp.c
+++ b/common/usb_pd_alt_mode_dfp.c
@@ -10,6 +10,7 @@
#include "task.h"
#include "task_id.h"
#include "timer.h"
+#include "usb_common.h"
#include "usb_charge.h"
#include "usb_dp_alt_mode.h"
#include "usb_mux.h"
@@ -638,25 +639,6 @@ void notify_sysjump_ready(void)
TASK_EVENT_SYSJUMP_READY, 0);
}
-/*
- * Before entering into alternate mode, state of the USB-C MUX
- * needs to be in safe mode.
- * Ref: USB Type-C Cable and Connector Specification
- * Section E.2.2 Alternate Mode Electrical Requirements
- */
-void usb_mux_set_safe_mode(int port)
-{
- if (IS_ENABLED(CONFIG_USBC_SS_MUX)) {
- usb_mux_set(port, IS_ENABLED(CONFIG_USB_MUX_VIRTUAL) ?
- USB_PD_MUX_SAFE_MODE : USB_PD_MUX_NONE,
- USB_SWITCH_CONNECT, pd_get_polarity(port));
- }
-
- /* Isolate the SBU lines. */
- if (IS_ENABLED(CONFIG_USBC_PPC_SBU))
- ppc_set_sbu(port, 0);
-}
-
static inline bool is_rev3_vdo(int port, enum tcpm_transmit_type type)
{
return pd_get_vdo_ver(port, type) == PD_REV30;
diff --git a/common/usbc/usb_mode.c b/common/usbc/usb_mode.c
index caeb3b661e..fcbb58cd6f 100644
--- a/common/usbc/usb_mode.c
+++ b/common/usbc/usb_mode.c
@@ -14,6 +14,7 @@
#include "compile_time_macros.h"
#include "console.h"
#include "tcpm.h"
+#include "usb_common.h"
#include "usb_mode.h"
#include "usb_mux.h"
#include "usb_pd.h"
diff --git a/include/usb_common.h b/include/usb_common.h
index 180ebbcc95..1e92a4b22a 100644
--- a/include/usb_common.h
+++ b/include/usb_common.h
@@ -163,6 +163,17 @@ void notify_sysjump_ready(void);
void set_usb_mux_with_current_data_role(int port);
/**
+ * Configure the USB MUX in safe mode.
+ * Before entering into alternate mode, state of the USB-C MUX needs to be in
+ * safe mode.
+ * Ref: USB Type-C Cable and Connector Specification
+ * Section E.2.2 Alternate Mode Electrical Requirements
+ *
+ * @param port The PD port number
+ */
+void usb_mux_set_safe_mode(int port);
+
+/**
* Get the PD flags stored in BB Ram
*
* @param port USB-C port number
diff --git a/include/usb_pd.h b/include/usb_pd.h
index 2341ebc31a..1028b53631 100644
--- a/include/usb_pd.h
+++ b/include/usb_pd.h
@@ -2782,13 +2782,6 @@ extern uint32_t dp_status[CONFIG_USB_PD_PORT_MAX_COUNT];
#endif /* CONFIG_USB_PD_ALT_MODE_DFP */
/*
- * Configure the USB MUX in safe mode
- *
- * @param port The PD port number
- */
-void usb_mux_set_safe_mode(int port);
-
-/*
* Set HPD GPIO level
*
* @param port The PD port number