2009-08-18 21:38:32 +00:00
|
|
|
#ifdef CONFIG_PM_RUNTIME
|
|
|
|
|
|
|
|
extern void pm_runtime_init(struct device *dev);
|
|
|
|
extern void pm_runtime_remove(struct device *dev);
|
|
|
|
|
|
|
|
#else /* !CONFIG_PM_RUNTIME */
|
|
|
|
|
|
|
|
static inline void pm_runtime_init(struct device *dev) {}
|
|
|
|
static inline void pm_runtime_remove(struct device *dev) {}
|
|
|
|
|
|
|
|
#endif /* !CONFIG_PM_RUNTIME */
|
2008-08-07 17:06:12 +00:00
|
|
|
|
2007-07-29 21:27:18 +00:00
|
|
|
#ifdef CONFIG_PM_SLEEP
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2010-01-23 21:25:15 +00:00
|
|
|
/* kernel/power/main.c */
|
|
|
|
extern int pm_async_enabled;
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2010-01-23 21:25:15 +00:00
|
|
|
/* drivers/base/power/main.c */
|
Introduce new top level suspend and hibernation callbacks
Introduce 'struct pm_ops' and 'struct pm_ext_ops' ('ext' meaning
'extended') representing suspend and hibernation operations for bus
types, device classes, device types and device drivers.
Modify the PM core to use 'struct pm_ops' and 'struct pm_ext_ops'
objects, if defined, instead of the ->suspend(), ->resume(),
->suspend_late(), and ->resume_early() callbacks (the old callbacks
will be considered as legacy and gradually phased out).
The main purpose of doing this is to separate suspend (aka S2RAM and
standby) callbacks from hibernation callbacks in such a way that the
new callbacks won't take arguments and the semantics of each of them
will be clearly specified. This has been requested for multiple
times by many people, including Linus himself, and the reason is that
within the current scheme if ->resume() is called, for example, it's
difficult to say why it's been called (ie. is it a resume from RAM or
from hibernation or a suspend/hibernation failure etc.?).
The second purpose is to make the suspend/hibernation callbacks more
flexible so that device drivers can handle more than they can within
the current scheme. For example, some drivers may need to prevent
new children of the device from being registered before their
->suspend() callbacks are executed or they may want to carry out some
operations requiring the availability of some other devices, not
directly bound via the parent-child relationship, in order to prepare
for the execution of ->suspend(), etc.
Ultimately, we'd like to stop using the freezing of tasks for suspend
and therefore the drivers' suspend/hibernation code will have to take
care of the handling of the user space during suspend/hibernation.
That, in turn, would be difficult within the current scheme, without
the new ->prepare() and ->complete() callbacks.
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
2008-05-20 21:00:01 +00:00
|
|
|
extern struct list_head dpm_list; /* The active device list */
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2007-11-21 22:55:18 +00:00
|
|
|
static inline struct device *to_device(struct list_head *entry)
|
2005-04-16 22:20:36 +00:00
|
|
|
{
|
2007-09-21 19:36:56 +00:00
|
|
|
return container_of(entry, struct device, power.entry);
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
2009-08-18 21:38:32 +00:00
|
|
|
extern void device_pm_init(struct device *dev);
|
2008-08-07 17:06:12 +00:00
|
|
|
extern void device_pm_add(struct device *);
|
2005-04-16 22:20:36 +00:00
|
|
|
extern void device_pm_remove(struct device *);
|
2009-03-04 11:44:00 +00:00
|
|
|
extern void device_pm_move_before(struct device *, struct device *);
|
|
|
|
extern void device_pm_move_after(struct device *, struct device *);
|
|
|
|
extern void device_pm_move_last(struct device *);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2009-08-18 21:38:32 +00:00
|
|
|
#else /* !CONFIG_PM_SLEEP */
|
|
|
|
|
|
|
|
static inline void device_pm_init(struct device *dev)
|
|
|
|
{
|
2010-09-22 20:09:10 +00:00
|
|
|
spin_lock_init(&dev->power.lock);
|
2009-08-18 21:38:32 +00:00
|
|
|
pm_runtime_init(dev);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void device_pm_remove(struct device *dev)
|
|
|
|
{
|
|
|
|
pm_runtime_remove(dev);
|
|
|
|
}
|
2007-11-21 22:55:18 +00:00
|
|
|
|
2008-08-07 17:06:12 +00:00
|
|
|
static inline void device_pm_add(struct device *dev) {}
|
2009-03-04 11:44:00 +00:00
|
|
|
static inline void device_pm_move_before(struct device *deva,
|
|
|
|
struct device *devb) {}
|
|
|
|
static inline void device_pm_move_after(struct device *deva,
|
|
|
|
struct device *devb) {}
|
|
|
|
static inline void device_pm_move_last(struct device *dev) {}
|
2008-01-12 19:40:46 +00:00
|
|
|
|
2009-08-18 21:38:32 +00:00
|
|
|
#endif /* !CONFIG_PM_SLEEP */
|
2007-11-21 22:55:18 +00:00
|
|
|
|
|
|
|
#ifdef CONFIG_PM
|
|
|
|
|
2005-04-16 22:20:36 +00:00
|
|
|
/*
|
|
|
|
* sysfs.c
|
|
|
|
*/
|
|
|
|
|
|
|
|
extern int dpm_sysfs_add(struct device *);
|
|
|
|
extern void dpm_sysfs_remove(struct device *);
|
2010-09-25 21:35:15 +00:00
|
|
|
extern void rpm_sysfs_remove(struct device *);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2007-11-21 22:55:18 +00:00
|
|
|
#else /* CONFIG_PM */
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2007-11-21 22:55:18 +00:00
|
|
|
static inline int dpm_sysfs_add(struct device *dev)
|
2005-04-16 22:20:36 +00:00
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2007-11-21 22:55:18 +00:00
|
|
|
static inline void dpm_sysfs_remove(struct device *dev)
|
|
|
|
{
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|