Merge tag 'input-for-v6.3-rc0' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor...
[linux-block.git] / include / linux / platform_data / cros_ec_commands.h
index a2073ed43972b346f85a0f534f6de0f85e729bc4..7e9c76aedd2dd6022931a2ae6f110a1f6f1b340e 100644 (file)
@@ -1082,7 +1082,7 @@ struct ec_params_get_cmd_versions_v1 {
 } __ec_align2;
 
 /**
- * struct ec_response_get_cmd_version - Response to the get command versions.
+ * struct ec_response_get_cmd_versions - Response to the get command versions.
  * @version_mask: Mask of supported versions; use EC_VER_MASK() to compare with
  *                a desired version.
  */
@@ -1300,8 +1300,18 @@ enum ec_feature_code {
         * mux.
         */
        EC_FEATURE_TYPEC_MUX_REQUIRE_AP_ACK = 43,
-       /* The MCU is a System Companion Processor (SCP) 2nd Core. */
-       EC_FEATURE_SCP_C1 = 45,
+       /*
+        * The EC supports entering and residing in S4.
+        */
+       EC_FEATURE_S4_RESIDENCY = 44,
+       /*
+        * The EC supports the AP directing mux sets for the board.
+        */
+       EC_FEATURE_TYPEC_AP_MUX_SET = 45,
+       /*
+        * The EC supports the AP composing VDMs for us to send.
+        */
+       EC_FEATURE_TYPEC_AP_VDM_SEND = 46,
 };
 
 #define EC_FEATURE_MASK_0(event_code) BIT(event_code % 32)
@@ -5473,7 +5483,7 @@ struct ec_response_rollback_info {
 /* Issue AP reset */
 #define EC_CMD_AP_RESET 0x0125
 
-/**
+/*
  * Get the number of peripheral charge ports
  */
 #define EC_CMD_PCHG_COUNT 0x0134
@@ -5484,7 +5494,7 @@ struct ec_response_pchg_count {
        uint8_t port_count;
 } __ec_align1;
 
-/**
+/*
  * Get the status of a peripheral charge port
  */
 #define EC_CMD_PCHG 0x0135
@@ -5729,6 +5739,8 @@ enum typec_control_command {
        TYPEC_CONTROL_COMMAND_ENTER_MODE,
        TYPEC_CONTROL_COMMAND_TBT_UFP_REPLY,
        TYPEC_CONTROL_COMMAND_USB_MUX_SET,
+       TYPEC_CONTROL_COMMAND_BIST_SHARE_MODE,
+       TYPEC_CONTROL_COMMAND_SEND_VDM_REQ,
 };
 
 /* Replies the AP may specify to the TBT EnterMode command as a UFP */
@@ -5742,6 +5754,17 @@ struct typec_usb_mux_set {
        uint8_t mux_flags;      /* USB_PD_MUX_*-encoded USB mux state to set */
 } __ec_align1;
 
+#define VDO_MAX_SIZE 7
+
+struct typec_vdm_req {
+       /* VDM data, including VDM header */
+       uint32_t vdm_data[VDO_MAX_SIZE];
+       /* Number of 32-bit fields filled in */
+       uint8_t vdm_data_objects;
+       /* Partner to address - see enum typec_partner_type */
+       uint8_t partner_type;
+} __ec_align1;
+
 struct ec_params_typec_control {
        uint8_t port;
        uint8_t command;        /* enum typec_control_command */
@@ -5757,6 +5780,8 @@ struct ec_params_typec_control {
                uint8_t mode_to_enter;      /* enum typec_mode */
                uint8_t tbt_ufp_reply;      /* enum typec_tbt_ufp_reply */
                struct typec_usb_mux_set mux_params;
+               /* Used for VMD_REQ */
+               struct typec_vdm_req vdm_req_params;
                uint8_t placeholder[128];
        };
 } __ec_align1;
@@ -5838,6 +5863,9 @@ enum tcpc_cc_polarity {
 #define PD_STATUS_EVENT_DISCONNECTED           BIT(3)
 #define PD_STATUS_EVENT_MUX_0_SET_DONE         BIT(4)
 #define PD_STATUS_EVENT_MUX_1_SET_DONE         BIT(5)
+#define PD_STATUS_EVENT_VDM_REQ_REPLY          BIT(6)
+#define PD_STATUS_EVENT_VDM_REQ_FAILED         BIT(7)
+#define PD_STATUS_EVENT_VDM_ATTENTION          BIT(8)
 
 struct ec_params_typec_status {
        uint8_t port;
@@ -5881,6 +5909,37 @@ struct ec_response_typec_status {
        uint32_t sink_cap_pdos[7];      /* Max 7 PDOs can be present */
 } __ec_align1;
 
+/*
+ * Gather the response to the most recent VDM REQ from the AP, as well
+ * as popping the oldest VDM:Attention from the DPM queue
+ */
+#define EC_CMD_TYPEC_VDM_RESPONSE 0x013C
+
+struct ec_params_typec_vdm_response {
+       uint8_t port;
+} __ec_align1;
+
+struct ec_response_typec_vdm_response {
+       /* Number of 32-bit fields filled in */
+       uint8_t vdm_data_objects;
+       /* Partner to address - see enum typec_partner_type */
+       uint8_t partner_type;
+       /* enum ec_status describing VDM response */
+       uint16_t vdm_response_err;
+       /* VDM data, including VDM header */
+       uint32_t vdm_response[VDO_MAX_SIZE];
+       /* Number of 32-bit Attention fields filled in */
+       uint8_t vdm_attention_objects;
+       /* Number of remaining messages to consume */
+       uint8_t vdm_attention_left;
+       /* Reserved */
+       uint16_t reserved1;
+       /* VDM:Attention contents */
+       uint32_t vdm_attention[2];
+} __ec_align1;
+
+#undef VDO_MAX_SIZE
+
 /*****************************************************************************/
 /* The command range 0x200-0x2FF is reserved for Rotor. */