regulator: da9052: Ensure enough delay time for .set_voltage_time_sel
authorAxel Lin <axel.lin@ingics.com>
Fri, 18 Jun 2021 14:14:11 +0000 (22:14 +0800)
committerMark Brown <broonie@kernel.org>
Wed, 23 Jun 2021 11:34:40 +0000 (12:34 +0100)
commita336dc8f683e5be794186b5643cd34cb28dd2c53
tree95333d8b37822f21602b883c199fefe30c40af68
parent9bc146acc33125cd9f365b92f1c02ec89f639977
regulator: da9052: Ensure enough delay time for .set_voltage_time_sel

Use DIV_ROUND_UP to prevent truncation by integer division issue.
This ensures we return enough delay time.

Also fix returning negative value when new_sel < old_sel.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Link: https://lore.kernel.org/r/20210618141412.4014912-1-axel.lin@ingics.com
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/regulator/da9052-regulator.c