summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorEric Herrmann <eherrmann@chromium.org>2020-02-14 11:04:48 -0800
committerCommit Bot <commit-bot@chromium.org>2020-06-18 23:46:19 +0000
commite0c415b8f76a5179474b89418094f986fd1cd772 (patch)
tree4e614720ed0998711964071feca11def6b85fa10 /include
parentfe6ca90ed3188c5a0d890c1076ad1b0b1b9db29c (diff)
downloadchrome-ec-e0c415b8f76a5179474b89418094f986fd1cd772.tar.gz
TCPMv2: Add pathway to enable FRS from PPC driver
Some PPCs have integrated CC line detection to trigger FRS faster, but this needs to be enabled from the USBC policy engine only after the sink capabilities have been exchanged. BUG=b:148144711 TEST=make buildall BRANCH=none Change-Id: Iaa64f64845c5ffdd32fa66a3eb6f6251abb7c157 Signed-off-by: Eric Herrmann <eherrmann@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2056493 Reviewed-by: Keith Short <keithshort@chromium.org>
Diffstat (limited to 'include')
-rw-r--r--include/config.h21
-rw-r--r--include/usb_pd.h8
-rw-r--r--include/usbc_ppc.h19
3 files changed, 46 insertions, 2 deletions
diff --git a/include/config.h b/include/config.h
index 53f5ac9052..0edf5697c2 100644
--- a/include/config.h
+++ b/include/config.h
@@ -4058,8 +4058,14 @@
*/
#undef CONFIG_USB_PD_PREFER_MV
-/* Type-C Fast Role Swap */
-#undef CONFIG_USB_TYPEC_PD_FAST_ROLE_SWAP
+/*
+ * The Fast Role Swap trigger can be implemented in either the TCPC or PPC
+ * driver. If either CONFIG_USB_PD_FRS_TCPC or CONFIG_USB_PD_FRS_PPC is set,
+ * CONFIG_USB_FRS will be set automatically to enable the protocol-side of FRS.
+ */
+#undef CONFIG_USB_PD_FRS_TCPC
+#undef CONFIG_USB_PD_FRS_PPC
+#undef CONFIG_USB_PD_FRS
/*
* USB Product ID. Each platform (e.g. baseboard set) should have a single
@@ -4646,6 +4652,17 @@
#endif
#endif
+
+/******************************************************************************/
+/*
+ * Automatically define CONFIG_USB_PD_FRS if FRS is enabled in the TCPC or PPC
+ */
+#if defined(CONFIG_USB_PD_FRS_PPC) || defined(CONFIG_USB_PD_FRS_TCPC)
+#define CONFIG_USB_PD_FRS
+#endif
+
+
+
/******************************************************************************/
/*
* Ensure that CONFIG_USB_PD_TCPMV2 is being used with exactly one device type
diff --git a/include/usb_pd.h b/include/usb_pd.h
index 34fe964966..90d8a1392a 100644
--- a/include/usb_pd.h
+++ b/include/usb_pd.h
@@ -2711,6 +2711,14 @@ bool pd_check_vbus_level(int port, enum vbus_level level);
int pd_is_vbus_present(int port);
/**
+ * Enable or disable the FRS trigger for a given port
+ *
+ * @param port USB-C port number
+ * @param enable 1 to enable the FRS trigger, 0 to disable
+ */
+void pd_set_frs_enable(int port, int enable);
+
+/**
* Get current DisplayPort pin mode on the specified port.
*
* @param port USB-C port number
diff --git a/include/usbc_ppc.h b/include/usbc_ppc.h
index efbfbe4b6c..b794792d31 100644
--- a/include/usbc_ppc.h
+++ b/include/usbc_ppc.h
@@ -114,6 +114,16 @@ struct ppc_drv {
int (*set_vconn)(int port, int enable);
#endif
+#ifdef CONFIG_USB_PD_FRS_PPC
+ /**
+ * Turn on/off the FRS trigger
+ *
+ * @param port: The Type-C port number.
+ * @return EC_SUCCESS on success, error otherwise
+ */
+ int (*set_frs_enable)(int port, int enable);
+#endif
+
#ifdef CONFIG_CMD_PPC_DUMP
/**
* Perform a register dump of the PPC.
@@ -148,6 +158,7 @@ struct ppc_config_t {
int i2c_port;
uint16_t i2c_addr_flags;
const struct ppc_drv *drv;
+ int frs_en;
};
extern struct ppc_config_t ppc_chips[];
@@ -301,4 +312,12 @@ int ppc_enter_low_power_mode(int port);
*/
int ppc_get_alert_status(int port);
+/**
+ * Turn on/off the FRS trigger
+ *
+ * @param port: The Type-C port number.
+ * @return EC_SUCCESS on success, error otherwise
+ */
+int ppc_set_frs_enable(int port, int enable);
+
#endif /* !defined(__CROS_EC_USBC_PPC_H) */