Lines Matching +full:wakeup +full:- +full:method

1 // SPDX-License-Identifier: GPL-2.0-only
3 * kernel/power/suspend.c - Suspend to RAM and standby functionality.
65 * pm_suspend_default_s2idle - Check if suspend-to-idle is the default suspend.
67 * Return 'true' if suspend-to-idle has been selected as the default system
68 * suspend method.
128 pm_pr_dbg("suspend-to-idle\n"); in s2idle_loop()
131 * Suspend-to-idle equals: in s2idle_loop()
140 if (s2idle_ops && s2idle_ops->wake) { in s2idle_loop()
141 if (s2idle_ops->wake()) in s2idle_loop()
147 if (s2idle_ops && s2idle_ops->check) in s2idle_loop()
148 s2idle_ops->check(); in s2idle_loop()
153 pm_pr_dbg("resume from suspend-to-idle\n"); in s2idle_loop()
172 * The PM_SUSPEND_STANDBY and PM_SUSPEND_MEM states require low-level in valid_state()
173 * support and need to be valid to the low-level implementation. in valid_state()
175 * No ->valid() or ->enter() callback implies that none are valid. in valid_state()
177 return suspend_ops && suspend_ops->valid && suspend_ops->valid(state) && in valid_state()
178 suspend_ops->enter; in valid_state()
187 * Suspend-to-idle should be supported even without any suspend_ops, in pm_states_init()
210 * suspend_set_ops - Set the global suspend method table.
238 * suspend_valid_only_mem - Generic memory-only valid callback.
259 return state != PM_SUSPEND_TO_IDLE && suspend_ops->prepare ? in platform_suspend_prepare()
260 suspend_ops->prepare() : 0; in platform_suspend_prepare()
265 return state == PM_SUSPEND_TO_IDLE && s2idle_ops && s2idle_ops->prepare ? in platform_suspend_prepare_late()
266 s2idle_ops->prepare() : 0; in platform_suspend_prepare_late()
272 return s2idle_ops && s2idle_ops->prepare_late ? in platform_suspend_prepare_noirq()
273 s2idle_ops->prepare_late() : 0; in platform_suspend_prepare_noirq()
275 return suspend_ops->prepare_late ? suspend_ops->prepare_late() : 0; in platform_suspend_prepare_noirq()
281 if (s2idle_ops && s2idle_ops->restore_early) in platform_resume_noirq()
282 s2idle_ops->restore_early(); in platform_resume_noirq()
283 } else if (suspend_ops->wake) { in platform_resume_noirq()
284 suspend_ops->wake(); in platform_resume_noirq()
290 if (state == PM_SUSPEND_TO_IDLE && s2idle_ops && s2idle_ops->restore) in platform_resume_early()
291 s2idle_ops->restore(); in platform_resume_early()
296 if (state != PM_SUSPEND_TO_IDLE && suspend_ops->finish) in platform_resume_finish()
297 suspend_ops->finish(); in platform_resume_finish()
302 if (state == PM_SUSPEND_TO_IDLE && s2idle_ops && s2idle_ops->begin) in platform_suspend_begin()
303 return s2idle_ops->begin(); in platform_suspend_begin()
304 else if (suspend_ops && suspend_ops->begin) in platform_suspend_begin()
305 return suspend_ops->begin(state); in platform_suspend_begin()
312 if (state == PM_SUSPEND_TO_IDLE && s2idle_ops && s2idle_ops->end) in platform_resume_end()
313 s2idle_ops->end(); in platform_resume_end()
314 else if (suspend_ops && suspend_ops->end) in platform_resume_end()
315 suspend_ops->end(); in platform_resume_end()
320 if (state != PM_SUSPEND_TO_IDLE && suspend_ops->recover) in platform_recover()
321 suspend_ops->recover(); in platform_recover()
326 return state != PM_SUSPEND_TO_IDLE && suspend_ops->suspend_again ? in platform_suspend_again()
327 suspend_ops->suspend_again() : false; in platform_suspend_again()
351 * suspend_prepare - Prepare for entering system sleep state.
363 return -EPERM; in suspend_prepare()
397 * suspend_enter - Make the system enter the given sleep state.
399 * @wakeup: Returns information that the sleep state should not be re-entered.
403 static int suspend_enter(suspend_state_t state, bool *wakeup) in suspend_enter() argument
448 *wakeup = pm_wakeup_pending(); in suspend_enter()
449 if (!(suspend_test(TEST_CORE) || *wakeup)) { in suspend_enter()
452 error = suspend_ops->enter(state); in suspend_enter()
455 } else if (*wakeup) { in suspend_enter()
456 error = -EBUSY; in suspend_enter()
485 * suspend_devices_and_enter - Suspend devices and enter system sleep state.
491 bool wakeup = false; in suspend_devices_and_enter() local
494 return -ENOSYS; in suspend_devices_and_enter()
517 error = suspend_enter(state, &wakeup); in suspend_devices_and_enter()
518 } while (!error && !wakeup && platform_suspend_again(state)); in suspend_devices_and_enter()
539 * suspend_finish - Clean up before finishing the suspend sequence.
552 * enter_state - Do common work needed to enter system sleep state.
557 * system enter the given sleep state and clean up after wakeup.
568 return -EAGAIN; in enter_state()
572 return -EINVAL; in enter_state()
575 return -EBUSY; in enter_state()
603 pm_pr_dbg("Finishing wakeup.\n"); in enter_state()
611 * pm_suspend - Externally visible function for suspending the system.
622 return -EINVAL; in pm_suspend()