summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Adolfsson <sadolfsson@google.com>2018-04-24 09:56:31 +0200
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2018-06-19 20:06:17 +0000
commitf136319edb37c8282d1ba5257ba90909b0d05120 (patch)
tree57bcdde254cc09789eba4bf589a24bb8f3fa1ee2
parent801273617d2feb754253f715a3ade1b23eeafefc (diff)
downloadchrome-ec-f136319edb37c8282d1ba5257ba90909b0d05120.tar.gz
CEC: Add CEC API
Add HDMI CEC commands and events. Will be used by npcx CEC implementation. Signed-off-by: Stefan Adolfsson <sadolfsson@chromium.org> BUG=b:76467407 BRANCH=none TEST=Build ec-utils and chromeos-ec Reviewed-on: https://chromium-review.googlesource.com/995440 Reviewed-by: Randall Spangler <rspangler@chromium.org> (cherry picked from commit f04ec041b21b44a94cb4c59f73249424bb276b71) Conflicts: include/ec_commands.h util/ectool.c The feature name string was removed since holes in that array causes segmentation fault when running "ectool inventory" Change-Id: I9008eb77179c296d6d07d321f48ba24585323607 Reviewed-on: https://chromium-review.googlesource.com/1063873 Reviewed-by: Stefan Adolfsson <sadolfsson@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Tested-by: Stefan Adolfsson <sadolfsson@chromium.org> Commit-Queue: Stefan Adolfsson <sadolfsson@chromium.org>
-rw-r--r--include/ec_commands.h70
1 files changed, 70 insertions, 0 deletions
diff --git a/include/ec_commands.h b/include/ec_commands.h
index b2abacb83a..c6c4c509dd 100644
--- a/include/ec_commands.h
+++ b/include/ec_commands.h
@@ -1247,6 +1247,8 @@ enum ec_feature_code {
EC_FEATURE_UNIFIED_WAKE_MASKS = 32,
/* EC supports 64-bit host events */
EC_FEATURE_HOST_EVENT64 = 33,
+ /* EC supports CEC commands */
+ EC_FEATURE_CEC = 35,
};
#define EC_FEATURE_MASK_0(event_code) (1UL << (event_code % 32))
@@ -3157,6 +3159,9 @@ enum ec_mkbp_event {
*/
EC_MKBP_EVENT_HOST_EVENT64 = 7,
+ /* Notify the AP that something happened on CEC */
+ EC_MKBP_EVENT_CEC = 8,
+
/* Number of MKBP events */
EC_MKBP_EVENT_COUNT,
};
@@ -3181,6 +3186,9 @@ union __ec_align_offset1 ec_response_get_next_data {
uint32_t fp_events;
uint32_t sysrq;
+
+ /* CEC events from enum mkbp_cec_event */
+ uint32_t cec_events;
};
struct __ec_align1 ec_response_get_next_event {
@@ -3963,6 +3971,68 @@ struct __ec_align1 ec_response_i2c_passthru_protect {
uint8_t status; /* Status flags (0: unlocked, 1: locked) */
};
+
+/*****************************************************************************/
+/*
+ * HDMI CEC commands
+ *
+ * These commands are for sending and receiving message via HDMI CEC
+ */
+
+#define MAX_CEC_MSG_LEN 16
+
+/* CEC message from the AP to be written on the CEC bus */
+#define EC_CMD_CEC_WRITE_MSG 0x00B8
+
+/* Message to write to the CEC bus */
+struct __ec_align1 ec_params_cec_write {
+ uint8_t msg[MAX_CEC_MSG_LEN];
+};
+
+/* CEC message from a CEC sink reported back to the AP */
+#define EC_CMD_CEC_READ_MSG 0x00B9
+
+/* Message read from to the CEC bus */
+struct __ec_align1 ec_response_cec_read {
+ uint8_t msg[MAX_CEC_MSG_LEN];
+};
+
+/* Set various CEC parameters */
+#define EC_CMD_CEC_SET 0x00BA
+
+struct __ec_align1 ec_params_cec_set {
+ uint8_t cmd; /* enum cec_command */
+ uint8_t val;
+};
+
+/* Read various CEC parameters */
+#define EC_CMD_CEC_GET 0x00BB
+
+struct __ec_align1 ec_params_cec_get {
+ uint8_t cmd; /* enum cec_command */
+};
+
+struct __ec_align1 ec_response_cec_get {
+ uint8_t val;
+};
+
+enum cec_command {
+ /* CEC reading, writing and events enable */
+ CEC_CMD_ENABLE,
+ /* CEC logical address */
+ CEC_CMD_LOGICAL_ADDRESS,
+};
+
+/* Events from CEC to AP */
+enum mkbp_cec_event {
+ /* Outgoing message was acknowledged by a follower */
+ EC_MKBP_CEC_SEND_OK = 1 << 0,
+ /* Outgoing message was not acknowledged */
+ EC_MKBP_CEC_SEND_FAILED = 1 << 1,
+ /* Incoming message can be read out by AP */
+ EC_MKBP_CEC_HAVE_DATA = 1 << 2,
+};
+
/*****************************************************************************/
/* System commands */