summaryrefslogtreecommitdiff
path: root/common/usb_port_power_smart.c
diff options
context:
space:
mode:
authorMarco Chen <marcochen@google.com>2019-05-21 21:16:45 +0800
committerchrome-bot <chrome-bot@chromium.org>2019-05-24 21:14:00 -0700
commit65e137d416970043463d00905f96f7590e847fbe (patch)
tree0704cf8be3192a0ea0ef8efe6618242d59a5ba7b /common/usb_port_power_smart.c
parent583f6db2d7c22c402c260531c1834c9db39d974a (diff)
downloadchrome-ec-65e137d416970043463d00905f96f7590e847fbe.tar.gz
usb_port_power_smart: support a new usb_charge_mode - USB_CHARGE_MODE_DEFAULT.
OS can leverage `ectool usbchargemode` to control the usb_charge_mode in the EC. In this case, we might want to set mode back to the default one defined in the config of board level therefore the new usb_charge_mode is added for this purpose. BUG=b:130767435 BRANCH=octopus TEST=1. make -j buildall 2. ectool usbchargemode 0 0x5 0 3. usb charging mode is set to CDP in Octopus board Change-Id: Ib7397993fc49e6c744dc55b9adace95dd6b8bd3a Signed-off-by: Marco Chen <marcochen@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1621452 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Legacy-Commit-Queue: Commit Bot <commit-bot@chromium.org> Reviewed-by: Diana Z <dzigterman@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
Diffstat (limited to 'common/usb_port_power_smart.c')
-rw-r--r--common/usb_port_power_smart.c13
1 files changed, 3 insertions, 10 deletions
diff --git a/common/usb_port_power_smart.c b/common/usb_port_power_smart.c
index d37b218709..a7ef9cc3bc 100644
--- a/common/usb_port_power_smart.c
+++ b/common/usb_port_power_smart.c
@@ -107,6 +107,9 @@ int usb_charge_set_mode(int port_id, enum usb_charge_mode mode,
if (port_id >= CONFIG_USB_PORT_POWER_SMART_PORT_COUNT)
return EC_ERROR_INVAL;
+ if (mode == USB_CHARGE_MODE_DEFAULT)
+ mode = CONFIG_USB_PORT_POWER_SMART_DEFAULT_MODE;
+
switch (mode) {
case USB_CHARGE_MODE_DISABLED:
usb_charge_set_enabled(port_id, 0);
@@ -177,16 +180,6 @@ static int command_set_mode(int argc, char **argv)
DECLARE_CONSOLE_COMMAND(usbchargemode, command_set_mode,
"[<port> <0 | 1 | 2 | 3> [<0 | 1>]]",
"Set USB charge mode");
-/*
- * Modes:
- * 0 = Disabled.
- * 1 = Standard downstream port.
- * 2 = Charging downstream port, BC 1.2.
- * 3 = Dedicated charging port, BC 1.2.
- * Inhibit Charge:
- * 0 = Enable charging during system suspend
- * 1 = Disable charging during system suspend
- */
/*****************************************************************************/
/* Host commands */