Skip to content

Commit c714a58

Browse files
AxelLinbroonie
authored andcommitted
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: Axel Lin <[email protected]> Acked-by: Laxman Dewangan <[email protected]> Signed-off-by: Mark Brown <[email protected]>
1 parent 1a695a9 commit c714a58

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

drivers/regulator/tps51632-regulator.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,11 +94,14 @@ static int tps51632_dcdc_set_ramp_delay(struct regulator_dev *rdev,
9494
int ramp_delay)
9595
{
9696
struct tps51632_chip *tps = rdev_get_drvdata(rdev);
97-
int bit = ramp_delay/6000;
97+
int bit;
9898
int ret;
9999

100-
if (bit)
101-
bit--;
100+
if (ramp_delay == 0)
101+
bit = 0;
102+
else
103+
bit = DIV_ROUND_UP(ramp_delay, 6000) - 1;
104+
102105
ret = regmap_write(tps->regmap, TPS51632_SLEW_REGS, BIT(bit));
103106
if (ret < 0)
104107
dev_err(tps->dev, "SLEW reg write failed, err %d\n", ret);

0 commit comments

Comments
 (0)