summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorSam Hurst <shurst@google.com>2020-06-03 14:52:27 -0700
committerCommit Bot <commit-bot@chromium.org>2020-06-25 03:55:36 +0000
commitd945012134ae499ff8903739d5472f5cdd51703a (patch)
tree18d0f4fa130e1888b220d2832700a9a023db0582 /include
parentb38f3970ef0ea24c77a8ceeddd0f3eae3692c702 (diff)
downloadchrome-ec-d945012134ae499ff8903739d5472f5cdd51703a.tar.gz
TCPMV2: Add support for sending Alert Messages
Add support for sending Alert OVC and OVP messages BRANCH=none BUG=b:117854867 TEST=make -j buildall Signed-off-by: Sam Hurst <shurst@google.com> Change-Id: Ia436c8869880897ea9af0c2c2b0d6e9288831a8f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2229285 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Diffstat (limited to 'include')
-rw-r--r--include/usb_common.h10
-rw-r--r--include/usb_pd.h10
-rw-r--r--include/usb_pe_sm.h1
3 files changed, 21 insertions, 0 deletions
diff --git a/include/usb_common.h b/include/usb_common.h
index 078f4b0029..180ebbcc95 100644
--- a/include/usb_common.h
+++ b/include/usb_common.h
@@ -179,4 +179,14 @@ int pd_get_saved_port_flags(int port, uint8_t *flags);
* @param do_set value written to the BB Ram flag
*/
void pd_update_saved_port_flags(int port, uint8_t flag, uint8_t do_set);
+
+/**
+ * Build PD alert message
+ *
+ * @param msg pointer where message is stored
+ * @param len pointer where length of message is stored in bytes
+ * @param pr current PD power role
+ * @return EC_SUCCESS on success else EC_ERROR_INVAL
+ */
+int pd_build_alert_msg(uint32_t *msg, uint32_t *len, enum pd_power_role pr);
#endif /* __CROS_EC_USB_COMMON_H */
diff --git a/include/usb_pd.h b/include/usb_pd.h
index 90d8a1392a..09468911bf 100644
--- a/include/usb_pd.h
+++ b/include/usb_pd.h
@@ -1096,6 +1096,16 @@ enum pd_ext_msg_type {
/* 15-31 Reserved */
};
+/* Alert Data Object fields for REV 3.0 */
+#define ADO_OVP_EVENT BIT(30)
+#define ADO_SOURCE_INPUT_CHANGE BIT(29)
+#define ADO_OPERATING_CONDITION_CHANGE BIT(28)
+#define ADO_OTP_EVENT BIT(27)
+#define ADO_OCP_EVENT BIT(26)
+#define ADO_BATTERY_STATUS_CHANGE BIT(25)
+#define ADO_FIXED_BATTERIES(n) ((n & 0xf) << 20)
+#define ADO_HOT_SWAPPABLE_BATTERIES(n) ((n & 0xf) << 16)
+
/* Data message type */
enum pd_data_msg_type {
/* 0 Reserved */
diff --git a/include/usb_pe_sm.h b/include/usb_pe_sm.h
index e69eff572f..8089fddb55 100644
--- a/include/usb_pe_sm.h
+++ b/include/usb_pe_sm.h
@@ -42,6 +42,7 @@ enum pe_dpm_request {
DPM_REQUEST_HARD_RESET_SEND = BIT(15),
DPM_REQUEST_SOFT_RESET_SEND = BIT(16),
DPM_REQUEST_PORT_DISCOVERY = BIT(17),
+ DPM_REQUEST_SEND_ALERT = BIT(18),
};
/**