linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
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 05/16] cpufreq: dbx500: use cpufreq_generic_get() routine
Date: Thu, 31 Oct 2013 04:22:03 +0530	[thread overview]
Message-ID: <956f3793295af6ac2552406ff3b7cf79edc93ae0.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 have to find closest frequency in platform specific ->get() routine
wihch dbx500 driver was doing and hence it can be removed as well.

Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
 drivers/cpufreq/dbx500-cpufreq.c | 19 ++-----------------
 1 file changed, 2 insertions(+), 17 deletions(-)

diff --git a/drivers/cpufreq/dbx500-cpufreq.c b/drivers/cpufreq/dbx500-cpufreq.c
index 0e67ab9..d83129d 100644
--- a/drivers/cpufreq/dbx500-cpufreq.c
+++ b/drivers/cpufreq/dbx500-cpufreq.c
@@ -26,24 +26,9 @@ static int dbx500_cpufreq_target(struct cpufreq_policy *policy,
 	return clk_set_rate(armss_clk, freq_table[index].frequency * 1000);
 }
 
-static unsigned int dbx500_cpufreq_getspeed(unsigned int cpu)
-{
-	int i = 0;
-	unsigned long freq = clk_get_rate(armss_clk) / 1000;
-
-	/* The value is rounded to closest frequency in the defined table. */
-	while (freq_table[i + 1].frequency != CPUFREQ_TABLE_END) {
-		if (freq < freq_table[i].frequency +
-		   (freq_table[i + 1].frequency - freq_table[i].frequency) / 2)
-			return freq_table[i].frequency;
-		i++;
-	}
-
-	return freq_table[i].frequency;
-}
-
 static int dbx500_cpufreq_init(struct cpufreq_policy *policy)
 {
+	policy->clk = armss_clk;
 	return cpufreq_generic_init(policy, freq_table, 20 * 1000);
 }
 
@@ -51,7 +36,7 @@ static struct cpufreq_driver dbx500_cpufreq_driver = {
 	.flags  = CPUFREQ_STICKY | CPUFREQ_CONST_LOOPS,
 	.verify = cpufreq_generic_frequency_table_verify,
 	.target_index = dbx500_cpufreq_target,
-	.get    = dbx500_cpufreq_getspeed,
+	.get    = cpufreq_generic_get,
 	.init   = dbx500_cpufreq_init,
 	.name   = "DBX500",
 	.attr   = cpufreq_generic_attr,
-- 
1.7.12.rc2.18.g61b472e

  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 ` Viresh Kumar [this message]
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 ` [PATCH V2 Resend 12/16] cpufreq: s5pv210: " Viresh Kumar
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=956f3793295af6ac2552406ff3b7cf79edc93ae0.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).