]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
regulator: core: add regulator_get_linear_step()
authorPaul Walmsley <pwalmsley@nvidia.com>
Fri, 7 Jun 2013 08:06:56 +0000 (08:06 +0000)
committerMark Brown <broonie@linaro.org>
Fri, 7 Jun 2013 10:19:29 +0000 (11:19 +0100)
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>
drivers/regulator/core.c
include/linux/regulator/consumer.h

index 6e501784158266d990fc6cad8fb6e0ee7733d923..f07d7adefdda67620cd15ee6340d160a5cb2b703 100644 (file)
@@ -2134,6 +2134,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
  *
index 145022a830857a5af55d63562c9da980eb2498f9..3a76389c6aaa6989900247712c8ffe33658b33db 100644 (file)
@@ -165,6 +165,7 @@ int regulator_count_voltages(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);
+unsigned int regulator_get_linear_step(struct regulator *regulator);
 int regulator_set_voltage(struct regulator *regulator, int min_uV, int max_uV);
 int regulator_set_voltage_time(struct regulator *regulator,
                               int old_uV, int new_uV);