diff options
author | Aseda Aboagye <aaboagye@google.com> | 2017-11-30 00:02:20 -0800 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2017-12-06 17:30:46 -0800 |
commit | eff4baf03f28f04cf1e89a602fe3a244228cbb6e (patch) | |
tree | 84a20fe7679ad083133be0c1b47617b7543e67cb /include | |
parent | 0dd7716c4f8fbd73e57060d32badf4b2c3767678 (diff) | |
download | chrome-ec-eff4baf03f28f04cf1e89a602fe3a244228cbb6e.tar.gz |
sn5s330: Add support for Vbus detection.
The SN5S330 has support for detecting when Vbus is present on a port.
This commit simply adds an API to query the PPC.
BUG=None
BRANCH=None
TEST=`make -j buildall`.
TEST=Flash a board with the SN5S330, with some extra code, verify that
Vbus can be detected with this API.
Change-Id: I45bf7ff24bcdc447efe12932f51f8094108e29d5
Signed-off-by: Aseda Aboagye <aaboagye@google.com>
Reviewed-on: https://chromium-review.googlesource.com/791502
Commit-Ready: Aseda Aboagye <aaboagye@chromium.org>
Tested-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Edward Hill <ecgh@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/config.h | 2 | ||||
-rw-r--r-- | include/usbc_ppc.h | 28 |
2 files changed, 30 insertions, 0 deletions
diff --git a/include/config.h b/include/config.h index bb4584b0b6..713bb87bb5 100644 --- a/include/config.h +++ b/include/config.h @@ -2641,6 +2641,7 @@ * - Some TCPCs can detect and report the presence of VBUS. * - In some configurations, charger ICs can report the presence of VBUS. * - On some boards, dedicated VBUS interrupt pins are available. + * - Some power path controllers (PPC) can report the presence of VBUS. * * Exactly one of these should be defined for all boards that run the PD * state machine. @@ -2648,6 +2649,7 @@ #undef CONFIG_USB_PD_VBUS_DETECT_TCPC #undef CONFIG_USB_PD_VBUS_DETECT_CHARGER #undef CONFIG_USB_PD_VBUS_DETECT_GPIO +#undef CONFIG_USB_PD_VBUS_DETECT_PPC #undef CONFIG_USB_PD_VBUS_DETECT_NONE diff --git a/include/usbc_ppc.h b/include/usbc_ppc.h index 05e671728a..f5b72742d2 100644 --- a/include/usbc_ppc.h +++ b/include/usbc_ppc.h @@ -56,6 +56,24 @@ struct ppc_drv { */ int (*reg_dump)(int port); #endif /* defined(CONFIG_CMD_PPC_DUMP) */ + +#ifdef CONFIG_USB_PD_VBUS_DETECT_PPC + /* + * TODO(aaboagye): In order for VBUS detection to work properly for our + * system, we need to enable VBUS interrupts and send the appropriate + * notifications. + */ + + /** + * Determine if VBUS is present or not. + * + * @param port: The Type-C port number. + * @param vbus_present: 1: VBUS is present. 0: VBUS is not present. + * @return EC_SUCCESS if able to determine VBUS status, otherwise an + * error. + */ + int (*is_vbus_present)(int port, int *vbus_present); +#endif /* defined(CONFIG_USB_PD_VBUS_DETECT_PPC) */ }; struct ppc_config_t { @@ -68,6 +86,16 @@ extern const struct ppc_config_t ppc_chips[]; extern const unsigned int ppc_cnt; /** + * Determine if VBUS is present or not. + * + * @param port: The Type-C port number. + * @param vbus_present: 1: VBUS is present. 0: VBUS is not present. + * @return EC_SUCCESS if able to determine VBUS status, otherwise an + * error. + */ +int ppc_is_vbus_present(int port, int *vbus_present); + +/** * Is the port sourcing Vbus? * * @param port: The Type-C port number. |