aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-s3c64xx/cpuidle.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-s3c64xx/cpuidle.c')
-rw-r--r--arch/arm/mach-s3c64xx/cpuidle.c45
1 files changed, 15 insertions, 30 deletions
diff --git a/arch/arm/mach-s3c64xx/cpuidle.c b/arch/arm/mach-s3c64xx/cpuidle.c
index 179460f38db7..acb197ccf3f7 100644
--- a/arch/arm/mach-s3c64xx/cpuidle.c
+++ b/arch/arm/mach-s3c64xx/cpuidle.c
@@ -27,12 +27,7 @@ static int s3c64xx_enter_idle(struct cpuidle_device *dev,
27 struct cpuidle_driver *drv, 27 struct cpuidle_driver *drv,
28 int index) 28 int index)
29{ 29{
30 struct timeval before, after;
31 unsigned long tmp; 30 unsigned long tmp;
32 int idle_time;
33
34 local_irq_disable();
35 do_gettimeofday(&before);
36 31
37 /* Setup PWRCFG to enter idle mode */ 32 /* Setup PWRCFG to enter idle mode */
38 tmp = __raw_readl(S3C64XX_PWR_CFG); 33 tmp = __raw_readl(S3C64XX_PWR_CFG);
@@ -42,42 +37,32 @@ static int s3c64xx_enter_idle(struct cpuidle_device *dev,
42 37
43 cpu_do_idle(); 38 cpu_do_idle();
44 39
45 do_gettimeofday(&after);
46 local_irq_enable();
47 idle_time = (after.tv_sec - before.tv_sec) * USEC_PER_SEC +
48 (after.tv_usec - before.tv_usec);
49
50 dev->last_residency = idle_time;
51 return index; 40 return index;
52} 41}
53 42
54static struct cpuidle_state s3c64xx_cpuidle_set[] = { 43static DEFINE_PER_CPU(struct cpuidle_device, s3c64xx_cpuidle_device);
55 [0] = {
56 .enter = s3c64xx_enter_idle,
57 .exit_latency = 1,
58 .target_residency = 1,
59 .flags = CPUIDLE_FLAG_TIME_VALID,
60 .name = "IDLE",
61 .desc = "System active, ARM gated",
62 },
63};
64 44
65static struct cpuidle_driver s3c64xx_cpuidle_driver = { 45static struct cpuidle_driver s3c64xx_cpuidle_driver = {
66 .name = "s3c64xx_cpuidle", 46 .name = "s3c64xx_cpuidle",
67 .owner = THIS_MODULE, 47 .owner = THIS_MODULE,
68 .state_count = ARRAY_SIZE(s3c64xx_cpuidle_set), 48 .en_core_tk_irqen = 1,
69}; 49 .states = {
70 50 {
71static struct cpuidle_device s3c64xx_cpuidle_device = { 51 .enter = s3c64xx_enter_idle,
72 .state_count = ARRAY_SIZE(s3c64xx_cpuidle_set), 52 .exit_latency = 1,
53 .target_residency = 1,
54 .flags = CPUIDLE_FLAG_TIME_VALID,
55 .name = "IDLE",
56 .desc = "System active, ARM gated",
57 },
58 },
59 .state_count = 1,
73}; 60};
74 61
75static int __init s3c64xx_init_cpuidle(void) 62static int __init s3c64xx_init_cpuidle(void)
76{ 63{
77 int ret; 64 int ret;
78 65
79 memcpy(s3c64xx_cpuidle_driver.states, s3c64xx_cpuidle_set,
80 sizeof(s3c64xx_cpuidle_set));
81 cpuidle_register_driver(&s3c64xx_cpuidle_driver); 66 cpuidle_register_driver(&s3c64xx_cpuidle_driver);
82 67
83 ret = cpuidle_register_device(&s3c64xx_cpuidle_device); 68 ret = cpuidle_register_device(&s3c64xx_cpuidle_device);