diff options
| author | Olof Johansson <olof@lixom.net> | 2012-05-19 18:44:36 -0400 |
|---|---|---|
| committer | Olof Johansson <olof@lixom.net> | 2012-05-19 18:44:36 -0400 |
| commit | b19861a2a550fac67c8bb92ba8045ede3b6c1286 (patch) | |
| tree | bd843281a854f69c677cb9f8af010de7cd7578d8 | |
| parent | 36be50515fe2aef61533b516fa2576a2c7fe7664 (diff) | |
| parent | aba607d63c71ef9b185fc7cb9637ab70a2d88491 (diff) | |
Merge branch 'next/cleanup-samsung-2' of git://git.kernel.org/pub/scm/linux/kernel/git/kgene/linux-samsung into late/cleanup
* 'next/cleanup-samsung-2' of git://git.kernel.org/pub/scm/linux/kernel/git/kgene/linux-samsung:
ARM: S3C64XX: use timekeeping wrapper on cpuidle
ARM: S3C64XX: declare the states with the new api on cpuidle
| -rw-r--r-- | arch/arm/mach-s3c64xx/cpuidle.c | 45 |
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 | ||
| 54 | static struct cpuidle_state s3c64xx_cpuidle_set[] = { | 43 | static 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 | ||
| 65 | static struct cpuidle_driver s3c64xx_cpuidle_driver = { | 45 | static 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 | { | |
| 71 | static 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 | ||
| 75 | static int __init s3c64xx_init_cpuidle(void) | 62 | static 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); |
