From 75857e80d0ef0426fd80fd7cb526ff7b895ba9a0 Mon Sep 17 00:00:00 2001 From: Randall Spangler Date: Wed, 22 Jan 2014 15:36:08 -0800 Subject: rambi: Leave 5V rail on in S3 if USB ports are powered Previously, the 5V rail was disabled unconditionally in the S0->S3 transition. Now, the rail is left powered if one or both of the USB ports are powered. BUG=chrome-os-partner:25178 BRANCH=rambi TEST=Modify the OS to leave USB ports powered in S3. Then suspend. On the EC console, 'gpioget pp5000_en' should be 1. Change-Id: I3c73f3fe228e940317c0da7330f117c7ab0a6d0c Signed-off-by: Randall Spangler Reviewed-on: https://chromium-review.googlesource.com/183548 Reviewed-by: Duncan Laurie Reviewed-by: Aaron Durbin --- common/usb_port_power_smart.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'common/usb_port_power_smart.c') diff --git a/common/usb_port_power_smart.c b/common/usb_port_power_smart.c index 9a47d78326..89f72c7339 100644 --- a/common/usb_port_power_smart.c +++ b/common/usb_port_power_smart.c @@ -85,6 +85,19 @@ static void usb_charge_all_ports_off(void) usb_charge_set_mode(1, USB_CHARGE_MODE_DISABLED); } +int usb_charge_ports_enabled(void) +{ + int mask = 0; + + if (gpio_get_level(GPIO_USB1_ENABLE)) + mask |= (1 << 0); + + if (gpio_get_level(GPIO_USB2_ENABLE)) + mask |= (1 << 1); + + return mask; +} + int usb_charge_set_mode(int port_id, enum usb_charge_mode mode) { CPRINTF("[%T USB charge p%d m%d]\n", port_id, mode); -- cgit v1.2.1