aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/regulator/ab8500-ext.c
diff options
context:
space:
mode:
authorLee Jones <lee.jones@linaro.org>2013-06-07 12:11:25 -0400
committerMark Brown <broonie@linaro.org>2013-06-07 12:52:35 -0400
commit33fb880249b1f2f349461c64d19bdfe2e969c1ba (patch)
treec6124af69aa9f891dfd54eed961bfca7856d0e6d /drivers/regulator/ab8500-ext.c
parent1e1bb58da2ae080002578c35f80495dadda50940 (diff)
regulator: ab8500-ext: Provide a set_voltage call-back operation
When registering regulators which have a single voltage through Device Tree, the framework insists that the specified voltage is actually set. Well in order to do that we need to provide this call-back, where we check that the value is sane and return without error. Not that the selector isn't populated, but in our case list_voltage doesn't actually use it, so we're good. Signed-off-by: Lee Jones <lee.jones@linaro.org> Signed-off-by: Mark Brown <broonie@linaro.org>
Diffstat (limited to 'drivers/regulator/ab8500-ext.c')
-rw-r--r--drivers/regulator/ab8500-ext.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/drivers/regulator/ab8500-ext.c b/drivers/regulator/ab8500-ext.c
index b4d45472aae6..e4975bc61e81 100644
--- a/drivers/regulator/ab8500-ext.c
+++ b/drivers/regulator/ab8500-ext.c
@@ -229,6 +229,28 @@ static unsigned int ab8500_ext_regulator_get_mode(struct regulator_dev *rdev)
229 return ret; 229 return ret;
230} 230}
231 231
232static int ab8500_ext_set_voltage(struct regulator_dev *rdev, int min_uV,
233 int max_uV, unsigned *selector)
234{
235 struct regulation_constraints *regu_constraints = rdev->constraints;
236
237 if (!regu_constraints) {
238 dev_err(rdev_get_dev(rdev), "No regulator constraints\n");
239 return -EINVAL;
240 }
241
242 if (regu_constraints->min_uV == min_uV &&
243 regu_constraints->max_uV == max_uV)
244 return 0;
245
246 dev_err(rdev_get_dev(rdev),
247 "Requested min %duV max %duV != constrained min %duV max %duV\n",
248 min_uV, max_uV,
249 regu_constraints->min_uV, regu_constraints->max_uV);
250
251 return -EINVAL;
252}
253
232static int ab8500_ext_list_voltage(struct regulator_dev *rdev, 254static int ab8500_ext_list_voltage(struct regulator_dev *rdev,
233 unsigned selector) 255 unsigned selector)
234{ 256{
@@ -252,6 +274,7 @@ static struct regulator_ops ab8500_ext_regulator_ops = {
252 .is_enabled = ab8500_ext_regulator_is_enabled, 274 .is_enabled = ab8500_ext_regulator_is_enabled,
253 .set_mode = ab8500_ext_regulator_set_mode, 275 .set_mode = ab8500_ext_regulator_set_mode,
254 .get_mode = ab8500_ext_regulator_get_mode, 276 .get_mode = ab8500_ext_regulator_get_mode,
277 .set_voltage = ab8500_ext_set_voltage,
255 .list_voltage = ab8500_ext_list_voltage, 278 .list_voltage = ab8500_ext_list_voltage,
256}; 279};
257 280