diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/config.h | 21 | ||||
-rw-r--r-- | include/usb_pd.h | 8 | ||||
-rw-r--r-- | include/usbc_ppc.h | 19 |
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) */ |