Sumeet R Pawnikar has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/59261 )
Change subject: ec/google/chromeec: add battery participant support ......................................................................
ec/google/chromeec: add battery participant support
Add battery participant support
BUG=b:206057712 BRANCH=None TEST=Build and test battery info
Change-Id: I2781ceff611877aef37141f195f21f9bdc31eb4c Signed-off-by: Sumeet Pawnikar sumeet.r.pawnikar@intel.com --- M src/ec/google/chromeec/ec.c M src/ec/google/chromeec/ec.h M src/ec/google/chromeec/ec_commands.h 3 files changed, 47 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/61/59261/1
diff --git a/src/ec/google/chromeec/ec.c b/src/ec/google/chromeec/ec.c index 4477d9e..ca42291 100644 --- a/src/ec/google/chromeec/ec.c +++ b/src/ec/google/chromeec/ec.c @@ -1862,3 +1862,25 @@
return 0; } + +int google_chromeec_set_batteryinfo_config(uint32_t uvth) +{ + struct ec_battery_info_v1 params = { + .uvth_value = uvth + }; + + struct chromeec_command cmd = { + .cmd_code = EC_CMD_BATTERY_INFO, + .cmd_version = 1, + .cmd_size_in = sizeof(params), + .cmd_data_in = ¶ms, + .cmd_data_out = NULL, + .cmd_size_out = 0, + .cmd_dev_index = 0, + }; + + if (google_chromeec_command(&cmd)) + return -1; + + return 0; +} diff --git a/src/ec/google/chromeec/ec.h b/src/ec/google/chromeec/ec.h index 56fca2e..6406ff0 100644 --- a/src/ec/google/chromeec/ec.h +++ b/src/ec/google/chromeec/ec.h @@ -415,6 +415,13 @@ */ int google_chromeec_get_powerinfo_config(void);
+/** + * Send battery config details to EC + * @param resp Filled with host command protocol information + * @return 0 on success, -1 on error + */ +int google_chromeec_set_batteryinfo_config(uint32_t uvth); + #if CONFIG(HAVE_ACPI_TABLES) /** * Writes USB Type-C PD related information to the SSDT diff --git a/src/ec/google/chromeec/ec_commands.h b/src/ec/google/chromeec/ec_commands.h index 4637d1c..d1af590 100644 --- a/src/ec/google/chromeec/ec_commands.h +++ b/src/ec/google/chromeec/ec_commands.h @@ -4706,6 +4706,24 @@ } __ec_align2;
/*****************************************************************************/ +/* Battery info. */ + +/* Default low voltage thershold value */ +#define ISL9241_BC12_MIN_VOLTAGE 4096 + +/* + * Get battery info. + * + * Note: v0 of this command is deprecated + */ +#define EC_CMD_BATTERY_INFO 0x00A5 + +struct ec_battery_info_v1 { + uint32_t uvth_value; +} __ec_align1; + + +/*****************************************************************************/ /* Hibernate/Deep Sleep Commands */
/* Set the delay before going into hibernation. */