mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2025-12-30 10:31:02 +00:00
Cr50: Preserve the idle action across soft reboots
This preserves the selected idle action (wfi, sleep, deep sleep) across soft reboots, which includes deep sleep. Hard reboots will restore the default which is to not sleep at all. BUG=chrome-os-partner:49955, chrome-os-partner:50721 BRANCH=none TEST=make buildall; test on Cr50 Use the "idle d" console command to put the Cr50 into deep sleep when idle (refer to previous commit messages for the setup required). Wake it up, then let it sleep again. It should go back to the deep sleep state. Change-Id: Iaad82b725d2b32a19205fa403dbaab9a31c35630 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/336834 Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
This commit is contained in:
committed by
chrome-bot
parent
bf24d5b264
commit
79e45936fa
@@ -63,6 +63,8 @@ static void prepare_to_deep_sleep(void)
|
||||
* resume.
|
||||
*/
|
||||
GREG32(PMU, PWRDN_SCRATCH18) = GR_USB_DCFG;
|
||||
/* And the idle action */
|
||||
GREG32(PMU, PWRDN_SCRATCH17) = idle_action;
|
||||
|
||||
/* Latch the pinmux values */
|
||||
GREG32(PINMUX, HOLD) = 1;
|
||||
@@ -126,11 +128,12 @@ void __idle(void)
|
||||
{
|
||||
int sleep_ok, sleep_delay_passed, prev_ok = 0;
|
||||
|
||||
while (1) {
|
||||
/* Preserved across soft reboots, but not hard */
|
||||
idle_action = GREG32(PMU, PWRDN_SCRATCH17);
|
||||
if (idle_action >= NUM_CHOICES)
|
||||
idle_action = IDLE_WFI;
|
||||
|
||||
/* Don't even bother unless we've enabled it */
|
||||
if (idle_action == IDLE_WFI)
|
||||
goto wfi;
|
||||
while (1) {
|
||||
|
||||
/* Anyone still busy? */
|
||||
sleep_ok = DEEP_SLEEP_ALLOWED;
|
||||
@@ -159,7 +162,6 @@ void __idle(void)
|
||||
prepare_to_deep_sleep();
|
||||
/* Normal sleep is not yet implemented */
|
||||
|
||||
wfi:
|
||||
/* Wait for the next irq event. This stops the CPU clock and
|
||||
* may trigger sleep or deep sleep if enabled. */
|
||||
asm("wfi");
|
||||
|
||||
Reference in New Issue
Block a user