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 --- power/baytrail.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'power') diff --git a/power/baytrail.c b/power/baytrail.c index e938f9298e..8615964705 100644 --- a/power/baytrail.c +++ b/power/baytrail.c @@ -16,6 +16,7 @@ #include "power.h" #include "system.h" #include "timer.h" +#include "usb_charge.h" #include "util.h" #include "wireless.h" @@ -315,13 +316,27 @@ enum power_state power_handle_state(enum power_state state) /* Turn off power rails */ gpio_set_level(GPIO_PP3300_DX_EN, 0); + +#ifdef CONFIG_USB_PORT_POWER_IN_S3 + /* + * Disable the 5V rail if all USB ports are disabled. Else + * leave 5V enabled so the ports will continue to work in S3. + */ + if (!usb_charge_ports_enabled()) + gpio_set_level(GPIO_PP5000_EN, 0); +#else gpio_set_level(GPIO_PP5000_EN, 0); +#endif + return POWER_S3; case POWER_S3S5: /* Call hooks before we remove power rails */ hook_notify(HOOK_CHIPSET_SHUTDOWN); + /* Turn off 5V rail (if it wasn't turned off in S3) */ + gpio_set_level(GPIO_PP5000_EN, 0); + /* Disable wireless */ wireless_enable(0); -- cgit v1.2.1