From: Viresh Kumar <viresh.kumar@linaro.org>
To: rjw@sisk.pl
Cc: linaro-kernel@lists.linaro.org, patches@linaro.org,
cpufreq@vger.kernel.org, linux-pm@vger.kernel.org,
linux-kernel@vger.kernel.org, viresh.kumar@linaro.org
Subject: [PATCH V2 Resend 12/16] cpufreq: s5pv210: use cpufreq_generic_get() routine
Date: Thu, 31 Oct 2013 04:22:10 +0530 [thread overview]
Message-ID: <30a7fe7b07dad08b80f8b8d6df3dc5ffdeb906be.1383173230.git.viresh.kumar@linaro.org> (raw)
In-Reply-To: <cover.1383173230.git.viresh.kumar@linaro.org>
In-Reply-To: <cover.1383173230.git.viresh.kumar@linaro.org>
We have common infrastructure available with us for getting a CPUs clk rate.
Lets use it for this driver.
We don't need a global variable to hold clock anymore.
Cc: Kukjin Kim <kgene.kim@samsung.com>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
drivers/cpufreq/s5pv210-cpufreq.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/drivers/cpufreq/s5pv210-cpufreq.c b/drivers/cpufreq/s5pv210-cpufreq.c
index e3973da..da0e291 100644
--- a/drivers/cpufreq/s5pv210-cpufreq.c
+++ b/drivers/cpufreq/s5pv210-cpufreq.c
@@ -23,7 +23,6 @@
#include <mach/map.h>
#include <mach/regs-clock.h>
-static struct clk *cpu_clk;
static struct clk *dmc0_clk;
static struct clk *dmc1_clk;
static DEFINE_MUTEX(set_freq_lock);
@@ -164,14 +163,6 @@ static void s5pv210_set_refresh(enum s5pv210_dmc_port ch, unsigned long freq)
__raw_writel(tmp1, reg);
}
-static unsigned int s5pv210_getspeed(unsigned int cpu)
-{
- if (cpu)
- return 0;
-
- return clk_get_rate(cpu_clk) / 1000;
-}
-
static int s5pv210_target(struct cpufreq_policy *policy, unsigned int index)
{
unsigned long reg;
@@ -193,7 +184,7 @@ static int s5pv210_target(struct cpufreq_policy *policy, unsigned int index)
goto exit;
}
- old_freq = s5pv210_getspeed(0);
+ old_freq = policy->cur;
new_freq = s5pv210_freq_table[index].frequency;
/* Finding current running level index */
@@ -471,9 +462,9 @@ static int __init s5pv210_cpu_init(struct cpufreq_policy *policy)
unsigned long mem_type;
int ret;
- cpu_clk = clk_get(NULL, "armclk");
- if (IS_ERR(cpu_clk))
- return PTR_ERR(cpu_clk);
+ policy->clk = clk_get(NULL, "armclk");
+ if (IS_ERR(policy->clk))
+ return PTR_ERR(policy->clk);
dmc0_clk = clk_get(NULL, "sclk_dmc0");
if (IS_ERR(dmc0_clk)) {
@@ -516,7 +507,7 @@ static int __init s5pv210_cpu_init(struct cpufreq_policy *policy)
out_dmc1:
clk_put(dmc0_clk);
out_dmc0:
- clk_put(cpu_clk);
+ clk_put(policy->clk);
return ret;
}
@@ -563,7 +554,7 @@ static struct cpufreq_driver s5pv210_driver = {
.flags = CPUFREQ_STICKY,
.verify = cpufreq_generic_frequency_table_verify,
.target_index = s5pv210_target,
- .get = s5pv210_getspeed,
+ .get = cpufreq_generic_get,
.init = s5pv210_cpu_init,
.name = "s5pv210",
#ifdef CONFIG_PM
--
1.7.12.rc2.18.g61b472e
next prev parent reply other threads:[~2013-10-30 22:52 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-30 22:51 [PATCH V2 Resend 00/16] CPUFreq Cleanup Part V Viresh Kumar
2013-10-30 22:51 ` [PATCH V2 Resend 01/16] cpufreq: create cpufreq_generic_get() routine Viresh Kumar
2013-10-30 22:52 ` [PATCH V2 Resend 02/16] cpufreq: at32ap: use " Viresh Kumar
2013-10-30 22:52 ` [PATCH V2 Resend 03/16] cpufreq: cpu0: " Viresh Kumar
2013-10-30 22:52 ` [PATCH V2 Resend 04/16] cpufreq: davinci: " Viresh Kumar
2013-10-30 22:52 ` [PATCH V2 Resend 05/16] cpufreq: dbx500: " Viresh Kumar
2013-10-30 22:52 ` [PATCH V2 Resend 06/16] cpufreq: exynos: " Viresh Kumar
2013-10-30 22:52 ` [PATCH V2 Resend 07/16] cpufreq: imx6q: " Viresh Kumar
2013-10-30 22:52 ` [PATCH V2 Resend 08/16] cpufreq: loongson2: " Viresh Kumar
2013-10-30 22:52 ` [PATCH V2 Resend 09/16] cpufreq: omap: " Viresh Kumar
2013-10-30 22:52 ` [PATCH V2 Resend 10/16] cpufreq: ppc: " Viresh Kumar
2013-10-30 22:52 ` [PATCH V2 Resend 11/16] cpufreq: s3c: " Viresh Kumar
2013-10-30 22:52 ` Viresh Kumar [this message]
2013-10-30 22:52 ` [PATCH V2 Resend 13/16] cpufreq: spear: " Viresh Kumar
2013-10-30 22:52 ` [PATCH V2 Resend 14/16] cpufreq: tegra: remove target_cpu_speed[] array Viresh Kumar
2013-10-30 22:52 ` [PATCH V2 Resend 15/16] cpufreq: tegra: use cpufreq_generic_get() routine Viresh Kumar
2013-10-30 22:52 ` [PATCH V2 Resend 16/16] cpufreq: unicore2: " Viresh Kumar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=30a7fe7b07dad08b80f8b8d6df3dc5ffdeb906be.1383173230.git.viresh.kumar@linaro.org \
--to=viresh.kumar@linaro.org \
--cc=cpufreq@vger.kernel.org \
--cc=linaro-kernel@lists.linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=patches@linaro.org \
--cc=rjw@sisk.pl \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).