summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlec Berg <alecaberg@chromium.org>2014-10-31 10:10:55 -0700
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2014-10-31 22:32:54 +0000
commit3a4f718f224d3def71d269f99c9092f4ea23d715 (patch)
treec1f16ae09bcad9ac16f58a0b7951aaf6531ee131
parent86c7e2e90a7fd86b5f5b9e422fdbe968d30670da (diff)
downloadchrome-ec-stabilize-6436.B.tar.gz
samus_pd: add dual-role port flag to power info host commandstabilize-6436.B
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 <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/226820 Reviewed-by: Sameer Nanda <snanda@chromium.org>
-rw-r--r--common/charge_manager.c3
-rw-r--r--include/ec_commands.h3
-rw-r--r--util/ectool.c5
3 files changed, 11 insertions, 0 deletions
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: