aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/cpufreq/p4-clockmod.c
diff options
context:
space:
mode:
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>2013-10-27 20:29:34 -0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2013-10-27 20:29:34 -0400
commit93658cb8597ab76655220be43d3d7f74c66e9e4e (patch)
treee6da56aac9cda2c80315cc73ee31ef4c47af8472 /drivers/cpufreq/p4-clockmod.c
parent6e0ca95aa3c83c47d13f9f400bfaaa853d0b224b (diff)
parentad7722dab7292dbc1c4586d701ac226b68122d39 (diff)
Merge branch 'pm-cpufreq'
* pm-cpufreq: (167 commits) cpufreq: create per policy rwsem instead of per CPU cpu_policy_rwsem intel_pstate: Add Baytrail support intel_pstate: Refactor driver to support CPUs with different MSR layouts cpufreq: Implement light weight ->target_index() routine PM / OPP: rename header to linux/pm_opp.h PM / OPP: rename data structures to dev_pm equivalents PM / OPP: rename functions to dev_pm_opp* cpufreq / governor: Remove fossil comment cpufreq: exynos4210: Use the common clock framework to set APLL clock rate cpufreq: exynos4x12: Use the common clock framework to set APLL clock rate cpufreq: Detect spurious invocations of update_policy_cpu() cpufreq: pmac64: enable cpufreq on iMac G5 (iSight) model cpufreq: pmac64: provide cpufreq transition latency for older G5 models cpufreq: pmac64: speed up frequency switch cpufreq: highbank-cpufreq: Enable Midway/ECX-2000 exynos-cpufreq: fix false return check from "regulator_set_voltage" speedstep-centrino: Remove unnecessary braces acpi-cpufreq: Add comment under ACPI_ADR_SPACE_SYSTEM_IO case cpufreq: arm-big-little: use clk_get instead of clk_get_sys cpufreq: exynos: Show a list of available frequencies ... Conflicts: drivers/devfreq/exynos/exynos5_bus.c
Diffstat (limited to 'drivers/cpufreq/p4-clockmod.c')
-rw-r--r--drivers/cpufreq/p4-clockmod.c45
1 files changed, 8 insertions, 37 deletions
diff --git a/drivers/cpufreq/p4-clockmod.c b/drivers/cpufreq/p4-clockmod.c
index 2f0a2a65c37f..3c23053afdfd 100644
--- a/drivers/cpufreq/p4-clockmod.c
+++ b/drivers/cpufreq/p4-clockmod.c
@@ -105,23 +105,13 @@ static struct cpufreq_frequency_table p4clockmod_table[] = {
105}; 105};
106 106
107 107
108static int cpufreq_p4_target(struct cpufreq_policy *policy, 108static int cpufreq_p4_target(struct cpufreq_policy *policy, unsigned int index)
109 unsigned int target_freq,
110 unsigned int relation)
111{ 109{
112 unsigned int newstate = DC_RESV;
113 struct cpufreq_freqs freqs; 110 struct cpufreq_freqs freqs;
114 int i; 111 int i;
115 112
116 if (cpufreq_frequency_table_target(policy, &p4clockmod_table[0],
117 target_freq, relation, &newstate))
118 return -EINVAL;
119
120 freqs.old = cpufreq_p4_get(policy->cpu); 113 freqs.old = cpufreq_p4_get(policy->cpu);
121 freqs.new = stock_freq * p4clockmod_table[newstate].driver_data / 8; 114 freqs.new = stock_freq * p4clockmod_table[index].driver_data / 8;
122
123 if (freqs.new == freqs.old)
124 return 0;
125 115
126 /* notifiers */ 116 /* notifiers */
127 cpufreq_notify_transition(policy, &freqs, CPUFREQ_PRECHANGE); 117 cpufreq_notify_transition(policy, &freqs, CPUFREQ_PRECHANGE);
@@ -131,7 +121,7 @@ static int cpufreq_p4_target(struct cpufreq_policy *policy,
131 * Developer's Manual, Volume 3 121 * Developer's Manual, Volume 3
132 */ 122 */
133 for_each_cpu(i, policy->cpus) 123 for_each_cpu(i, policy->cpus)
134 cpufreq_p4_setdc(i, p4clockmod_table[newstate].driver_data); 124 cpufreq_p4_setdc(i, p4clockmod_table[index].driver_data);
135 125
136 /* notifiers */ 126 /* notifiers */
137 cpufreq_notify_transition(policy, &freqs, CPUFREQ_POSTCHANGE); 127 cpufreq_notify_transition(policy, &freqs, CPUFREQ_POSTCHANGE);
@@ -140,12 +130,6 @@ static int cpufreq_p4_target(struct cpufreq_policy *policy,
140} 130}
141 131
142 132
143static int cpufreq_p4_verify(struct cpufreq_policy *policy)
144{
145 return cpufreq_frequency_table_verify(policy, &p4clockmod_table[0]);
146}
147
148
149static unsigned int cpufreq_p4_get_frequency(struct cpuinfo_x86 *c) 133static unsigned int cpufreq_p4_get_frequency(struct cpuinfo_x86 *c)
150{ 134{
151 if (c->x86 == 0x06) { 135 if (c->x86 == 0x06) {
@@ -230,25 +214,17 @@ static int cpufreq_p4_cpu_init(struct cpufreq_policy *policy)
230 else 214 else
231 p4clockmod_table[i].frequency = (stock_freq * i)/8; 215 p4clockmod_table[i].frequency = (stock_freq * i)/8;
232 } 216 }
233 cpufreq_frequency_table_get_attr(p4clockmod_table, policy->cpu);
234 217
235 /* cpuinfo and default policy values */ 218 /* cpuinfo and default policy values */
236 219
237 /* the transition latency is set to be 1 higher than the maximum 220 /* the transition latency is set to be 1 higher than the maximum
238 * transition latency of the ondemand governor */ 221 * transition latency of the ondemand governor */
239 policy->cpuinfo.transition_latency = 10000001; 222 policy->cpuinfo.transition_latency = 10000001;
240 policy->cur = stock_freq;
241 223
242 return cpufreq_frequency_table_cpuinfo(policy, &p4clockmod_table[0]); 224 return cpufreq_table_validate_and_show(policy, &p4clockmod_table[0]);
243} 225}
244 226
245 227
246static int cpufreq_p4_cpu_exit(struct cpufreq_policy *policy)
247{
248 cpufreq_frequency_table_put_attr(policy->cpu);
249 return 0;
250}
251
252static unsigned int cpufreq_p4_get(unsigned int cpu) 228static unsigned int cpufreq_p4_get(unsigned int cpu)
253{ 229{
254 u32 l, h; 230 u32 l, h;
@@ -267,19 +243,14 @@ static unsigned int cpufreq_p4_get(unsigned int cpu)
267 return stock_freq; 243 return stock_freq;
268} 244}
269 245
270static struct freq_attr *p4clockmod_attr[] = {
271 &cpufreq_freq_attr_scaling_available_freqs,
272 NULL,
273};
274
275static struct cpufreq_driver p4clockmod_driver = { 246static struct cpufreq_driver p4clockmod_driver = {
276 .verify = cpufreq_p4_verify, 247 .verify = cpufreq_generic_frequency_table_verify,
277 .target = cpufreq_p4_target, 248 .target_index = cpufreq_p4_target,
278 .init = cpufreq_p4_cpu_init, 249 .init = cpufreq_p4_cpu_init,
279 .exit = cpufreq_p4_cpu_exit, 250 .exit = cpufreq_generic_exit,
280 .get = cpufreq_p4_get, 251 .get = cpufreq_p4_get,
281 .name = "p4-clockmod", 252 .name = "p4-clockmod",
282 .attr = p4clockmod_attr, 253 .attr = cpufreq_generic_attr,
283}; 254};
284 255
285static const struct x86_cpu_id cpufreq_p4_id[] = { 256static const struct x86_cpu_id cpufreq_p4_id[] = {