From 0086f8a7802fa9faddc2fda9c348fa88a47c291e Mon Sep 17 00:00:00 2001 From: Divya Jyothi Date: Thu, 9 Apr 2015 13:37:42 -0700 Subject: braswell: Support added for suspend/resume and shutdown The current power sequencing would shutdown the system when suspend command or reboot was initiated from the kernal. Proper transitions from S0-S3 and S3-S0 are handled. BUG=None BRANCH=None TEST=Tested on Braswell reference design. Issued commands from kernel:For shutdown - "shutdown -P now" and suspend - "powerd_dbus_suspend" Change-Id: I7cc734f29c0dca89f7d9564f175895467b405df0 Signed-off-by: Divya Jyothi Reviewed-on: https://chromium-review.googlesource.com/265091 Reviewed-by: Shawn N Commit-Queue: Eric Caruso --- power/braswell.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'power') diff --git a/power/braswell.c b/power/braswell.c index 818c610f44..79b33b0d39 100644 --- a/power/braswell.c +++ b/power/braswell.c @@ -49,8 +49,7 @@ /* All PM_SLP signals from PCH deasserted */ #define IN_ALL_PM_SLP_DEASSERTED (IN_SLP_S3_DEASSERTED | IN_SLP_S4_DEASSERTED) /* All inputs in the right state for S0 */ -#define IN_ALL_S0 (IN_PGOOD_ALWAYS_ON | IN_PGOOD_ALL_NONCORE | \ - IN_PGOOD_ALL_CORE | IN_ALL_PM_SLP_DEASSERTED) +#define IN_ALL_S0 (IN_PGOOD_S0 | IN_ALL_PM_SLP_DEASSERTED) static int throttle_cpu; /* Throttle CPU? */ static int pause_in_s5 = 1; /* Pause in S5 when shutting down? */ @@ -185,11 +184,11 @@ enum power_state power_handle_state(enum power_state state) /*wireless_set_state(WIRELESS_ON);*/ - if (power_wait_signals(IN_PGOOD_S0)) { + if (!power_has_signals(IN_PGOOD_S3)) { chipset_force_shutdown(); /*wireless_set_state(WIRELESS_OFF);*/ - return POWER_S3; + return POWER_S3S5; } /* Call hooks now that rails are up */ @@ -222,9 +221,8 @@ enum power_state power_handle_state(enum power_state state) CPRINTS("power wait for PLTRST# to deassert"); while (lpc_get_pltrst_asserted()) { usleep(MSEC); -#ifndef STRAGO_PO - i++; -#endif + + i++; if (i >= 50) { CPRINTS("power timeout on PLTRST#"); chipset_force_shutdown(); @@ -239,12 +237,15 @@ enum power_state power_handle_state(enum power_state state) case POWER_S0: - if (!power_has_signals(IN_PGOOD_S0)) { - /* Required rail went away - Cold Reset? */ + + if (!power_has_signals(IN_PGOOD_ALWAYS_ON)) { chipset_force_shutdown(); return POWER_S0S3; - } else if (gpio_get_level(GPIO_PCH_SLP_S3_L) == 0) { + } + + if (!power_has_signals(IN_ALL_S0)) { /* Power down to next state */ + gpio_set_level(GPIO_PCH_SYS_PWROK, 0); return POWER_S0S3; } -- cgit v1.2.1