Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
cpuidle.c
Go to the documentation of this file.
1 /*
2  * CPUIdle support code for SH-Mobile ARM
3  *
4  * Copyright (C) 2011 Magnus Damm
5  *
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  */
10 
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>
18 
20  int index)
21 {
22  cpu_do_idle();
23  return 0;
24 }
25 
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,
35 };
36 
37 static struct cpuidle_driver *cpuidle_drv = &shmobile_cpuidle_default_driver;
38 
40 {
41  cpuidle_drv = drv;
42 }
43 
45 {
46  struct cpuidle_device *dev = &shmobile_cpuidle_dev;
47 
48  cpuidle_register_driver(cpuidle_drv);
49 
50  dev->state_count = cpuidle_drv->state_count;
52 
53  return 0;
54 }