diff options
author | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2014-06-04 01:11:42 +0400 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2014-06-04 01:11:42 +0400 |
commit | a392f7d4afb850934851fde5a8e298912650a6b8 (patch) | |
tree | ed9901ba019615f6911c0f9f1a3af180b243bc8f /kernel | |
parent | f58c41cc0427115e3d750ec090020892acf0fb9c (diff) | |
parent | 4cf563c5d97c83d4b2fb3a778dd7d5e362cc3e34 (diff) | |
download | linux-a392f7d4afb850934851fde5a8e298912650a6b8.tar.xz |
Merge branch 'acpi-pm'
* acpi-pm:
ACPI / PM: Export rest of the subsys PM callbacks
ACPI / PM: Avoid resuming devices in ACPI PM domain during system suspend
ACPI / PM: Hold ACPI scan lock over the "freeze" sleep state
ACPI / PM: Export acpi_target_system_state() to modules
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/power/suspend.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/kernel/power/suspend.c b/kernel/power/suspend.c index 338a6f147974..963e6d0f050b 100644 --- a/kernel/power/suspend.c +++ b/kernel/power/suspend.c @@ -38,6 +38,7 @@ struct pm_sleep_state pm_states[PM_SUSPEND_MAX] = { }; static const struct platform_suspend_ops *suspend_ops; +static const struct platform_freeze_ops *freeze_ops; static bool need_suspend_ops(suspend_state_t state) { @@ -47,6 +48,13 @@ static bool need_suspend_ops(suspend_state_t state) static DECLARE_WAIT_QUEUE_HEAD(suspend_freeze_wait_head); static bool suspend_freeze_wake; +void freeze_set_ops(const struct platform_freeze_ops *ops) +{ + lock_system_sleep(); + freeze_ops = ops; + unlock_system_sleep(); +} + static void freeze_begin(void) { suspend_freeze_wake = false; @@ -291,6 +299,10 @@ int suspend_devices_and_enter(suspend_state_t state) error = suspend_ops->begin(state); if (error) goto Close; + } else if (state == PM_SUSPEND_FREEZE && freeze_ops->begin) { + error = freeze_ops->begin(); + if (error) + goto Close; } suspend_console(); suspend_test_start(); @@ -316,6 +328,9 @@ int suspend_devices_and_enter(suspend_state_t state) Close: if (need_suspend_ops(state) && suspend_ops->end) suspend_ops->end(); + else if (state == PM_SUSPEND_FREEZE && freeze_ops->end) + freeze_ops->end(); + trace_machine_suspend(PWR_EVENT_EXIT); return error; |