ARM: shmobile: Make sh7372 cpuidle handling more straightforward
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / arch / arm / mach-shmobile / cpuidle.c
blob9e050268cde4d237ab850a532b38c22cdb37c694
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 int shmobile_enter_wfi(struct cpuidle_device *dev, struct cpuidle_driver *drv,
20 int index)
22 cpu_do_idle();
23 return 0;
26 static struct cpuidle_device shmobile_cpuidle_dev;
27 static struct cpuidle_driver shmobile_cpuidle_default_driver = {
28 .name = "shmobile_cpuidle",
29 .owner = THIS_MODULE,
30 .en_core_tk_irqen = 1,
31 .states[0] = ARM_CPUIDLE_WFI_STATE,
32 .states[0].enter = shmobile_enter_wfi,
33 .safe_state_index = 0, /* C1 */
34 .state_count = 1,
37 static struct cpuidle_driver *cpuidle_drv = &shmobile_cpuidle_default_driver;
39 void shmobile_cpuidle_set_driver(struct cpuidle_driver *drv)
41 cpuidle_drv = drv;
44 int shmobile_cpuidle_init(void)
46 struct cpuidle_device *dev = &shmobile_cpuidle_dev;
48 cpuidle_register_driver(cpuidle_drv);
50 dev->state_count = cpuidle_drv->state_count;
51 cpuidle_register_device(dev);
53 return 0;