summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaisuke Nojiri <dnojiri@chromium.org>2022-06-28 12:21:57 -0700
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2022-06-29 23:39:13 +0000
commit1622e5e7ba7b85e3f8eca30b35e5c0dfd6ed1d10 (patch)
treea31fd74aa1b3a43343b3cfaf8984d13dde571687
parentf80da163f2a09ec49e26bcf03ad4f6a9d20b8f42 (diff)
downloadchrome-ec-1622e5e7ba7b85e3f8eca30b35e5c0dfd6ed1d10.tar.gz
Make vbus command print vsys as well
This patch makes vbus console command print vsys as well. > vbus VBUS VSYS P0 19008mV 16416mV P1 19008mV 16416mV P2 19008mV 16416mV BUG=None BRANCH=None TEST=On Agah. See above. Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Change-Id: I3c4e56b945773a552967bde845b996419e58040f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3733419 Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
-rw-r--r--common/charge_manager.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/common/charge_manager.c b/common/charge_manager.c
index c5eb93f704..d74410ebe8 100644
--- a/common/charge_manager.c
+++ b/common/charge_manager.c
@@ -411,21 +411,30 @@ static int command_vbus(int argc, char **argv)
{
/* port = -1 to print all the ports */
int port = -1;
+ int vbus, vsys;
if (argc == 2)
port = atoi(argv[1]);
- for (int i = 0; i < board_get_usb_pd_port_count(); i++) {
- if (port < 0 || i == port)
- ccprintf("VBUS C%d = %d mV\n", i,
- charge_manager_get_vbus_voltage(i));
+ ccprintf(" VBUS VSYS\n");
+ for (int i = 0; i < CHARGE_PORT_COUNT; i++) {
+ if (port < 0 || i == port) {
+ vbus = charge_manager_get_vbus_voltage(i);
+ if (charger_get_vsys_voltage(i, &vsys))
+ vsys = -1;
+ ccprintf(" P%d %6dmV ", i, vbus);
+ if (vsys >= 0)
+ ccprintf("%6dmV\n", vsys);
+ else
+ ccprintf("(unknown)\n");
+ }
}
return EC_SUCCESS;
}
DECLARE_CONSOLE_COMMAND(vbus, command_vbus,
"[port]",
- "VBUS of the given port");
+ "Print VBUS & VSYS of the given port");
#endif
/**