summaryrefslogtreecommitdiff
path: root/include/usb_pd_tcpm.h
diff options
context:
space:
mode:
authorEric Yilun Lin <yllin@chromium.org>2022-01-19 16:54:51 +0800
committerCommit Bot <commit-bot@chromium.org>2022-03-04 23:04:21 +0000
commit8dad81f65fa9bbf97b8d66c61af29660b38f067e (patch)
tree5e259d01c4cee054c8d275ad8119b0ce5487e21b /include/usb_pd_tcpm.h
parent83995780242fcab243370e4ffa83e70b001848b6 (diff)
downloadchrome-ec-8dad81f65fa9bbf97b8d66c61af29660b38f067e.tar.gz
tcpci: support tcpci_get_vbus_voltage
Implement the common interface tcpic_get_vbus_voltage BUG=b:214893572 TEST=on kinger, the VBUS ADC reading is correct BRANCH=none Change-Id: I5f31533e8b290b4019e74870053e009b0da6ddcf Signed-off-by: Eric Yilun Lin <yllin@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3400768 Auto-Submit: Eric Yilun Lin <yllin@google.com> Tested-by: Eric Yilun Lin <yllin@google.com> Reviewed-by: Diana Z <dzigterman@chromium.org> Commit-Queue: Diana Z <dzigterman@chromium.org>
Diffstat (limited to 'include/usb_pd_tcpm.h')
-rw-r--r--include/usb_pd_tcpm.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/include/usb_pd_tcpm.h b/include/usb_pd_tcpm.h
index 598e8aeae1..c104b3af8f 100644
--- a/include/usb_pd_tcpm.h
+++ b/include/usb_pd_tcpm.h
@@ -213,6 +213,16 @@ struct tcpm_drv {
bool (*check_vbus_level)(int port, enum vbus_level level);
/**
+ * Get VBUS voltage
+ *
+ * @param port Type-C port number
+ * @param vbus read VBUS voltage in mV
+ *
+ * @return EC_SUCCESS or error
+ */
+ int (*get_vbus_voltage)(int port, int *vbus);
+
+ /**
* Set the value of the CC pull-up used when we are a source.
*
* @param port Type-C port number
@@ -499,6 +509,7 @@ struct tcpm_drv {
* Bit 5 --> Set to 1 to prevent TCPC setting debug accessory control
* Bit 6 --> TCPC controls VCONN (even when CONFIG_USB_PD_TCPC_VCONN is off)
* Bit 7 --> TCPC controls FRS (even when CONFIG_USB_PD_FRS_TCPC is off)
+ * Bit 8 --> TCPC enable VBUS monitoring
*/
#define TCPC_FLAGS_ALERT_ACTIVE_HIGH BIT(0)
#define TCPC_FLAGS_ALERT_OD BIT(1)
@@ -508,6 +519,7 @@ struct tcpm_drv {
#define TCPC_FLAGS_NO_DEBUG_ACC_CONTROL BIT(5)
#define TCPC_FLAGS_CONTROL_VCONN BIT(6)
#define TCPC_FLAGS_CONTROL_FRS BIT(7)
+#define TCPC_FLAGS_VBUS_MONITOR BIT(8)
struct tcpc_config_t {
enum ec_bus_type bus_type; /* enum ec_bus_type */