aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-kirkwood
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2011-11-07 13:13:52 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2011-11-07 13:13:52 -0500
commit3c00303206c3a1ccd86579efdc90bc35f140962e (patch)
tree66170c84b5ddaeb102aea3530517a26657b6ea29 /arch/arm/mach-kirkwood
parent83dbb15e9cd78a3619e3db36777e2f81d09b2914 (diff)
parentefb90582c575084723cc14302c1300cb26c7e01f (diff)
Merge branch 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux
* 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux: cpuidle: Single/Global registration of idle states cpuidle: Split cpuidle_state structure and move per-cpu statistics fields cpuidle: Remove CPUIDLE_FLAG_IGNORE and dev->prepare() cpuidle: Move dev->last_residency update to driver enter routine; remove dev->last_state ACPI: Fix CONFIG_ACPI_DOCK=n compiler warning ACPI: Export FADT pm_profile integer value to userspace thermal: Prevent polling from happening during system suspend ACPI: Drop ACPI_NO_HARDWARE_INIT ACPI atomicio: Convert width in bits to bytes in __acpi_ioremap_fast() PNPACPI: Simplify disabled resource registration ACPI: Fix possible recursive locking in hwregs.c ACPI: use kstrdup() mrst pmu: update comment tools/power turbostat: less verbose debugging
Diffstat (limited to 'arch/arm/mach-kirkwood')
-rw-r--r--arch/arm/mach-kirkwood/cpuidle.c42
1 files changed, 24 insertions, 18 deletions
diff --git a/arch/arm/mach-kirkwood/cpuidle.c b/arch/arm/mach-kirkwood/cpuidle.c
index 864e569f684e..7088180b018b 100644
--- a/arch/arm/mach-kirkwood/cpuidle.c
+++ b/arch/arm/mach-kirkwood/cpuidle.c
@@ -33,17 +33,18 @@ static DEFINE_PER_CPU(struct cpuidle_device, kirkwood_cpuidle_device);
33 33
34/* Actual code that puts the SoC in different idle states */ 34/* Actual code that puts the SoC in different idle states */
35static int kirkwood_enter_idle(struct cpuidle_device *dev, 35static int kirkwood_enter_idle(struct cpuidle_device *dev,
36 struct cpuidle_state *state) 36 struct cpuidle_driver *drv,
37 int index)
37{ 38{
38 struct timeval before, after; 39 struct timeval before, after;
39 int idle_time; 40 int idle_time;
40 41
41 local_irq_disable(); 42 local_irq_disable();
42 do_gettimeofday(&before); 43 do_gettimeofday(&before);
43 if (state == &dev->states[0]) 44 if (index == 0)
44 /* Wait for interrupt state */ 45 /* Wait for interrupt state */
45 cpu_do_idle(); 46 cpu_do_idle();
46 else if (state == &dev->states[1]) { 47 else if (index == 1) {
47 /* 48 /*
48 * Following write will put DDR in self refresh. 49 * Following write will put DDR in self refresh.
49 * Note that we have 256 cycles before DDR puts it 50 * Note that we have 256 cycles before DDR puts it
@@ -58,35 +59,40 @@ static int kirkwood_enter_idle(struct cpuidle_device *dev,
58 local_irq_enable(); 59 local_irq_enable();
59 idle_time = (after.tv_sec - before.tv_sec) * USEC_PER_SEC + 60 idle_time = (after.tv_sec - before.tv_sec) * USEC_PER_SEC +
60 (after.tv_usec - before.tv_usec); 61 (after.tv_usec - before.tv_usec);
61 return idle_time; 62
63 /* Update last residency */
64 dev->last_residency = idle_time;
65
66 return index;
62} 67}
63 68
64/* Initialize CPU idle by registering the idle states */ 69/* Initialize CPU idle by registering the idle states */
65static int kirkwood_init_cpuidle(void) 70static int kirkwood_init_cpuidle(void)
66{ 71{
67 struct cpuidle_device *device; 72 struct cpuidle_device *device;
68 73 struct cpuidle_driver *driver = &kirkwood_idle_driver;
69 cpuidle_register_driver(&kirkwood_idle_driver);
70 74
71 device = &per_cpu(kirkwood_cpuidle_device, smp_processor_id()); 75 device = &per_cpu(kirkwood_cpuidle_device, smp_processor_id());
72 device->state_count = KIRKWOOD_MAX_STATES; 76 device->state_count = KIRKWOOD_MAX_STATES;
77 driver->state_count = KIRKWOOD_MAX_STATES;
73 78
74 /* Wait for interrupt state */ 79 /* Wait for interrupt state */
75 device->states[0].enter = kirkwood_enter_idle; 80 driver->states[0].enter = kirkwood_enter_idle;
76 device->states[0].exit_latency = 1; 81 driver->states[0].exit_latency = 1;
77 device->states[0].target_residency = 10000; 82 driver->states[0].target_residency = 10000;
78 device->states[0].flags = CPUIDLE_FLAG_TIME_VALID; 83 driver->states[0].flags = CPUIDLE_FLAG_TIME_VALID;
79 strcpy(device->states[0].name, "WFI"); 84 strcpy(driver->states[0].name, "WFI");
80 strcpy(device->states[0].desc, "Wait for interrupt"); 85 strcpy(driver->states[0].desc, "Wait for interrupt");
81 86
82 /* Wait for interrupt and DDR self refresh state */ 87 /* Wait for interrupt and DDR self refresh state */
83 device->states[1].enter = kirkwood_enter_idle; 88 driver->states[1].enter = kirkwood_enter_idle;
84 device->states[1].exit_latency = 10; 89 driver->states[1].exit_latency = 10;
85 device->states[1].target_residency = 10000; 90 driver->states[1].target_residency = 10000;
86 device->states[1].flags = CPUIDLE_FLAG_TIME_VALID; 91 driver->states[1].flags = CPUIDLE_FLAG_TIME_VALID;
87 strcpy(device->states[1].name, "DDR SR"); 92 strcpy(driver->states[1].name, "DDR SR");
88 strcpy(device->states[1].desc, "WFI and DDR Self Refresh"); 93 strcpy(driver->states[1].desc, "WFI and DDR Self Refresh");
89 94
95 cpuidle_register_driver(&kirkwood_idle_driver);
90 if (cpuidle_register_device(device)) { 96 if (cpuidle_register_device(device)) {
91 printk(KERN_ERR "kirkwood_init_cpuidle: Failed registering\n"); 97 printk(KERN_ERR "kirkwood_init_cpuidle: Failed registering\n");
92 return -EIO; 98 return -EIO;