[PATCH 2/4] regulator: add support for struct regulator_desc::off_on_delay
Ahmad Fatoum
a.fatoum at pengutronix.de
Mon Feb 8 14:18:25 EST 2021
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 at 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
More information about the barebox
mailing list