summaryrefslogtreecommitdiff
path: root/drivers/regulator
diff options
context:
space:
mode:
authorPaul Walmsley <pwalmsley@nvidia.com>2013-06-07 08:06:56 +0000
committerMark Brown <broonie@linaro.org>2013-06-07 11:19:29 +0100
commit2a668a8bc2cbe7a464ab1212475a3efb23a94b1e (patch)
tree74419d34e14f6307468a659e63072426d65b592e /drivers/regulator
parentd683b96b072dc4680fc74964eca77e6a23d1fa6e (diff)
downloadlinux-stable-2a668a8bc2cbe7a464ab1212475a3efb23a94b1e.tar.gz
linux-stable-2a668a8bc2cbe7a464ab1212475a3efb23a94b1e.tar.bz2
linux-stable-2a668a8bc2cbe7a464ab1212475a3efb23a94b1e.zip
regulator: core: add regulator_get_linear_step()
Add regulator_get_linear_step(), which returns the voltage step size between VSEL values for linear regulators. This is intended for use by regulator consumers which build their own voltage-to-VSEL tables. Signed-off-by: Paul Walmsley <pwalmsley@nvidia.com> Reviewed-by: Andrew Chew <achew@nvidia.com> Cc: Matthew Longnecker <mlongnecker@nvidia.com> Signed-off-by: Mark Brown <broonie@linaro.org>
Diffstat (limited to 'drivers/regulator')
-rw-r--r--drivers/regulator/core.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 6e5017841582..f07d7adefdda 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -2135,6 +2135,21 @@ int regulator_list_voltage(struct regulator *regulator, unsigned selector)
EXPORT_SYMBOL_GPL(regulator_list_voltage);
/**
+ * regulator_get_linear_step - return the voltage step size between VSEL values
+ * @regulator: regulator source
+ *
+ * Returns the voltage step size between VSEL values for linear
+ * regulators, or return 0 if the regulator isn't a linear regulator.
+ */
+unsigned int regulator_get_linear_step(struct regulator *regulator)
+{
+ struct regulator_dev *rdev = regulator->rdev;
+
+ return rdev->desc->uV_step;
+}
+EXPORT_SYMBOL_GPL(regulator_get_linear_step);
+
+/**
* regulator_is_supported_voltage - check if a voltage range can be supported
*
* @regulator: Regulator to check.