Blob Blame History Raw
From: Peng Fan <peng.fan@nxp.com>
Date: Tue, 29 Oct 2019 01:21:31 +0000
Subject: regulator: fixed: add off-on-delay

Git-commit: f7907e57aea2adcd0b57ebcca410e125412ab680
Patch-mainline: v5.5-rc1
References: jsc#SLE-12251

Depends on board design, the gpio controlling regulator may
connects with a big capacitance. When need off, it takes some time
to let the regulator to be truly off. If not add enough delay, the
regulator might have always been on, so introduce off-on-delay to
handle such case.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Link: https://lore.kernel.org/r/1572311875-22880-3-git-send-email-peng.fan@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Mian Yousaf Kaukab <yousaf.kaukab@suse.com>
---
 drivers/regulator/fixed.c       |    2 ++
 include/linux/regulator/fixed.h |    1 +
 2 files changed, 3 insertions(+)

--- a/drivers/regulator/fixed.c
+++ b/drivers/regulator/fixed.c
@@ -74,6 +74,7 @@ of_get_fixed_voltage_config(struct devic
 		config->enabled_at_boot = true;
 
 	of_property_read_u32(np, "startup-delay-us", &config->startup_delay);
+	of_property_read_u32(np, "off-on-delay-us", &config->off_on_delay);
 
 	if (of_find_property(np, "vin-supply", NULL))
 		config->input_supply = "vin";
@@ -121,6 +122,7 @@ static int reg_fixed_voltage_probe(struc
 	drvdata->desc.ops = &fixed_voltage_ops;
 
 	drvdata->desc.enable_time = config->startup_delay;
+	drvdata->desc.off_on_delay = config->off_on_delay;
 
 	if (config->input_supply) {
 		drvdata->desc.supply_name = devm_kstrdup(&pdev->dev,
--- a/include/linux/regulator/fixed.h
+++ b/include/linux/regulator/fixed.h
@@ -36,6 +36,7 @@ struct fixed_voltage_config {
 	const char *input_supply;
 	int microvolts;
 	unsigned startup_delay;
+	unsigned int off_on_delay;
 	unsigned enabled_at_boot:1;
 	struct regulator_init_data *init_data;
 };