aboutsummaryrefslogtreecommitdiff
path: root/drivers/regulator/s5m8767.c
diff options
context:
space:
mode:
authorAxel Lin <axel.lin@gmail.com>2012-02-24 14:52:45 +0800
committerMark Brown <broonie@opensource.wolfsonmicro.com>2012-03-11 20:48:45 +0000
commit89e0f0e40002e0d95b7be079fa2c2133304ce09f (patch)
tree195a191c2a0ea04e17f9b8daff8d5827ed495273 /drivers/regulator/s5m8767.c
parent0757b6020f5aaa9f770068ca0396c0ea5cb0740d (diff)
downloadlinaro-lsk-89e0f0e40002e0d95b7be079fa2c2133304ce09f.tar.gz
regulator: Fix the logic of s5m8767_set_voltage_time_sel
This patch includes below fixes: 1. The mask variable is not used at all here, remove it. 2. We already have the new_sel and old_sel, simply returns the delay by: DIV_ROUND_UP(desc->step * (new_sel - old_sel), s5m8767->ramp_delay); Signed-off-by: Axel Lin <axel.lin@gmail.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'drivers/regulator/s5m8767.c')
-rw-r--r--drivers/regulator/s5m8767.c30
1 files changed, 2 insertions, 28 deletions
diff --git a/drivers/regulator/s5m8767.c b/drivers/regulator/s5m8767.c
index 2fb2adddd48..9b97aa36b7c 100644
--- a/drivers/regulator/s5m8767.c
+++ b/drivers/regulator/s5m8767.c
@@ -452,39 +452,13 @@ static int s5m8767_set_voltage_time_sel(struct regulator_dev *rdev,
struct s5m8767_info *s5m8767 = rdev_get_drvdata(rdev);
const struct s5m_voltage_desc *desc;
int reg_id = rdev_get_id(rdev);
- int mask;
- int new_val, old_val;
- switch (reg_id) {
- case S5M8767_LDO1 ... S5M8767_LDO28:
- mask = 0x3f;
- break;
- case S5M8767_BUCK1 ... S5M8767_BUCK6:
- mask = 0xff;
- break;
- case S5M8767_BUCK7 ... S5M8767_BUCK8:
- return -EINVAL;
- case S5M8767_BUCK9:
- mask = 0xff;
- break;
- default:
- return -EINVAL;
- }
desc = reg_voltage_map[reg_id];
- new_val = s5m8767_convert_voltage(desc, new_sel, new_sel);
- if (new_val < 0)
- return new_val;
-
- old_val = s5m8767_convert_voltage(desc, old_sel, old_sel);
- if (old_val < 0)
- return old_val;
-
if (old_sel < new_sel)
- return DIV_ROUND_UP(desc->step * (new_val - old_val),
+ return DIV_ROUND_UP(desc->step * (new_sel - old_sel),
s5m8767->ramp_delay);
- else
- return 0;
+ return 0;
}
static struct regulator_ops s5m8767_ldo_ops = {