From 9670696203029efa87b0871073e149b7ba8619c2 Mon Sep 17 00:00:00 2001 From: Zhuohao Lee Date: Sat, 19 Jan 2019 17:03:10 +0800 Subject: 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 Reviewed-on: https://chromium-review.googlesource.com/1424040 Reviewed-by: Jett Rink --- include/usb_charge.h | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'include/usb_charge.h') 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) -- cgit v1.2.1