summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMary Ruthven <mruthven@chromium.org>2016-07-27 00:20:46 +0000
committerchrome-bot <chrome-bot@chromium.org>2016-07-28 20:19:50 -0700
commit893e1c0cb779f30839fa368a603b2838e03efdbf (patch)
tree22407457ced5ae69fbec16854411873573b59877
parent4b202194e9e7774f8f333e8a69a11fa0f87b369f (diff)
downloadchrome-ec-893e1c0cb779f30839fa368a603b2838e03efdbf.tar.gz
Reenable "Cr50: Set the default idle action to Sleep"
Cr50 sleep has been fixed so we can now set the default idle action to sleep. This reverts commit 734d834becd3f8e08cdc094882aed447c6275b9f to add back commit 9a644c429af9f299445962892666685233cb0a1b. BUG=chrome-os-partner:54331 Change-Id: I62edffe0823f6d49a50d8e3fbde3d16f075585c8 Signed-off-by: Mary Ruthven <mruthven@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/363582 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
-rw-r--r--chip/g/idle.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/chip/g/idle.c b/chip/g/idle.c
index 68e2e16678..fe712323c5 100644
--- a/chip/g/idle.c
+++ b/chip/g/idle.c
@@ -13,13 +13,17 @@
/* What to do when we're just waiting */
static enum {
- IDLE_WFI, /* default */
+ DONT_KNOW,
+ IDLE_WFI,
IDLE_SLEEP,
IDLE_DEEP_SLEEP,
NUM_CHOICES
} idle_action;
+#define IDLE_DEFAULT IDLE_SLEEP
+
static const char const *idle_name[] = {
+ "invalid",
"wfi",
"sleep",
"deep sleep",
@@ -32,7 +36,7 @@ static int command_idle(int argc, char **argv)
if (argc > 1) {
c = tolower(argv[1][0]);
- for (i = 0; i < ARRAY_SIZE(idle_name); i++)
+ for (i = 1; i < ARRAY_SIZE(idle_name); i++)
if (idle_name[i][0] == c) {
idle_action = i;
break;
@@ -141,10 +145,17 @@ void __idle(void)
{
int sleep_ok, sleep_delay_passed;
- /* Preserved across soft reboots, but not hard */
+ /*
+ * This register is preserved across soft reboots, but not hard. It
+ * defaults to zero, which is how we can tell whether this is the
+ * preserved value or not. We only need to remember it because we might
+ * change it with the console command.
+ */
idle_action = GREG32(PMU, PWRDN_SCRATCH17);
- if (idle_action >= NUM_CHOICES)
- idle_action = IDLE_WFI;
+ if (idle_action == DONT_KNOW || idle_action >= NUM_CHOICES) {
+ idle_action = IDLE_DEFAULT;
+ GREG32(PMU, PWRDN_SCRATCH17) = idle_action;
+ }
while (1) {