Commit e5c86131 authored by Stephen Rothwell's avatar Stephen Rothwell

Merge commit 'suspend/linux-next'

parents e15e3b5e 33f82d14
This diff is collapsed.
...@@ -4151,7 +4151,7 @@ static void floppy_device_release(struct device *dev) ...@@ -4151,7 +4151,7 @@ static void floppy_device_release(struct device *dev)
{ {
} }
static int floppy_resume(struct platform_device *dev) static int floppy_resume(struct device *dev)
{ {
int fdc; int fdc;
...@@ -4162,10 +4162,15 @@ static int floppy_resume(struct platform_device *dev) ...@@ -4162,10 +4162,15 @@ static int floppy_resume(struct platform_device *dev)
return 0; return 0;
} }
static struct platform_driver floppy_driver = { static struct dev_pm_ops floppy_pm_ops = {
.resume = floppy_resume, .resume = floppy_resume,
.restore = floppy_resume,
};
static struct platform_driver floppy_driver = {
.driver = { .driver = {
.name = "floppy", .name = "floppy",
.pm = &floppy_pm_ops,
}, },
}; };
......
...@@ -1168,32 +1168,37 @@ static void at_dma_shutdown(struct platform_device *pdev) ...@@ -1168,32 +1168,37 @@ static void at_dma_shutdown(struct platform_device *pdev)
clk_disable(atdma->clk); clk_disable(atdma->clk);
} }
static int at_dma_suspend_late(struct platform_device *pdev, pm_message_t mesg) static int at_dma_suspend_noirq(struct device *dev)
{ {
struct at_dma *atdma = platform_get_drvdata(pdev); struct platform_device *pdev = to_platform_device(dev);
struct at_dma *atdma = platform_get_drvdata(pdev);
at_dma_off(platform_get_drvdata(pdev)); at_dma_off(platform_get_drvdata(pdev));
clk_disable(atdma->clk); clk_disable(atdma->clk);
return 0; return 0;
} }
static int at_dma_resume_early(struct platform_device *pdev) static int at_dma_resume_noirq(struct device *dev)
{ {
struct at_dma *atdma = platform_get_drvdata(pdev); struct platform_device *pdev = to_platform_device(dev);
struct at_dma *atdma = platform_get_drvdata(pdev);
clk_enable(atdma->clk); clk_enable(atdma->clk);
dma_writel(atdma, EN, AT_DMA_ENABLE); dma_writel(atdma, EN, AT_DMA_ENABLE);
return 0; return 0;
} }
static struct dev_pm_ops at_dma_dev_pm_ops = {
.suspend_noirq = at_dma_suspend_noirq,
.resume_noirq = at_dma_resume_noirq,
};
static struct platform_driver at_dma_driver = { static struct platform_driver at_dma_driver = {
.remove = __exit_p(at_dma_remove), .remove = __exit_p(at_dma_remove),
.shutdown = at_dma_shutdown, .shutdown = at_dma_shutdown,
.suspend_late = at_dma_suspend_late,
.resume_early = at_dma_resume_early,
.driver = { .driver = {
.name = "at_hdmac", .name = "at_hdmac",
.pm = &at_dma_dev_pm_ops,
}, },
}; };
......
...@@ -53,7 +53,7 @@ MODULE_ALIAS("wmi:5FB7F034-2C63-45e9-BE91-3D44E2C707E4"); ...@@ -53,7 +53,7 @@ MODULE_ALIAS("wmi:5FB7F034-2C63-45e9-BE91-3D44E2C707E4");
static int __init hp_wmi_bios_setup(struct platform_device *device); static int __init hp_wmi_bios_setup(struct platform_device *device);
static int __exit hp_wmi_bios_remove(struct platform_device *device); static int __exit hp_wmi_bios_remove(struct platform_device *device);
static int hp_wmi_resume_handler(struct platform_device *device); static int hp_wmi_resume_handler(struct device *device);
struct bios_args { struct bios_args {
u32 signature; u32 signature;
...@@ -94,14 +94,19 @@ static struct rfkill *wifi_rfkill; ...@@ -94,14 +94,19 @@ static struct rfkill *wifi_rfkill;
static struct rfkill *bluetooth_rfkill; static struct rfkill *bluetooth_rfkill;
static struct rfkill *wwan_rfkill; static struct rfkill *wwan_rfkill;
static struct dev_pm_ops hp_wmi_pm_ops = {
.resume = hp_wmi_resume_handler,
.restore = hp_wmi_resume_handler,
};
static struct platform_driver hp_wmi_driver = { static struct platform_driver hp_wmi_driver = {
.driver = { .driver = {
.name = "hp-wmi", .name = "hp-wmi",
.owner = THIS_MODULE, .owner = THIS_MODULE,
.pm = &hp_wmi_pm_ops,
}, },
.probe = hp_wmi_bios_setup, .probe = hp_wmi_bios_setup,
.remove = hp_wmi_bios_remove, .remove = hp_wmi_bios_remove,
.resume = hp_wmi_resume_handler,
}; };
static int hp_wmi_perform_query(int query, int write, int value) static int hp_wmi_perform_query(int query, int write, int value)
...@@ -512,7 +517,7 @@ static int __exit hp_wmi_bios_remove(struct platform_device *device) ...@@ -512,7 +517,7 @@ static int __exit hp_wmi_bios_remove(struct platform_device *device)
return 0; return 0;
} }
static int hp_wmi_resume_handler(struct platform_device *device) static int hp_wmi_resume_handler(struct device *device)
{ {
/* /*
* Hardware state may have changed while suspended, so trigger * Hardware state may have changed while suspended, so trigger
......
...@@ -213,6 +213,20 @@ struct dev_pm_ops { ...@@ -213,6 +213,20 @@ struct dev_pm_ops {
int (*runtime_idle)(struct device *dev); int (*runtime_idle)(struct device *dev);
}; };
/*
* Use this if you want to use the same suspend and resume callbacks for suspend
* to RAM and hibernation.
*/
#define SIMPLE_DEV_PM_OPS(name, suspend_fn, resume_fn) \
struct dev_pm_ops name = { \
.suspend = suspend_fn, \
.resume = resume_fn, \
.freeze = suspend_fn, \
.thaw = resume_fn, \
.poweroff = suspend_fn, \
.restore = resume_fn, \
}
/** /**
* PM_EVENT_ messages * PM_EVENT_ messages
* *
......
...@@ -298,8 +298,8 @@ int hibernation_snapshot(int platform_mode) ...@@ -298,8 +298,8 @@ int hibernation_snapshot(int platform_mode)
if (error) if (error)
return error; return error;
/* Free memory before shutting down devices. */ /* Preallocate image memory before shutting down devices. */
error = swsusp_shrink_memory(); error = hibernate_preallocate_memory();
if (error) if (error)
goto Close; goto Close;
...@@ -315,6 +315,10 @@ int hibernation_snapshot(int platform_mode) ...@@ -315,6 +315,10 @@ int hibernation_snapshot(int platform_mode)
/* Control returns here after successful restore */ /* Control returns here after successful restore */
Resume_devices: Resume_devices:
/* We may need to release the preallocated image pages here. */
if (error || !in_suspend)
swsusp_free();
dpm_resume_end(in_suspend ? dpm_resume_end(in_suspend ?
(error ? PMSG_RECOVER : PMSG_THAW) : PMSG_RESTORE); (error ? PMSG_RECOVER : PMSG_THAW) : PMSG_RESTORE);
resume_console(); resume_console();
...@@ -460,11 +464,11 @@ int hibernation_platform_enter(void) ...@@ -460,11 +464,11 @@ int hibernation_platform_enter(void)
error = hibernation_ops->prepare(); error = hibernation_ops->prepare();
if (error) if (error)
goto Platofrm_finish; goto Platform_finish;
error = disable_nonboot_cpus(); error = disable_nonboot_cpus();
if (error) if (error)
goto Platofrm_finish; goto Platform_finish;
local_irq_disable(); local_irq_disable();
sysdev_suspend(PMSG_HIBERNATE); sysdev_suspend(PMSG_HIBERNATE);
...@@ -476,7 +480,7 @@ int hibernation_platform_enter(void) ...@@ -476,7 +480,7 @@ int hibernation_platform_enter(void)
* We don't need to reenable the nonboot CPUs or resume consoles, since * We don't need to reenable the nonboot CPUs or resume consoles, since
* the system is going to be halted anyway. * the system is going to be halted anyway.
*/ */
Platofrm_finish: Platform_finish:
hibernation_ops->finish(); hibernation_ops->finish();
dpm_suspend_noirq(PMSG_RESTORE); dpm_suspend_noirq(PMSG_RESTORE);
...@@ -578,7 +582,10 @@ int hibernate(void) ...@@ -578,7 +582,10 @@ int hibernate(void)
goto Thaw; goto Thaw;
error = hibernation_snapshot(hibernation_mode == HIBERNATION_PLATFORM); error = hibernation_snapshot(hibernation_mode == HIBERNATION_PLATFORM);
if (in_suspend && !error) { if (error)
goto Thaw;
if (in_suspend) {
unsigned int flags = 0; unsigned int flags = 0;
if (hibernation_mode == HIBERNATION_PLATFORM) if (hibernation_mode == HIBERNATION_PLATFORM)
...@@ -590,8 +597,8 @@ int hibernate(void) ...@@ -590,8 +597,8 @@ int hibernate(void)
power_down(); power_down();
} else { } else {
pr_debug("PM: Image restored successfully.\n"); pr_debug("PM: Image restored successfully.\n");
swsusp_free();
} }
Thaw: Thaw:
thaw_processes(); thaw_processes();
Finish: Finish:
......
...@@ -74,7 +74,7 @@ extern asmlinkage int swsusp_arch_resume(void); ...@@ -74,7 +74,7 @@ extern asmlinkage int swsusp_arch_resume(void);
extern int create_basic_memory_bitmaps(void); extern int create_basic_memory_bitmaps(void);
extern void free_basic_memory_bitmaps(void); extern void free_basic_memory_bitmaps(void);
extern int swsusp_shrink_memory(void); extern int hibernate_preallocate_memory(void);
/** /**
* Auxiliary structure used for reading the snapshot image data and * Auxiliary structure used for reading the snapshot image data and
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment