summaryrefslogtreecommitdiff
path: root/power
diff options
context:
space:
mode:
authorShawn Nematbakhsh <shawnn@chromium.org>2016-10-21 13:58:35 -0700
committerchrome-bot <chrome-bot@chromium.org>2016-10-28 21:06:49 -0700
commit690873bc757176e8c1d6ffae43226660a32a08c3 (patch)
treee99753f1592c0685b8adab66d805fcfdf8350722 /power
parentc2d60f53bca9e9c0004722da80730c6028e5f8d0 (diff)
downloadchrome-ec-690873bc757176e8c1d6ffae43226660a32a08c3.tar.gz
power: rk3399: Decrease max. latency for aborted suspend
Make several calls to msleep() rather than one single call. BUG=chrome-os-partner:58474 BRANCH=gru TEST=S/R stress test on kevin. Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Change-Id: Icdc8f221c51519e0f2b95d273aa0523ea3a4eeee Reviewed-on: https://chromium-review.googlesource.com/401930 Reviewed-by: Douglas Anderson <dianders@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/403460 Commit-Ready: Shawn N <shawnn@chromium.org> Tested-by: Shawn N <shawnn@chromium.org>
Diffstat (limited to 'power')
-rw-r--r--power/rk3399.c40
1 files changed, 20 insertions, 20 deletions
diff --git a/power/rk3399.c b/power/rk3399.c
index ab601638d8..7352af8efc 100644
--- a/power/rk3399.c
+++ b/power/rk3399.c
@@ -106,12 +106,20 @@ DECLARE_DEFERRED(force_shutdown);
* be minimized, so check for deassertion at various stages of our suspend
* power sequencing, and immediately transition out of suspend if necessary.
*/
-#define CHECK_ABORTED_SUSPEND() \
- if (!forcing_shutdown && \
- power_get_signals() & IN_SUSPEND_DEASSERTED) { \
- CPRINTS("suspend aborted"); \
- return POWER_S3S0; \
- }
+#define SLEEP_INTERVAL_MS 5
+#define MSLEEP_CHECK_ABORTED_SUSPEND(msec) \
+ do { \
+ int sleep_remain = msec; \
+ do { \
+ msleep(MIN(sleep_remain, SLEEP_INTERVAL_MS)); \
+ sleep_remain -= SLEEP_INTERVAL_MS; \
+ if (!forcing_shutdown && \
+ power_get_signals() & IN_SUSPEND_DEASSERTED) { \
+ CPRINTS("suspend aborted"); \
+ return POWER_S3S0; \
+ } \
+ } while (sleep_remain > 0); \
+ } while (0)
enum power_state power_handle_state(enum power_state state)
{
@@ -276,32 +284,24 @@ enum power_state power_handle_state(enum power_state state)
case POWER_S0S3:
/* Call hooks before we remove power rails */
hook_notify(HOOK_CHIPSET_SUSPEND);
- CHECK_ABORTED_SUSPEND();
-
- msleep(20);
- CHECK_ABORTED_SUSPEND();
+ MSLEEP_CHECK_ABORTED_SUSPEND(20);
gpio_set_level(GPIO_PP1800_SENSOR_EN_L, 1);
gpio_set_level(GPIO_PP1800_SIXAXIS_EN_L, 1);
gpio_set_level(GPIO_PP3300_S0_EN_L, 1);
- msleep(20);
- CHECK_ABORTED_SUSPEND();
+ MSLEEP_CHECK_ABORTED_SUSPEND(20);
gpio_set_level(GPIO_PP1800_S0_EN_L, 1);
- msleep(1);
- CHECK_ABORTED_SUSPEND();
+ MSLEEP_CHECK_ABORTED_SUSPEND(1);
gpio_set_level(GPIO_AP_CORE_EN, 0);
- msleep(20);
- CHECK_ABORTED_SUSPEND();
+ MSLEEP_CHECK_ABORTED_SUSPEND(20);
gpio_set_level(GPIO_PP1800_AP_AVDD_EN_L, 1);
- msleep(1);
- CHECK_ABORTED_SUSPEND();
+ MSLEEP_CHECK_ABORTED_SUSPEND(1);
gpio_set_level(GPIO_PP900_DDRPLL_EN, 0);
- msleep(1);
- CHECK_ABORTED_SUSPEND();
+ MSLEEP_CHECK_ABORTED_SUSPEND(1);
gpio_set_level(GPIO_PPVAR_CLOGIC_EN, 0);