Skip to contentSkip to conversation

regulator: fixed: obey startup delay

PATCH In review John Keeping 3 participants 4 messages Aug 22, 2016 – Sep 7, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 regulator: fixed: obey startup delay

When enabling a fixed regulator, it may take some time to rise to the correct voltage. If we do not delay here then subsequent operations will fail.

---
 doc/device-tree-bindings/regulator/fixed.txt |  1 +
 drivers/power/regulator/fixed.c              | 10 ++++++++++
 2 files changed, 11 insertions(+)
doc/device-tree-bindings/regulator/fixed.txt +1 -0
index 4ff39b8..8a0d002 100644
@@ -10,6 +10,7 @@ Required properties:
 
 Optional properties:
 - gpio: GPIO to use for enable control
+- startup-delay-us: startup time in microseconds
 - regulator constraints (binding info: regulator.txt)
 
 Other kernel-style properties, are currently not used.
drivers/power/regulator/fixed.c +10 -0
index d053817..37b8400 100644
@@ -19,6 +19,7 @@ DECLARE_GLOBAL_DATA_PTR;
 
 struct fixed_regulator_platdata {
 	struct gpio_desc gpio; /* GPIO for regulator enable control */
+	unsigned int startup_delay_us;
 };
 
 static int fixed_regulator_ofdata_to_platdata(struct udevice *dev)
@@ -42,6 +43,11 @@ static int fixed_regulator_ofdata_to_platdata(struct udevice *dev)
 	if (ret)
 		debug("Fixed regulator gpio - not found! Error: %d", ret);
 
+	/* Get optional ramp up delay */
+	dev_pdata->startup_delay_us = fdtdec_get_uint(gd->fdt_blob,
+						      dev->of_offset,
+						      "startup-delay-us", 0);
+
 	return 0;
 }
 
@@ -101,6 +107,10 @@ static int fixed_regulator_set_enable(struct udevice *dev, bool enable)
 		      enable);
 		return ret;
 	}
+
+	if (enable && dev_pdata->startup_delay_us)
+		udelay(dev_pdata->startup_delay_us);
+
 	return 0;
 }
 
Signature · 1 line
2.9.3.728.g30b24b4.dirty
#1 lore raw

PATCH 1/1 regulator: fixed: obey startup delay

Quoted 5 lines · John Keeping

When enabling a fixed regulator, it may take some time to rise to the correct voltage. If we do not delay here then subsequent operations will fail.

As this matches the kernel binding:

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160822/6e0509e1/attachment.sig>
#2 lore raw

PATCH 1/1 regulator: fixed: obey startup delay

In reply to John Keeping
Quoted 10 lines · John Keeping

When enabling a fixed regulator, it may take some time to rise to the correct voltage. If we do not delay here then subsequent operations will fail.

---
 doc/device-tree-bindings/regulator/fixed.txt |  1 +
 drivers/power/regulator/fixed.c              | 10 ++++++++++
 2 files changed, 11 insertions(+)
#3 lore raw
In reply to John Keeping
Quoted 7 lines · John Keeping

When enabling a fixed regulator, it may take some time to rise to the correct voltage. If we do not delay here then subsequent operations will fail.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160907/84673162/attachment.sig>