sysfs: Remove support for tagged directories with untagged members (again)
[linux-btrfs-devel.git] / arch / arm / mach-s3c2412 / pm.c
blobf4077efa51fa4d4b4a2f7550c8298cc392cd9010
1 /* linux/arch/arm/mach-s3c2412/pm.c
3 * Copyright (c) 2006 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk>
6 * http://armlinux.simtec.co.uk/.
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
13 #include <linux/kernel.h>
14 #include <linux/types.h>
15 #include <linux/interrupt.h>
16 #include <linux/list.h>
17 #include <linux/timer.h>
18 #include <linux/init.h>
19 #include <linux/sysdev.h>
20 #include <linux/syscore_ops.h>
21 #include <linux/platform_device.h>
22 #include <linux/io.h>
24 #include <mach/hardware.h>
25 #include <asm/cacheflush.h>
26 #include <asm/irq.h>
28 #include <mach/regs-power.h>
29 #include <mach/regs-gpioj.h>
30 #include <mach/regs-gpio.h>
31 #include <mach/regs-dsc.h>
33 #include <plat/cpu.h>
34 #include <plat/pm.h>
36 #include <plat/s3c2412.h>
38 extern void s3c2412_sleep_enter(void);
40 static int s3c2412_cpu_suspend(unsigned long arg)
42 unsigned long tmp;
44 /* set our standby method to sleep */
46 tmp = __raw_readl(S3C2412_PWRCFG);
47 tmp |= S3C2412_PWRCFG_STANDBYWFI_SLEEP;
48 __raw_writel(tmp, S3C2412_PWRCFG);
50 s3c2412_sleep_enter();
52 panic("sleep resumed to originator?");
55 static void s3c2412_pm_prepare(void)
59 static int s3c2412_pm_add(struct sys_device *sysdev)
61 pm_cpu_prep = s3c2412_pm_prepare;
62 pm_cpu_sleep = s3c2412_cpu_suspend;
64 return 0;
67 static struct sleep_save s3c2412_sleep[] = {
68 SAVE_ITEM(S3C2412_DSC0),
69 SAVE_ITEM(S3C2412_DSC1),
70 SAVE_ITEM(S3C2413_GPJDAT),
71 SAVE_ITEM(S3C2413_GPJCON),
72 SAVE_ITEM(S3C2413_GPJUP),
74 /* save the PWRCFG to get back to original sleep method */
76 SAVE_ITEM(S3C2412_PWRCFG),
78 /* save the sleep configuration anyway, just in case these
79 * get damaged during wakeup */
81 SAVE_ITEM(S3C2412_GPBSLPCON),
82 SAVE_ITEM(S3C2412_GPCSLPCON),
83 SAVE_ITEM(S3C2412_GPDSLPCON),
84 SAVE_ITEM(S3C2412_GPFSLPCON),
85 SAVE_ITEM(S3C2412_GPGSLPCON),
86 SAVE_ITEM(S3C2412_GPHSLPCON),
87 SAVE_ITEM(S3C2413_GPJSLPCON),
90 static struct sysdev_driver s3c2412_pm_driver = {
91 .add = s3c2412_pm_add,
94 static __init int s3c2412_pm_init(void)
96 return sysdev_driver_register(&s3c2412_sysclass, &s3c2412_pm_driver);
99 arch_initcall(s3c2412_pm_init);
101 static int s3c2412_pm_suspend(void)
103 s3c_pm_do_save(s3c2412_sleep, ARRAY_SIZE(s3c2412_sleep));
104 return 0;
107 static void s3c2412_pm_resume(void)
109 unsigned long tmp;
111 tmp = __raw_readl(S3C2412_PWRCFG);
112 tmp &= ~S3C2412_PWRCFG_STANDBYWFI_MASK;
113 tmp |= S3C2412_PWRCFG_STANDBYWFI_IDLE;
114 __raw_writel(tmp, S3C2412_PWRCFG);
116 s3c_pm_do_restore(s3c2412_sleep, ARRAY_SIZE(s3c2412_sleep));
119 struct syscore_ops s3c2412_pm_syscore_ops = {
120 .suspend = s3c2412_pm_suspend,
121 .resume = s3c2412_pm_resume,