All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] regulator: core: Respect off_on_delay at startup
@ 2021-04-22  8:30 Vincent Whitchurch
  2021-04-22 16:48 ` Mark Brown
  0 siblings, 1 reply; 2+ messages in thread
From: Vincent Whitchurch @ 2021-04-22  8:30 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown; +Cc: kernel, Vincent Whitchurch, linux-kernel

We currently do not respect off_on_delay the first time we turn on a
regulator.  This is problematic since the regulator could have been
turned off by the bootloader, or it could it have been turned off during
the probe of the regulator driver (such as when regulator-fixed requests
the enable GPIO), either of which could potentially have happened less
than off_on_delay microseconds ago before the first time a client
requests for the regulator to be turned on.

We can't know exactly when the regulator was turned off, but initialise
off_on_delay to the current time when registering the regulator, so that
we guarantee that we respect the off_on_delay in all cases.

Signed-off-by: Vincent Whitchurch <vincent.whitchurch@axis.com>
---
 drivers/regulator/core.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 16114aea099a..d6219cb8bd29 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -1439,6 +1439,8 @@ static int set_machine_constraints(struct regulator_dev *rdev)
 
 		if (rdev->constraints->always_on)
 			rdev->use_count++;
+	} else if (rdev->desc->off_on_delay) {
+		rdev->last_off_jiffy = jiffies;
 	}
 
 	print_constraints(rdev);
-- 
2.28.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] regulator: core: Respect off_on_delay at startup
  2021-04-22  8:30 [PATCH] regulator: core: Respect off_on_delay at startup Vincent Whitchurch
@ 2021-04-22 16:48 ` Mark Brown
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2021-04-22 16:48 UTC (permalink / raw)
  To: Vincent Whitchurch, Liam Girdwood; +Cc: Mark Brown, linux-kernel, kernel

On Thu, 22 Apr 2021 10:30:44 +0200, Vincent Whitchurch wrote:
> We currently do not respect off_on_delay the first time we turn on a
> regulator.  This is problematic since the regulator could have been
> turned off by the bootloader, or it could it have been turned off during
> the probe of the regulator driver (such as when regulator-fixed requests
> the enable GPIO), either of which could potentially have happened less
> than off_on_delay microseconds ago before the first time a client
> requests for the regulator to be turned on.
> 
> [...]

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git for-next

Thanks!

[1/1] regulator: core: Respect off_on_delay at startup
      commit: a5ccccb3ec0b052804d03df90c0d08689be54170

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-04-22 16:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-22  8:30 [PATCH] regulator: core: Respect off_on_delay at startup Vincent Whitchurch
2021-04-22 16:48 ` Mark Brown

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.