summaryrefslogtreecommitdiff
path: root/power
diff options
context:
space:
mode:
authorWai-Hong Tam <waihong@google.com>2020-05-28 17:47:21 -0700
committerCommit Bot <commit-bot@chromium.org>2020-07-22 03:33:40 +0000
commit05d9a30c9d829f09b16a0e707d062c3bed7b2651 (patch)
treebaa0ed0e8dc8585d4c0604af5c33139f06856415 /power
parent989b932ce14b6a15fb4191d33951419b0d01f17e (diff)
downloadchrome-ec-05d9a30c9d829f09b16a0e707d062c3bed7b2651.tar.gz
sc7180: Support staying and leaving S3
In the previous power state machine, S3 was just a transitional state between S0 <-> S5. This change supports staying and leaving S3, by checking the AP_SUSPEND signal. BRANCH=none BUG=b:148149387 TEST=Powered DUT on and off; verified transition to S0 and S5. TEST=Modified the AP_SUSPEND signal; verified transition to S3 and S0. Change-Id: I7978be31d05546c814d2588eaf1f4e1ac47638ce Signed-off-by: Wai-Hong Tam <waihong@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2220833 Reviewed-by: Alexandru M Stan <amstan@chromium.org> Reviewed-by: Matthias Kaehlcke <mka@chromium.org> Commit-Queue: Alexandru M Stan <amstan@chromium.org>
Diffstat (limited to 'power')
-rw-r--r--power/sc7180.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/power/sc7180.c b/power/sc7180.c
index 18f4c40b65..c9fb0242e1 100644
--- a/power/sc7180.c
+++ b/power/sc7180.c
@@ -39,6 +39,7 @@
/* Masks for power signals */
#define IN_POWER_GOOD POWER_SIGNAL_MASK(SC7180_POWER_GOOD)
#define IN_AP_RST_ASSERTED POWER_SIGNAL_MASK(SC7180_AP_RST_ASSERTED)
+#define IN_SUSPEND POWER_SIGNAL_MASK(SC7180_AP_SUSPEND)
/* Long power key press to force shutdown */
@@ -807,8 +808,18 @@ enum power_state power_handle_state(enum power_state state)
CPRINTS("power off %d", value);
return POWER_S3S5;
}
- /* Go to S3S0 directly, as don't know if it is in suspend */
- return POWER_S3S0;
+
+ /*
+ * AP has woken up and it deasserts the suspend signal;
+ * go to S0.
+ *
+ * TODO(b/148149387): Add the hang detection that waits for a
+ * host event before transits the state. It prevents changing
+ * the state for modem paging.
+ */
+ if (!(power_get_signals() & IN_SUSPEND))
+ return POWER_S3S0;
+ break;
case POWER_S3S0:
hook_notify(HOOK_CHIPSET_RESUME);
@@ -816,7 +827,8 @@ enum power_state power_handle_state(enum power_state state)
case POWER_S0:
shutdown_from_s0 = check_for_power_off_event();
- if (shutdown_from_s0)
+ if (shutdown_from_s0 ||
+ power_get_signals() & IN_SUSPEND)
return POWER_S0S3;
break;