From: Bjorn Andersson <bjorn@kryo.se>
To: Liam Girdwood <lgirdwood@gmail.com>,
Mark Brown <broonie@kernel.org>,
linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org,
linux-arm-kernel@lists.infradead.org
Subject: [PATCH] regulator: core: Make regulator object reflect configured voltage
Date: Mon, 3 Feb 2014 21:54:28 -0800 [thread overview]
Message-ID: <1391493268-3242-1-git-send-email-bjorn.andersson@sonymobile.com> (raw)
In the case when a regulator is initialized from DT with equal min and max
voltages the voltage is applied on initialization and future calls to
regulator_set_voltage fails. This behavious is different than if the regulator
is configured to be a span and therefor requires logic to handle this
difference in the consumer driver.
Eliminate this difference by populating the min_uV and max_uV of the newly
created regulator from the constraints so that calles to regulator_set_voltage
is considered no-ops and not a failure.
Signed-off-by: Bjorn Andersson <bjorn.andersson@sonymobile.com>
---
drivers/regulator/core.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index d85f313..9c82d37 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -1209,6 +1209,16 @@ static struct regulator *create_regulator(struct regulator_dev *rdev,
_regulator_is_enabled(rdev))
regulator->always_on = true;
+ /*
+ * Make the regulator reflect the configured voltage selected in
+ * machine_constraints_voltage()
+ */
+ if (rdev->constraints->apply_uV &&
+ rdev->constraints->min_uV == rdev->constraints->max_uV) {
+ regulator->min_uV = rdev->constraints->min_uV;
+ regulator->max_uV = rdev->constraints->min_uV;
+ }
+
mutex_unlock(&rdev->mutex);
return regulator;
overflow_err:
--
1.7.9.5
next reply other threads:[~2014-02-04 5:54 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-04 5:54 Bjorn Andersson [this message]
2014-02-04 11:05 ` Mark Brown
2014-02-04 18:02 ` Bjorn Andersson
2014-02-04 18:18 ` Mark Brown
2014-02-04 19:09 ` Bjorn Andersson
2014-02-04 20:00 ` Mark Brown
2014-02-05 18:00 ` Bjorn Andersson
2014-02-05 18:18 ` Mark Brown
2014-02-05 20:30 ` [PATCH] regulator: core: Allow regulator_set_voltage for fixed regulators Bjorn Andersson
2014-02-07 12:14 ` Mark Brown
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=1391493268-3242-1-git-send-email-bjorn.andersson@sonymobile.com \
--to=bjorn@kryo.se \
--cc=broonie@kernel.org \
--cc=lgirdwood@gmail.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.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®