diff options
author | Tim Wawrzynczak <twawrzynczak@chromium.org> | 2019-09-25 16:05:47 -0600 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2019-10-05 01:24:12 +0000 |
commit | 376d2f802aeae034d523d79317fc48d25c35e25a (patch) | |
tree | 318f8e1833e59677806d4ecc6093a82ad1d29c19 /util | |
parent | 4ed8c9fb0586ed87552fbd5126085d57c4e55760 (diff) | |
download | chrome-ec-376d2f802aeae034d523d79317fc48d25c35e25a.tar.gz |
ec_commands: Obsolete v0 and declare v1 of host command EC_CMD_POWER_INFO
v0 of this command is no longer used (no handler is defined), so it is
removed. The new host command version gives the AP the ability to
dynamically change its power settings based on the battery status,
A/C, USB-PD, and the static configuration of the system and its
battery.
Also modified ectool to support v1 of this command and deprecate
support for v0.
BUG=b:139840435
BRANCH=master
TEST=buildall
Change-Id: I516d838581400314e626fd679ca1c5afd5e34ff6
Signed-off-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1825880
Reviewed-by: Paul Fagerburg <pfagerburg@chromium.org>
Reviewed-by: Furquan Shaikh <furquan@chromium.org>
Diffstat (limited to 'util')
-rw-r--r-- | util/ectool.c | 38 |
1 files changed, 29 insertions, 9 deletions
diff --git a/util/ectool.c b/util/ectool.c index a78c8ba5f6..c7cac69a7c 100644 --- a/util/ectool.c +++ b/util/ectool.c @@ -5801,20 +5801,40 @@ int cmd_panic_info(int argc, char *argv[]) int cmd_power_info(int argc, char *argv[]) { - struct ec_response_power_info r; + struct ec_response_power_info_v1 r; int rv; - rv = ec_command(EC_CMD_POWER_INFO, 0, NULL, 0, &r, sizeof(r)); + rv = ec_command(EC_CMD_POWER_INFO, 1, NULL, 0, &r, sizeof(r)); if (rv < 0) return rv; - printf("AC Voltage: %d mV\n", r.voltage_ac); - printf("System Voltage: %d mV\n", r.voltage_system); - printf("System Current: %d mA\n", r.current_system); - printf("System Power: %d mW\n", - r.voltage_system * r.current_system / 1000); - printf("USB Device Type: 0x%x\n", r.usb_dev_type); - printf("USB Current Limit: %d mA\n", r.usb_current_limit); + printf("Power source:\t"); + switch (r.system_power_source) { + case POWER_SOURCE_UNKNOWN: + printf("Unknown\n"); + break; + case POWER_SOURCE_BATTERY: + printf("Battery\n"); + break; + case POWER_SOURCE_AC: + printf("AC\n"); + break; + case POWER_SOURCE_AC_BATTERY: + printf("AC + battery\n"); + break; + } + + printf("Battery state-of-charge: %d%%\n", r.battery_soc); + printf("Max AC power: %d Watts\n", r.ac_adapter_100pct); + printf("Battery 1Cd rate: %d\n", r.battery_1cd); + printf("RoP Avg: %d Watts\n", r.rop_avg); + printf("RoP Peak: %d Watts\n", r.rop_peak); + printf("Battery DBPT support level: %d\n", + r.intel.batt_dbpt_support_level); + printf("Battery DBPT Max Peak Power: %d Watts\n", + r.intel.batt_dbpt_max_peak_power); + printf("Battery DBPT Sus Peak Power: %d Watts\n", + r.intel.batt_dbpt_sus_peak_power); return 0; } |