24 #include <linux/list.h>
27 #include <linux/wait.h>
47 #define power_group_name NULL
290 #ifdef CONFIG_PM_SLEEP
291 #define SET_SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn) \
292 .suspend = suspend_fn, \
293 .resume = resume_fn, \
294 .freeze = suspend_fn, \
296 .poweroff = suspend_fn, \
297 .restore = resume_fn,
299 #define SET_SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn)
302 #ifdef CONFIG_PM_RUNTIME
303 #define SET_RUNTIME_PM_OPS(suspend_fn, resume_fn, idle_fn) \
304 .runtime_suspend = suspend_fn, \
305 .runtime_resume = resume_fn, \
306 .runtime_idle = idle_fn,
308 #define SET_RUNTIME_PM_OPS(suspend_fn, resume_fn, idle_fn)
315 #define SIMPLE_DEV_PM_OPS(name, suspend_fn, resume_fn) \
316 const struct dev_pm_ops name = { \
317 SET_SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn) \
333 #define UNIVERSAL_DEV_PM_OPS(name, suspend_fn, resume_fn, idle_fn) \
334 const struct dev_pm_ops name = { \
335 SET_SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn) \
336 SET_RUNTIME_PM_OPS(suspend_fn, resume_fn, idle_fn) \
391 #define PM_EVENT_INVALID (-1)
392 #define PM_EVENT_ON 0x0000
393 #define PM_EVENT_FREEZE 0x0001
394 #define PM_EVENT_SUSPEND 0x0002
395 #define PM_EVENT_HIBERNATE 0x0004
396 #define PM_EVENT_QUIESCE 0x0008
397 #define PM_EVENT_RESUME 0x0010
398 #define PM_EVENT_THAW 0x0020
399 #define PM_EVENT_RESTORE 0x0040
400 #define PM_EVENT_RECOVER 0x0080
401 #define PM_EVENT_USER 0x0100
402 #define PM_EVENT_REMOTE 0x0200
403 #define PM_EVENT_AUTO 0x0400
405 #define PM_EVENT_SLEEP (PM_EVENT_SUSPEND | PM_EVENT_HIBERNATE)
406 #define PM_EVENT_USER_SUSPEND (PM_EVENT_USER | PM_EVENT_SUSPEND)
407 #define PM_EVENT_USER_RESUME (PM_EVENT_USER | PM_EVENT_RESUME)
408 #define PM_EVENT_REMOTE_RESUME (PM_EVENT_REMOTE | PM_EVENT_RESUME)
409 #define PM_EVENT_AUTO_SUSPEND (PM_EVENT_AUTO | PM_EVENT_SUSPEND)
410 #define PM_EVENT_AUTO_RESUME (PM_EVENT_AUTO | PM_EVENT_RESUME)
412 #define PMSG_INVALID ((struct pm_message){ .event = PM_EVENT_INVALID, })
413 #define PMSG_ON ((struct pm_message){ .event = PM_EVENT_ON, })
414 #define PMSG_FREEZE ((struct pm_message){ .event = PM_EVENT_FREEZE, })
415 #define PMSG_QUIESCE ((struct pm_message){ .event = PM_EVENT_QUIESCE, })
416 #define PMSG_SUSPEND ((struct pm_message){ .event = PM_EVENT_SUSPEND, })
417 #define PMSG_HIBERNATE ((struct pm_message){ .event = PM_EVENT_HIBERNATE, })
418 #define PMSG_RESUME ((struct pm_message){ .event = PM_EVENT_RESUME, })
419 #define PMSG_THAW ((struct pm_message){ .event = PM_EVENT_THAW, })
420 #define PMSG_RESTORE ((struct pm_message){ .event = PM_EVENT_RESTORE, })
421 #define PMSG_RECOVER ((struct pm_message){ .event = PM_EVENT_RECOVER, })
422 #define PMSG_USER_SUSPEND ((struct pm_message) \
423 { .event = PM_EVENT_USER_SUSPEND, })
424 #define PMSG_USER_RESUME ((struct pm_message) \
425 { .event = PM_EVENT_USER_RESUME, })
426 #define PMSG_REMOTE_RESUME ((struct pm_message) \
427 { .event = PM_EVENT_REMOTE_RESUME, })
428 #define PMSG_AUTO_SUSPEND ((struct pm_message) \
429 { .event = PM_EVENT_AUTO_SUSPEND, })
430 #define PMSG_AUTO_RESUME ((struct pm_message) \
431 { .event = PM_EVENT_AUTO_RESUME, })
433 #define PMSG_IS_AUTO(msg) (((msg).event & PM_EVENT_AUTO) != 0)
501 #ifdef CONFIG_PM_GENERIC_DOMAINS
515 #ifdef CONFIG_PM_SLEEP
524 #ifdef CONFIG_PM_RUNTIME
531 unsigned int disable_depth:3;
532 unsigned int idle_notification:1;
533 unsigned int request_pending:1;
534 unsigned int deferred_resume:1;
535 unsigned int run_wake:1;
536 unsigned int runtime_auto:1;
537 unsigned int no_callbacks:1;
538 unsigned int irq_safe:1;
539 unsigned int use_autosuspend:1;
540 unsigned int timer_autosuspends:1;
544 int autosuspend_delay;
545 unsigned long last_busy;
546 unsigned long active_jiffies;
547 unsigned long suspended_jiffies;
548 unsigned long accounting_timestamp;
575 #define PM_EVENT_PRETHAW PM_EVENT_QUIESCE
622 #ifdef CONFIG_PM_SLEEP
637 #define suspend_report_result(fn, ret) \
639 __suspend_report_result(__func__, fn, ret); \
646 extern int pm_generic_suspend_late(
struct device *
dev);
647 extern int pm_generic_suspend_noirq(
struct device *
dev);
649 extern int pm_generic_resume_early(
struct device *
dev);
650 extern int pm_generic_resume_noirq(
struct device *
dev);
652 extern int pm_generic_freeze_noirq(
struct device *
dev);
653 extern int pm_generic_freeze_late(
struct device *
dev);
655 extern int pm_generic_thaw_noirq(
struct device *
dev);
656 extern int pm_generic_thaw_early(
struct device *
dev);
658 extern int pm_generic_restore_noirq(
struct device *
dev);
659 extern int pm_generic_restore_early(
struct device *
dev);
661 extern int pm_generic_poweroff_noirq(
struct device *
dev);
662 extern int pm_generic_poweroff_late(
struct device *
dev);
668 #define device_pm_lock() do {} while (0)
669 #define device_pm_unlock() do {} while (0)
676 #define suspend_report_result(fn, ret) do {} while (0)
687 #define pm_generic_prepare NULL
688 #define pm_generic_suspend NULL
689 #define pm_generic_resume NULL
690 #define pm_generic_freeze NULL
691 #define pm_generic_thaw NULL
692 #define pm_generic_restore NULL
693 #define pm_generic_poweroff NULL
694 #define pm_generic_complete NULL