linux-stable/include/linux/regulator
Vincent Whitchurch a8ce7bd896
regulator: core: Fix off_on_delay handling
The jiffies-based off_on_delay implementation has a couple of problems
that cause it to sometimes not actually delay for the required time:

 (1) If, for example, the off_on_delay time is equivalent to one jiffy,
     and the ->last_off_jiffy is set just before a new jiffy starts,
     then _regulator_do_enable() does not wait at all since it checks
     using time_before().

 (2) When jiffies overflows, the value of "remaining" becomes higher
     than "max_delay" and the code simply proceeds without waiting.

Fix these problems by changing it to use ktime_t instead.

[Note that since jiffies doesn't start at zero but at INITIAL_JIFFIES
 ("-5 minutes"), (2) above also led to the code not delaying if
 the first regulator_enable() is called when the ->last_off_jiffy is not
 initialised, such as for regulators with ->constraints->boot_on set.
 It's not clear to me if this was intended or not, but I've preserved
 this behaviour explicitly with the check for a non-zero ->last_off.]

Signed-off-by: Vincent Whitchurch <vincent.whitchurch@axis.com>
Link: https://lore.kernel.org/r/20210423114524.26414-1-vincent.whitchurch@axis.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-04-23 13:18:35 +01:00
..
act8865.h
arizona-ldo1.h
arizona-micsupp.h
consumer.h regulator: consumer: Add missing stubs to regulator/consumer.h 2021-01-21 12:35:42 +00:00
coupler.h
da9121.h regulator: da9121: Add support for device variants via devicetree 2020-12-01 12:18:00 +00:00
da9211.h
db8500-prcmu.h
driver.h regulator: core: Fix off_on_delay handling 2021-04-23 13:18:35 +01:00
fan53555.h
fixed.h
gpio-regulator.h
lp872x.h
lp3971.h
lp3972.h
machine.h regulator: Correct kernel-doc inconsistency 2020-07-17 00:16:50 +01:00
max1586.h
max8649.h
max8660.h
max8952.h
max8973-regulator.h
mt6311.h
mt6315-regulator.h regulator: mt6315: Add support for MT6315 regulator 2021-02-08 11:48:48 +00:00
mt6323-regulator.h
mt6358-regulator.h
mt6380-regulator.h
mt6397-regulator.h
of_regulator.h
pca9450.h regulator: pca9450: Clear PRESET_EN bit to fix BUCK1/2/3 voltage setting 2021-03-10 12:22:26 +00:00
pfuze100.h regulator: pfuze100: Convert the driver to DT-only 2020-12-11 13:23:06 +00:00
tps6507x.h
tps51632-regulator.h
tps62360.h
userspace-consumer.h