bluetooth: hci_core: defer hci_unregister_sysfs()
[pv_ops_mirror.git] / arch / arm / mach-s3c2412 / pm.c
blobd4ffb2d98076d25674491d2af7b286c3f737eeb6
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>
22 #include <asm/hardware.h>
23 #include <asm/io.h>
24 #include <asm/irq.h>
26 #include <asm/arch/regs-power.h>
27 #include <asm/arch/regs-gpioj.h>
28 #include <asm/arch/regs-gpio.h>
29 #include <asm/arch/regs-dsc.h>
31 #include <asm/plat-s3c24xx/cpu.h>
32 #include <asm/plat-s3c24xx/pm.h>
34 #include <asm/plat-s3c24xx/s3c2412.h>
36 extern void s3c2412_sleep_enter(void);
38 static void s3c2412_cpu_suspend(void)
40 unsigned long tmp;
42 /* set our standby method to sleep */
44 tmp = __raw_readl(S3C2412_PWRCFG);
45 tmp |= S3C2412_PWRCFG_STANDBYWFI_SLEEP;
46 __raw_writel(tmp, S3C2412_PWRCFG);
48 s3c2412_sleep_enter();
51 static void s3c2412_pm_prepare(void)
55 static int s3c2412_pm_add(struct sys_device *sysdev)
57 pm_cpu_prep = s3c2412_pm_prepare;
58 pm_cpu_sleep = s3c2412_cpu_suspend;
60 return 0;
63 static struct sleep_save s3c2412_sleep[] = {
64 SAVE_ITEM(S3C2412_DSC0),
65 SAVE_ITEM(S3C2412_DSC1),
66 SAVE_ITEM(S3C2413_GPJDAT),
67 SAVE_ITEM(S3C2413_GPJCON),
68 SAVE_ITEM(S3C2413_GPJUP),
70 /* save the PWRCFG to get back to original sleep method */
72 SAVE_ITEM(S3C2412_PWRCFG),
74 /* save the sleep configuration anyway, just in case these
75 * get damaged during wakeup */
77 SAVE_ITEM(S3C2412_GPBSLPCON),
78 SAVE_ITEM(S3C2412_GPCSLPCON),
79 SAVE_ITEM(S3C2412_GPDSLPCON),
80 SAVE_ITEM(S3C2412_GPFSLPCON),
81 SAVE_ITEM(S3C2412_GPGSLPCON),
82 SAVE_ITEM(S3C2412_GPHSLPCON),
83 SAVE_ITEM(S3C2413_GPJSLPCON),
86 static int s3c2412_pm_suspend(struct sys_device *dev, pm_message_t state)
88 s3c2410_pm_do_save(s3c2412_sleep, ARRAY_SIZE(s3c2412_sleep));
89 return 0;
92 static int s3c2412_pm_resume(struct sys_device *dev)
94 unsigned long tmp;
96 tmp = __raw_readl(S3C2412_PWRCFG);
97 tmp &= ~S3C2412_PWRCFG_STANDBYWFI_MASK;
98 tmp |= S3C2412_PWRCFG_STANDBYWFI_IDLE;
99 __raw_writel(tmp, S3C2412_PWRCFG);
101 s3c2410_pm_do_restore(s3c2412_sleep, ARRAY_SIZE(s3c2412_sleep));
102 return 0;
105 static struct sysdev_driver s3c2412_pm_driver = {
106 .add = s3c2412_pm_add,
107 .suspend = s3c2412_pm_suspend,
108 .resume = s3c2412_pm_resume,
111 static __init int s3c2412_pm_init(void)
113 return sysdev_driver_register(&s3c2412_sysclass, &s3c2412_pm_driver);
116 arch_initcall(s3c2412_pm_init);