forked from luck/tmp_suning_uos_patched
Merge branches 'pm-sleep', 'pm-runtime' and 'pm-apm'
* pm-sleep: PM / hibernate: Call platform_leave() in suspend path too PM / Sleep: Add macro to define common late/early system PM callbacks PM / hibernate: export hibernation_set_ops * pm-runtime: PM / Runtime: Implement the pm_generic_runtime functions for CONFIG_PM PM / Runtime: Add second macro for definition of runtime PM callbacks * pm-apm: apm-emulation: add hibernation APM events to support suspend2disk
This commit is contained in:
commit
4ff913373a
|
@ -10,7 +10,7 @@
|
|||
#include <linux/pm_runtime.h>
|
||||
#include <linux/export.h>
|
||||
|
||||
#ifdef CONFIG_PM_RUNTIME
|
||||
#ifdef CONFIG_PM
|
||||
/**
|
||||
* pm_generic_runtime_suspend - Generic runtime suspend callback for subsystems.
|
||||
* @dev: Device to suspend.
|
||||
|
@ -48,7 +48,7 @@ int pm_generic_runtime_resume(struct device *dev)
|
|||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(pm_generic_runtime_resume);
|
||||
#endif /* CONFIG_PM_RUNTIME */
|
||||
#endif /* CONFIG_PM */
|
||||
|
||||
#ifdef CONFIG_PM_SLEEP
|
||||
/**
|
||||
|
|
|
@ -531,6 +531,7 @@ static int apm_suspend_notifier(struct notifier_block *nb,
|
|||
{
|
||||
struct apm_user *as;
|
||||
int err;
|
||||
unsigned long apm_event;
|
||||
|
||||
/* short-cut emergency suspends */
|
||||
if (atomic_read(&userspace_notification_inhibit))
|
||||
|
@ -538,6 +539,9 @@ static int apm_suspend_notifier(struct notifier_block *nb,
|
|||
|
||||
switch (event) {
|
||||
case PM_SUSPEND_PREPARE:
|
||||
case PM_HIBERNATION_PREPARE:
|
||||
apm_event = (event == PM_SUSPEND_PREPARE) ?
|
||||
APM_USER_SUSPEND : APM_USER_HIBERNATION;
|
||||
/*
|
||||
* Queue an event to all "writer" users that we want
|
||||
* to suspend and need their ack.
|
||||
|
@ -550,7 +554,7 @@ static int apm_suspend_notifier(struct notifier_block *nb,
|
|||
as->writer && as->suser) {
|
||||
as->suspend_state = SUSPEND_PENDING;
|
||||
atomic_inc(&suspend_acks_pending);
|
||||
queue_add_event(&as->queue, APM_USER_SUSPEND);
|
||||
queue_add_event(&as->queue, apm_event);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -601,11 +605,14 @@ static int apm_suspend_notifier(struct notifier_block *nb,
|
|||
return notifier_from_errno(err);
|
||||
|
||||
case PM_POST_SUSPEND:
|
||||
case PM_POST_HIBERNATION:
|
||||
apm_event = (event == PM_POST_SUSPEND) ?
|
||||
APM_NORMAL_RESUME : APM_HIBERNATION_RESUME;
|
||||
/*
|
||||
* Anyone on the APM queues will think we're still suspended.
|
||||
* Send a message so everyone knows we're now awake again.
|
||||
*/
|
||||
queue_event(APM_NORMAL_RESUME);
|
||||
queue_event(apm_event);
|
||||
|
||||
/*
|
||||
* Finally, wake up anyone who is sleeping on the suspend.
|
||||
|
|
|
@ -311,6 +311,18 @@ struct dev_pm_ops {
|
|||
#define SET_SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn)
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_PM_SLEEP
|
||||
#define SET_LATE_SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn) \
|
||||
.suspend_late = suspend_fn, \
|
||||
.resume_early = resume_fn, \
|
||||
.freeze_late = suspend_fn, \
|
||||
.thaw_early = resume_fn, \
|
||||
.poweroff_late = suspend_fn, \
|
||||
.restore_early = resume_fn,
|
||||
#else
|
||||
#define SET_LATE_SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn)
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_PM_RUNTIME
|
||||
#define SET_RUNTIME_PM_OPS(suspend_fn, resume_fn, idle_fn) \
|
||||
.runtime_suspend = suspend_fn, \
|
||||
|
@ -320,6 +332,15 @@ struct dev_pm_ops {
|
|||
#define SET_RUNTIME_PM_OPS(suspend_fn, resume_fn, idle_fn)
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_PM
|
||||
#define SET_PM_RUNTIME_PM_OPS(suspend_fn, resume_fn, idle_fn) \
|
||||
.runtime_suspend = suspend_fn, \
|
||||
.runtime_resume = resume_fn, \
|
||||
.runtime_idle = idle_fn,
|
||||
#else
|
||||
#define SET_PM_RUNTIME_PM_OPS(suspend_fn, resume_fn, idle_fn)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Use this if you want to use the same suspend and resume callbacks for suspend
|
||||
* to RAM and hibernation.
|
||||
|
|
|
@ -23,6 +23,14 @@
|
|||
usage_count */
|
||||
#define RPM_AUTO 0x08 /* Use autosuspend_delay */
|
||||
|
||||
#ifdef CONFIG_PM
|
||||
extern int pm_generic_runtime_suspend(struct device *dev);
|
||||
extern int pm_generic_runtime_resume(struct device *dev);
|
||||
#else
|
||||
static inline int pm_generic_runtime_suspend(struct device *dev) { return 0; }
|
||||
static inline int pm_generic_runtime_resume(struct device *dev) { return 0; }
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_PM_RUNTIME
|
||||
|
||||
extern struct workqueue_struct *pm_wq;
|
||||
|
@ -37,8 +45,6 @@ extern void pm_runtime_enable(struct device *dev);
|
|||
extern void __pm_runtime_disable(struct device *dev, bool check_resume);
|
||||
extern void pm_runtime_allow(struct device *dev);
|
||||
extern void pm_runtime_forbid(struct device *dev);
|
||||
extern int pm_generic_runtime_suspend(struct device *dev);
|
||||
extern int pm_generic_runtime_resume(struct device *dev);
|
||||
extern void pm_runtime_no_callbacks(struct device *dev);
|
||||
extern void pm_runtime_irq_safe(struct device *dev);
|
||||
extern void __pm_runtime_use_autosuspend(struct device *dev, bool use);
|
||||
|
@ -142,8 +148,6 @@ static inline bool pm_runtime_active(struct device *dev) { return true; }
|
|||
static inline bool pm_runtime_status_suspended(struct device *dev) { return false; }
|
||||
static inline bool pm_runtime_enabled(struct device *dev) { return false; }
|
||||
|
||||
static inline int pm_generic_runtime_suspend(struct device *dev) { return 0; }
|
||||
static inline int pm_generic_runtime_resume(struct device *dev) { return 0; }
|
||||
static inline void pm_runtime_no_callbacks(struct device *dev) {}
|
||||
static inline void pm_runtime_irq_safe(struct device *dev) {}
|
||||
|
||||
|
|
|
@ -67,6 +67,8 @@ struct apm_bios_info {
|
|||
#define APM_USER_SUSPEND 0x000a
|
||||
#define APM_STANDBY_RESUME 0x000b
|
||||
#define APM_CAPABILITY_CHANGE 0x000c
|
||||
#define APM_USER_HIBERNATION 0x000d
|
||||
#define APM_HIBERNATION_RESUME 0x000e
|
||||
|
||||
/*
|
||||
* Error codes
|
||||
|
|
|
@ -82,6 +82,7 @@ void hibernation_set_ops(const struct platform_hibernation_ops *ops)
|
|||
|
||||
unlock_system_sleep();
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(hibernation_set_ops);
|
||||
|
||||
static bool entering_platform_hibernation;
|
||||
|
||||
|
@ -293,10 +294,10 @@ static int create_image(int platform_mode)
|
|||
error);
|
||||
/* Restore control flow magically appears here */
|
||||
restore_processor_state();
|
||||
if (!in_suspend) {
|
||||
if (!in_suspend)
|
||||
events_check_enabled = false;
|
||||
platform_leave(platform_mode);
|
||||
}
|
||||
|
||||
platform_leave(platform_mode);
|
||||
|
||||
Power_up:
|
||||
syscore_resume();
|
||||
|
|
Loading…
Reference in New Issue
Block a user