From 3a4f718f224d3def71d269f99c9092f4ea23d715 Mon Sep 17 00:00:00 2001 From: Alec Berg Date: Fri, 31 Oct 2014 10:10:55 -0700 Subject: samus_pd: add dual-role port flag to power info host command Add flag for whether or not device plugged into a given port is a dual-role PD device. For now, the dual-role flag is always 0, but need to add the flag to the host command now for compatibility in the future. BUG=chrome-os-partner:32650 BRANCH=samus TEST=load onto samus, run ectool --name=cros_pd usbpdpower and verify that for anything plugged in it says "dedicated charger" Change-Id: I2d3c8c149802492f27a87a47aaa68fbf505ee7a9 Signed-off-by: Alec Berg Reviewed-on: https://chromium-review.googlesource.com/226820 Reviewed-by: Sameer Nanda --- common/charge_manager.c | 3 +++ include/ec_commands.h | 3 +++ util/ectool.c | 5 +++++ 3 files changed, 11 insertions(+) diff --git a/common/charge_manager.c b/common/charge_manager.c index 01552a7144..3bea74747f 100644 --- a/common/charge_manager.c +++ b/common/charge_manager.c @@ -201,6 +201,9 @@ static int hc_pd_power_info(struct host_cmd_handler_args *args) else r->role = USB_PD_PORT_POWER_DISCONNECTED; + /* TODO: fill in appropriate dual-role status */ + r->dualrole = 0; + if (sup == CHARGE_SUPPLIER_NONE) { r->type = USB_CHG_TYPE_NONE; r->voltage_max = 0; diff --git a/include/ec_commands.h b/include/ec_commands.h index df392d7d62..2266f07971 100644 --- a/include/ec_commands.h +++ b/include/ec_commands.h @@ -2778,9 +2778,12 @@ enum usb_power_roles { struct ec_response_usb_pd_power_info { uint8_t role; uint8_t type; + uint8_t dualrole; + uint8_t reserved1; uint16_t voltage_max; uint16_t voltage_now; uint16_t current_max; + uint16_t reserved2; uint32_t max_power; } __packed; diff --git a/util/ectool.c b/util/ectool.c index e9f0195077..062ffafedb 100644 --- a/util/ectool.c +++ b/util/ectool.c @@ -2921,6 +2921,11 @@ int cmd_usb_pd_power(int argc, char *argv[]) printf("Unknown\n"); } + if (r->role != USB_PD_PORT_POWER_DISCONNECTED) { + printf(" %s\n", r->dualrole ? + "Dual-role device" : "Dedicated charger"); + } + printf(" Charger type: "); switch (r->type) { case USB_CHG_TYPE_PD: -- cgit v1.2.1