mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-10 23:24:38 +00:00
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>
This commit is contained in:
parent
4aee624c92
commit
39dd00fc5d
2 changed files with 7 additions and 0 deletions
|
@ -11,6 +11,7 @@ Required properties:
|
||||||
Optional properties:
|
Optional properties:
|
||||||
- gpio: GPIO to use for enable control
|
- gpio: GPIO to use for enable control
|
||||||
- startup-delay-us: startup time in microseconds
|
- startup-delay-us: startup time in microseconds
|
||||||
|
- u-boot,off-on-delay-us: off delay time in microseconds
|
||||||
- regulator constraints (binding info: regulator.txt)
|
- regulator constraints (binding info: regulator.txt)
|
||||||
- enable-active-high: Polarity of GPIO is Active high. If this property
|
- enable-active-high: Polarity of GPIO is Active high. If this property
|
||||||
is missing, the default assumed is Active low.
|
is missing, the default assumed is Active low.
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
struct fixed_regulator_platdata {
|
struct fixed_regulator_platdata {
|
||||||
struct gpio_desc gpio; /* GPIO for regulator enable control */
|
struct gpio_desc gpio; /* GPIO for regulator enable control */
|
||||||
unsigned int startup_delay_us;
|
unsigned int startup_delay_us;
|
||||||
|
unsigned int off_on_delay_us;
|
||||||
};
|
};
|
||||||
|
|
||||||
static int fixed_regulator_ofdata_to_platdata(struct udevice *dev)
|
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 */
|
/* Get optional ramp up delay */
|
||||||
dev_pdata->startup_delay_us = dev_read_u32_default(dev,
|
dev_pdata->startup_delay_us = dev_read_u32_default(dev,
|
||||||
"startup-delay-us", 0);
|
"startup-delay-us", 0);
|
||||||
|
dev_pdata->off_on_delay_us =
|
||||||
|
dev_read_u32_default(dev, "u-boot,off-on-delay-us", 0);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -123,6 +126,9 @@ static int fixed_regulator_set_enable(struct udevice *dev, bool enable)
|
||||||
udelay(dev_pdata->startup_delay_us);
|
udelay(dev_pdata->startup_delay_us);
|
||||||
debug("%s: done\n", __func__);
|
debug("%s: done\n", __func__);
|
||||||
|
|
||||||
|
if (!enable && dev_pdata->off_on_delay_us)
|
||||||
|
udelay(dev_pdata->off_on_delay_us);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue