From: Taras Kondratiuk <taras@ti.com>
To: Mark Brown <broonie@kernel.org>
Cc: lgirdwood@gmail.com, rjw@sisk.pl, viresh.kumar@linaro.org,
shawn.guo@linaro.org, cpufreq@vger.kernel.org,
linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
Philip Rakity <prakity@nvidia.com>,
Eric Miao <eric.y.miao@gmail.com>
Subject: Re: [RFC PATCH 1/2] regulator: core: Add regulator_set_voltage_min()
Date: Mon, 22 Apr 2013 19:49:37 +0300 [thread overview]
Message-ID: <51756A21.3020405@ti.com> (raw)
In-Reply-To: <20130422131904.GL30351@opensource.wolfsonmicro.com>
On 04/22/2013 04:19 PM, Mark Brown wrote:
> On Fri, Apr 19, 2013 at 02:55:53PM +0300, Taras Kondratiuk wrote:
>> Sometimes it is a need to constrain only a minimum voltage
>> and let system constraints to limit maximum.
>> Add a new function regulator_set_voltage_min() for this.
> I don't believe you on this one. It is going to be a very unusual
> system which has a maximum supply voltage specified at over 4kV (or
> more) which is what INT_MAX will come out as - there will be some
> electrical specs for what voltages can be tolerated sustainably.
Yeah. Sure 4kV is not a real request, but
max will be limited by system constrains.
According to regulator_set_voltage() documentation
system constraints should be set before calling this function,
so I assume I can rely on them. No?
Another possible implementation is below, but prefer initial one.
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index e3661c2..28c1be3 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -2355,6 +2355,19 @@ out2:
}
EXPORT_SYMBOL_GPL(regulator_set_voltage);
+int regulator_set_voltage_min(struct regulator *regulator, int min_uV)
+{
+ struct regulator_dev *rdev = regulator->rdev;
+ int max_uV;
+
+ mutex_lock(&rdev->mutex);
+ max_uV = rdev->constraints->max_uV;
+ mutex_unlock(&rdev->mutex);
+ return regulator_set_voltage(regulator, min_uV, max_uV);
+}
+EXPORT_SYMBOL_GPL(regulator_set_voltage_min);
+
+
/**
* regulator_set_voltage_time - get raise/fall time
* @regulator: regulator source
--
BR
Taras Kondratiuk | GlobalLogic
next prev parent reply other threads:[~2013-04-22 16:49 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: Limit minimum voltage only 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 [this message]
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 ` [RFC PATCH 2/2] cpufreq: cpufreq-cpu0: Limit minimum voltage only Taras Kondratiuk
2013-04-19 16:21 ` [RFC PATCH 0/2] cpufreq/regulator: " 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=51756A21.3020405@ti.com \
--to=taras@ti.com \
--cc=broonie@kernel.org \
--cc=cpufreq@vger.kernel.org \
--cc=eric.y.miao@gmail.com \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=prakity@nvidia.com \
--cc=rjw@sisk.pl \
--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