aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/cpufreq/powernow-k7.c
diff options
context:
space:
mode:
authorViresh Kumar <viresh.kumar@linaro.org>2013-10-25 10:15:48 -0400
committerRafael J. Wysocki <rjw@rjwysocki.net>2013-10-25 16:42:24 -0400
commit9c0ebcf78fde0ffa348a95a544c6d3f2dac5af65 (patch)
tree0aa1814b3cdbd6900a6494d8f0c56551d90cf693 /drivers/cpufreq/powernow-k7.c
parent6ddee424fea2d269c2f402278d93165c7b92dc58 (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/powernow-k7.c')
-rw-r--r--drivers/cpufreq/powernow-k7.c22
1 files changed, 4 insertions, 18 deletions
diff --git a/drivers/cpufreq/powernow-k7.c b/drivers/cpufreq/powernow-k7.c
index 44d345bad6fb..946708a1d745 100644
--- a/drivers/cpufreq/powernow-k7.c
+++ b/drivers/cpufreq/powernow-k7.c
@@ -248,7 +248,7 @@ static void change_VID(int vid)
248} 248}
249 249
250 250
251static void change_speed(struct cpufreq_policy *policy, unsigned int index) 251static int powernow_target(struct cpufreq_policy *policy, unsigned int index)
252{ 252{
253 u8 fid, vid; 253 u8 fid, vid;
254 struct cpufreq_freqs freqs; 254 struct cpufreq_freqs freqs;
@@ -291,6 +291,8 @@ static void change_speed(struct cpufreq_policy *policy, unsigned int index)
291 local_irq_enable(); 291 local_irq_enable();
292 292
293 cpufreq_notify_transition(policy, &freqs, CPUFREQ_POSTCHANGE); 293 cpufreq_notify_transition(policy, &freqs, CPUFREQ_POSTCHANGE);
294
295 return 0;
294} 296}
295 297
296 298
@@ -533,22 +535,6 @@ static int powernow_decode_bios(int maxfid, int startvid)
533} 535}
534 536
535 537
536static int powernow_target(struct cpufreq_policy *policy,
537 unsigned int target_freq,
538 unsigned int relation)
539{
540 unsigned int newstate;
541
542 if (cpufreq_frequency_table_target(policy, powernow_table, target_freq,
543 relation, &newstate))
544 return -EINVAL;
545
546 change_speed(policy, newstate);
547
548 return 0;
549}
550
551
552/* 538/*
553 * We use the fact that the bus frequency is somehow 539 * We use the fact that the bus frequency is somehow
554 * a multiple of 100000/3 khz, then we compute sgtc according 540 * a multiple of 100000/3 khz, then we compute sgtc according
@@ -694,7 +680,7 @@ static int powernow_cpu_exit(struct cpufreq_policy *policy)
694 680
695static struct cpufreq_driver powernow_driver = { 681static struct cpufreq_driver powernow_driver = {
696 .verify = cpufreq_generic_frequency_table_verify, 682 .verify = cpufreq_generic_frequency_table_verify,
697 .target = powernow_target, 683 .target_index = powernow_target,
698 .get = powernow_get, 684 .get = powernow_get,
699#ifdef CONFIG_X86_POWERNOW_K7_ACPI 685#ifdef CONFIG_X86_POWERNOW_K7_ACPI
700 .bios_limit = acpi_processor_get_bios_limit, 686 .bios_limit = acpi_processor_get_bios_limit,