aboutsummaryrefslogtreecommitdiff
path: root/drivers/regulator
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2012-12-10 12:42:52 +0900
committerMark Brown <broonie@opensource.wolfsonmicro.com>2012-12-10 12:42:52 +0900
commit6234427eb8b3c4cd329bcb68773d1e5389b3f83b (patch)
treee4f6f0b2cd75527702ca044802240fb66be0f85e /drivers/regulator
parentb0e5997ef4300da08b051d2a84ce6cc11b267042 (diff)
parentd1e7de3007c6e34c5e6d5e1b707b5aba4a1cd57f (diff)
Merge remote-tracking branch 'regulator/topic/change' into regulator-next
Diffstat (limited to 'drivers/regulator')
-rw-r--r--drivers/regulator/core.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index e872c8be080..59e08633372 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -1867,6 +1867,28 @@ int regulator_is_enabled(struct regulator *regulator)
EXPORT_SYMBOL_GPL(regulator_is_enabled);
/**
+ * regulator_can_change_voltage - check if regulator can change voltage
+ * @regulator: regulator source
+ *
+ * Returns positive if the regulator driver backing the source/client
+ * can change its voltage, false otherwise. Usefull for detecting fixed
+ * or dummy regulators and disabling voltage change logic in the client
+ * driver.
+ */
+int regulator_can_change_voltage(struct regulator *regulator)
+{
+ struct regulator_dev *rdev = regulator->rdev;
+
+ if (rdev->constraints &&
+ rdev->constraints->valid_ops_mask & REGULATOR_CHANGE_VOLTAGE &&
+ rdev->desc->n_voltages > 1)
+ return 1;
+
+ return 0;
+}
+EXPORT_SYMBOL_GPL(regulator_can_change_voltage);
+
+/**
* regulator_count_voltages - count regulator_list_voltage() selectors
* @regulator: regulator source
*