summaryrefslogtreecommitdiff
path: root/drivers/regulator/da903x.c
diff options
context:
space:
mode:
authorAxel Lin <axel.lin@gmail.com>2012-06-07 10:38:30 +0800
committerMark Brown <broonie@opensource.wolfsonmicro.com>2012-06-08 07:29:47 +0800
commitee3ed6effd8cc4c0cbfa35307cfc5fcec75b5e12 (patch)
treea61eee540cfac1df79bd1988b149d8c204879726 /drivers/regulator/da903x.c
parent985f769c89aedcae2981080051fc85b4ed035a9b (diff)
regulator: da903x: Don't read/write to DA9030_INVAL/DA9034_INVAL address
For fixed voltage, DA9030_LDO13 and DA9034_LDO5, the info->vol_reg is DA9030_INVAL/DA9034_INVAL. It does not make sense to read/write to DA9030_INVAL/DA9034_INVAL address. Signed-off-by: Axel Lin <axel.lin@gmail.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'drivers/regulator/da903x.c')
-rw-r--r--drivers/regulator/da903x.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/regulator/da903x.c b/drivers/regulator/da903x.c
index 1005f5f7e603..36c5b92fe0af 100644
--- a/drivers/regulator/da903x.c
+++ b/drivers/regulator/da903x.c
@@ -107,6 +107,9 @@ static int da903x_set_voltage_sel(struct regulator_dev *rdev, unsigned selector)
struct device *da9034_dev = to_da903x_dev(rdev);
uint8_t val, mask;
+ if (rdev->desc->n_voltages == 1)
+ return -EINVAL;
+
val = selector << info->vol_shift;
mask = ((1 << info->vol_nbits) - 1) << info->vol_shift;
@@ -120,6 +123,9 @@ static int da903x_get_voltage_sel(struct regulator_dev *rdev)
uint8_t val, mask;
int ret;
+ if (rdev->desc->n_voltages == 1)
+ return 0;
+
ret = da903x_read(da9034_dev, info->vol_reg, &val);
if (ret)
return ret;