Commit c714a588 authored by Axel Lin's avatar Axel Lin Committed by Mark Brown

regulator: tps51632: Fix setting ramp delay

According to the datasheet:

SLEW Register(Address = 07h)
b7      b6      b5      b4      b3      b2      b1      b0
48mV/us 42mV/us 36mV/us 30mV/us 24mV/us 18mV/us 12mV/us 6mV/us

Current code does not set correct slew rate in some cases:
e.g. Assume ramp_delay is 10000, current code sets slew register to 6mV/us.
Fix the logic to set slew register.
Signed-off-by: default avatarAxel Lin <>
Acked-by: default avatarLaxman Dewangan <>
Signed-off-by: default avatarMark Brown <>
parent 1a695a90
......@@ -94,11 +94,14 @@ static int tps51632_dcdc_set_ramp_delay(struct regulator_dev *rdev,
int ramp_delay)
struct tps51632_chip *tps = rdev_get_drvdata(rdev);
int bit = ramp_delay/6000;
int bit;
int ret;
if (bit)
if (ramp_delay == 0)
bit = 0;
bit = DIV_ROUND_UP(ramp_delay, 6000) - 1;
ret = regmap_write(tps->regmap, TPS51632_SLEW_REGS, BIT(bit));
if (ret < 0)
dev_err(tps->dev, "SLEW reg write failed, err %d\n", ret);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment