From 2a668a8bc2cbe7a464ab1212475a3efb23a94b1e Mon Sep 17 00:00:00 2001 From: Paul Walmsley Date: Fri, 7 Jun 2013 08:06:56 +0000 Subject: 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 Reviewed-by: Andrew Chew Cc: Matthew Longnecker Signed-off-by: Mark Brown --- drivers/regulator/core.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'drivers/regulator/core.c') diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index 6e501784158..f07d7adefdd 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c @@ -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 * -- cgit v1.2.3-18-g5258