Skip to content

Commit 9aa6fca

Browse files
authored
fwk: disable deep sleep when the system run at S0 state. (#1064)
Follow the power/amd_x86.c disable the deep sleep when the system in S0 and enable the deep sleep when the system enter S3/S0ix. Signed-off-by: Josh-Tsai <josh_tsai@compal.com>
1 parent cb82597 commit 9aa6fca

2 files changed

Lines changed: 52 additions & 0 deletions

File tree

zephyr/program/lotus/azalea/src/power_sequence.c

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -439,6 +439,12 @@ enum power_state power_handle_state(enum power_state state)
439439
/* Call hooks now that rails are up */
440440
hook_notify(HOOK_CHIPSET_RESUME);
441441

442+
/*
443+
* Disable idle task deep sleep. This means that the low
444+
* power idle task will not go into deep sleep while in S0.
445+
*/
446+
disable_sleep(SLEEP_MASK_AP_RUN);
447+
442448
/* set the PD chip system power state "S0" */
443449
cypd_set_power_active();
444450

@@ -503,6 +509,13 @@ enum power_state power_handle_state(enum power_state state)
503509
lpc_s0ix_resume_restore_masks();
504510
/* Call hooks now that rails are up */
505511
hook_notify(HOOK_CHIPSET_RESUME);
512+
513+
/*
514+
* Disable idle task deep sleep. This means that the low
515+
* power idle task will not go into deep sleep while in S0.
516+
*/
517+
disable_sleep(SLEEP_MASK_AP_RUN);
518+
506519
CPRINTS("PH S0ixS0->S0");
507520
return POWER_S0;
508521

@@ -515,6 +528,13 @@ enum power_state power_handle_state(enum power_state state)
515528
lpc_s0ix_suspend_clear_masks();
516529
/* Call hooks before we remove power rails */
517530
hook_notify(HOOK_CHIPSET_SUSPEND);
531+
532+
/*
533+
* Enable idle task deep sleep. Allow the low power idle task
534+
* to go into deep sleep in S3 or lower.
535+
*/
536+
enable_sleep(SLEEP_MASK_AP_RUN);
537+
518538
CPRINTS("PH S0S0ix->S0ix");
519539
return POWER_S0ix;
520540

@@ -533,6 +553,12 @@ enum power_state power_handle_state(enum power_state state)
533553
/* Call hooks before we remove power rails */
534554
hook_notify(HOOK_CHIPSET_SUSPEND);
535555

556+
/*
557+
* Enable idle task deep sleep. Allow the low power idle task
558+
* to go into deep sleep in S3 or lower.
559+
*/
560+
enable_sleep(SLEEP_MASK_AP_RUN);
561+
536562
/* set the PD chip system power state "S3" */
537563
cypd_set_power_active();
538564
return POWER_S3;

zephyr/program/lotus/lotus/src/power_sequence.c

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -544,6 +544,12 @@ enum power_state power_handle_state(enum power_state state)
544544
hook_notify(HOOK_CHIPSET_RESUME);
545545
peripheral_power_resume();
546546

547+
/*
548+
* Disable idle task deep sleep. This means that the low
549+
* power idle task will not go into deep sleep while in S0.
550+
*/
551+
disable_sleep(SLEEP_MASK_AP_RUN);
552+
547553
/* set the PD chip system power state "S0" */
548554
cypd_set_power_active();
549555

@@ -610,6 +616,13 @@ enum power_state power_handle_state(enum power_state state)
610616

611617
lpc_s0ix_resume_restore_masks();
612618
hook_notify(HOOK_CHIPSET_RESUME);
619+
620+
/*
621+
* Disable idle task deep sleep. This means that the low
622+
* power idle task will not go into deep sleep while in S0.
623+
*/
624+
disable_sleep(SLEEP_MASK_AP_RUN);
625+
613626
return POWER_S0;
614627

615628
break;
@@ -619,6 +632,13 @@ enum power_state power_handle_state(enum power_state state)
619632
system_in_s0ix = 1;
620633
lpc_s0ix_suspend_clear_masks();
621634
hook_notify(HOOK_CHIPSET_SUSPEND);
635+
636+
/*
637+
* Enable idle task deep sleep. Allow the low power idle task
638+
* to go into deep sleep in S3 or lower.
639+
*/
640+
enable_sleep(SLEEP_MASK_AP_RUN);
641+
622642
return POWER_S0ix;
623643

624644
break;
@@ -636,6 +656,12 @@ enum power_state power_handle_state(enum power_state state)
636656
hook_notify(HOOK_CHIPSET_SUSPEND);
637657
peripheral_power_suspend();
638658

659+
/*
660+
* Enable idle task deep sleep. Allow the low power idle task
661+
* to go into deep sleep in S3 or lower.
662+
*/
663+
enable_sleep(SLEEP_MASK_AP_RUN);
664+
639665
/* set the PD chip system power state "S3" */
640666
cypd_set_power_active();
641667
return POWER_S3;

0 commit comments

Comments
 (0)