mirror of
https://github.com/torvalds/linux.git
synced 2024-11-23 12:42:02 +00:00
Merge branch 'acpi-pm'
* acpi-pm: ACPI / sleep: Rework the handling of ACPI GPE wakeup from suspend-to-idle PM / sleep: Rename platform suspend/resume functions in suspend.c PM / sleep: Export dpm_suspend_late/noirq() and dpm_resume_early/noirq()
This commit is contained in:
commit
28c399e2a1
@ -835,7 +835,7 @@ acpi_os_install_interrupt_handler(u32 gsi, acpi_osd_handler handler,
|
||||
|
||||
acpi_irq_handler = handler;
|
||||
acpi_irq_context = context;
|
||||
if (request_irq(irq, acpi_irq, IRQF_SHARED | IRQF_NO_SUSPEND, "acpi", acpi_irq)) {
|
||||
if (request_irq(irq, acpi_irq, IRQF_SHARED, "acpi", acpi_irq)) {
|
||||
printk(KERN_ERR PREFIX "SCI (IRQ%d) allocation failed\n", irq);
|
||||
acpi_irq_handler = NULL;
|
||||
return AE_NOT_ACQUIRED;
|
||||
|
@ -14,6 +14,7 @@
|
||||
#include <linux/irq.h>
|
||||
#include <linux/dmi.h>
|
||||
#include <linux/device.h>
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/suspend.h>
|
||||
#include <linux/reboot.h>
|
||||
#include <linux/acpi.h>
|
||||
@ -626,6 +627,19 @@ static int acpi_freeze_begin(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int acpi_freeze_prepare(void)
|
||||
{
|
||||
acpi_enable_all_wakeup_gpes();
|
||||
enable_irq_wake(acpi_gbl_FADT.sci_interrupt);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void acpi_freeze_restore(void)
|
||||
{
|
||||
disable_irq_wake(acpi_gbl_FADT.sci_interrupt);
|
||||
acpi_enable_all_runtime_gpes();
|
||||
}
|
||||
|
||||
static void acpi_freeze_end(void)
|
||||
{
|
||||
acpi_scan_lock_release();
|
||||
@ -633,6 +647,8 @@ static void acpi_freeze_end(void)
|
||||
|
||||
static const struct platform_freeze_ops acpi_freeze_ops = {
|
||||
.begin = acpi_freeze_begin,
|
||||
.prepare = acpi_freeze_prepare,
|
||||
.restore = acpi_freeze_restore,
|
||||
.end = acpi_freeze_end,
|
||||
};
|
||||
|
||||
|
@ -540,7 +540,7 @@ static void async_resume_noirq(void *data, async_cookie_t cookie)
|
||||
* Call the "noirq" resume handlers for all devices in dpm_noirq_list and
|
||||
* enable device drivers to receive interrupts.
|
||||
*/
|
||||
static void dpm_resume_noirq(pm_message_t state)
|
||||
void dpm_resume_noirq(pm_message_t state)
|
||||
{
|
||||
struct device *dev;
|
||||
ktime_t starttime = ktime_get();
|
||||
@ -662,7 +662,7 @@ static void async_resume_early(void *data, async_cookie_t cookie)
|
||||
* dpm_resume_early - Execute "early resume" callbacks for all devices.
|
||||
* @state: PM transition of the system being carried out.
|
||||
*/
|
||||
static void dpm_resume_early(pm_message_t state)
|
||||
void dpm_resume_early(pm_message_t state)
|
||||
{
|
||||
struct device *dev;
|
||||
ktime_t starttime = ktime_get();
|
||||
@ -1093,7 +1093,7 @@ static int device_suspend_noirq(struct device *dev)
|
||||
* Prevent device drivers from receiving interrupts and call the "noirq" suspend
|
||||
* handlers for all non-sysdev devices.
|
||||
*/
|
||||
static int dpm_suspend_noirq(pm_message_t state)
|
||||
int dpm_suspend_noirq(pm_message_t state)
|
||||
{
|
||||
ktime_t starttime = ktime_get();
|
||||
int error = 0;
|
||||
@ -1232,7 +1232,7 @@ static int device_suspend_late(struct device *dev)
|
||||
* dpm_suspend_late - Execute "late suspend" callbacks for all devices.
|
||||
* @state: PM transition of the system being carried out.
|
||||
*/
|
||||
static int dpm_suspend_late(pm_message_t state)
|
||||
int dpm_suspend_late(pm_message_t state)
|
||||
{
|
||||
ktime_t starttime = ktime_get();
|
||||
int error = 0;
|
||||
|
@ -679,12 +679,16 @@ struct dev_pm_domain {
|
||||
extern void device_pm_lock(void);
|
||||
extern void dpm_resume_start(pm_message_t state);
|
||||
extern void dpm_resume_end(pm_message_t state);
|
||||
extern void dpm_resume_noirq(pm_message_t state);
|
||||
extern void dpm_resume_early(pm_message_t state);
|
||||
extern void dpm_resume(pm_message_t state);
|
||||
extern void dpm_complete(pm_message_t state);
|
||||
|
||||
extern void device_pm_unlock(void);
|
||||
extern int dpm_suspend_end(pm_message_t state);
|
||||
extern int dpm_suspend_start(pm_message_t state);
|
||||
extern int dpm_suspend_noirq(pm_message_t state);
|
||||
extern int dpm_suspend_late(pm_message_t state);
|
||||
extern int dpm_suspend(pm_message_t state);
|
||||
extern int dpm_prepare(pm_message_t state);
|
||||
|
||||
|
@ -189,6 +189,8 @@ struct platform_suspend_ops {
|
||||
|
||||
struct platform_freeze_ops {
|
||||
int (*begin)(void);
|
||||
int (*prepare)(void);
|
||||
void (*restore)(void);
|
||||
void (*end)(void);
|
||||
};
|
||||
|
||||
|
@ -145,18 +145,30 @@ static int platform_suspend_prepare(suspend_state_t state)
|
||||
}
|
||||
|
||||
static int platform_suspend_prepare_late(suspend_state_t state)
|
||||
{
|
||||
return state == PM_SUSPEND_FREEZE && freeze_ops->prepare ?
|
||||
freeze_ops->prepare() : 0;
|
||||
}
|
||||
|
||||
static int platform_suspend_prepare_noirq(suspend_state_t state)
|
||||
{
|
||||
return state != PM_SUSPEND_FREEZE && suspend_ops->prepare_late ?
|
||||
suspend_ops->prepare_late() : 0;
|
||||
}
|
||||
|
||||
static void platform_suspend_wake(suspend_state_t state)
|
||||
static void platform_resume_noirq(suspend_state_t state)
|
||||
{
|
||||
if (state != PM_SUSPEND_FREEZE && suspend_ops->wake)
|
||||
suspend_ops->wake();
|
||||
}
|
||||
|
||||
static void platform_suspend_finish(suspend_state_t state)
|
||||
static void platform_resume_early(suspend_state_t state)
|
||||
{
|
||||
if (state == PM_SUSPEND_FREEZE && freeze_ops->restore)
|
||||
freeze_ops->restore();
|
||||
}
|
||||
|
||||
static void platform_resume_finish(suspend_state_t state)
|
||||
{
|
||||
if (state != PM_SUSPEND_FREEZE && suspend_ops->finish)
|
||||
suspend_ops->finish();
|
||||
@ -172,7 +184,7 @@ static int platform_suspend_begin(suspend_state_t state)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void platform_suspend_end(suspend_state_t state)
|
||||
static void platform_resume_end(suspend_state_t state)
|
||||
{
|
||||
if (state == PM_SUSPEND_FREEZE && freeze_ops && freeze_ops->end)
|
||||
freeze_ops->end();
|
||||
@ -180,7 +192,7 @@ static void platform_suspend_end(suspend_state_t state)
|
||||
suspend_ops->end();
|
||||
}
|
||||
|
||||
static void platform_suspend_recover(suspend_state_t state)
|
||||
static void platform_recover(suspend_state_t state)
|
||||
{
|
||||
if (state != PM_SUSPEND_FREEZE && suspend_ops->recover)
|
||||
suspend_ops->recover();
|
||||
@ -265,12 +277,21 @@ static int suspend_enter(suspend_state_t state, bool *wakeup)
|
||||
if (error)
|
||||
goto Platform_finish;
|
||||
|
||||
error = dpm_suspend_end(PMSG_SUSPEND);
|
||||
error = dpm_suspend_late(PMSG_SUSPEND);
|
||||
if (error) {
|
||||
printk(KERN_ERR "PM: Some devices failed to power down\n");
|
||||
printk(KERN_ERR "PM: late suspend of devices failed\n");
|
||||
goto Platform_finish;
|
||||
}
|
||||
error = platform_suspend_prepare_late(state);
|
||||
if (error)
|
||||
goto Devices_early_resume;
|
||||
|
||||
error = dpm_suspend_noirq(PMSG_SUSPEND);
|
||||
if (error) {
|
||||
printk(KERN_ERR "PM: noirq suspend of devices failed\n");
|
||||
goto Platform_early_resume;
|
||||
}
|
||||
error = platform_suspend_prepare_noirq(state);
|
||||
if (error)
|
||||
goto Platform_wake;
|
||||
|
||||
@ -318,11 +339,17 @@ static int suspend_enter(suspend_state_t state, bool *wakeup)
|
||||
enable_nonboot_cpus();
|
||||
|
||||
Platform_wake:
|
||||
platform_suspend_wake(state);
|
||||
dpm_resume_start(PMSG_RESUME);
|
||||
platform_resume_noirq(state);
|
||||
dpm_resume_noirq(PMSG_RESUME);
|
||||
|
||||
Platform_early_resume:
|
||||
platform_resume_early(state);
|
||||
|
||||
Devices_early_resume:
|
||||
dpm_resume_early(PMSG_RESUME);
|
||||
|
||||
Platform_finish:
|
||||
platform_suspend_finish(state);
|
||||
platform_resume_finish(state);
|
||||
return error;
|
||||
}
|
||||
|
||||
@ -366,11 +393,11 @@ int suspend_devices_and_enter(suspend_state_t state)
|
||||
trace_suspend_resume(TPS("resume_console"), state, false);
|
||||
|
||||
Close:
|
||||
platform_suspend_end(state);
|
||||
platform_resume_end(state);
|
||||
return error;
|
||||
|
||||
Recover_platform:
|
||||
platform_suspend_recover(state);
|
||||
platform_recover(state);
|
||||
goto Resume_devices;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user