summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorZhuohao Lee <zhuohao@chromium.org>2019-01-19 17:03:10 +0800
committerchrome-bot <chrome-bot@chromium.org>2019-01-30 01:26:10 -0800
commit9670696203029efa87b0871073e149b7ba8619c2 (patch)
treef43006c56429474192f199415914c72b6a2b9742 /include
parent0a9e45cdb4544c7a9da21e256dc87f8bcbd3f477 (diff)
downloadchrome-ec-9670696203029efa87b0871073e149b7ba8619c2.tar.gz
usb_port_power_smart: turn on/off charging mode during system suspend
This patch adds a feature to allow the userspace program turns on/off the usb type-a charging mode during system suspend. BUG=b:121438672 BRANCH=firmware-rammus-11275 TEST=make -j buildall ectool usbchargemode 0 0x2 0, CDP works in S0 and S0ix ectool usbchargemode 0 0x2 1, CDP works in S0 but not in S0ix Change-Id: Icb8ab1b3f1beb671fbd02f441bf40284ba74e097 Signed-off-by: Zhuohao Lee <zhuohao@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1424040 Reviewed-by: Jett Rink <jettrink@chromium.org>
Diffstat (limited to 'include')
-rw-r--r--include/ec_commands.h3
-rw-r--r--include/usb_charge.h15
2 files changed, 14 insertions, 4 deletions
diff --git a/include/ec_commands.h b/include/ec_commands.h
index 6ad86ed1d5..09b90ea3db 100644
--- a/include/ec_commands.h
+++ b/include/ec_commands.h
@@ -2861,7 +2861,8 @@ struct ec_params_config_power_button {
struct ec_params_usb_charge_set_mode {
uint8_t usb_port_id;
- uint8_t mode;
+ uint8_t mode:7;
+ uint8_t inhibit_charge:1;
} __ec_align1;
/*****************************************************************************/
diff --git a/include/usb_charge.h b/include/usb_charge.h
index e7de9a0b3f..a974f7511e 100644
--- a/include/usb_charge.h
+++ b/include/usb_charge.h
@@ -30,14 +30,23 @@ enum usb_charge_mode {
USB_CHARGE_MODE_COUNT
};
+enum usb_suspend_charge {
+ /* Enable charging in suspend */
+ USB_ALLOW_SUSPEND_CHARGE,
+ /* Disable charging in suspend */
+ USB_DISALLOW_SUSPEND_CHARGE
+};
+
/**
* Set USB charge mode for the port.
*
- * @param usb_port_id Port to set.
- * @param mode New mode for port.
+ * @param usb_port_id Port to set.
+ * @param mode New mode for port.
+ * @param inhibit_charge Inhibit charging during system suspend.
* @return EC_SUCCESS, or non-zero if error.
*/
-int usb_charge_set_mode(int usb_port_id, enum usb_charge_mode mode);
+int usb_charge_set_mode(int usb_port_id, enum usb_charge_mode mode,
+ enum usb_suspend_charge inhibit_charge);
#ifdef HAS_TASK_USB_CHG_P0
#define USB_CHG_EVENT_BC12 TASK_EVENT_CUSTOM(1)