From: Vincent Whitchurch <vincent.whitchurch@axis.com>
To: Liam Girdwood <lgirdwood@gmail.com>, Mark Brown <broonie@kernel.org>
Cc: <kernel@axis.com>,
Vincent Whitchurch <vincent.whitchurch@axis.com>,
<linux-kernel@vger.kernel.org>
Subject: [PATCH] regulator: core: Respect off_on_delay at startup
Date: Thu, 22 Apr 2021 10:30:44 +0200 [thread overview]
Message-ID: <20210422083044.11479-1-vincent.whitchurch@axis.com> (raw)
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
next reply other threads:[~2021-04-22 8:30 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-22 8:30 Vincent Whitchurch [this message]
2021-04-22 16:48 ` Mark Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210422083044.11479-1-vincent.whitchurch@axis.com \
--to=vincent.whitchurch@axis.com \
--cc=broonie@kernel.org \
--cc=kernel@axis.com \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®