aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sh
diff options
context:
space:
mode:
authorFrancesco VIRLINZI <francesco.virlinzi@st.com>2009-03-11 06:39:02 -0400
committerPaul Mundt <lethal@linux-sh.org>2009-03-16 06:46:17 -0400
commita83c0b739f3ad1887704cfa9f1ee5ee208cf1532 (patch)
tree213fac95be0a7215a2f381c421b93bc1466e08a2 /arch/sh
parent039a718ebb37298de87801288673859ac40b6fc4 (diff)
sh: PMB hibernation support
This implements preliminary suspend/resume support for the PMB. Signed-off-by: Francesco Virlinzi <francesco.virlinzi@st.com> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch/sh')
-rw-r--r--arch/sh/mm/pmb.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/arch/sh/mm/pmb.c b/arch/sh/mm/pmb.c
index 84241676265e..b1a714a92b14 100644
--- a/arch/sh/mm/pmb.c
+++ b/arch/sh/mm/pmb.c
@@ -15,6 +15,8 @@
15 */ 15 */
16#include <linux/init.h> 16#include <linux/init.h>
17#include <linux/kernel.h> 17#include <linux/kernel.h>
18#include <linux/sysdev.h>
19#include <linux/cpu.h>
18#include <linux/module.h> 20#include <linux/module.h>
19#include <linux/slab.h> 21#include <linux/slab.h>
20#include <linux/bitops.h> 22#include <linux/bitops.h>
@@ -402,3 +404,39 @@ static int __init pmb_debugfs_init(void)
402 return 0; 404 return 0;
403} 405}
404postcore_initcall(pmb_debugfs_init); 406postcore_initcall(pmb_debugfs_init);
407
408#ifdef CONFIG_PM
409static int pmb_sysdev_suspend(struct sys_device *dev, pm_message_t state)
410{
411 static pm_message_t prev_state;
412
413 /* Restore the PMB after a resume from hibernation */
414 if (state.event == PM_EVENT_ON &&
415 prev_state.event == PM_EVENT_FREEZE) {
416 struct pmb_entry *pmbe;
417 spin_lock_irq(&pmb_list_lock);
418 for (pmbe = pmb_list; pmbe; pmbe = pmbe->next)
419 set_pmb_entry(pmbe);
420 spin_unlock_irq(&pmb_list_lock);
421 }
422 prev_state = state;
423 return 0;
424}
425
426static int pmb_sysdev_resume(struct sys_device *dev)
427{
428 return pmb_sysdev_suspend(dev, PMSG_ON);
429}
430
431static struct sysdev_driver pmb_sysdev_driver = {
432 .suspend = pmb_sysdev_suspend,
433 .resume = pmb_sysdev_resume,
434};
435
436static int __init pmb_sysdev_init(void)
437{
438 return sysdev_driver_register(&cpu_sysdev_class, &pmb_sysdev_driver);
439}
440
441subsys_initcall(pmb_sysdev_init);
442#endif