mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>, has@pengutronix.de
Subject: [PATCH 2/4] regulator: add support for struct regulator_desc::off_on_delay
Date: Mon,  8 Feb 2021 20:18:25 +0100	[thread overview]
Message-ID: <20210208191827.19241-2-a.fatoum@pengutronix.de> (raw)
In-Reply-To: <20210208191827.19241-1-a.fatoum@pengutronix.de>

We already honour the enable time in the device tree, read it out
of a new regulator_desc::off_on_delay as well, same as Linux does.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 drivers/regulator/core.c | 3 +++
 include/regulator.h      | 2 ++
 2 files changed, 5 insertions(+)

diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 7ced283c116c..ac3a9b048ea8 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -176,6 +176,9 @@ int of_regulator_register(struct regulator_dev *rd, struct device_node *node)
 
 	ri->node = node;
 
+	if (rd->desc->off_on_delay)
+		ri->enable_time_us = rd->desc->off_on_delay;
+
 	if (rd->desc->fixed_uV && rd->desc->n_voltages == 1)
 		ri->min_uv = ri->max_uv = rd->desc->fixed_uV;
 
diff --git a/include/regulator.h b/include/regulator.h
index 524e53042c92..83a8813265ff 100644
--- a/include/regulator.h
+++ b/include/regulator.h
@@ -52,6 +52,7 @@ struct regulator_bulk_data {
  * @enable_is_inverted: A flag to indicate set enable_mask bits to disable
  *                      when using regulator_enable_regmap and friends APIs.
  * @fixed_uV: Fixed voltage of rails.
+ * @off_on_delay: guard time (in uS), before re-enabling a regulator
  */
 
 struct regulator_desc {
@@ -75,6 +76,7 @@ struct regulator_desc {
 	const struct regulator_linear_range *linear_ranges;
 	int n_linear_ranges;
 	int fixed_uV;
+	unsigned int off_on_delay;
 };
 
 struct regulator_dev {
-- 
2.30.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  reply	other threads:[~2021-02-08 19:18 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-08 19:18 [PATCH 1/4] regulator: add regulator_get_voltage() to API Ahmad Fatoum
2021-02-08 19:18 ` Ahmad Fatoum [this message]
2021-02-08 19:18 ` [PATCH 3/4] regulator: add driver for stm32-vrefbuf Ahmad Fatoum
2021-02-08 19:18 ` [PATCH 4/4] aiodev: add support for STM32 ADC Ahmad Fatoum
2021-02-09  8:00   ` [PATCH] fixup! " Ahmad Fatoum
2021-02-10  9:15 ` [PATCH 1/4] regulator: add regulator_get_voltage() to API Sascha Hauer

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=20210208191827.19241-2-a.fatoum@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=has@pengutronix.de \
    /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