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/platform_device.h>
23 #include <mach/hardware.h>
24 #include <asm/cacheflush.h>
27 #include <mach/regs-power.h>
28 #include <mach/regs-gpioj.h>
29 #include <mach/regs-gpio.h>
30 #include <mach/regs-dsc.h>
35 #include <plat/s3c2412.h>
37 extern void s3c2412_sleep_enter(void);
39 static void s3c2412_cpu_suspend(void)
45 /* set our standby method to sleep */
47 tmp
= __raw_readl(S3C2412_PWRCFG
);
48 tmp
|= S3C2412_PWRCFG_STANDBYWFI_SLEEP
;
49 __raw_writel(tmp
, S3C2412_PWRCFG
);
51 s3c2412_sleep_enter();
54 static void s3c2412_pm_prepare(void)
58 static int s3c2412_pm_add(struct sys_device
*sysdev
)
60 pm_cpu_prep
= s3c2412_pm_prepare
;
61 pm_cpu_sleep
= s3c2412_cpu_suspend
;
66 static struct sleep_save s3c2412_sleep
[] = {
67 SAVE_ITEM(S3C2412_DSC0
),
68 SAVE_ITEM(S3C2412_DSC1
),
69 SAVE_ITEM(S3C2413_GPJDAT
),
70 SAVE_ITEM(S3C2413_GPJCON
),
71 SAVE_ITEM(S3C2413_GPJUP
),
73 /* save the PWRCFG to get back to original sleep method */
75 SAVE_ITEM(S3C2412_PWRCFG
),
77 /* save the sleep configuration anyway, just in case these
78 * get damaged during wakeup */
80 SAVE_ITEM(S3C2412_GPBSLPCON
),
81 SAVE_ITEM(S3C2412_GPCSLPCON
),
82 SAVE_ITEM(S3C2412_GPDSLPCON
),
83 SAVE_ITEM(S3C2412_GPFSLPCON
),
84 SAVE_ITEM(S3C2412_GPGSLPCON
),
85 SAVE_ITEM(S3C2412_GPHSLPCON
),
86 SAVE_ITEM(S3C2413_GPJSLPCON
),
89 static int s3c2412_pm_suspend(struct sys_device
*dev
, pm_message_t state
)
91 s3c_pm_do_save(s3c2412_sleep
, ARRAY_SIZE(s3c2412_sleep
));
95 static int s3c2412_pm_resume(struct sys_device
*dev
)
99 tmp
= __raw_readl(S3C2412_PWRCFG
);
100 tmp
&= ~S3C2412_PWRCFG_STANDBYWFI_MASK
;
101 tmp
|= S3C2412_PWRCFG_STANDBYWFI_IDLE
;
102 __raw_writel(tmp
, S3C2412_PWRCFG
);
104 s3c_pm_do_restore(s3c2412_sleep
, ARRAY_SIZE(s3c2412_sleep
));
108 static struct sysdev_driver s3c2412_pm_driver
= {
109 .add
= s3c2412_pm_add
,
110 .suspend
= s3c2412_pm_suspend
,
111 .resume
= s3c2412_pm_resume
,
114 static __init
int s3c2412_pm_init(void)
116 return sysdev_driver_register(&s3c2412_sysclass
, &s3c2412_pm_driver
);
119 arch_initcall(s3c2412_pm_init
);