diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/battery.h | 22 | ||||
-rw-r--r-- | include/config.h | 7 | ||||
-rw-r--r-- | include/ec_commands.h | 27 |
3 files changed, 56 insertions, 0 deletions
diff --git a/include/battery.h b/include/battery.h index 61c9dee20f..9743a451e5 100644 --- a/include/battery.h +++ b/include/battery.h @@ -268,4 +268,26 @@ int battery_device_chemistry(char *dest, int size); */ int battery_manufacturer_date(int *year, int *month, int *day); +/** + * Read battery vendor parameter. + * + * Vendor parameter handlers are implemented in a board-specific battery.c + * + * @param param Parameter identifier. + * @param value Location to store retrieved value. + * @return non-zero if error. + */ +int battery_get_vendor_param(uint32_t param, uint32_t *value); + +/** + * Write battery vendor parameter. + * + * Vendor parameter handlers are implemented in a board-specific battery.c + * + * @param param Parameter identifier. + * @param value Value to write to the battery. + * @return non-zero if error. + */ +int battery_set_vendor_param(uint32_t param, uint32_t value); + #endif /* __CROS_EC_BATTERY_H */ diff --git a/include/config.h b/include/config.h index 9b8d5e362c..c49e8d244a 100644 --- a/include/config.h +++ b/include/config.h @@ -126,6 +126,13 @@ */ #undef CONFIG_BATTERY_VENDOR_PARAMS +/* + * The board-specific battery.c implements get and set functions to read and + * write arbirary vendor-specific parameters stored in the battery. + * See include/battery.h for prototypes. + */ +#undef CONFIG_BATTERY_VENDOR_PARAM + /*****************************************************************************/ /* diff --git a/include/ec_commands.h b/include/ec_commands.h index 14efc3eb68..04cc3e5e79 100644 --- a/include/ec_commands.h +++ b/include/ec_commands.h @@ -1879,6 +1879,33 @@ struct ec_params_sb_wr_block { uint16_t data[32]; } __packed; + +/*****************************************************************************/ +/* Battery vendor parameters + * + * Get or set vendor-specific parameters in the battery. Implementations may + * differ between boards or batteries. On a set operation, the response + * contains the actual value set, which may be rounded or clipped from the + * requested value. + */ + +#define EC_CMD_BATTERY_VENDOR_PARAM 0xb4 + +enum ec_battery_vendor_param_mode { + BATTERY_VENDOR_PARAM_MODE_GET = 0, + BATTERY_VENDOR_PARAM_MODE_SET, +}; + +struct ec_params_battery_vendor_param { + uint32_t param; + uint32_t value; + uint8_t mode; +} __packed; + +struct ec_response_battery_vendor_param { + uint32_t value; +} __packed; + /*****************************************************************************/ /* System commands */ |