Adding support for MOXA ART SoC. Testing port of linux-2.6.32.60-moxart.
[linux-3.6.7-moxart.git] / arch / arm / mach-shmobile / cpuidle.c
blob7b541e911ab4aebe99262ef74c8ec0fb6084c01c
1 /*
2 * CPUIdle support code for SH-Mobile ARM
4 * Copyright (C) 2011 Magnus Damm
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
8 * for more details.
9 */
11 #include <linux/pm.h>
12 #include <linux/cpuidle.h>
13 #include <linux/suspend.h>
14 #include <linux/module.h>
15 #include <linux/err.h>
16 #include <asm/cpuidle.h>
17 #include <asm/io.h>
19 static void shmobile_enter_wfi(void)
21 cpu_do_idle();
24 void (*shmobile_cpuidle_modes[CPUIDLE_STATE_MAX])(void) = {
25 shmobile_enter_wfi, /* regular sleep mode */
28 static int shmobile_cpuidle_enter(struct cpuidle_device *dev,
29 struct cpuidle_driver *drv,
30 int index)
32 shmobile_cpuidle_modes[index]();
34 return index;
37 static struct cpuidle_device shmobile_cpuidle_dev;
38 static struct cpuidle_driver shmobile_cpuidle_driver = {
39 .name = "shmobile_cpuidle",
40 .owner = THIS_MODULE,
41 .en_core_tk_irqen = 1,
42 .states[0] = ARM_CPUIDLE_WFI_STATE,
43 .safe_state_index = 0, /* C1 */
44 .state_count = 1,
47 void (*shmobile_cpuidle_setup)(struct cpuidle_driver *drv);
49 int shmobile_cpuidle_init(void)
51 struct cpuidle_device *dev = &shmobile_cpuidle_dev;
52 struct cpuidle_driver *drv = &shmobile_cpuidle_driver;
53 int i;
55 for (i = 0; i < CPUIDLE_STATE_MAX; i++)
56 drv->states[i].enter = shmobile_cpuidle_enter;
58 if (shmobile_cpuidle_setup)
59 shmobile_cpuidle_setup(drv);
61 cpuidle_register_driver(drv);
63 dev->state_count = drv->state_count;
64 cpuidle_register_device(dev);
66 return 0;