aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/regulator/tps51632-regulator.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/regulator/tps51632-regulator.c')
-rw-r--r--drivers/regulator/tps51632-regulator.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/drivers/regulator/tps51632-regulator.c b/drivers/regulator/tps51632-regulator.c
index 572816e30095..c139890c1514 100644
--- a/drivers/regulator/tps51632-regulator.c
+++ b/drivers/regulator/tps51632-regulator.c
@@ -94,11 +94,14 @@ static int tps51632_dcdc_set_ramp_delay(struct regulator_dev *rdev,
94 int ramp_delay) 94 int ramp_delay)
95{ 95{
96 struct tps51632_chip *tps = rdev_get_drvdata(rdev); 96 struct tps51632_chip *tps = rdev_get_drvdata(rdev);
97 int bit = ramp_delay/6000; 97 int bit;
98 int ret; 98 int ret;
99 99
100 if (bit) 100 if (ramp_delay == 0)
101 bit--; 101 bit = 0;
102 else
103 bit = DIV_ROUND_UP(ramp_delay, 6000) - 1;
104
102 ret = regmap_write(tps->regmap, TPS51632_SLEW_REGS, BIT(bit)); 105 ret = regmap_write(tps->regmap, TPS51632_SLEW_REGS, BIT(bit));
103 if (ret < 0) 106 if (ret < 0)
104 dev_err(tps->dev, "SLEW reg write failed, err %d\n", ret); 107 dev_err(tps->dev, "SLEW reg write failed, err %d\n", ret);