summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorShawn Nematbakhsh <shawnn@chromium.org>2015-01-02 12:41:34 -0800
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2015-01-07 17:48:09 +0000
commit35ea0a968caacc73e6ece2bd68db465cc21f07c2 (patch)
treeeeb27d9e81b9df879b3c15f4a0b3a78ad9d63131 /common
parentc0933f00b15d63a0a50e4faeed43fb3a60d48390 (diff)
downloadchrome-ec-35ea0a968caacc73e6ece2bd68db465cc21f07c2.tar.gz
charge_manager: Bug fixes for power_info host commands
- Correctly identify certain source ports (ex. c-plug to empty a-receptacle) - Correct ectool power unit print (mV * mA != mW). BUG=chrome-os-partner:33248 TEST=Manual on Samus. Connect c-plug to empty a-receptacle, run "ectool --name usbpdpower", verify that port power role is identified as source. Also, verify that 5000 mV @ 500mA port correctly prints 2500mW total power. BRANCH=Samus Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Change-Id: Icf0850afc570a1056578df9f1a647079a00229b3 Reviewed-on: https://chromium-review.googlesource.com/238235 Reviewed-by: Alec Berg <alecaberg@chromium.org> Commit-Queue: Alec Berg <alecaberg@chromium.org>
Diffstat (limited to 'common')
-rw-r--r--common/charge_manager.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/common/charge_manager.c b/common/charge_manager.c
index 4b400f137c..1622997f02 100644
--- a/common/charge_manager.c
+++ b/common/charge_manager.c
@@ -441,10 +441,10 @@ static int hc_pd_power_info(struct host_cmd_handler_args *args)
/* Fill in power role */
if (charge_port == port)
r->role = USB_PD_PORT_POWER_SINK;
- else if (sup != CHARGE_SUPPLIER_NONE)
- r->role = USB_PD_PORT_POWER_SINK_NOT_CHARGING;
else if (pd_is_connected(port) && pd_get_role(port) == PD_ROLE_SOURCE)
r->role = USB_PD_PORT_POWER_SOURCE;
+ else if (sup != CHARGE_SUPPLIER_NONE)
+ r->role = USB_PD_PORT_POWER_SINK_NOT_CHARGING;
else
r->role = USB_PD_PORT_POWER_DISCONNECTED;