linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 1/2] regulator: core: add regulator_has_continuous_voltage_range()
@ 2017-03-08 20:02 Matthias Kaehlcke
  2017-03-08 20:02 ` [PATCH v2 2/2] regulator: Add driver for voltage controlled regulators Matthias Kaehlcke
  2017-03-09 10:28 ` [PATCH v2 1/2] regulator: core: add regulator_has_continuous_voltage_range() Mark Brown
  0 siblings, 2 replies; 9+ messages in thread
From: Matthias Kaehlcke @ 2017-03-08 20:02 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown, Rob Herring, Mark Rutland
  Cc: linux-kernel, devicetree, Douglas Anderson, Brian Norris,
	Guenter Roeck, Dmitry Torokhov, Matthias Kaehlcke

The new function allows consumers to determine if a regulator is
continuous or discrete, and whether the results of
regulator_count_voltages() and regulator_list_voltage() correspond
to the regulator itself or its supply.

Change-Id: I1198cee9fff60dc747a02860e9652034f4d5da33
Signed-off-by: Matthias Kaehlcke <mka@chromium.org>
---
Changes in v2:
- Added regulator_has_continuous_voltage_range()

 drivers/regulator/core.c           | 16 ++++++++++++++++
 include/linux/regulator/consumer.h |  1 +
 2 files changed, 17 insertions(+)

diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 53d4fc70dbd0..ce1d02792ef4 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -2552,6 +2552,22 @@ int regulator_count_voltages(struct regulator *regulator)
 EXPORT_SYMBOL_GPL(regulator_count_voltages);
 
 /**
+ * regulator_has_continuous_voltage_range - is the regulator continuous
+ * or discrete
+ * @regulator: regulator source
+ *
+ * Returns true if the regulator has a continuous voltage range and
+ * false for discrete voltage regulators.
+ */
+int regulator_has_continuous_voltage_range(struct regulator *regulator)
+{
+	struct regulator_dev	*rdev = regulator->rdev;
+
+	return rdev->desc->continuous_voltage_range;
+}
+EXPORT_SYMBOL_GPL(regulator_has_continuous_voltage_range);
+
+/**
  * regulator_list_voltage - enumerate supported voltages
  * @regulator: regulator source
  * @selector: identify voltage to list
diff --git a/include/linux/regulator/consumer.h b/include/linux/regulator/consumer.h
index ea0fffa5faeb..19945b5a702e 100644
--- a/include/linux/regulator/consumer.h
+++ b/include/linux/regulator/consumer.h
@@ -241,6 +241,7 @@ void regulator_bulk_free(int num_consumers,
 			 struct regulator_bulk_data *consumers);
 
 int regulator_count_voltages(struct regulator *regulator);
+int regulator_has_continuous_voltage_range(struct regulator *regulator);
 int regulator_list_voltage(struct regulator *regulator, unsigned selector);
 int regulator_is_supported_voltage(struct regulator *regulator,
 				   int min_uV, int max_uV);
-- 
2.12.0.246.ga2ecc84866-goog

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

end of thread, other threads:[~2017-03-24 18:43 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-08 20:02 [PATCH v2 1/2] regulator: core: add regulator_has_continuous_voltage_range() Matthias Kaehlcke
2017-03-08 20:02 ` [PATCH v2 2/2] regulator: Add driver for voltage controlled regulators Matthias Kaehlcke
2017-03-09 10:28 ` [PATCH v2 1/2] regulator: core: add regulator_has_continuous_voltage_range() Mark Brown
2017-03-09 19:40   ` Matthias Kaehlcke
2017-03-17 21:15     ` Mark Brown
2017-03-18  0:03       ` Matthias Kaehlcke
2017-03-20 12:06         ` Mark Brown
2017-03-23 21:40           ` Matthias Kaehlcke
2017-03-24 18:43             ` Mark Brown

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).