aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2011-03-16 12:24:44 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2011-03-16 12:24:44 -0400
commitfc82e1d59a24cbac01c49d4eb3b28d6abc26a5f4 (patch)
tree5e01479d69e69dbbe483044b39afd2aa99d4f2b2 /include
parent48d5f6731837f0ec9a0e19ca763aa17d58385a98 (diff)
parentbea3864fb627d110933cfb8babe048b63c4fc76e (diff)
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/suspend-2.6
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/suspend-2.6: (21 commits) PM / Hibernate: Reduce autotuned default image size PM / Core: Introduce struct syscore_ops for core subsystems PM PM QoS: Make pm_qos settings readable PM / OPP: opp_find_freq_exact() documentation fix PM: Documentation/power/states.txt: fix repetition PM: Make system-wide PM and runtime PM treat subsystems consistently PM: Simplify kernel/power/Kconfig PM: Add support for device power domains PM: Drop pm_flags that is not necessary PM: Allow pm_runtime_suspend() to succeed during system suspend PM: Clean up PM_TRACE dependencies and drop unnecessary Kconfig option PM: Remove CONFIG_PM_OPS PM: Reorder power management Kconfig options PM: Make CONFIG_PM depend on (CONFIG_PM_SLEEP || CONFIG_PM_RUNTIME) PM / ACPI: Remove references to pm_flags from bus.c PM: Do not create wakeup sysfs files for devices that cannot wake up USB / Hub: Do not call device_set_wakeup_capable() under spinlock PM: Use appropriate printk() priority level in trace.c PM / Wakeup: Don't update events_check_enabled in pm_get_wakeup_count() PM / Wakeup: Make pm_save_wakeup_count() work as documented ...
Diffstat (limited to 'include')
-rw-r--r--include/acpi/acpi_bus.h2
-rw-r--r--include/linux/device.h1
-rw-r--r--include/linux/pm.h19
-rw-r--r--include/linux/pm_runtime.h6
-rw-r--r--include/linux/pm_wakeup.h8
-rw-r--r--include/linux/syscore_ops.h29
6 files changed, 47 insertions, 18 deletions
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h
index 78ca429929f7..ff103ba96b78 100644
--- a/include/acpi/acpi_bus.h
+++ b/include/acpi/acpi_bus.h
@@ -381,7 +381,7 @@ struct acpi_pci_root *acpi_pci_find_root(acpi_handle handle);
381int acpi_enable_wakeup_device_power(struct acpi_device *dev, int state); 381int acpi_enable_wakeup_device_power(struct acpi_device *dev, int state);
382int acpi_disable_wakeup_device_power(struct acpi_device *dev); 382int acpi_disable_wakeup_device_power(struct acpi_device *dev);
383 383
384#ifdef CONFIG_PM_OPS 384#ifdef CONFIG_PM
385int acpi_pm_device_sleep_state(struct device *, int *); 385int acpi_pm_device_sleep_state(struct device *, int *);
386#else 386#else
387static inline int acpi_pm_device_sleep_state(struct device *d, int *p) 387static inline int acpi_pm_device_sleep_state(struct device *d, int *p)
diff --git a/include/linux/device.h b/include/linux/device.h
index ca5d25225aab..dba775a68752 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -420,6 +420,7 @@ struct device {
420 void *platform_data; /* Platform specific data, device 420 void *platform_data; /* Platform specific data, device
421 core doesn't touch it */ 421 core doesn't touch it */
422 struct dev_pm_info power; 422 struct dev_pm_info power;
423 struct dev_power_domain *pwr_domain;
423 424
424#ifdef CONFIG_NUMA 425#ifdef CONFIG_NUMA
425 int numa_node; /* NUMA node this device is close to */ 426 int numa_node; /* NUMA node this device is close to */
diff --git a/include/linux/pm.h b/include/linux/pm.h
index 21415cc91cbb..6618216bb973 100644
--- a/include/linux/pm.h
+++ b/include/linux/pm.h
@@ -267,7 +267,7 @@ const struct dev_pm_ops name = { \
267 * callbacks provided by device drivers supporting both the system sleep PM and 267 * callbacks provided by device drivers supporting both the system sleep PM and
268 * runtime PM, make the pm member point to generic_subsys_pm_ops. 268 * runtime PM, make the pm member point to generic_subsys_pm_ops.
269 */ 269 */
270#ifdef CONFIG_PM_OPS 270#ifdef CONFIG_PM
271extern struct dev_pm_ops generic_subsys_pm_ops; 271extern struct dev_pm_ops generic_subsys_pm_ops;
272#define GENERIC_SUBSYS_PM_OPS (&generic_subsys_pm_ops) 272#define GENERIC_SUBSYS_PM_OPS (&generic_subsys_pm_ops)
273#else 273#else
@@ -465,6 +465,14 @@ struct dev_pm_info {
465 465
466extern void update_pm_runtime_accounting(struct device *dev); 466extern void update_pm_runtime_accounting(struct device *dev);
467 467
468/*
469 * Power domains provide callbacks that are executed during system suspend,
470 * hibernation, system resume and during runtime PM transitions along with
471 * subsystem-level and driver-level callbacks.
472 */
473struct dev_power_domain {
474 struct dev_pm_ops ops;
475};
468 476
469/* 477/*
470 * The PM_EVENT_ messages are also used by drivers implementing the legacy 478 * The PM_EVENT_ messages are also used by drivers implementing the legacy
@@ -565,15 +573,6 @@ enum dpm_order {
565 DPM_ORDER_DEV_LAST, 573 DPM_ORDER_DEV_LAST,
566}; 574};
567 575
568/*
569 * Global Power Management flags
570 * Used to keep APM and ACPI from both being active
571 */
572extern unsigned int pm_flags;
573
574#define PM_APM 1
575#define PM_ACPI 2
576
577extern int pm_generic_suspend(struct device *dev); 576extern int pm_generic_suspend(struct device *dev);
578extern int pm_generic_resume(struct device *dev); 577extern int pm_generic_resume(struct device *dev);
579extern int pm_generic_freeze(struct device *dev); 578extern int pm_generic_freeze(struct device *dev);
diff --git a/include/linux/pm_runtime.h b/include/linux/pm_runtime.h
index d34f067e2a7f..8de9aa6e7def 100644
--- a/include/linux/pm_runtime.h
+++ b/include/linux/pm_runtime.h
@@ -87,6 +87,11 @@ static inline bool pm_runtime_enabled(struct device *dev)
87 return !dev->power.disable_depth; 87 return !dev->power.disable_depth;
88} 88}
89 89
90static inline bool pm_runtime_callbacks_present(struct device *dev)
91{
92 return !dev->power.no_callbacks;
93}
94
90static inline void pm_runtime_mark_last_busy(struct device *dev) 95static inline void pm_runtime_mark_last_busy(struct device *dev)
91{ 96{
92 ACCESS_ONCE(dev->power.last_busy) = jiffies; 97 ACCESS_ONCE(dev->power.last_busy) = jiffies;
@@ -133,6 +138,7 @@ static inline int pm_generic_runtime_resume(struct device *dev) { return 0; }
133static inline void pm_runtime_no_callbacks(struct device *dev) {} 138static inline void pm_runtime_no_callbacks(struct device *dev) {}
134static inline void pm_runtime_irq_safe(struct device *dev) {} 139static inline void pm_runtime_irq_safe(struct device *dev) {}
135 140
141static inline bool pm_runtime_callbacks_present(struct device *dev) { return false; }
136static inline void pm_runtime_mark_last_busy(struct device *dev) {} 142static inline void pm_runtime_mark_last_busy(struct device *dev) {}
137static inline void __pm_runtime_use_autosuspend(struct device *dev, 143static inline void __pm_runtime_use_autosuspend(struct device *dev,
138 bool use) {} 144 bool use) {}
diff --git a/include/linux/pm_wakeup.h b/include/linux/pm_wakeup.h
index 03a67db03d01..a32da962d693 100644
--- a/include/linux/pm_wakeup.h
+++ b/include/linux/pm_wakeup.h
@@ -62,18 +62,11 @@ struct wakeup_source {
62 * Changes to device_may_wakeup take effect on the next pm state change. 62 * Changes to device_may_wakeup take effect on the next pm state change.
63 */ 63 */
64 64
65static inline void device_set_wakeup_capable(struct device *dev, bool capable)
66{
67 dev->power.can_wakeup = capable;
68}
69
70static inline bool device_can_wakeup(struct device *dev) 65static inline bool device_can_wakeup(struct device *dev)
71{ 66{
72 return dev->power.can_wakeup; 67 return dev->power.can_wakeup;
73} 68}
74 69
75
76
77static inline bool device_may_wakeup(struct device *dev) 70static inline bool device_may_wakeup(struct device *dev)
78{ 71{
79 return dev->power.can_wakeup && !!dev->power.wakeup; 72 return dev->power.can_wakeup && !!dev->power.wakeup;
@@ -88,6 +81,7 @@ extern struct wakeup_source *wakeup_source_register(const char *name);
88extern void wakeup_source_unregister(struct wakeup_source *ws); 81extern void wakeup_source_unregister(struct wakeup_source *ws);
89extern int device_wakeup_enable(struct device *dev); 82extern int device_wakeup_enable(struct device *dev);
90extern int device_wakeup_disable(struct device *dev); 83extern int device_wakeup_disable(struct device *dev);
84extern void device_set_wakeup_capable(struct device *dev, bool capable);
91extern int device_init_wakeup(struct device *dev, bool val); 85extern int device_init_wakeup(struct device *dev, bool val);
92extern int device_set_wakeup_enable(struct device *dev, bool enable); 86extern int device_set_wakeup_enable(struct device *dev, bool enable);
93extern void __pm_stay_awake(struct wakeup_source *ws); 87extern void __pm_stay_awake(struct wakeup_source *ws);
diff --git a/include/linux/syscore_ops.h b/include/linux/syscore_ops.h
new file mode 100644
index 000000000000..27b3b0bc41a9
--- /dev/null
+++ b/include/linux/syscore_ops.h
@@ -0,0 +1,29 @@
1/*
2 * syscore_ops.h - System core operations.
3 *
4 * Copyright (C) 2011 Rafael J. Wysocki <rjw@sisk.pl>, Novell Inc.
5 *
6 * This file is released under the GPLv2.
7 */
8
9#ifndef _LINUX_SYSCORE_OPS_H
10#define _LINUX_SYSCORE_OPS_H
11
12#include <linux/list.h>
13
14struct syscore_ops {
15 struct list_head node;
16 int (*suspend)(void);
17 void (*resume)(void);
18 void (*shutdown)(void);
19};
20
21extern void register_syscore_ops(struct syscore_ops *ops);
22extern void unregister_syscore_ops(struct syscore_ops *ops);
23#ifdef CONFIG_PM_SLEEP
24extern int syscore_suspend(void);
25extern void syscore_resume(void);
26#endif
27extern void syscore_shutdown(void);
28
29#endif