Merge tag 'pm-for-3.6-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
Pull power management updates from Rafael Wysocki: - ACPI conversion to PM handling based on struct dev_pm_ops. - Conversion of a number of platform drivers to PM handling based on struct dev_pm_ops and removal of empty legacy PM callbacks from a couple of PCI drivers. - Suspend-to-both for in-kernel hibernation from Bojan Smojver. - cpuidle fixes and cleanups from ShuoX Liu, Daniel Lezcano and Preeti Murthy. - cpufreq bug fixes from Jonghwa Lee and Stephen Boyd. - Suspend and hibernate fixes from Srivatsa Bhat and Colin Cross. - Generic PM domains framework updates. - RTC CMOS wakeup signaling update from Paul Fox. - sparse warnings fixes from Sachin Kamat. - Build warnings fixes for the generic PM domains framework and PM sysfs code. - sysfs switch for printing device suspend times from Sameer Nanda. - Documentation fix from Oskar Schirmer. * tag 'pm-for-3.6-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: (70 commits) cpufreq: Fix sysfs deadlock with concurrent hotplug/frequency switch EXYNOS: bugfix on retrieving old_index from freqs.old PM / Sleep: call early resume handlers when suspend_noirq fails PM / QoS: Use NULL pointer instead of plain integer in qos.c PM / QoS: Use NULL pointer instead of plain integer in pm_qos.h PM / Sleep: Require CAP_BLOCK_SUSPEND to use wake_lock/wake_unlock PM / Sleep: Add missing static storage class specifiers in main.c cpuilde / ACPI: remove time from acpi_processor_cx structure cpuidle / ACPI: remove usage from acpi_processor_cx structure cpuidle / ACPI : remove latency_ticks from acpi_processor_cx structure rtc-cmos: report wakeups from interrupt handler PM / Sleep: Fix build warning in sysfs.c for CONFIG_PM_SLEEP unset PM / Domains: Fix build warning for CONFIG_PM_RUNTIME unset olpc-xo15-sci: Use struct dev_pm_ops for power management PM / Domains: Replace plain integer with NULL pointer in domain.c file PM / Domains: Add missing static storage class specifier in domain.c file PM / crypto / ux500: Use struct dev_pm_ops for power management PM / IPMI: Remove empty legacy PCI PM callbacks tpm_nsc: Use struct dev_pm_ops for power management tpm_tis: Use struct dev_pm_ops for power management ...
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
* Copyright (c) 2003 Open Source Development Lab
|
||||
* Copyright (c) 2004 Pavel Machek <pavel@ucw.cz>
|
||||
* Copyright (c) 2009 Rafael J. Wysocki, Novell Inc.
|
||||
* Copyright (C) 2012 Bojan Smojver <bojan@rexursive.com>
|
||||
*
|
||||
* This file is released under the GPLv2.
|
||||
*/
|
||||
@@ -45,6 +46,9 @@ enum {
|
||||
HIBERNATION_PLATFORM,
|
||||
HIBERNATION_SHUTDOWN,
|
||||
HIBERNATION_REBOOT,
|
||||
#ifdef CONFIG_SUSPEND
|
||||
HIBERNATION_SUSPEND,
|
||||
#endif
|
||||
/* keep last */
|
||||
__HIBERNATION_AFTER_LAST
|
||||
};
|
||||
@@ -353,6 +357,7 @@ int hibernation_snapshot(int platform_mode)
|
||||
}
|
||||
|
||||
suspend_console();
|
||||
ftrace_stop();
|
||||
pm_restrict_gfp_mask();
|
||||
|
||||
error = dpm_suspend(PMSG_FREEZE);
|
||||
@@ -378,6 +383,7 @@ int hibernation_snapshot(int platform_mode)
|
||||
if (error || !in_suspend)
|
||||
pm_restore_gfp_mask();
|
||||
|
||||
ftrace_start();
|
||||
resume_console();
|
||||
dpm_complete(msg);
|
||||
|
||||
@@ -480,6 +486,7 @@ int hibernation_restore(int platform_mode)
|
||||
|
||||
pm_prepare_console();
|
||||
suspend_console();
|
||||
ftrace_stop();
|
||||
pm_restrict_gfp_mask();
|
||||
error = dpm_suspend_start(PMSG_QUIESCE);
|
||||
if (!error) {
|
||||
@@ -487,6 +494,7 @@ int hibernation_restore(int platform_mode)
|
||||
dpm_resume_end(PMSG_RECOVER);
|
||||
}
|
||||
pm_restore_gfp_mask();
|
||||
ftrace_start();
|
||||
resume_console();
|
||||
pm_restore_console();
|
||||
return error;
|
||||
@@ -513,6 +521,7 @@ int hibernation_platform_enter(void)
|
||||
|
||||
entering_platform_hibernation = true;
|
||||
suspend_console();
|
||||
ftrace_stop();
|
||||
error = dpm_suspend_start(PMSG_HIBERNATE);
|
||||
if (error) {
|
||||
if (hibernation_ops->recover)
|
||||
@@ -556,6 +565,7 @@ int hibernation_platform_enter(void)
|
||||
Resume_devices:
|
||||
entering_platform_hibernation = false;
|
||||
dpm_resume_end(PMSG_RESTORE);
|
||||
ftrace_start();
|
||||
resume_console();
|
||||
|
||||
Close:
|
||||
@@ -573,6 +583,10 @@ int hibernation_platform_enter(void)
|
||||
*/
|
||||
static void power_down(void)
|
||||
{
|
||||
#ifdef CONFIG_SUSPEND
|
||||
int error;
|
||||
#endif
|
||||
|
||||
switch (hibernation_mode) {
|
||||
case HIBERNATION_REBOOT:
|
||||
kernel_restart(NULL);
|
||||
@@ -582,6 +596,25 @@ static void power_down(void)
|
||||
case HIBERNATION_SHUTDOWN:
|
||||
kernel_power_off();
|
||||
break;
|
||||
#ifdef CONFIG_SUSPEND
|
||||
case HIBERNATION_SUSPEND:
|
||||
error = suspend_devices_and_enter(PM_SUSPEND_MEM);
|
||||
if (error) {
|
||||
if (hibernation_ops)
|
||||
hibernation_mode = HIBERNATION_PLATFORM;
|
||||
else
|
||||
hibernation_mode = HIBERNATION_SHUTDOWN;
|
||||
power_down();
|
||||
}
|
||||
/*
|
||||
* Restore swap signature.
|
||||
*/
|
||||
error = swsusp_unmark();
|
||||
if (error)
|
||||
printk(KERN_ERR "PM: Swap will be unusable! "
|
||||
"Try swapon -a.\n");
|
||||
return;
|
||||
#endif
|
||||
}
|
||||
kernel_halt();
|
||||
/*
|
||||
@@ -819,6 +852,9 @@ static const char * const hibernation_modes[] = {
|
||||
[HIBERNATION_PLATFORM] = "platform",
|
||||
[HIBERNATION_SHUTDOWN] = "shutdown",
|
||||
[HIBERNATION_REBOOT] = "reboot",
|
||||
#ifdef CONFIG_SUSPEND
|
||||
[HIBERNATION_SUSPEND] = "suspend",
|
||||
#endif
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -859,6 +895,9 @@ static ssize_t disk_show(struct kobject *kobj, struct kobj_attribute *attr,
|
||||
switch (i) {
|
||||
case HIBERNATION_SHUTDOWN:
|
||||
case HIBERNATION_REBOOT:
|
||||
#ifdef CONFIG_SUSPEND
|
||||
case HIBERNATION_SUSPEND:
|
||||
#endif
|
||||
break;
|
||||
case HIBERNATION_PLATFORM:
|
||||
if (hibernation_ops)
|
||||
@@ -899,6 +938,9 @@ static ssize_t disk_store(struct kobject *kobj, struct kobj_attribute *attr,
|
||||
switch (mode) {
|
||||
case HIBERNATION_SHUTDOWN:
|
||||
case HIBERNATION_REBOOT:
|
||||
#ifdef CONFIG_SUSPEND
|
||||
case HIBERNATION_SUSPEND:
|
||||
#endif
|
||||
hibernation_mode = mode;
|
||||
break;
|
||||
case HIBERNATION_PLATFORM:
|
||||
|
Reference in New Issue
Block a user