aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Walmsley <pwalmsley@nvidia.com>2013-06-07 04:06:56 -0400
committerMark Brown <broonie@linaro.org>2013-06-07 06:19:29 -0400
commit2a668a8bc2cbe7a464ab1212475a3efb23a94b1e (patch)
tree74419d34e14f6307468a659e63072426d65b592e
parentd683b96b072dc4680fc74964eca77e6a23d1fa6e (diff)
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>
-rw-r--r--drivers/regulator/core.c15
-rw-r--r--include/linux/regulator/consumer.h1
2 files changed, 16 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)
2135EXPORT_SYMBOL_GPL(regulator_list_voltage); 2135EXPORT_SYMBOL_GPL(regulator_list_voltage);
2136 2136
2137/** 2137/**
2138 * regulator_get_linear_step - return the voltage step size between VSEL values
2139 * @regulator: regulator source
2140 *
2141 * Returns the voltage step size between VSEL values for linear
2142 * regulators, or return 0 if the regulator isn't a linear regulator.
2143 */
2144unsigned int regulator_get_linear_step(struct regulator *regulator)
2145{
2146 struct regulator_dev *rdev = regulator->rdev;
2147
2148 return rdev->desc->uV_step;
2149}
2150EXPORT_SYMBOL_GPL(regulator_get_linear_step);
2151
2152/**
2138 * regulator_is_supported_voltage - check if a voltage range can be supported 2153 * regulator_is_supported_voltage - check if a voltage range can be supported
2139 * 2154 *
2140 * @regulator: Regulator to check. 2155 * @regulator: Regulator to check.
diff --git a/include/linux/regulator/consumer.h b/include/linux/regulator/consumer.h
index 145022a83085..3a76389c6aaa 100644
--- a/include/linux/regulator/consumer.h
+++ b/include/linux/regulator/consumer.h
@@ -165,6 +165,7 @@ int regulator_count_voltages(struct regulator *regulator);
165int regulator_list_voltage(struct regulator *regulator, unsigned selector); 165int regulator_list_voltage(struct regulator *regulator, unsigned selector);
166int regulator_is_supported_voltage(struct regulator *regulator, 166int regulator_is_supported_voltage(struct regulator *regulator,
167 int min_uV, int max_uV); 167 int min_uV, int max_uV);
168unsigned int regulator_get_linear_step(struct regulator *regulator);
168int regulator_set_voltage(struct regulator *regulator, int min_uV, int max_uV); 169int regulator_set_voltage(struct regulator *regulator, int min_uV, int max_uV);
169int regulator_set_voltage_time(struct regulator *regulator, 170int regulator_set_voltage_time(struct regulator *regulator,
170 int old_uV, int new_uV); 171 int old_uV, int new_uV);