Skip to contentSkip to conversation

drivers: regulator: fixed: add u-boot, off-on-delay-us

PATCH Superseded Peng Fan 4 participants 7 messages Jul 24, 2018 – Jul 26, 2018

Subsystems (2)
lore
Share & tools
lore

Peng Fan

author
#0 lore raw

PATCH v2 1/1 drivers: regulator: fixed: add u-boot, off-on-delay-us

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.

Cc Masahiro Yamada <[email protected]>
Cc Simon Glass <[email protected]>

---

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
Documentation/devicetree/bindings/regulator/fixed-regulator.txt new file +16 -0
new file mode 100644
index 0000000000..2b241cf563
@@ -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>;
+		...
+	};
drivers/power/regulator/fixed.c +6 -0
index 0be5b7bd51..c5fe0ba43d 100644
@@ -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;
 }
 
Signature · 1 line
2.14.1
#1 lore raw

PATCH v2 1/1 drivers: regulator: fixed: add u-boot, off-on-delay-us

Quoted 17 lines · Peng Fan

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.

Cc Masahiro Yamada <[email protected]>
Cc Simon Glass <[email protected]>

---

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.

Quoted 7 lines

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
#2 lore raw

PATCH v2 1/1 drivers: regulator: fixed: add u-boot, off-on-delay-us

In reply to Peng Fan

Hi Peng,

Quoted 4 lines · Peng Fan
 .../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

I thought that bindings should go into doc/device-tree-bindings/ in U-Boot instead?

author
#3 lore raw

PATCH v2 1/1 drivers: regulator: fixed: add u-boot, off-on-delay-us

Hi Fabio,

Quoted 15 lines

-----Original Message-----
From: Fabio Estevam [mailto:festevam at gmail.com]
Sent: 2018年7月25日 10:59
To: Peng Fan <[email protected]>
Cc: Simon Glass <[email protected]>; U-Boot-Denx <[email protected]>; dl-linux-imx <[email protected]>; Breno Matheus Lima <[email protected]>
Subject: Re: [U-Boot] [PATCH V2] drivers: regulator: fixed: add u-boot, off-on-delay-us

Hi Peng,

Quoted 1 line · Peng Fan
 .../devicetree/bindings/regulator/fixed-regulator.txt    | 16

++++++++++++++++

Quoted 8 lines
Quoted 1 line
 drivers/power/regulator/fixed.c                          |  6

++++++

Quoted 3 lines
 2 files changed, 22 insertions(+)
 create mode 100644

Documentation/devicetree/bindings/regulator/fixed-regulator.txt

I thought that bindings should go into doc/device-tree-bindings/ in U-Boot instead?

I was not aware of this place. I am not sure, because there is also a Documentation/devicetree/bindings/ directory.

Tom,

Where should the new uboot bindings be put into?

Thanks,
Peng.

#4 lore raw

PATCH v2 1/1 drivers: regulator: fixed: add u-boot, off-on-delay-us

Hi Peng,

Quoted 1 line · Peng Fan

I was not aware of this place. I am not sure, because there is also a Documentation/devicetree/bindings/ directory.

Yes, currently we have only a few bindings inside
Documentation/devicetree/bindings/.

Most of the bindings are inside doc/device-tree-bindings/ in U-Boot.

Breno has recently submitted a patch to move bindings to the more common used doc/device-tree-bindings/ directory:
https://lists.denx.de/pipermail/u-boot/2018-July/335626.html

Quoted 3 lines

Tom,

Where should the new uboot bindings be put into?

Yes, some guidance here would be helpful to avoid inconsistent placement of the bindings.

Thanks

#5 lore raw

PATCH v2 1/1 drivers: regulator: fixed: add u-boot, off-on-delay-us

In reply to Peng Fan
Quoted 26 lines · Peng Fan

Hi Fabio,

Quoted 15 lines

-----Original Message-----
From: Fabio Estevam [mailto:festevam at gmail.com]
Sent: 2018年7月25日 10:59
To: Peng Fan <[email protected]>
Cc: Simon Glass <[email protected]>; U-Boot-Denx <[email protected]>; dl-linux-imx <[email protected]>; Breno Matheus Lima <[email protected]>
Subject: Re: [U-Boot] [PATCH V2] drivers: regulator: fixed: add u-boot, off-on-delay-us

Hi Peng,

Quoted 1 line · Peng Fan
 .../devicetree/bindings/regulator/fixed-regulator.txt    | 16

++++++++++++++++

Quoted 8 lines
Quoted 1 line
 drivers/power/regulator/fixed.c                          |  6

++++++

Quoted 3 lines
 2 files changed, 22 insertions(+)
 create mode 100644

Documentation/devicetree/bindings/regulator/fixed-regulator.txt

I thought that bindings should go into doc/device-tree-bindings/ in U-Boot instead?

Quoted 6 lines

I was not aware of this place. I am not sure, because there is also a Documentation/devicetree/bindings/ directory.

Tom,

Where should the new uboot bindings be put into?

I just yesterday consolidated into just doc/device-tree-bindings/ as everything else was already in there.

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

PATCH v2 1/1 drivers: regulator: fixed: add u-boot, off-on-delay-us

Hi Tom,

Quoted 2 lines · Tom Rini

I just yesterday consolidated into just doc/device-tree-bindings/ as everything else was already in there.

Excellent, I saw that Breno's patch has been applied.

Thanks