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; }
int _sys_soc_suspend(int32_t ticks) { int ret = SYS_PM_NOT_HANDLED; pm_state = check_pm_policy(ticks); switch (pm_state) { case 1: start_time = rtc_read(rtc_dev); ret = low_power_state_entry(ticks); break; case 2: start_time = rtc_read(rtc_dev); ret = device_suspend_only_entry(ticks); break; default: /* No PM operations */ ret = SYS_PM_NOT_HANDLED; break; } return ret; }