summaryrefslogtreecommitdiff
path: root/include/usbc_ppc.h
diff options
context:
space:
mode:
authorAseda Aboagye <aaboagye@google.com>2017-11-30 00:02:20 -0800
committerchrome-bot <chrome-bot@chromium.org>2017-12-06 17:30:46 -0800
commiteff4baf03f28f04cf1e89a602fe3a244228cbb6e (patch)
tree84a20fe7679ad083133be0c1b47617b7543e67cb /include/usbc_ppc.h
parent0dd7716c4f8fbd73e57060d32badf4b2c3767678 (diff)
downloadchrome-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/usbc_ppc.h')
-rw-r--r--include/usbc_ppc.h28
1 files changed, 28 insertions, 0 deletions
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.