diff options
author | Shawn Nematbakhsh <shawnn@chromium.org> | 2016-06-14 15:05:35 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2016-07-21 00:47:55 -0700 |
commit | f2fa9c94772f245bf7b91779a4765103d07df156 (patch) | |
tree | 5778a4232d776238249eab9fdf594a7c3c8adcea /power | |
parent | 72b8d6f199e32a88a89f343b7ec2cf17243b4f6f (diff) | |
download | chrome-ec-f2fa9c94772f245bf7b91779a4765103d07df156.tar.gz |
rk3399: Transition to / from S3 based upon GPIO_AP_EC_S3_S0_L
BRANCH=None
TEST=Set GPIO_AP_EC_S3_S0_L high from sysfs, verify EC power state
machine enters S3.
BUG=chrome-os-partner:54328
CQ-DEPEND=CL:*270114
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Change-Id: I0fbd49775c245f3d747ddb46801ed89085829e12
Reviewed-on: https://chromium-review.googlesource.com/352651
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Douglas Anderson <dianders@chromium.org>
Diffstat (limited to 'power')
-rw-r--r-- | power/rk3399.c | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/power/rk3399.c b/power/rk3399.c index 8efebaf69a..dd76f5ef74 100644 --- a/power/rk3399.c +++ b/power/rk3399.c @@ -98,6 +98,7 @@ DECLARE_DEFERRED(force_shutdown); enum power_state power_handle_state(enum power_state state) { + static int sys_reset_needed; int tries = 0; switch (state) { @@ -109,16 +110,20 @@ enum power_state power_handle_state(enum power_state state) return POWER_S5G3; else return POWER_S5S3; + break; case POWER_S3: if (!power_has_signals(IN_PGOOD_S3) || forcing_shutdown) return POWER_S3S5; - else if (power_has_signals(IN_SUSPEND_DEASSERTED)) + else if (!gpio_get_level(GPIO_AP_EC_S3_S0_L)) return POWER_S3S0; + break; case POWER_S0: if (!power_has_signals(IN_PGOOD_S0) || forcing_shutdown) return POWER_S0S3; + else if (gpio_get_level(GPIO_AP_EC_S3_S0_L)) + return POWER_S0S3; break; case POWER_G3S5: @@ -179,6 +184,10 @@ enum power_state power_handle_state(enum power_state state) /* Call hooks now that rails are up */ hook_notify(HOOK_CHIPSET_STARTUP); + + /* We came from S5, so be sure to pulse sys_rst later */ + sys_reset_needed = 1; + /* Power up to next state */ return POWER_S3; @@ -192,10 +201,14 @@ enum power_state power_handle_state(enum power_state state) gpio_set_level(GPIO_PP3300_USB_EN_L, 0); msleep(2); - /* Pulse SYS_RST */ - gpio_set_level(GPIO_SYS_RST_L, 0); - msleep(10); - gpio_set_level(GPIO_SYS_RST_L, 1); + if (sys_reset_needed) { + /* Pulse SYS_RST if we came from S5 */ + gpio_set_level(GPIO_SYS_RST_L, 0); + msleep(10); + gpio_set_level(GPIO_SYS_RST_L, 1); + + sys_reset_needed = 0; + } gpio_set_level(GPIO_PP1800_LID_EN_L, 0); gpio_set_level(GPIO_PP1800_SENSOR_EN_L, 0); |