aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/cpufreq/p4-clockmod.c
diff options
context:
space:
mode:
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[] = {