mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-23 21:42:20 +07:00
mfd: cros_ec: Add Smart Battery Firmware update API
Add API to update battery firmware. Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Acked-by: Enric Balletbo i Serra <enric.balletbo@collabora.com> Acked-by: Benson Leung <bleung@chromium.org> Reviewed-by: Fabien Lahoudere <fabien.lahoudere@collabora.com> Signed-off-by: Lee Jones <lee.jones@linaro.org>
This commit is contained in:
parent
b92be99f37
commit
77c48c76ad
@ -4243,6 +4243,79 @@ struct ec_response_battery_vendor_param {
|
||||
uint32_t value;
|
||||
} __ec_align4;
|
||||
|
||||
/*****************************************************************************/
|
||||
/*
|
||||
* Smart Battery Firmware Update Commands
|
||||
*/
|
||||
#define EC_CMD_SB_FW_UPDATE 0x00B5
|
||||
|
||||
enum ec_sb_fw_update_subcmd {
|
||||
EC_SB_FW_UPDATE_PREPARE = 0x0,
|
||||
EC_SB_FW_UPDATE_INFO = 0x1, /*query sb info */
|
||||
EC_SB_FW_UPDATE_BEGIN = 0x2, /*check if protected */
|
||||
EC_SB_FW_UPDATE_WRITE = 0x3, /*check if protected */
|
||||
EC_SB_FW_UPDATE_END = 0x4,
|
||||
EC_SB_FW_UPDATE_STATUS = 0x5,
|
||||
EC_SB_FW_UPDATE_PROTECT = 0x6,
|
||||
EC_SB_FW_UPDATE_MAX = 0x7,
|
||||
};
|
||||
|
||||
#define SB_FW_UPDATE_CMD_WRITE_BLOCK_SIZE 32
|
||||
#define SB_FW_UPDATE_CMD_STATUS_SIZE 2
|
||||
#define SB_FW_UPDATE_CMD_INFO_SIZE 8
|
||||
|
||||
struct ec_sb_fw_update_header {
|
||||
uint16_t subcmd; /* enum ec_sb_fw_update_subcmd */
|
||||
uint16_t fw_id; /* firmware id */
|
||||
} __ec_align4;
|
||||
|
||||
struct ec_params_sb_fw_update {
|
||||
struct ec_sb_fw_update_header hdr;
|
||||
union {
|
||||
/* EC_SB_FW_UPDATE_PREPARE = 0x0 */
|
||||
/* EC_SB_FW_UPDATE_INFO = 0x1 */
|
||||
/* EC_SB_FW_UPDATE_BEGIN = 0x2 */
|
||||
/* EC_SB_FW_UPDATE_END = 0x4 */
|
||||
/* EC_SB_FW_UPDATE_STATUS = 0x5 */
|
||||
/* EC_SB_FW_UPDATE_PROTECT = 0x6 */
|
||||
/* Those have no args */
|
||||
|
||||
/* EC_SB_FW_UPDATE_WRITE = 0x3 */
|
||||
struct __ec_align4 {
|
||||
uint8_t data[SB_FW_UPDATE_CMD_WRITE_BLOCK_SIZE];
|
||||
} write;
|
||||
};
|
||||
} __ec_align4;
|
||||
|
||||
struct ec_response_sb_fw_update {
|
||||
union {
|
||||
/* EC_SB_FW_UPDATE_INFO = 0x1 */
|
||||
struct __ec_align1 {
|
||||
uint8_t data[SB_FW_UPDATE_CMD_INFO_SIZE];
|
||||
} info;
|
||||
|
||||
/* EC_SB_FW_UPDATE_STATUS = 0x5 */
|
||||
struct __ec_align1 {
|
||||
uint8_t data[SB_FW_UPDATE_CMD_STATUS_SIZE];
|
||||
} status;
|
||||
};
|
||||
} __ec_align1;
|
||||
|
||||
/*
|
||||
* Entering Verified Boot Mode Command
|
||||
* Default mode is VBOOT_MODE_NORMAL if EC did not receive this command.
|
||||
* Valid Modes are: normal, developer, and recovery.
|
||||
*/
|
||||
#define EC_CMD_ENTERING_MODE 0x00B6
|
||||
|
||||
struct ec_params_entering_mode {
|
||||
int vboot_mode;
|
||||
} __ec_align4;
|
||||
|
||||
#define VBOOT_MODE_NORMAL 0
|
||||
#define VBOOT_MODE_DEVELOPER 1
|
||||
#define VBOOT_MODE_RECOVERY 2
|
||||
|
||||
/*****************************************************************************/
|
||||
/*
|
||||
* HDMI CEC commands
|
||||
|
Loading…
Reference in New Issue
Block a user