void _sys_soc_resume(void) { /* * This notification is called from the ISR of the event * that caused exit from kernel idling after PM operations. * * Some CPU low power states require enabling of interrupts * atomically when entering those states. The wake up from * such a state first executes code in the ISR of the interrupt * that caused the wake. This hook will be called from the ISR. * For such CPU LPS states, do post operations and restores here. * The kernel scheduler will get control after the ISR finishes * and it may schedule another thread. * * Call _sys_soc_pm_idle_exit_notification_disable() if this * notification is not required. */ if (!post_ops_done) { if (pm_state == SYS_POWER_STATE_CPU_LPS) { low_power_state_exit(); } post_ops_done = 1; _sys_soc_power_state_post_ops(pm_state); } }
int _sys_soc_suspend(s32_t ticks) { int ret = SYS_PM_NOT_HANDLED; post_ops_done = 0; if ((ticks != K_FOREVER) && (ticks < MIN_TIME_TO_SUSPEND)) { printk("Not enough time for PM operations (" TIME_UNIT_STRING ": %d).\n", ticks); return SYS_PM_NOT_HANDLED; } pm_state = check_pm_policy(ticks); switch (pm_state) { case SYS_POWER_STATE_CPU_LPS: /* Do CPU LPS operations */ ret = low_power_state_entry(ticks); break; case SYS_POWER_STATE_DEEP_SLEEP: /* Do deep sleep operations */ ret = deep_sleep_entry(ticks); break; default: /* No PM operations */ printk("\nNo PM operations done\n"); ret = SYS_PM_NOT_HANDLED; break; } if (ret != SYS_PM_NOT_HANDLED) { /* * Do any arch or soc specific post operations specific to the * power state. * * If this enables interrupts, then it should be done * right before function return. * * Some CPU power states would require interrupts to be * enabled at the time of entering the low power state. * For such states the post operations need to be done * at _sys_soc_resume. To avoid doing it twice, check a * flag. */ if (!post_ops_done) { if (pm_state == SYS_POWER_STATE_CPU_LPS) { low_power_state_exit(); } post_ops_done = 1; _sys_soc_power_state_post_ops(pm_state); } } return ret; }
void _sys_soc_resume(void) { switch (pm_state) { case 1: low_power_state_exit(); break; case 2: device_suspend_only_exit(); break; default: break; } pm_state = 0; }