CHROMIUM: mfd: chromeos_ec: update EC<->AP protocol
[cascardo/linux.git] / include / linux / mfd / chromeos_ec_commands.h
index 9dc5566..cd714cc 100644 (file)
@@ -1198,6 +1198,65 @@ struct ec_params_force_idle {
  */
 #define EC_CMD_BATTERY_CUT_OFF 0x99
 
+/*****************************************************************************/
+/* USB port mux control. */
+
+/*
+ * Switch USB mux or return to automatic switching.
+ */
+#define EC_CMD_USB_MUX 0x9a
+
+struct ec_params_usb_mux {
+       uint8_t mux;
+} __packed;
+
+/*****************************************************************************/
+/* LDOs / FETs control. */
+
+enum ec_ldo_state {
+       EC_LDO_STATE_OFF = 0,   /* the LDO / FET is shut down */
+       EC_LDO_STATE_ON = 1,    /* the LDO / FET is ON / providing power */
+};
+
+/*
+ * Switch on/off a LDO.
+ */
+#define EC_CMD_LDO_SET 0x9b
+
+struct ec_params_ldo_set {
+       uint8_t index;
+       uint8_t state;
+} __packed;
+
+/*
+ * Get LDO state.
+ */
+#define EC_CMD_LDO_GET 0x9c
+
+struct ec_params_ldo_get {
+       uint8_t index;
+} __packed;
+
+struct ec_response_ldo_get {
+       uint8_t state;
+} __packed;
+
+/*****************************************************************************/
+/* Power info. */
+
+/*
+ * Get power info.
+ */
+#define EC_CMD_POWER_INFO 0x9d
+
+struct ec_response_power_info {
+       uint32_t usb_dev_type;
+       uint16_t voltage_ac;
+       uint16_t voltage_system;
+       uint16_t current_system;
+       uint16_t usb_current_limit;
+} __packed;
+
 /*****************************************************************************/
 /* Temporary debug commands. TODO: remove this crosbug.com/p/13849 */
 
@@ -1217,6 +1276,41 @@ struct ec_params_current_limit {
        uint32_t limit;
 } __packed;
 
+/*****************************************************************************/
+/* Smart battery pass-through */
+
+/* Get / Set 16-bit smart battery registers */
+#define EC_CMD_SB_READ_WORD   0xb0
+#define EC_CMD_SB_WRITE_WORD  0xb1
+
+/* Get / Set string smart battery parameters
+ * formatted as SMBUS "block".
+ */
+#define EC_CMD_SB_READ_BLOCK  0xb2
+#define EC_CMD_SB_WRITE_BLOCK 0xb3
+
+struct ec_params_sb_rd {
+       uint8_t reg;
+} __packed;
+
+struct ec_response_sb_rd_word {
+       uint16_t value;
+} __packed;
+
+struct ec_params_sb_wr_word {
+       uint8_t reg;
+       uint16_t value;
+} __packed;
+
+struct ec_response_sb_rd_block {
+       uint8_t data[32];
+} __packed;
+
+struct ec_params_sb_wr_block {
+       uint8_t reg;
+       uint16_t data[32];
+} __packed;
+
 /*****************************************************************************/
 /* System commands */