summaryrefslogtreecommitdiff
path: root/src/ec/google/chromeec
diff options
context:
space:
mode:
authorYidi Lin <yidi.lin@mediatek.com>2020-09-21 18:04:10 +0800
committerHung-Te Lin <hungte@chromium.org>2020-10-15 13:44:52 +0000
commit42f795904c550215fc53706155ceb82f1f720117 (patch)
tree9ebecbad7c990479a3e3f36f2ab68c220216f9e1 /src/ec/google/chromeec
parent232d8a8eb57a0e343369ba869d71ca27b4b1ad88 (diff)
downloadcoreboot-42f795904c550215fc53706155ceb82f1f720117.tar.xz
ec/google/chromeec: Update ec_commands.h
This change copies ec_commands.h from Chromium OS EC repo at 7b6cb69db. The change also drops unneeded empty lines and coverts license header to SPDX style. BUG=b:147789962 BRANCH=none TEST=emerge-asurada coreboot Change-Id: I9816dab5edb418e76896355a0802c59307c664c4 Signed-off-by: Yidi Lin <yidi.lin@mediatek.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/46403 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Hung-Te Lin <hungte@chromium.org> Reviewed-by: Yu-Ping Wu <yupingso@google.com>
Diffstat (limited to 'src/ec/google/chromeec')
-rw-r--r--src/ec/google/chromeec/ec_commands.h228
1 files changed, 226 insertions, 2 deletions
diff --git a/src/ec/google/chromeec/ec_commands.h b/src/ec/google/chromeec/ec_commands.h
index 4c3d0bb838..4e40c6dee5 100644
--- a/src/ec/google/chromeec/ec_commands.h
+++ b/src/ec/google/chromeec/ec_commands.h
@@ -2520,6 +2520,12 @@ enum motionsense_command {
*/
MOTIONSENSE_CMD_ONLINE_CALIB_READ = 19,
+ /*
+ * Activity management
+ * Retrieve current status of given activity.
+ */
+ MOTIONSENSE_CMD_GET_ACTIVITY = 20,
+
/* Number of motionsense sub-commands. */
MOTIONSENSE_NUM_CMDS
};
@@ -2572,6 +2578,8 @@ enum motionsensor_chip {
MOTIONSENSE_CHIP_LIS2DW12 = 21,
MOTIONSENSE_CHIP_LIS2DWL = 22,
MOTIONSENSE_CHIP_LIS2DS = 23,
+ MOTIONSENSE_CHIP_BMI260 = 24,
+ MOTIONSENSE_CHIP_ICM426XX = 25,
MOTIONSENSE_CHIP_MAX,
};
@@ -2592,6 +2600,8 @@ struct ec_response_motion_sensor_data {
/* Each sensor is up to 3-axis. */
union {
int16_t data[3];
+ /* for sensors using unsigned data */
+ uint16_t udata[3];
struct __ec_todo_packed {
uint16_t reserved;
uint32_t timestamp;
@@ -2637,6 +2647,7 @@ enum motionsensor_activity {
MOTIONSENSE_ACTIVITY_SIG_MOTION = 1,
MOTIONSENSE_ACTIVITY_DOUBLE_TAP = 2,
MOTIONSENSE_ACTIVITY_ORIENTATION = 3,
+ MOTIONSENSE_ACTIVITY_BODY_DETECTION = 4,
};
struct ec_motion_sense_activity {
@@ -2820,6 +2831,7 @@ struct ec_params_motion_sense {
uint32_t max_data_vector;
} fifo_read;
+ /* Used for MOTIONSENSE_CMD_SET_ACTIVITY */
struct ec_motion_sense_activity set_activity;
/* Used for MOTIONSENSE_CMD_LID_ANGLE */
@@ -2874,6 +2886,13 @@ struct ec_params_motion_sense {
uint8_t sensor_num;
} online_calib_read;
+ /*
+ * Used for MOTIONSENSE_CMD_GET_ACTIVITY.
+ */
+ struct __ec_todo_unpacked {
+ uint8_t sensor_num;
+ uint8_t activity; /* enum motionsensor_activity */
+ } get_activity;
};
} __ec_todo_packed;
@@ -3025,6 +3044,10 @@ struct ec_response_motion_sense {
uint16_t hys_degree;
} tablet_mode_threshold;
+ /* USED for MOTIONSENSE_CMD_GET_ACTIVITY. */
+ struct __ec_todo_unpacked {
+ uint8_t state;
+ } get_activity;
};
} __ec_todo_packed;
@@ -4429,6 +4452,7 @@ struct ec_params_charge_state {
uint32_t value; /* value to set */
} set_param;
};
+ uint8_t chgnum; /* Version 1 supports chgnum */
} __ec_todo_packed;
struct ec_response_charge_state {
@@ -4982,6 +5006,7 @@ enum ec_codec_i2s_rx_subcmd {
EC_CODEC_I2S_RX_SET_SAMPLE_DEPTH = 0x2,
EC_CODEC_I2S_RX_SET_DAIFMT = 0x3,
EC_CODEC_I2S_RX_SET_BCLK = 0x4,
+ EC_CODEC_I2S_RX_RESET = 0x5,
EC_CODEC_I2S_RX_SUBCMD_COUNT,
};
@@ -5095,6 +5120,33 @@ struct __ec_align4 ec_response_ec_codec_wov_read_audio_shm {
};
/*****************************************************************************/
+/* Commands for PoE PSE controller */
+
+#define EC_CMD_PSE 0x00C0
+
+enum ec_pse_subcmd {
+ EC_PSE_STATUS = 0x0,
+ EC_PSE_ENABLE = 0x1,
+ EC_PSE_DISABLE = 0x2,
+ EC_PSE_SUBCMD_COUNT,
+};
+
+struct __ec_align1 ec_params_pse {
+ uint8_t cmd; /* enum ec_pse_subcmd */
+ uint8_t port; /* PSE port */
+};
+
+enum ec_pse_status {
+ EC_PSE_STATUS_DISABLED = 0x0,
+ EC_PSE_STATUS_ENABLED = 0x1,
+ EC_PSE_STATUS_POWERED = 0x2,
+};
+
+struct __ec_align1 ec_response_pse_status {
+ uint8_t status; /* enum ec_pse_status */
+};
+
+/*****************************************************************************/
/* System commands */
/*
@@ -5112,7 +5164,7 @@ enum ec_reboot_cmd {
EC_REBOOT_COLD = 4, /* Cold-reboot */
EC_REBOOT_DISABLE_JUMP = 5, /* Disable jump until next reboot */
EC_REBOOT_HIBERNATE = 6, /* Hibernate EC */
- EC_REBOOT_HIBERNATE_CLEAR_AP_OFF = 7, /* and clears AP_OFF flag */
+ EC_REBOOT_HIBERNATE_CLEAR_AP_OFF = 7, /* and clears AP_IDLE flag */
};
/* Flags for ec_params_reboot_ec.reboot_flags */
@@ -5330,7 +5382,8 @@ struct ec_response_usb_pd_control_v2 {
uint8_t dp_mode; /* Current DP pin mode (MODE_DP_PIN_[A-E]) */
uint8_t reserved; /* Reserved for future use */
uint8_t control_flags; /* USB_PD_CTRL_*flags */
- uint8_t cable_speed; /* TBT_SS_* cable speed */
+ /* TODO: b:158234949 Add definitions for cable speed */
+ uint8_t cable_speed; /* USB_R30_SS/TBT_SS_* cable speed */
uint8_t cable_gen; /* TBT_GEN3_* cable rounded support */
} __ec_align1;
@@ -5386,6 +5439,7 @@ struct ec_response_usb_pd_power_info {
uint32_t max_power;
} __ec_align4;
+
/*
* This command will return the number of USB PD charge port + the number
* of dedicated port present.
@@ -5587,6 +5641,7 @@ struct ec_params_pd_write_log_entry {
uint8_t port; /* port#, or 0 for events unrelated to a given port */
} __ec_align1;
+
/* Control USB-PD chip */
#define EC_CMD_PD_CONTROL 0x0119
@@ -5711,6 +5766,8 @@ enum cbi_data_tag {
CBI_TAG_MODEL_ID = 5, /* uint32_t or smaller */
CBI_TAG_FW_CONFIG = 6, /* uint32_t bit field */
CBI_TAG_PCB_SUPPLIER = 7, /* uint32_t or smaller */
+ /* Second Source Factory Cache */
+ CBI_TAG_SSFC = 8, /* uint32_t bit field */
CBI_TAG_COUNT,
};
@@ -5775,6 +5832,9 @@ struct ec_params_set_cbi {
#define EC_RESET_FLAG_STAY_IN_RO BIT(19) /* Do not select RW in EFS. This
* enables PD in RO for Chromebox.
*/
+#define EC_RESET_FLAG_EFS BIT(20) /* Jumped to this image by EFS */
+#define EC_RESET_FLAG_AP_IDLE BIT(21) /* Leave alone AP */
+#define EC_RESET_FLAG_INITIAL_PWR BIT(22) /* EC had power, then was reset */
struct ec_response_uptime_info {
/*
@@ -5870,6 +5930,7 @@ struct ec_response_rollback_info {
int32_t rw_rollback_version;
} __ec_align4;
+
/* Issue AP reset */
#define EC_CMD_AP_RESET 0x0125
@@ -5911,6 +5972,7 @@ struct ec_params_locate_chip {
};
} __ec_align2;
+
struct ec_response_locate_chip {
uint8_t bus_type; /* enum ec_bus_type */
uint8_t reserved; /* Aligning the following union to 2 bytes */
@@ -6035,6 +6097,7 @@ enum keyboard_button_type {
KEYBOARD_BUTTON_COUNT
};
+
/*****************************************************************************/
/*
* "Get the Keyboard Config". An EC implementing this command is expected to be
@@ -6113,6 +6176,164 @@ struct ec_response_keybd_config {
} __ec_align1;
+/*
+ * Configure smart discharge
+ */
+#define EC_CMD_SMART_DISCHARGE 0x012B
+
+#define EC_SMART_DISCHARGE_FLAGS_SET BIT(0)
+
+/* Discharge rates when the system is in cutoff or hibernation. */
+struct discharge_rate {
+ uint16_t cutoff; /* Discharge rate (uA) in cutoff */
+ uint16_t hibern; /* Discharge rate (uA) in hibernation */
+};
+
+struct smart_discharge_zone {
+ /* When the capacity (mAh) goes below this, EC cuts off the battery. */
+ int cutoff;
+ /* When the capacity (mAh) is below this, EC stays up. */
+ int stayup;
+};
+
+struct ec_params_smart_discharge {
+ uint8_t flags; /* EC_SMART_DISCHARGE_FLAGS_* */
+ /*
+ * Desired hours for the battery to survive before reaching 0%. Set to
+ * zero to disable smart discharging. That is, the system hibernates as
+ * soon as the G3 idle timer expires.
+ */
+ uint16_t hours_to_zero;
+ /* Set both to zero to keep the current rates. */
+ struct discharge_rate drate;
+};
+
+struct ec_response_smart_discharge {
+ uint16_t hours_to_zero;
+ struct discharge_rate drate;
+ struct smart_discharge_zone dzone;
+};
+
+/*****************************************************************************/
+/* Voltage regulator controls */
+
+/*
+ * Get basic info of voltage regulator for given index.
+ *
+ * Returns the regulator name and supported voltage list in mV.
+ */
+#define EC_CMD_REGULATOR_GET_INFO 0x012C
+
+/* Maximum length of regulator name */
+#define EC_REGULATOR_NAME_MAX_LEN 16
+
+/* Maximum length of the supported voltage list. */
+#define EC_REGULATOR_VOLTAGE_MAX_COUNT 16
+
+struct ec_params_regulator_get_info {
+ uint32_t index;
+} __ec_align4;
+
+struct ec_response_regulator_get_info {
+ char name[EC_REGULATOR_NAME_MAX_LEN];
+ uint16_t num_voltages;
+ uint16_t voltages_mv[EC_REGULATOR_VOLTAGE_MAX_COUNT];
+} __ec_align2;
+
+/*
+ * Configure the regulator as enabled / disabled.
+ */
+#define EC_CMD_REGULATOR_ENABLE 0x012D
+
+struct ec_params_regulator_enable {
+ uint32_t index;
+ uint8_t enable;
+} __ec_align4;
+
+/*
+ * Query if the regulator is enabled.
+ *
+ * Returns 1 if the regulator is enabled, 0 if not.
+ */
+#define EC_CMD_REGULATOR_IS_ENABLED 0x012E
+
+struct ec_params_regulator_is_enabled {
+ uint32_t index;
+} __ec_align4;
+
+struct ec_response_regulator_is_enabled {
+ uint8_t enabled;
+} __ec_align1;
+
+/*
+ * Set voltage for the voltage regulator within the range specified.
+ *
+ * The driver should select the voltage in range closest to min_mv.
+ *
+ * Also note that this might be called before the regulator is enabled, and the
+ * setting should be in effect after the regulator is enabled.
+ */
+#define EC_CMD_REGULATOR_SET_VOLTAGE 0x012F
+
+struct ec_params_regulator_set_voltage {
+ uint32_t index;
+ uint32_t min_mv;
+ uint32_t max_mv;
+} __ec_align4;
+
+/*
+ * Get the currently configured voltage for the voltage regulator.
+ *
+ * Note that this might be called before the regulator is enabled, and this
+ * should return the configured output voltage if the regulator is enabled.
+ */
+#define EC_CMD_REGULATOR_GET_VOLTAGE 0x0130
+
+struct ec_params_regulator_get_voltage {
+ uint32_t index;
+} __ec_align4;
+
+struct ec_response_regulator_get_voltage {
+ uint32_t voltage_mv;
+} __ec_align4;
+
+/*
+ * Gather all discovery information for the given port and partner type.
+ *
+ * Note that if discovery has not yet completed, only the currently completed
+ * responses will be filled in. If the discovery data structures are changed
+ * in the process of the command running, BUSY will be returned.
+ *
+ * VDO field sizes are set to the maximum possible number of VDOs a VDM may
+ * contain, while the number of SVIDs here is selected to fit within the PROTO2
+ * maximum parameter size.
+ */
+#define EC_CMD_TYPEC_DISCOVERY 0x0131
+
+enum typec_partner_type {
+ TYPEC_PARTNER_SOP = 0,
+ TYPEC_PARTNER_SOP_PRIME = 1,
+};
+
+struct ec_params_typec_discovery {
+ uint8_t port;
+ uint8_t partner_type; /* enum typec_partner_type */
+} __ec_align1;
+
+struct svid_mode_info {
+ uint16_t svid;
+ uint16_t mode_count; /* Number of modes partner sent */
+ uint32_t mode_vdo[6]; /* Max VDOs allowed after VDM header is 6 */
+};
+
+struct ec_response_typec_discovery {
+ uint8_t identity_count; /* Number of identity VDOs partner sent */
+ uint8_t svid_count; /* Number of SVIDs partner sent */
+ uint16_t reserved;
+ uint32_t discovery_vdo[6]; /* Max VDOs allowed after VDM header is 6 */
+ struct svid_mode_info svids[0];
+} __ec_align1;
+
/*****************************************************************************/
/* The command range 0x200-0x2FF is reserved for Rotor. */
@@ -6156,6 +6377,8 @@ struct ec_params_fp_passthru {
#define FP_MODE_MATCH BIT(6)
/* Reset and re-initialize the sensor. */
#define FP_MODE_RESET_SENSOR BIT(7)
+/* Sensor maintenance for dead pixels. */
+#define FP_MODE_SENSOR_MAINTENANCE BIT(8)
/* special value: don't change anything just read back current mode */
#define FP_MODE_DONT_CHANGE BIT(31)
@@ -6167,6 +6390,7 @@ struct ec_params_fp_passthru {
FP_MODE_ENROLL_IMAGE | \
FP_MODE_MATCH | \
FP_MODE_RESET_SENSOR | \
+ FP_MODE_SENSOR_MAINTENANCE | \
FP_MODE_DONT_CHANGE)
/* Capture types defined in bits [30..28] */