mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Taras Kondratiuk <taras@ti.com>
To: <lgirdwood@gmail.com>, <broonie@kernel.org>, <rjw@sisk.pl>,
	<viresh.kumar@linaro.org>, <shawn.guo@linaro.org>
Cc: <cpufreq@vger.kernel.org>, <linux-pm@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>, Taras Kondratiuk <taras@ti.com>,
	Santosh Shilimkar <santosh.shilimkar@ti.com>,
	Mark Langsdorf <mark.langsdorf@calxeda.com>
Subject: [RFC PATCH 2/2] cpufreq: cpufreq-cpu0: Limit minimum voltage only
Date: Fri, 19 Apr 2013 14:55:54 +0300	[thread overview]
Message-ID: <1366372554-20866-3-git-send-email-taras@ti.com> (raw)
In-Reply-To: <1366372554-20866-1-git-send-email-taras@ti.com>

cpufreq-cpu0 uses regulator_set_voltage_tol() API
to set CPU regulator voltage to some narrow range around OPP voltage.
It creates an issue if CPU regulator device has other consumers,
because their request doesn't overlap with cpufreq's one.
Normally cpufreq should constrain only lower voltage limit,
so other consumers have a chance to set their own constraints.

Use regulator_set_voltage_min() API to limit minimum voltage.
Remove a voltage tolerance parameter as redundant.

Signed-off-by: Taras Kondratiuk <taras@ti.com>
---
 drivers/cpufreq/cpufreq-cpu0.c |   12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/drivers/cpufreq/cpufreq-cpu0.c b/drivers/cpufreq/cpufreq-cpu0.c
index 37d23a0..e494a97 100644
--- a/drivers/cpufreq/cpufreq-cpu0.c
+++ b/drivers/cpufreq/cpufreq-cpu0.c
@@ -22,7 +22,6 @@
 #include <linux/slab.h>
 
 static unsigned int transition_latency;
-static unsigned int voltage_tolerance; /* in percentage */
 
 static struct device *cpu_dev;
 static struct clk *cpu_clk;
@@ -44,7 +43,7 @@ static int cpu0_set_target(struct cpufreq_policy *policy,
 {
 	struct cpufreq_freqs freqs;
 	struct opp *opp;
-	unsigned long freq_Hz, volt = 0, volt_old = 0, tol = 0;
+	unsigned long freq_Hz, volt = 0, volt_old = 0;
 	unsigned int index, cpu;
 	int ret;
 
@@ -80,7 +79,6 @@ static int cpu0_set_target(struct cpufreq_policy *policy,
 		}
 		volt = opp_get_voltage(opp);
 		rcu_read_unlock();
-		tol = volt * voltage_tolerance / 100;
 		volt_old = regulator_get_voltage(cpu_reg);
 	}
 
@@ -90,7 +88,7 @@ static int cpu0_set_target(struct cpufreq_policy *policy,
 
 	/* scaling up?  scale voltage before frequency */
 	if (cpu_reg && freqs.new > freqs.old) {
-		ret = regulator_set_voltage_tol(cpu_reg, volt, tol);
+		ret = regulator_set_voltage_min(cpu_reg, volt);
 		if (ret) {
 			pr_err("failed to scale voltage up: %d\n", ret);
 			freqs.new = freqs.old;
@@ -102,13 +100,13 @@ static int cpu0_set_target(struct cpufreq_policy *policy,
 	if (ret) {
 		pr_err("failed to set clock rate: %d\n", ret);
 		if (cpu_reg)
-			regulator_set_voltage_tol(cpu_reg, volt_old, tol);
+			regulator_set_voltage_min(cpu_reg, volt_old);
 		return ret;
 	}
 
 	/* scaling down?  scale voltage after frequency */
 	if (cpu_reg && freqs.new < freqs.old) {
-		ret = regulator_set_voltage_tol(cpu_reg, volt, tol);
+		ret = regulator_set_voltage_min(cpu_reg, volt);
 		if (ret) {
 			pr_err("failed to scale voltage down: %d\n", ret);
 			clk_set_rate(cpu_clk, freqs.old * 1000);
@@ -225,8 +223,6 @@ static int cpu0_cpufreq_probe(struct platform_device *pdev)
 		goto out_put_node;
 	}
 
-	of_property_read_u32(np, "voltage-tolerance", &voltage_tolerance);
-
 	if (of_property_read_u32(np, "clock-latency", &transition_latency))
 		transition_latency = CPUFREQ_ETERNAL;
 
-- 
1.7.9.5


  parent reply	other threads:[~2013-04-19 12:02 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-19 11:55 [RFC PATCH 0/2] cpufreq/regulator: " Taras Kondratiuk
2013-04-19 11:55 ` [RFC PATCH 1/2] regulator: core: Add regulator_set_voltage_min() Taras Kondratiuk
2013-04-22 13:19   ` Mark Brown
2013-04-22 16:49     ` Taras Kondratiuk
2013-04-23  8:48       ` Mark Brown
2013-04-23 11:44         ` Taras Kondratiuk
2013-04-23 13:45           ` Mark Brown
2013-04-23 18:45             ` Taras Kondratiuk
2013-04-24  9:38               ` Mark Brown
2013-04-19 11:55 ` Taras Kondratiuk [this message]
2013-04-19 16:21 ` [RFC PATCH 0/2] cpufreq/regulator: Limit minimum voltage only Nishanth Menon
2013-04-20  0:24   ` Kondratiuk, Taras
2013-04-22  6:11     ` Bedia, Vaibhav
2013-04-22 13:25       ` Mark Brown
2013-04-22 16:25       ` Taras Kondratiuk

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=1366372554-20866-3-git-send-email-taras@ti.com \
    --to=taras@ti.com \
    --cc=broonie@kernel.org \
    --cc=cpufreq@vger.kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=mark.langsdorf@calxeda.com \
    --cc=rjw@sisk.pl \
    --cc=santosh.shilimkar@ti.com \
    --cc=shawn.guo@linaro.org \
    --cc=viresh.kumar@linaro.org \
    /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

all inboxes | Powered by JetHome®