diff options
Diffstat (limited to 'include/usbc_ppc.h')
-rw-r--r-- | include/usbc_ppc.h | 70 |
1 files changed, 64 insertions, 6 deletions
diff --git a/include/usbc_ppc.h b/include/usbc_ppc.h index 0af3e766e3..05e671728a 100644 --- a/include/usbc_ppc.h +++ b/include/usbc_ppc.h @@ -8,30 +8,88 @@ #include "common.h" - /* Common APIs for USB Type-C Power Path Controllers (PPC) */ +struct ppc_drv { + /** + * Initialize the PPC. + * + * @param port: The Type-C port number. + * @return EC_SUCCESS when init was successful, error otherwise. + */ + int (*init)(int port); + + /** + * Is the port sourcing Vbus? + * + * @param port: The Type-C port number. + * @return 1 if sourcing Vbus, 0 if not. + */ + int (*is_sourcing_vbus)(int port); + + /** + * Turn on/off the charge path FET, such that current flows into the + * system. + * + * @param port: The Type-C port number. + * @param enable: 1: Turn on the FET, 0: turn off the FET. + * @return EC_SUCCESS on success, error otherwise. + */ + int (*vbus_sink_enable)(int port, int enable); + + /** + * Turn on/off the source path FET, such that current flows from the + * system. + * + * @param port: The Type-C port number. + * @param enable: 1: Turn on the FET, 0: turn off the FET. + * @return EC_SUCCESS on success, error otherwise. + */ + int (*vbus_source_enable)(int port, int enable); + +#ifdef CONFIG_CMD_PPC_DUMP + /** + * Perform a register dump of the PPC. + * + * @param port: The Type-C port number. + * @return EC_SUCCESS on success, error otherwise. + */ + int (*reg_dump)(int port); +#endif /* defined(CONFIG_CMD_PPC_DUMP) */ +}; + +struct ppc_config_t { + int i2c_port; + int i2c_addr; + const struct ppc_drv *drv; +}; + +extern const struct ppc_config_t ppc_chips[]; +extern const unsigned int ppc_cnt; + /** * Is the port sourcing Vbus? * - * @param port: The type c port. + * @param port: The Type-C port number. * @return 1 if sourcing Vbus, 0 if not. */ int ppc_is_sourcing_vbus(int port); /** - * Allow current to flow into the system. + * Turn on/off the charge path FET, such that current flows into the + * system. * - * @param port: The Type-C port's FET to open. + * @param port: The Type-C port number. * @param enable: 1: Turn on the FET, 0: turn off the FET. * @return EC_SUCCESS on success, error otherwise. */ int ppc_vbus_sink_enable(int port, int enable); /** - * Allow current out of the system. + * Turn on/off the source path FET, such that current flows from the + * system. * - * @param port: The Type-C port's FET to open. + * @param port: The Type-C port number. * @param enable: 1: Turn on the FET, 0: turn off the FET. * @return EC_SUCCESS on success, error otherwise. */ |