diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2013-04-30 18:21:02 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-04-30 18:21:02 -0400 |
commit | 3ed1c478eff8db80e234d5446cb378b503135888 (patch) | |
tree | e1c8e0f488ca49c49b5a31fe59add4254381dd4b /arch/arm/mach-davinci | |
parent | 151173e8ce9b95bbbbd7eedb9035cfaffbdb7cb2 (diff) | |
parent | 371deb9500831ad1afbf9ea00e373f650deaed2f (diff) |
Merge tag 'pm+acpi-3.10-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
Pull power management and ACPI updates from Rafael J Wysocki:
- ARM big.LITTLE cpufreq driver from Viresh Kumar.
- exynos5440 cpufreq driver from Amit Daniel Kachhap.
- cpufreq core cleanup and code consolidation from Viresh Kumar and
Stratos Karafotis.
- cpufreq scalability improvement from Nathan Zimmer.
- AMD "frequency sensitivity feedback" powersave bias for the ondemand
cpufreq governor from Jacob Shin.
- cpuidle code consolidation and cleanups from Daniel Lezcano.
- ARM OMAP cpuidle fixes from Santosh Shilimkar and Daniel Lezcano.
- ACPICA fixes and other improvements from Bob Moore, Jung-uk Kim, Lv
Zheng, Yinghai Lu, Tang Chen, Colin Ian King, and Linn Crosetto.
- ACPI core updates related to hotplug from Toshi Kani, Paul Bolle,
Yasuaki Ishimatsu, and Rafael J Wysocki.
- Intel Lynxpoint LPSS (Low-Power Subsystem) support improvements from
Rafael J Wysocki and Andy Shevchenko.
* tag 'pm+acpi-3.10-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: (192 commits)
cpufreq: Revert incorrect commit 5800043
cpufreq: MAINTAINERS: Add co-maintainer
cpuidle: add maintainer entry
ACPI / thermal: do not always return THERMAL_TREND_RAISING for active trip points
ARM: s3c64xx: cpuidle: use init/exit common routine
cpufreq: pxa2xx: initialize variables
ACPI: video: correct acpi_video_bus_add error processing
SH: cpuidle: use init/exit common routine
ARM: S5pv210: compiling issue, ARM_S5PV210_CPUFREQ needs CONFIG_CPU_FREQ_TABLE=y
ACPI: Fix wrong parameter passed to memblock_reserve
cpuidle: fix comment format
pnp: use %*phC to dump small buffers
isapnp: remove debug leftovers
ARM: imx: cpuidle: use init/exit common routine
ARM: davinci: cpuidle: use init/exit common routine
ARM: kirkwood: cpuidle: use init/exit common routine
ARM: calxeda: cpuidle: use init/exit common routine
ARM: tegra: cpuidle: use init/exit common routine for tegra3
ARM: tegra: cpuidle: use init/exit common routine for tegra2
ARM: OMAP4: cpuidle: use init/exit common routine
...
Diffstat (limited to 'arch/arm/mach-davinci')
-rw-r--r-- | arch/arm/mach-davinci/Makefile | 1 | ||||
-rw-r--r-- | arch/arm/mach-davinci/cpufreq.c | 248 | ||||
-rw-r--r-- | arch/arm/mach-davinci/cpuidle.c | 29 |
3 files changed, 3 insertions, 275 deletions
diff --git a/arch/arm/mach-davinci/Makefile b/arch/arm/mach-davinci/Makefile index fb5c1aa98a63..dd1ffccc75e9 100644 --- a/arch/arm/mach-davinci/Makefile +++ b/arch/arm/mach-davinci/Makefile | |||
@@ -37,7 +37,6 @@ obj-$(CONFIG_MACH_MITYOMAPL138) += board-mityomapl138.o | |||
37 | obj-$(CONFIG_MACH_OMAPL138_HAWKBOARD) += board-omapl138-hawk.o | 37 | obj-$(CONFIG_MACH_OMAPL138_HAWKBOARD) += board-omapl138-hawk.o |
38 | 38 | ||
39 | # Power Management | 39 | # Power Management |
40 | obj-$(CONFIG_CPU_FREQ) += cpufreq.o | ||
41 | obj-$(CONFIG_CPU_IDLE) += cpuidle.o | 40 | obj-$(CONFIG_CPU_IDLE) += cpuidle.o |
42 | obj-$(CONFIG_SUSPEND) += pm.o sleep.o | 41 | obj-$(CONFIG_SUSPEND) += pm.o sleep.o |
43 | obj-$(CONFIG_HAVE_CLK) += pm_domain.o | 42 | obj-$(CONFIG_HAVE_CLK) += pm_domain.o |
diff --git a/arch/arm/mach-davinci/cpufreq.c b/arch/arm/mach-davinci/cpufreq.c deleted file mode 100644 index 4729eaab0f40..000000000000 --- a/arch/arm/mach-davinci/cpufreq.c +++ /dev/null | |||
@@ -1,248 +0,0 @@ | |||
1 | /* | ||
2 | * CPU frequency scaling for DaVinci | ||
3 | * | ||
4 | * Copyright (C) 2009 Texas Instruments Incorporated - http://www.ti.com/ | ||
5 | * | ||
6 | * Based on linux/arch/arm/plat-omap/cpu-omap.c. Original Copyright follows: | ||
7 | * | ||
8 | * Copyright (C) 2005 Nokia Corporation | ||
9 | * Written by Tony Lindgren <tony@atomide.com> | ||
10 | * | ||
11 | * Based on cpu-sa1110.c, Copyright (C) 2001 Russell King | ||
12 | * | ||
13 | * Copyright (C) 2007-2008 Texas Instruments, Inc. | ||
14 | * Updated to support OMAP3 | ||
15 | * Rajendra Nayak <rnayak@ti.com> | ||
16 | * | ||
17 | * This program is free software; you can redistribute it and/or modify | ||
18 | * it under the terms of the GNU General Public License version 2 as | ||
19 | * published by the Free Software Foundation. | ||
20 | */ | ||
21 | #include <linux/types.h> | ||
22 | #include <linux/cpufreq.h> | ||
23 | #include <linux/init.h> | ||
24 | #include <linux/err.h> | ||
25 | #include <linux/clk.h> | ||
26 | #include <linux/platform_device.h> | ||
27 | #include <linux/export.h> | ||
28 | |||
29 | #include <mach/hardware.h> | ||
30 | #include <mach/cpufreq.h> | ||
31 | #include <mach/common.h> | ||
32 | |||
33 | #include "clock.h" | ||
34 | |||
35 | struct davinci_cpufreq { | ||
36 | struct device *dev; | ||
37 | struct clk *armclk; | ||
38 | struct clk *asyncclk; | ||
39 | unsigned long asyncrate; | ||
40 | }; | ||
41 | static struct davinci_cpufreq cpufreq; | ||
42 | |||
43 | static int davinci_verify_speed(struct cpufreq_policy *policy) | ||
44 | { | ||
45 | struct davinci_cpufreq_config *pdata = cpufreq.dev->platform_data; | ||
46 | struct cpufreq_frequency_table *freq_table = pdata->freq_table; | ||
47 | struct clk *armclk = cpufreq.armclk; | ||
48 | |||
49 | if (freq_table) | ||
50 | return cpufreq_frequency_table_verify(policy, freq_table); | ||
51 | |||
52 | if (policy->cpu) | ||
53 | return -EINVAL; | ||
54 | |||
55 | cpufreq_verify_within_limits(policy, policy->cpuinfo.min_freq, | ||
56 | policy->cpuinfo.max_freq); | ||
57 | |||
58 | policy->min = clk_round_rate(armclk, policy->min * 1000) / 1000; | ||
59 | policy->max = clk_round_rate(armclk, policy->max * 1000) / 1000; | ||
60 | cpufreq_verify_within_limits(policy, policy->cpuinfo.min_freq, | ||
61 | policy->cpuinfo.max_freq); | ||
62 | return 0; | ||
63 | } | ||
64 | |||
65 | static unsigned int davinci_getspeed(unsigned int cpu) | ||
66 | { | ||
67 | if (cpu) | ||
68 | return 0; | ||
69 | |||
70 | return clk_get_rate(cpufreq.armclk) / 1000; | ||
71 | } | ||
72 | |||
73 | static int davinci_target(struct cpufreq_policy *policy, | ||
74 | unsigned int target_freq, unsigned int relation) | ||
75 | { | ||
76 | int ret = 0; | ||
77 | unsigned int idx; | ||
78 | struct cpufreq_freqs freqs; | ||
79 | struct davinci_cpufreq_config *pdata = cpufreq.dev->platform_data; | ||
80 | struct clk *armclk = cpufreq.armclk; | ||
81 | |||
82 | /* | ||
83 | * Ensure desired rate is within allowed range. Some govenors | ||
84 | * (ondemand) will just pass target_freq=0 to get the minimum. | ||
85 | */ | ||
86 | if (target_freq < policy->cpuinfo.min_freq) | ||
87 | target_freq = policy->cpuinfo.min_freq; | ||
88 | if (target_freq > policy->cpuinfo.max_freq) | ||
89 | target_freq = policy->cpuinfo.max_freq; | ||
90 | |||
91 | freqs.old = davinci_getspeed(0); | ||
92 | freqs.new = clk_round_rate(armclk, target_freq * 1000) / 1000; | ||
93 | freqs.cpu = 0; | ||
94 | |||
95 | if (freqs.old == freqs.new) | ||
96 | return ret; | ||
97 | |||
98 | dev_dbg(cpufreq.dev, "transition: %u --> %u\n", freqs.old, freqs.new); | ||
99 | |||
100 | ret = cpufreq_frequency_table_target(policy, pdata->freq_table, | ||
101 | freqs.new, relation, &idx); | ||
102 | if (ret) | ||
103 | return -EINVAL; | ||
104 | |||
105 | cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); | ||
106 | |||
107 | /* if moving to higher frequency, up the voltage beforehand */ | ||
108 | if (pdata->set_voltage && freqs.new > freqs.old) { | ||
109 | ret = pdata->set_voltage(idx); | ||
110 | if (ret) | ||
111 | goto out; | ||
112 | } | ||
113 | |||
114 | ret = clk_set_rate(armclk, idx); | ||
115 | if (ret) | ||
116 | goto out; | ||
117 | |||
118 | if (cpufreq.asyncclk) { | ||
119 | ret = clk_set_rate(cpufreq.asyncclk, cpufreq.asyncrate); | ||
120 | if (ret) | ||
121 | goto out; | ||
122 | } | ||
123 | |||
124 | /* if moving to lower freq, lower the voltage after lowering freq */ | ||
125 | if (pdata->set_voltage && freqs.new < freqs.old) | ||
126 | pdata->set_voltage(idx); | ||
127 | |||
128 | out: | ||
129 | cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); | ||
130 | |||
131 | return ret; | ||
132 | } | ||
133 | |||
134 | static int davinci_cpu_init(struct cpufreq_policy *policy) | ||
135 | { | ||
136 | int result = 0; | ||
137 | struct davinci_cpufreq_config *pdata = cpufreq.dev->platform_data; | ||
138 | struct cpufreq_frequency_table *freq_table = pdata->freq_table; | ||
139 | |||
140 | if (policy->cpu != 0) | ||
141 | return -EINVAL; | ||
142 | |||
143 | /* Finish platform specific initialization */ | ||
144 | if (pdata->init) { | ||
145 | result = pdata->init(); | ||
146 | if (result) | ||
147 | return result; | ||
148 | } | ||
149 | |||
150 | policy->cur = policy->min = policy->max = davinci_getspeed(0); | ||
151 | |||
152 | if (freq_table) { | ||
153 | result = cpufreq_frequency_table_cpuinfo(policy, freq_table); | ||
154 | if (!result) | ||
155 | cpufreq_frequency_table_get_attr(freq_table, | ||
156 | policy->cpu); | ||
157 | } else { | ||
158 | policy->cpuinfo.min_freq = policy->min; | ||
159 | policy->cpuinfo.max_freq = policy->max; | ||
160 | } | ||
161 | |||
162 | policy->min = policy->cpuinfo.min_freq; | ||
163 | policy->max = policy->cpuinfo.max_freq; | ||
164 | policy->cur = davinci_getspeed(0); | ||
165 | |||
166 | /* | ||
167 | * Time measurement across the target() function yields ~1500-1800us | ||
168 | * time taken with no drivers on notification list. | ||
169 | * Setting the latency to 2000 us to accommodate addition of drivers | ||
170 | * to pre/post change notification list. | ||
171 | */ | ||
172 | policy->cpuinfo.transition_latency = 2000 * 1000; | ||
173 | return 0; | ||
174 | } | ||
175 | |||
176 | static int davinci_cpu_exit(struct cpufreq_policy *policy) | ||
177 | { | ||
178 | cpufreq_frequency_table_put_attr(policy->cpu); | ||
179 | return 0; | ||
180 | } | ||
181 | |||
182 | static struct freq_attr *davinci_cpufreq_attr[] = { | ||
183 | &cpufreq_freq_attr_scaling_available_freqs, | ||
184 | NULL, | ||
185 | }; | ||
186 | |||
187 | static struct cpufreq_driver davinci_driver = { | ||
188 | .flags = CPUFREQ_STICKY, | ||
189 | .verify = davinci_verify_speed, | ||
190 | .target = davinci_target, | ||
191 | .get = davinci_getspeed, | ||
192 | .init = davinci_cpu_init, | ||
193 | .exit = davinci_cpu_exit, | ||
194 | .name = "davinci", | ||
195 | .attr = davinci_cpufreq_attr, | ||
196 | }; | ||
197 | |||
198 | static int __init davinci_cpufreq_probe(struct platform_device *pdev) | ||
199 | { | ||
200 | struct davinci_cpufreq_config *pdata = pdev->dev.platform_data; | ||
201 | struct clk *asyncclk; | ||
202 | |||
203 | if (!pdata) | ||
204 | return -EINVAL; | ||
205 | if (!pdata->freq_table) | ||
206 | return -EINVAL; | ||
207 | |||
208 | cpufreq.dev = &pdev->dev; | ||
209 | |||
210 | cpufreq.armclk = clk_get(NULL, "arm"); | ||
211 | if (IS_ERR(cpufreq.armclk)) { | ||
212 | dev_err(cpufreq.dev, "Unable to get ARM clock\n"); | ||
213 | return PTR_ERR(cpufreq.armclk); | ||
214 | } | ||
215 | |||
216 | asyncclk = clk_get(cpufreq.dev, "async"); | ||
217 | if (!IS_ERR(asyncclk)) { | ||
218 | cpufreq.asyncclk = asyncclk; | ||
219 | cpufreq.asyncrate = clk_get_rate(asyncclk); | ||
220 | } | ||
221 | |||
222 | return cpufreq_register_driver(&davinci_driver); | ||
223 | } | ||
224 | |||
225 | static int __exit davinci_cpufreq_remove(struct platform_device *pdev) | ||
226 | { | ||
227 | clk_put(cpufreq.armclk); | ||
228 | |||
229 | if (cpufreq.asyncclk) | ||
230 | clk_put(cpufreq.asyncclk); | ||
231 | |||
232 | return cpufreq_unregister_driver(&davinci_driver); | ||
233 | } | ||
234 | |||
235 | static struct platform_driver davinci_cpufreq_driver = { | ||
236 | .driver = { | ||
237 | .name = "cpufreq-davinci", | ||
238 | .owner = THIS_MODULE, | ||
239 | }, | ||
240 | .remove = __exit_p(davinci_cpufreq_remove), | ||
241 | }; | ||
242 | |||
243 | int __init davinci_cpufreq_init(void) | ||
244 | { | ||
245 | return platform_driver_probe(&davinci_cpufreq_driver, | ||
246 | davinci_cpufreq_probe); | ||
247 | } | ||
248 | |||
diff --git a/arch/arm/mach-davinci/cpuidle.c b/arch/arm/mach-davinci/cpuidle.c index 5ac9e9384b15..36aef3a7dedb 100644 --- a/arch/arm/mach-davinci/cpuidle.c +++ b/arch/arm/mach-davinci/cpuidle.c | |||
@@ -25,7 +25,6 @@ | |||
25 | 25 | ||
26 | #define DAVINCI_CPUIDLE_MAX_STATES 2 | 26 | #define DAVINCI_CPUIDLE_MAX_STATES 2 |
27 | 27 | ||
28 | static DEFINE_PER_CPU(struct cpuidle_device, davinci_cpuidle_device); | ||
29 | static void __iomem *ddr2_reg_base; | 28 | static void __iomem *ddr2_reg_base; |
30 | static bool ddr2_pdown; | 29 | static bool ddr2_pdown; |
31 | 30 | ||
@@ -50,14 +49,10 @@ static void davinci_save_ddr_power(int enter, bool pdown) | |||
50 | 49 | ||
51 | /* Actual code that puts the SoC in different idle states */ | 50 | /* Actual code that puts the SoC in different idle states */ |
52 | static int davinci_enter_idle(struct cpuidle_device *dev, | 51 | static int davinci_enter_idle(struct cpuidle_device *dev, |
53 | struct cpuidle_driver *drv, | 52 | struct cpuidle_driver *drv, int index) |
54 | int index) | ||
55 | { | 53 | { |
56 | davinci_save_ddr_power(1, ddr2_pdown); | 54 | davinci_save_ddr_power(1, ddr2_pdown); |
57 | 55 | cpu_do_idle(); | |
58 | index = cpuidle_wrap_enter(dev, drv, index, | ||
59 | arm_cpuidle_simple_enter); | ||
60 | |||
61 | davinci_save_ddr_power(0, ddr2_pdown); | 56 | davinci_save_ddr_power(0, ddr2_pdown); |
62 | 57 | ||
63 | return index; | 58 | return index; |
@@ -66,7 +61,6 @@ static int davinci_enter_idle(struct cpuidle_device *dev, | |||
66 | static struct cpuidle_driver davinci_idle_driver = { | 61 | static struct cpuidle_driver davinci_idle_driver = { |
67 | .name = "cpuidle-davinci", | 62 | .name = "cpuidle-davinci", |
68 | .owner = THIS_MODULE, | 63 | .owner = THIS_MODULE, |
69 | .en_core_tk_irqen = 1, | ||
70 | .states[0] = ARM_CPUIDLE_WFI_STATE, | 64 | .states[0] = ARM_CPUIDLE_WFI_STATE, |
71 | .states[1] = { | 65 | .states[1] = { |
72 | .enter = davinci_enter_idle, | 66 | .enter = davinci_enter_idle, |
@@ -81,12 +75,8 @@ static struct cpuidle_driver davinci_idle_driver = { | |||
81 | 75 | ||
82 | static int __init davinci_cpuidle_probe(struct platform_device *pdev) | 76 | static int __init davinci_cpuidle_probe(struct platform_device *pdev) |
83 | { | 77 | { |
84 | int ret; | ||
85 | struct cpuidle_device *device; | ||
86 | struct davinci_cpuidle_config *pdata = pdev->dev.platform_data; | 78 | struct davinci_cpuidle_config *pdata = pdev->dev.platform_data; |
87 | 79 | ||
88 | device = &per_cpu(davinci_cpuidle_device, smp_processor_id()); | ||
89 | |||
90 | if (!pdata) { | 80 | if (!pdata) { |
91 | dev_err(&pdev->dev, "cannot get platform data\n"); | 81 | dev_err(&pdev->dev, "cannot get platform data\n"); |
92 | return -ENOENT; | 82 | return -ENOENT; |
@@ -96,20 +86,7 @@ static int __init davinci_cpuidle_probe(struct platform_device *pdev) | |||
96 | 86 | ||
97 | ddr2_pdown = pdata->ddr2_pdown; | 87 | ddr2_pdown = pdata->ddr2_pdown; |
98 | 88 | ||
99 | ret = cpuidle_register_driver(&davinci_idle_driver); | 89 | return cpuidle_register(&davinci_idle_driver, NULL); |
100 | if (ret) { | ||
101 | dev_err(&pdev->dev, "failed to register driver\n"); | ||
102 | return ret; | ||
103 | } | ||
104 | |||
105 | ret = cpuidle_register_device(device); | ||
106 | if (ret) { | ||
107 | dev_err(&pdev->dev, "failed to register device\n"); | ||
108 | cpuidle_unregister_driver(&davinci_idle_driver); | ||
109 | return ret; | ||
110 | } | ||
111 | |||
112 | return 0; | ||
113 | } | 90 | } |
114 | 91 | ||
115 | static struct platform_driver davinci_cpuidle_driver = { | 92 | static struct platform_driver davinci_cpuidle_driver = { |