aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-davinci
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-03-30 19:45:38 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-03-30 19:45:39 -0400
commita335750b9a039a9d4cd727cdccacfb90fd63c4e8 (patch)
tree8f3198984fb75fe494e771d9431f6799228623c5 /arch/arm/mach-davinci
parent10f3cb41d48ab30f5c754b30eea557371892b4c2 (diff)
parentd326f44e5f2204c7a24db69bfc6dd3fe5f86182b (diff)
Merge branch 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux
Pull ACPI & Power Management changes from Len Brown: - ACPI 5.0 after-ripples, ACPICA/Linux divergence cleanup - cpuidle evolving, more ARM use - thermal sub-system evolving, ditto - assorted other PM bits Fix up conflicts in various cpuidle implementations due to ARM cpuidle cleanups (ARM at91 self-refresh and cpu idle code rewritten into "standby" in asm conflicting with the consolidation of cpuidle time keeping), trivial SH include file context conflict and RCU tracing fixes in generic code. * 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux: (77 commits) ACPI throttling: fix endian bug in acpi_read_throttling_status() Disable MCP limit exceeded messages from Intel IPS driver ACPI video: Don't start video device until its associated input device has been allocated ACPI video: Harden video bus adding. ACPI: Add support for exposing BGRT data ACPI: export acpi_kobj ACPI: Fix logic for removing mappings in 'acpi_unmap' CPER failed to handle generic error records with multiple sections ACPI: Clean redundant codes in scan.c ACPI: Fix unprotected smp_processor_id() in acpi_processor_cst_has_changed() ACPI: consistently use should_use_kmap() PNPACPI: Fix device ref leaking in acpi_pnp_match ACPI: Fix use-after-free in acpi_map_lsapic ACPI: processor_driver: add missing kfree ACPI, APEI: Fix incorrect APEI register bit width check and usage Update documentation for parameter *notrigger* in einj.txt ACPI, APEI, EINJ, new parameter to control trigger action ACPI, APEI, EINJ, limit the range of einj_param ACPI, APEI, Fix ERST header length check cpuidle: power_usage should be declared signed integer ...
Diffstat (limited to 'arch/arm/mach-davinci')
-rw-r--r--arch/arm/mach-davinci/cpuidle.c83
1 files changed, 34 insertions, 49 deletions
diff --git a/arch/arm/mach-davinci/cpuidle.c b/arch/arm/mach-davinci/cpuidle.c
index a30c7c5a6d83..9107691adbdb 100644
--- a/arch/arm/mach-davinci/cpuidle.c
+++ b/arch/arm/mach-davinci/cpuidle.c
@@ -18,6 +18,7 @@
18#include <linux/io.h> 18#include <linux/io.h>
19#include <linux/export.h> 19#include <linux/export.h>
20#include <asm/proc-fns.h> 20#include <asm/proc-fns.h>
21#include <asm/cpuidle.h>
21 22
22#include <mach/cpuidle.h> 23#include <mach/cpuidle.h>
23#include <mach/ddr2.h> 24#include <mach/ddr2.h>
@@ -30,12 +31,43 @@ struct davinci_ops {
30 u32 flags; 31 u32 flags;
31}; 32};
32 33
34/* Actual code that puts the SoC in different idle states */
35static int davinci_enter_idle(struct cpuidle_device *dev,
36 struct cpuidle_driver *drv,
37 int index)
38{
39 struct cpuidle_state_usage *state_usage = &dev->states_usage[index];
40 struct davinci_ops *ops = cpuidle_get_statedata(state_usage);
41
42 if (ops && ops->enter)
43 ops->enter(ops->flags);
44
45 index = cpuidle_wrap_enter(dev, drv, index,
46 arm_cpuidle_simple_enter);
47
48 if (ops && ops->exit)
49 ops->exit(ops->flags);
50
51 return index;
52}
53
33/* fields in davinci_ops.flags */ 54/* fields in davinci_ops.flags */
34#define DAVINCI_CPUIDLE_FLAGS_DDR2_PWDN BIT(0) 55#define DAVINCI_CPUIDLE_FLAGS_DDR2_PWDN BIT(0)
35 56
36static struct cpuidle_driver davinci_idle_driver = { 57static struct cpuidle_driver davinci_idle_driver = {
37 .name = "cpuidle-davinci", 58 .name = "cpuidle-davinci",
38 .owner = THIS_MODULE, 59 .owner = THIS_MODULE,
60 .en_core_tk_irqen = 1,
61 .states[0] = ARM_CPUIDLE_WFI_STATE,
62 .states[1] = {
63 .enter = davinci_enter_idle,
64 .exit_latency = 10,
65 .target_residency = 100000,
66 .flags = CPUIDLE_FLAG_TIME_VALID,
67 .name = "DDR SR",
68 .desc = "WFI and DDR Self Refresh",
69 },
70 .state_count = DAVINCI_CPUIDLE_MAX_STATES,
39}; 71};
40 72
41static DEFINE_PER_CPU(struct cpuidle_device, davinci_cpuidle_device); 73static DEFINE_PER_CPU(struct cpuidle_device, davinci_cpuidle_device);
@@ -77,41 +109,10 @@ static struct davinci_ops davinci_states[DAVINCI_CPUIDLE_MAX_STATES] = {
77 }, 109 },
78}; 110};
79 111
80/* Actual code that puts the SoC in different idle states */
81static int davinci_enter_idle(struct cpuidle_device *dev,
82 struct cpuidle_driver *drv,
83 int index)
84{
85 struct cpuidle_state_usage *state_usage = &dev->states_usage[index];
86 struct davinci_ops *ops = cpuidle_get_statedata(state_usage);
87 struct timeval before, after;
88 int idle_time;
89
90 local_irq_disable();
91 do_gettimeofday(&before);
92
93 if (ops && ops->enter)
94 ops->enter(ops->flags);
95 /* Wait for interrupt state */
96 cpu_do_idle();
97 if (ops && ops->exit)
98 ops->exit(ops->flags);
99
100 do_gettimeofday(&after);
101 local_irq_enable();
102 idle_time = (after.tv_sec - before.tv_sec) * USEC_PER_SEC +
103 (after.tv_usec - before.tv_usec);
104
105 dev->last_residency = idle_time;
106
107 return index;
108}
109
110static int __init davinci_cpuidle_probe(struct platform_device *pdev) 112static int __init davinci_cpuidle_probe(struct platform_device *pdev)
111{ 113{
112 int ret; 114 int ret;
113 struct cpuidle_device *device; 115 struct cpuidle_device *device;
114 struct cpuidle_driver *driver = &davinci_idle_driver;
115 struct davinci_cpuidle_config *pdata = pdev->dev.platform_data; 116 struct davinci_cpuidle_config *pdata = pdev->dev.platform_data;
116 117
117 device = &per_cpu(davinci_cpuidle_device, smp_processor_id()); 118 device = &per_cpu(davinci_cpuidle_device, smp_processor_id());
@@ -123,27 +124,11 @@ static int __init davinci_cpuidle_probe(struct platform_device *pdev)
123 124
124 ddr2_reg_base = pdata->ddr2_ctlr_base; 125 ddr2_reg_base = pdata->ddr2_ctlr_base;
125 126
126 /* Wait for interrupt state */
127 driver->states[0].enter = davinci_enter_idle;
128 driver->states[0].exit_latency = 1;
129 driver->states[0].target_residency = 10000;
130 driver->states[0].flags = CPUIDLE_FLAG_TIME_VALID;
131 strcpy(driver->states[0].name, "WFI");
132 strcpy(driver->states[0].desc, "Wait for interrupt");
133
134 /* Wait for interrupt and DDR self refresh state */
135 driver->states[1].enter = davinci_enter_idle;
136 driver->states[1].exit_latency = 10;
137 driver->states[1].target_residency = 10000;
138 driver->states[1].flags = CPUIDLE_FLAG_TIME_VALID;
139 strcpy(driver->states[1].name, "DDR SR");
140 strcpy(driver->states[1].desc, "WFI and DDR Self Refresh");
141 if (pdata->ddr2_pdown) 127 if (pdata->ddr2_pdown)
142 davinci_states[1].flags |= DAVINCI_CPUIDLE_FLAGS_DDR2_PWDN; 128 davinci_states[1].flags |= DAVINCI_CPUIDLE_FLAGS_DDR2_PWDN;
143 cpuidle_set_statedata(&device->states_usage[1], &davinci_states[1]); 129 cpuidle_set_statedata(&device->states_usage[1], &davinci_states[1]);
144 130
145 device->state_count = DAVINCI_CPUIDLE_MAX_STATES; 131 device->state_count = DAVINCI_CPUIDLE_MAX_STATES;
146 driver->state_count = DAVINCI_CPUIDLE_MAX_STATES;
147 132
148 ret = cpuidle_register_driver(&davinci_idle_driver); 133 ret = cpuidle_register_driver(&davinci_idle_driver);
149 if (ret) { 134 if (ret) {