regulator: core: Fix off-on-delay-us for always-on/boot-on regulators
authorChristian Kohlschütter <christian@kohlschutter.com>
Tue, 19 Jul 2022 14:02:00 +0000 (16:02 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 17 Mar 2023 07:48:52 +0000 (08:48 +0100)
commite1a078cac3e909a28e21fd89364d13d78582fb2a
treec8e794869ae8ebae95bb8d268773a953ce52dd5b
parent67a791df14572a022db81cdff569fd018365baf0
regulator: core: Fix off-on-delay-us for always-on/boot-on regulators

[ Upstream commit 218320fec29430438016f88dd4fbebfa1b95ad8d ]

Regulators marked with "regulator-always-on" or "regulator-boot-on"
as well as an "off-on-delay-us", may run into cycling issues that are
hard to detect.

This is caused by the "last_off" state not being initialized in this
case.

Fix the "last_off" initialization by setting it to the current kernel
time upon initialization, regardless of always_on/boot_on state.

Signed-off-by: Christian Kohlschütter <christian@kohlschutter.com>
Link: https://lore.kernel.org/r/FAFD5B39-E9C4-47C7-ACF1-2A04CD59758D@kohlschutter.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Stable-dep-of: 80d2c29e09e6 ("regulator: core: Use ktime_get_boottime() to determine how long a regulator was off")
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/regulator/core.c