aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/cpufreq/s5pv210-cpufreq.c
diff options
context:
space:
mode:
authorViresh Kumar <viresh.kumar@linaro.org>2013-08-14 10:08:24 -0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2013-10-30 19:11:08 -0400
commitd4019f0a92ab802f385cc9c8ad3ab7b5449712cb (patch)
treeebd06695585e457ae1bf219653452b111e7508db /drivers/cpufreq/s5pv210-cpufreq.c
parent7dbf694db6ac7c759599316d50d7050efcbd512a (diff)
cpufreq: move freq change notifications to cpufreq core
Most of the drivers do following in their ->target_index() routines: struct cpufreq_freqs freqs; freqs.old = old freq... freqs.new = new freq... cpufreq_notify_transition(policy, &freqs, CPUFREQ_PRECHANGE); /* Change rate here */ cpufreq_notify_transition(policy, &freqs, CPUFREQ_POSTCHANGE); This is replicated over all cpufreq drivers today and there doesn't exists a good enough reason why this shouldn't be moved to cpufreq core instead. There are few special cases though, like exynos5440, which doesn't do everything on the call to ->target_index() routine and call some kind of bottom halves for doing this work, work/tasklet/etc.. They may continue doing notification from their own code as flag: CPUFREQ_ASYNC_NOTIFICATION is already set for them. All drivers are also modified in this patch to avoid breaking 'git bisect', as double notification would happen otherwise. 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: Stephen Warren <swarren@nvidia.com> Tested-by: Andrew Lunn <andrew@lunn.ch> Tested-by: Nicolas Pitre <nicolas.pitre@linaro.org> Reviewed-by: Lan Tianyu <tianyu.lan@intel.com> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/cpufreq/s5pv210-cpufreq.c')
-rw-r--r--drivers/cpufreq/s5pv210-cpufreq.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/drivers/cpufreq/s5pv210-cpufreq.c b/drivers/cpufreq/s5pv210-cpufreq.c
index 5978b94e0340..e3973dae28a7 100644
--- a/drivers/cpufreq/s5pv210-cpufreq.c
+++ b/drivers/cpufreq/s5pv210-cpufreq.c
@@ -26,7 +26,6 @@
26static struct clk *cpu_clk; 26static struct clk *cpu_clk;
27static struct clk *dmc0_clk; 27static struct clk *dmc0_clk;
28static struct clk *dmc1_clk; 28static struct clk *dmc1_clk;
29static struct cpufreq_freqs freqs;
30static DEFINE_MUTEX(set_freq_lock); 29static DEFINE_MUTEX(set_freq_lock);
31 30
32/* APLL M,P,S values for 1G/800Mhz */ 31/* APLL M,P,S values for 1G/800Mhz */
@@ -179,6 +178,7 @@ static int s5pv210_target(struct cpufreq_policy *policy, unsigned int index)
179 unsigned int priv_index; 178 unsigned int priv_index;
180 unsigned int pll_changing = 0; 179 unsigned int pll_changing = 0;
181 unsigned int bus_speed_changing = 0; 180 unsigned int bus_speed_changing = 0;
181 unsigned int old_freq, new_freq;
182 int arm_volt, int_volt; 182 int arm_volt, int_volt;
183 int ret = 0; 183 int ret = 0;
184 184
@@ -193,12 +193,12 @@ static int s5pv210_target(struct cpufreq_policy *policy, unsigned int index)
193 goto exit; 193 goto exit;
194 } 194 }
195 195
196 freqs.old = s5pv210_getspeed(0); 196 old_freq = s5pv210_getspeed(0);
197 freqs.new = s5pv210_freq_table[index].frequency; 197 new_freq = s5pv210_freq_table[index].frequency;
198 198
199 /* Finding current running level index */ 199 /* Finding current running level index */
200 if (cpufreq_frequency_table_target(policy, s5pv210_freq_table, 200 if (cpufreq_frequency_table_target(policy, s5pv210_freq_table,
201 freqs.old, CPUFREQ_RELATION_H, 201 old_freq, CPUFREQ_RELATION_H,
202 &priv_index)) { 202 &priv_index)) {
203 ret = -EINVAL; 203 ret = -EINVAL;
204 goto exit; 204 goto exit;
@@ -207,7 +207,7 @@ static int s5pv210_target(struct cpufreq_policy *policy, unsigned int index)
207 arm_volt = dvs_conf[index].arm_volt; 207 arm_volt = dvs_conf[index].arm_volt;
208 int_volt = dvs_conf[index].int_volt; 208 int_volt = dvs_conf[index].int_volt;
209 209
210 if (freqs.new > freqs.old) { 210 if (new_freq > old_freq) {
211 ret = regulator_set_voltage(arm_regulator, 211 ret = regulator_set_voltage(arm_regulator,
212 arm_volt, arm_volt_max); 212 arm_volt, arm_volt_max);
213 if (ret) 213 if (ret)
@@ -219,8 +219,6 @@ static int s5pv210_target(struct cpufreq_policy *policy, unsigned int index)
219 goto exit; 219 goto exit;
220 } 220 }
221 221
222 cpufreq_notify_transition(policy, &freqs, CPUFREQ_PRECHANGE);
223
224 /* Check if there need to change PLL */ 222 /* Check if there need to change PLL */
225 if ((index == L0) || (priv_index == L0)) 223 if ((index == L0) || (priv_index == L0))
226 pll_changing = 1; 224 pll_changing = 1;
@@ -431,9 +429,7 @@ static int s5pv210_target(struct cpufreq_policy *policy, unsigned int index)
431 } 429 }
432 } 430 }
433 431
434 cpufreq_notify_transition(policy, &freqs, CPUFREQ_POSTCHANGE); 432 if (new_freq < old_freq) {
435
436 if (freqs.new < freqs.old) {
437 regulator_set_voltage(int_regulator, 433 regulator_set_voltage(int_regulator,
438 int_volt, int_volt_max); 434 int_volt, int_volt_max);
439 435