[U-Boot] [PATCH V2] drivers: regulator: fixed: add u-boot, off-on-delay-us

Peng Fan peng.fan at nxp.com
Tue Jul 24 08:11:52 UTC 2018


Add u-boot,off-on-delay-us for fixed regulator.

Depends on board design, the gpio regulator sometimes
connects with a big capacitance. When need to off, then
on the regulator, if there is no enough delay,
the voltage does not drop to 0, so introduce this
property to handle such case.

Signed-off-by: Peng Fan <peng.fan at nxp.com>
Cc: Masahiro Yamada <yamada.masahiro at socionext.com>
Cc: Simon Glass <sjg at chromium.org>
---

Simon, I droped your reviewed-by tag in V2, because I changed
"off-on-delay-us" to "u-boot,off-on-delay-us" and
add devicetree bindings.

Thanks,
Peng.

 .../devicetree/bindings/regulator/fixed-regulator.txt    | 16 ++++++++++++++++
 drivers/power/regulator/fixed.c                          |  6 ++++++
 2 files changed, 22 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/regulator/fixed-regulator.txt

diff --git a/Documentation/devicetree/bindings/regulator/fixed-regulator.txt b/Documentation/devicetree/bindings/regulator/fixed-regulator.txt
new file mode 100644
index 0000000000..2b241cf563
--- /dev/null
+++ b/Documentation/devicetree/bindings/regulator/fixed-regulator.txt
@@ -0,0 +1,16 @@
+Fixed Voltage regulators
+
+Check Linux Kernel
+Documentation/devicetree/bindings/regulator/fixed-regulator.txt
+
+U-Boot Specific:
+Optional properties:
+- u-boot,off-on-delay-us: off delay time in microseconds
+
+Example:
+
+	abc: fixedregulator at 0 {
+		...
+		u-boot,off-on-delay-us = <80000>;
+		...
+	};
diff --git a/drivers/power/regulator/fixed.c b/drivers/power/regulator/fixed.c
index 0be5b7bd51..c5fe0ba43d 100644
--- a/drivers/power/regulator/fixed.c
+++ b/drivers/power/regulator/fixed.c
@@ -16,6 +16,7 @@
 struct fixed_regulator_platdata {
 	struct gpio_desc gpio; /* GPIO for regulator enable control */
 	unsigned int startup_delay_us;
+	unsigned int off_on_delay_us;
 };
 
 static int fixed_regulator_ofdata_to_platdata(struct udevice *dev)
@@ -50,6 +51,8 @@ static int fixed_regulator_ofdata_to_platdata(struct udevice *dev)
 	/* Get optional ramp up delay */
 	dev_pdata->startup_delay_us = dev_read_u32_default(dev,
 							"startup-delay-us", 0);
+	dev_pdata->off_on_delay_us = dev_read_u32_default(dev,
+							  "u-boot,off-on-delay-us", 0);
 
 	return 0;
 }
@@ -123,6 +126,9 @@ static int fixed_regulator_set_enable(struct udevice *dev, bool enable)
 		udelay(dev_pdata->startup_delay_us);
 	debug("%s: done\n", __func__);
 
+	if (!enable && dev_pdata->off_on_delay_us)
+		udelay(dev_pdata->off_on_delay_us);
+
 	return 0;
 }
 
-- 
2.14.1



More information about the U-Boot mailing list