Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] regulator: core: Make regulator object reflect configured voltage
@ 2014-02-04  5:54 Bjorn Andersson
  2014-02-04 11:05 ` Mark Brown
  2014-02-05 20:30 ` [PATCH] regulator: core: Allow regulator_set_voltage for fixed regulators Bjorn Andersson
  0 siblings, 2 replies; 10+ messages in thread
From: Bjorn Andersson @ 2014-02-04  5:54 UTC (permalink / raw)
  To: linux-arm-kernel

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

^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2014-02-07 12:14 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-02-04  5:54 [PATCH] regulator: core: Make regulator object reflect configured voltage Bjorn Andersson
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox