diff options
author | Viresh Kumar <viresh.kumar@linaro.org> | 2013-10-25 10:15:48 -0400 |
---|---|---|
committer | Rafael J. Wysocki <rjw@rjwysocki.net> | 2013-10-25 16:42:24 -0400 |
commit | 9c0ebcf78fde0ffa348a95a544c6d3f2dac5af65 (patch) | |
tree | 0aa1814b3cdbd6900a6494d8f0c56551d90cf693 /drivers/cpufreq/e_powersaver.c | |
parent | 6ddee424fea2d269c2f402278d93165c7b92dc58 (diff) |
cpufreq: Implement light weight ->target_index() routine
Currently, the prototype of cpufreq_drivers target routines is:
int target(struct cpufreq_policy *policy, unsigned int target_freq,
unsigned int relation);
And most of the drivers call cpufreq_frequency_table_target() to get a valid
index of their frequency table which is closest to the target_freq. And they
don't use target_freq and relation after that.
So, it makes sense to just do this work in cpufreq core before calling
cpufreq_frequency_table_target() and simply pass index instead. But this can be
done only with drivers which expose their frequency table with cpufreq core. For
others we need to stick with the old prototype of target() until those drivers
are converted to expose frequency tables.
This patch implements the new light weight prototype for target_index() routine.
It looks like this:
int target_index(struct cpufreq_policy *policy, unsigned int index);
CPUFreq core will call cpufreq_frequency_table_target() before calling this
routine and pass index to it. Because CPUFreq core now requires to call routines
present in freq_table.c CONFIG_CPU_FREQ_TABLE must be enabled all the time.
This also marks target() interface as deprecated. So, that new drivers avoid
using it. And Documentation is updated accordingly.
It also converts existing .target() to newly defined light weight
.target_index() routine for many driver.
Acked-by: Hans-Christian Egtvedt <egtvedt@samfundet.no>
Acked-by: Jesper Nilsson <jesper.nilsson@axis.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: Russell King <linux@arm.linux.org.uk>
Acked-by: David S. Miller <davem@davemloft.net>
Tested-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Rafael J. Wysocki <rjw@rjwysocki.net>
Diffstat (limited to 'drivers/cpufreq/e_powersaver.c')
-rw-r--r-- | drivers/cpufreq/e_powersaver.c | 17 |
1 files changed, 3 insertions, 14 deletions
diff --git a/drivers/cpufreq/e_powersaver.c b/drivers/cpufreq/e_powersaver.c index 2c11ce3c67bd..b39c4ef60a7a 100644 --- a/drivers/cpufreq/e_powersaver.c +++ b/drivers/cpufreq/e_powersaver.c | |||
@@ -168,12 +168,9 @@ postchange: | |||
168 | return err; | 168 | return err; |
169 | } | 169 | } |
170 | 170 | ||
171 | static int eps_target(struct cpufreq_policy *policy, | 171 | static int eps_target(struct cpufreq_policy *policy, unsigned int index) |
172 | unsigned int target_freq, | ||
173 | unsigned int relation) | ||
174 | { | 172 | { |
175 | struct eps_cpu_data *centaur; | 173 | struct eps_cpu_data *centaur; |
176 | unsigned int newstate = 0; | ||
177 | unsigned int cpu = policy->cpu; | 174 | unsigned int cpu = policy->cpu; |
178 | unsigned int dest_state; | 175 | unsigned int dest_state; |
179 | int ret; | 176 | int ret; |
@@ -182,16 +179,8 @@ static int eps_target(struct cpufreq_policy *policy, | |||
182 | return -ENODEV; | 179 | return -ENODEV; |
183 | centaur = eps_cpu[cpu]; | 180 | centaur = eps_cpu[cpu]; |
184 | 181 | ||
185 | if (unlikely(cpufreq_frequency_table_target(policy, | ||
186 | &eps_cpu[cpu]->freq_table[0], | ||
187 | target_freq, | ||
188 | relation, | ||
189 | &newstate))) { | ||
190 | return -EINVAL; | ||
191 | } | ||
192 | |||
193 | /* Make frequency transition */ | 182 | /* Make frequency transition */ |
194 | dest_state = centaur->freq_table[newstate].driver_data & 0xffff; | 183 | dest_state = centaur->freq_table[index].driver_data & 0xffff; |
195 | ret = eps_set_state(centaur, policy, dest_state); | 184 | ret = eps_set_state(centaur, policy, dest_state); |
196 | if (ret) | 185 | if (ret) |
197 | printk(KERN_ERR "eps: Timeout!\n"); | 186 | printk(KERN_ERR "eps: Timeout!\n"); |
@@ -418,7 +407,7 @@ static int eps_cpu_exit(struct cpufreq_policy *policy) | |||
418 | 407 | ||
419 | static struct cpufreq_driver eps_driver = { | 408 | static struct cpufreq_driver eps_driver = { |
420 | .verify = cpufreq_generic_frequency_table_verify, | 409 | .verify = cpufreq_generic_frequency_table_verify, |
421 | .target = eps_target, | 410 | .target_index = eps_target, |
422 | .init = eps_cpu_init, | 411 | .init = eps_cpu_init, |
423 | .exit = eps_cpu_exit, | 412 | .exit = eps_cpu_exit, |
424 | .get = eps_get, | 413 | .get = eps_get, |