Skip to content

Commit f47674e

Browse files
superna9999Lee Jones
authored andcommitted
mfd: cros-ec: Introduce CEC commands and events definitions.
The EC can expose a CEC bus, this patch adds the CEC related definitions needed by the cros-ec-cec driver. Signed-off-by: Neil Armstrong <[email protected]> Tested-by: Enric Balletbo i Serra <[email protected]> Reviewed-by: Hans Verkuil <[email protected]> Signed-off-by: Lee Jones <[email protected]>
1 parent 57e94c8 commit f47674e

File tree

1 file changed

+81
-0
lines changed

1 file changed

+81
-0
lines changed

include/linux/mfd/cros_ec_commands.h

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -804,6 +804,8 @@ enum ec_feature_code {
804804
EC_FEATURE_MOTION_SENSE_FIFO = 24,
805805
/* EC has RTC feature that can be controlled by host commands */
806806
EC_FEATURE_RTC = 27,
807+
/* EC supports CEC commands */
808+
EC_FEATURE_CEC = 35,
807809
};
808810

809811
#define EC_FEATURE_MASK_0(event_code) (1UL << (event_code % 32))
@@ -2078,6 +2080,12 @@ enum ec_mkbp_event {
20782080
/* EC sent a sysrq command */
20792081
EC_MKBP_EVENT_SYSRQ = 6,
20802082

2083+
/* Notify the AP that something happened on CEC */
2084+
EC_MKBP_EVENT_CEC_EVENT = 8,
2085+
2086+
/* Send an incoming CEC message to the AP */
2087+
EC_MKBP_EVENT_CEC_MESSAGE = 9,
2088+
20812089
/* Number of MKBP events */
20822090
EC_MKBP_EVENT_COUNT,
20832091
};
@@ -2845,6 +2853,79 @@ struct ec_params_reboot_ec {
28452853
#define EC_ACPI_MEM_VERSION_CURRENT 1
28462854

28472855

2856+
/*****************************************************************************/
2857+
/*
2858+
* HDMI CEC commands
2859+
*
2860+
* These commands are for sending and receiving message via HDMI CEC
2861+
*/
2862+
#define EC_MAX_CEC_MSG_LEN 16
2863+
2864+
/* CEC message from the AP to be written on the CEC bus */
2865+
#define EC_CMD_CEC_WRITE_MSG 0x00B8
2866+
2867+
/**
2868+
* struct ec_params_cec_write - Message to write to the CEC bus
2869+
* @msg: message content to write to the CEC bus
2870+
*/
2871+
struct ec_params_cec_write {
2872+
uint8_t msg[EC_MAX_CEC_MSG_LEN];
2873+
} __packed;
2874+
2875+
/* Set various CEC parameters */
2876+
#define EC_CMD_CEC_SET 0x00BA
2877+
2878+
/**
2879+
* struct ec_params_cec_set - CEC parameters set
2880+
* @cmd: parameter type, can be CEC_CMD_ENABLE or CEC_CMD_LOGICAL_ADDRESS
2881+
* @val: in case cmd is CEC_CMD_ENABLE, this field can be 0 to disable CEC
2882+
* or 1 to enable CEC functionality, in case cmd is CEC_CMD_LOGICAL_ADDRESS,
2883+
* this field encodes the requested logical address between 0 and 15
2884+
* or 0xff to unregister
2885+
*/
2886+
struct ec_params_cec_set {
2887+
uint8_t cmd; /* enum cec_command */
2888+
uint8_t val;
2889+
} __packed;
2890+
2891+
/* Read various CEC parameters */
2892+
#define EC_CMD_CEC_GET 0x00BB
2893+
2894+
/**
2895+
* struct ec_params_cec_get - CEC parameters get
2896+
* @cmd: parameter type, can be CEC_CMD_ENABLE or CEC_CMD_LOGICAL_ADDRESS
2897+
*/
2898+
struct ec_params_cec_get {
2899+
uint8_t cmd; /* enum cec_command */
2900+
} __packed;
2901+
2902+
/**
2903+
* struct ec_response_cec_get - CEC parameters get response
2904+
* @val: in case cmd was CEC_CMD_ENABLE, this field will 0 if CEC is
2905+
* disabled or 1 if CEC functionality is enabled,
2906+
* in case cmd was CEC_CMD_LOGICAL_ADDRESS, this will encode the
2907+
* configured logical address between 0 and 15 or 0xff if unregistered
2908+
*/
2909+
struct ec_response_cec_get {
2910+
uint8_t val;
2911+
} __packed;
2912+
2913+
/* CEC parameters command */
2914+
enum ec_cec_command {
2915+
/* CEC reading, writing and events enable */
2916+
CEC_CMD_ENABLE,
2917+
/* CEC logical address */
2918+
CEC_CMD_LOGICAL_ADDRESS,
2919+
};
2920+
2921+
/* Events from CEC to AP */
2922+
enum mkbp_cec_event {
2923+
/* Outgoing message was acknowledged by a follower */
2924+
EC_MKBP_CEC_SEND_OK = BIT(0),
2925+
/* Outgoing message was not acknowledged */
2926+
EC_MKBP_CEC_SEND_FAILED = BIT(1),
2927+
};
2928+
28482929
/*****************************************************************************/
28492930
/*
28502931
* Special commands

0 commit comments

Comments
 (0)