diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/charge_state_v2.h | 5 | ||||
-rw-r--r-- | include/ec_commands.h | 39 |
2 files changed, 43 insertions, 1 deletions
diff --git a/include/charge_state_v2.h b/include/charge_state_v2.h index e3a43d8bcf..a649fb9c2e 100644 --- a/include/charge_state_v2.h +++ b/include/charge_state_v2.h @@ -47,6 +47,11 @@ struct charge_state_data { #endif }; +struct sustain_soc { + int8_t lower; + int8_t upper; +}; + /** * Set the output current limit and voltage. This is used to provide power from * the charger chip ("OTG" mode). diff --git a/include/ec_commands.h b/include/ec_commands.h index 12eb453ccb..cf45e682f8 100644 --- a/include/ec_commands.h +++ b/include/ec_commands.h @@ -3889,7 +3889,7 @@ struct ec_params_i2c_write { * discharge the battery. */ #define EC_CMD_CHARGE_CONTROL 0x0096 -#define EC_VER_CHARGE_CONTROL 1 +#define EC_VER_CHARGE_CONTROL 2 enum ec_charge_control_mode { CHARGE_CONTROL_NORMAL = 0, @@ -3897,8 +3897,45 @@ enum ec_charge_control_mode { CHARGE_CONTROL_DISCHARGE, }; +#define EC_CHARGE_MODE_TEXT { \ + [CHARGE_CONTROL_NORMAL] = "NORMAL", \ + [CHARGE_CONTROL_IDLE] = "IDLE", \ + [CHARGE_CONTROL_DISCHARGE] = "DISCHARGE", \ + } + +enum ec_charge_control_cmd { + EC_CHARGE_CONTROL_CMD_SET = 0, + EC_CHARGE_CONTROL_CMD_GET, +}; + struct ec_params_charge_control { uint32_t mode; /* enum charge_control_mode */ + + /* Below are the fields added in V2. */ + uint8_t cmd; /* enum ec_charge_control_cmd. */ + uint8_t reserved; + /* + * Lower and upper thresholds for battery sustainer. This struct isn't + * named to avoid tainting foreign projects' name spaces. + * + * If charge mode is explicitly set (e.g. DISCHARGE), battery sustainer + * will be disabled. To disable battery sustainer, set mode=NORMAL, + * lower=-1, upper=-1. + */ + struct { + int8_t lower; /* Display SoC in percentage. */ + int8_t upper; /* Display SoC in percentage. */ + } sustain_soc; +} __ec_align4; + +/* Added in v2 */ +struct ec_response_charge_control { + uint32_t mode; /* enum charge_control_mode */ + struct { /* Battery sustainer thresholds */ + int8_t lower; + int8_t upper; + } sustain_soc; + uint16_t reserved; } __ec_align4; /*****************************************************************************/ |