Sumeet R Pawnikar has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/59189 )
Change subject: ec/google/chromeec: Add powerinfo support ......................................................................
ec/google/chromeec: Add powerinfo support
Add powerinfo support to get the system power source details.
BUG=b:205928013 BUG=None TEST=Build and test powerinfo parameters on byra
Change-Id: I75b109592b327df11d1101bcf32a364c2ae7feac 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, 29 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/89/59189/1
diff --git a/src/ec/google/chromeec/ec.c b/src/ec/google/chromeec/ec.c index 642c313..4477d9e 100644 --- a/src/ec/google/chromeec/ec.c +++ b/src/ec/google/chromeec/ec.c @@ -1844,3 +1844,21 @@ *voltage_mv = resp.voltage_mv; return 0; } + +int google_chromeec_get_powerinfo_config(void) +{ + struct ec_response_power_info_v1 resp = {}; + struct chromeec_command cmd = { + .cmd_code = EC_CMD_POWER_INFO, + .cmd_version = 1, + .cmd_data_out = &resp, + .cmd_size_in = 0, + .cmd_size_out = sizeof(resp), + .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 131a460..56fca2e 100644 --- a/src/ec/google/chromeec/ec.h +++ b/src/ec/google/chromeec/ec.h @@ -408,6 +408,13 @@ */ int google_chromeec_regulator_get_voltage(uint32_t index, uint32_t *voltage_mv);
+/** + * Get powerinfo config details from EC + * @param resp If successful, this is filled with EC filled parameters + * @return 0 on success, -1 on error + */ +int google_chromeec_get_powerinfo_config(void); + #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 bbe34be..4637d1c 100644 --- a/src/ec/google/chromeec/ec_commands.h +++ b/src/ec/google/chromeec/ec_commands.h @@ -4451,6 +4451,8 @@ struct ec_response_power_info_v1 { /* enum system_power_source */ uint8_t system_power_source; + /* Power Delivery state change sequence number */ + uint8_t pd_sequence; /* Battery state-of-charge, 0-100, 0 if not present */ uint8_t battery_soc; /* AC Adapter 100% rating, Watts */ @@ -4459,6 +4461,8 @@ uint8_t ac_adapter_10ms; /* Battery 1C rating, derated */ uint8_t battery_1cd; + /* Rest of Platform worst, Watts */ + uint8_t rop_worst; /* Rest of Platform average, Watts */ uint8_t rop_avg; /* Rest of Platform peak, Watts */