summaryrefslogtreecommitdiffstats
path: root/drivers/regulator/da903x.c
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2012-03-18 21:37:37 +0000
committerMark Brown <broonie@opensource.wolfsonmicro.com>2012-03-18 21:37:37 +0000
commit63236f4038f7e14762114606d95769c32cf6cac1 (patch)
tree326303a0880c46ddadfc29d3bacad073ed1cef20 /drivers/regulator/da903x.c
parent16fbcc3b1139e90fe560fde5619169db74dc02c2 (diff)
parentca61a7bfcd1c68eba84a58070540684448216506 (diff)
downloadlinux-63236f4038f7e14762114606d95769c32cf6cac1.tar.gz
linux-63236f4038f7e14762114606d95769c32cf6cac1.tar.bz2
linux-63236f4038f7e14762114606d95769c32cf6cac1.zip
Merge remote-tracking branch 'regulator/topic/drivers' into regulator-next
Diffstat (limited to 'drivers/regulator/da903x.c')
-rw-r--r--drivers/regulator/da903x.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/drivers/regulator/da903x.c b/drivers/regulator/da903x.c
index 8dbc54da7d70..1851f0929ef0 100644
--- a/drivers/regulator/da903x.c
+++ b/drivers/regulator/da903x.c
@@ -119,7 +119,7 @@ static int da903x_set_ldo_voltage(struct regulator_dev *rdev,
return -EINVAL;
}
- val = (min_uV - info->min_uV + info->step_uV - 1) / info->step_uV;
+ val = DIV_ROUND_UP(min_uV - info->min_uV, info->step_uV);
*selector = val;
val <<= info->vol_shift;
mask = ((1 << info->vol_nbits) - 1) << info->vol_shift;
@@ -202,7 +202,7 @@ static int da9030_set_ldo1_15_voltage(struct regulator_dev *rdev,
return -EINVAL;
}
- val = (min_uV - info->min_uV + info->step_uV - 1) / info->step_uV;
+ val = DIV_ROUND_UP(min_uV - info->min_uV, info->step_uV);
*selector = val;
val <<= info->vol_shift;
mask = ((1 << info->vol_nbits) - 1) << info->vol_shift;
@@ -233,10 +233,10 @@ static int da9030_set_ldo14_voltage(struct regulator_dev *rdev,
thresh = (info->max_uV + info->min_uV) / 2;
if (min_uV < thresh) {
- val = (thresh - min_uV + info->step_uV - 1) / info->step_uV;
+ val = DIV_ROUND_UP(thresh - min_uV, info->step_uV);
val |= 0x4;
} else {
- val = (min_uV - thresh + info->step_uV - 1) / info->step_uV;
+ val = DIV_ROUND_UP(min_uV - thresh, info->step_uV);
}
*selector = val;
@@ -281,7 +281,7 @@ static int da9034_set_dvc_voltage(struct regulator_dev *rdev,
return -EINVAL;
}
- val = (min_uV - info->min_uV + info->step_uV - 1) / info->step_uV;
+ val = DIV_ROUND_UP(min_uV - info->min_uV, info->step_uV);
*selector = val;
val <<= info->vol_shift;
mask = ((1 << info->vol_nbits) - 1) << info->vol_shift;
@@ -307,7 +307,7 @@ static int da9034_set_ldo12_voltage(struct regulator_dev *rdev,
return -EINVAL;
}
- val = (min_uV - info->min_uV + info->step_uV - 1) / info->step_uV;
+ val = DIV_ROUND_UP(min_uV - info->min_uV, info->step_uV);
val = (val >= 20) ? val - 12 : ((val > 7) ? 8 : val);
*selector = val;
val <<= info->vol_shift;