Skip to content

Commit

Permalink
regulator: Ensure enough enable time for max8649
Browse files Browse the repository at this point in the history
Integer division may truncate the result, thus max8649_enable_time() may return
slightly shorter enable time. This patch fixes it.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
  • Loading branch information
Axel Lin authored and Liam Girdwood committed Aug 8, 2011
1 parent 99cd25c commit e69c499
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/regulator/max8649.c
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ static int max8649_enable_time(struct regulator_dev *rdev)
ret = (ret & MAX8649_RAMP_MASK) >> 5;
rate = (32 * 1000) >> ret; /* uV/uS */

return (voltage / rate);
return DIV_ROUND_UP(voltage, rate);
}

static int max8649_set_mode(struct regulator_dev *rdev, unsigned int mode)
Expand Down

0 comments on commit e69c499

Please sign in to comment.