Staging: asus_oled: fix up my fixup for some sysfs attribute permissions
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / arch / arm / mach-s3c2416 / pm.c
blob4a04205b04d5f3c5a26ebe00a7c0397dd7aac07c
1 /* linux/arch/arm/mach-s3c2416/pm.c
3 * Copyright (c) 2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com
6 * S3C2416 - PM support (Based on Ben Dooks' S3C2412 PM support)
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/sysdev.h>
14 #include <linux/io.h>
16 #include <asm/cacheflush.h>
18 #include <mach/regs-power.h>
19 #include <mach/regs-s3c2443-clock.h>
21 #include <plat/cpu.h>
22 #include <plat/pm.h>
24 extern void s3c2412_sleep_enter(void);
26 static void s3c2416_cpu_suspend(void)
28 flush_cache_all();
30 /* enable wakeup sources regardless of battery state */
31 __raw_writel(S3C2443_PWRCFG_SLEEP, S3C2443_PWRCFG);
33 /* set the mode as sleep, 2BED represents "Go to BED" */
34 __raw_writel(0x2BED, S3C2443_PWRMODE);
36 s3c2412_sleep_enter();
39 static void s3c2416_pm_prepare(void)
42 * write the magic value u-boot uses to check for resume into
43 * the INFORM0 register, and ensure INFORM1 is set to the
44 * correct address to resume from.
46 __raw_writel(0x2BED, S3C2412_INFORM0);
47 __raw_writel(virt_to_phys(s3c_cpu_resume), S3C2412_INFORM1);
50 static int s3c2416_pm_add(struct sys_device *sysdev)
52 pm_cpu_prep = s3c2416_pm_prepare;
53 pm_cpu_sleep = s3c2416_cpu_suspend;
55 return 0;
58 static int s3c2416_pm_suspend(struct sys_device *dev, pm_message_t state)
60 return 0;
63 static int s3c2416_pm_resume(struct sys_device *dev)
65 /* unset the return-from-sleep amd inform flags */
66 __raw_writel(0x0, S3C2443_PWRMODE);
67 __raw_writel(0x0, S3C2412_INFORM0);
68 __raw_writel(0x0, S3C2412_INFORM1);
70 return 0;
73 static struct sysdev_driver s3c2416_pm_driver = {
74 .add = s3c2416_pm_add,
75 .suspend = s3c2416_pm_suspend,
76 .resume = s3c2416_pm_resume,
79 static __init int s3c2416_pm_init(void)
81 return sysdev_driver_register(&s3c2416_sysclass, &s3c2416_pm_driver);
84 arch_initcall(s3c2416_pm_init);