[U-Boot] [PATCH V2] 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.
Signed-off-by: Peng Fan peng.fan@nxp.com Reviewed-by: Simon Glass sjg@chromium.org Cc: Masahiro Yamada yamada.masahiro@socionext.com ---
V2: Moved device tree bindings to new directory. Simon, I keep you reviewed by tag. Thanks.
doc/device-tree-bindings/regulator/fixed.txt | 1 + drivers/power/regulator/fixed.c | 6 ++++++ 2 files changed, 7 insertions(+)
diff --git a/doc/device-tree-bindings/regulator/fixed.txt b/doc/device-tree-bindings/regulator/fixed.txt index 5fd9033fea..453d2bef44 100644 --- a/doc/device-tree-bindings/regulator/fixed.txt +++ b/doc/device-tree-bindings/regulator/fixed.txt @@ -11,6 +11,7 @@ Required properties: Optional properties: - gpio: GPIO to use for enable control - startup-delay-us: startup time in microseconds +- u-boot,off-on-delay-us: off delay time in microseconds - regulator constraints (binding info: regulator.txt) - enable-active-high: Polarity of GPIO is Active high. If this property is missing, the default assumed is Active low. diff --git a/drivers/power/regulator/fixed.c b/drivers/power/regulator/fixed.c index 0be5b7bd51..a99aa78310 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; }

-----Original Message----- From: Peng Fan Sent: 2018年7月26日 19:47 To: sjg@chromium.org; trini@konsulko.com Cc: yamada.masahiro@socionext.com; u-boot@lists.denx.de; Peng Fan peng.fan@nxp.com Subject: [PATCH V2] 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.
Signed-off-by: Peng Fan peng.fan@nxp.com Reviewed-by: Simon Glass sjg@chromium.org Cc: Masahiro Yamada yamada.masahiro@socionext.com
V2: Moved device tree bindings to new directory. Simon, I keep you reviewed by tag. Thanks.
Sorry, this patchset should be V3 version.
Tom, should I resend a v3 out? Or you could apply this one?
Thanks, Peng.
doc/device-tree-bindings/regulator/fixed.txt | 1 + drivers/power/regulator/fixed.c | 6 ++++++ 2 files changed, 7 insertions(+)
diff --git a/doc/device-tree-bindings/regulator/fixed.txt b/doc/device-tree-bindings/regulator/fixed.txt index 5fd9033fea..453d2bef44 100644 --- a/doc/device-tree-bindings/regulator/fixed.txt +++ b/doc/device-tree-bindings/regulator/fixed.txt @@ -11,6 +11,7 @@ Required properties: Optional properties:
- gpio: GPIO to use for enable control
- startup-delay-us: startup time in microseconds
+- u-boot,off-on-delay-us: off delay time in microseconds
- regulator constraints (binding info: regulator.txt)
- enable-active-high: Polarity of GPIO is Active high. If this property is missing, the default assumed is Active low.
diff --git a/drivers/power/regulator/fixed.c b/drivers/power/regulator/fixed.c index 0be5b7bd51..a99aa78310 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

On Thu, Jul 26, 2018 at 01:59:20PM +0000, Peng Fan wrote:
-----Original Message----- From: Peng Fan Sent: 2018年7月26日 19:47 To: sjg@chromium.org; trini@konsulko.com Cc: yamada.masahiro@socionext.com; u-boot@lists.denx.de; Peng Fan peng.fan@nxp.com Subject: [PATCH V2] 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.
Signed-off-by: Peng Fan peng.fan@nxp.com Reviewed-by: Simon Glass sjg@chromium.org Cc: Masahiro Yamada yamada.masahiro@socionext.com
V2: Moved device tree bindings to new directory. Simon, I keep you reviewed by tag. Thanks.
Sorry, this patchset should be V3 version.
Tom, should I resend a v3 out? Or you could apply this one?
Barring further comments from people, you can just keep this version. FWIW, I think that if people register with patchwork they can manage the state of their own patches and that always helps keep me from failing to notice something / grab the wrong version :) Thanks!

-----Original Message----- From: Tom Rini [mailto:trini@konsulko.com] Sent: 2018年7月27日 1:06 To: Peng Fan peng.fan@nxp.com Cc: sjg@chromium.org; yamada.masahiro@socionext.com; u-boot@lists.denx.de Subject: Re: [PATCH V2] drivers: regulator: fixed: add u-boot,off-on-delay-us
On Thu, Jul 26, 2018 at 01:59:20PM +0000, Peng Fan wrote:
-----Original Message----- From: Peng Fan Sent: 2018年7月26日 19:47 To: sjg@chromium.org; trini@konsulko.com Cc: yamada.masahiro@socionext.com; u-boot@lists.denx.de; Peng Fan peng.fan@nxp.com Subject: [PATCH V2] 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.
Signed-off-by: Peng Fan peng.fan@nxp.com Reviewed-by: Simon Glass sjg@chromium.org Cc: Masahiro Yamada yamada.masahiro@socionext.com
V2: Moved device tree bindings to new directory. Simon, I keep you reviewed by tag. Thanks.
Sorry, this patchset should be V3 version.
Tom, should I resend a v3 out? Or you could apply this one?
Barring further comments from people, you can just keep this version. FWIW, I think that if people register with patchwork they can manage the state of their own patches and that always helps keep me from failing to notice something / grab the wrong version :) Thanks!
Thanks. I set the previous one to rejected.
Thanks, Peng.
-- Tom

Hi,
Would anyone pick up this patch?
Thanks, Peng.
-----Original Message----- From: Tom Rini [mailto:trini@konsulko.com] Sent: 2018年7月27日 1:06 To: Peng Fan peng.fan@nxp.com Cc: sjg@chromium.org; yamada.masahiro@socionext.com; u-boot@lists.denx.de Subject: Re: [PATCH V2] drivers: regulator: fixed: add u-boot,off-on-delay-us
On Thu, Jul 26, 2018 at 01:59:20PM +0000, Peng Fan wrote:
-----Original Message----- From: Peng Fan Sent: 2018年7月26日 19:47 To: sjg@chromium.org; trini@konsulko.com Cc: yamada.masahiro@socionext.com; u-boot@lists.denx.de; Peng Fan peng.fan@nxp.com Subject: [PATCH V2] 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.
Signed-off-by: Peng Fan peng.fan@nxp.com Reviewed-by: Simon Glass sjg@chromium.org Cc: Masahiro Yamada yamada.masahiro@socionext.com
V2: Moved device tree bindings to new directory. Simon, I keep you reviewed by tag. Thanks.
Sorry, this patchset should be V3 version.
Tom, should I resend a v3 out? Or you could apply this one?
Barring further comments from people, you can just keep this version. FWIW, I think that if people register with patchwork they can manage the state of their own patches and that always helps keep me from failing to notice something / grab the wrong version :) Thanks!
-- Tom

On Thu, Jul 26, 2018 at 07:47:24PM +0800, Peng Fan wrote:
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@nxp.com Reviewed-by: Simon Glass sjg@chromium.org Cc: Masahiro Yamada yamada.masahiro@socionext.com
Applied to u-boot/master, thanks!
participants (2)
-
Peng Fan
-
Tom Rini