提交 7302fbb3 编写于 作者: J John Keeping 提交者: Tom Rini

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.
Signed-off-by: NJohn Keeping <john@metanate.com>
Reviewed-by: NTom Rini <trini@konsulko.com>
Reviewed-by: NSimon Glass <sjg@chromium.org>
上级 07913d1e
...@@ -10,6 +10,7 @@ Required properties: ...@@ -10,6 +10,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
- regulator constraints (binding info: regulator.txt) - regulator constraints (binding info: regulator.txt)
Other kernel-style properties, are currently not used. Other kernel-style properties, are currently not used.
......
...@@ -19,6 +19,7 @@ DECLARE_GLOBAL_DATA_PTR; ...@@ -19,6 +19,7 @@ DECLARE_GLOBAL_DATA_PTR;
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;
}; };
static int fixed_regulator_ofdata_to_platdata(struct udevice *dev) static int fixed_regulator_ofdata_to_platdata(struct udevice *dev)
...@@ -42,6 +43,11 @@ 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) if (ret)
debug("Fixed regulator gpio - not found! Error: %d", 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; return 0;
} }
...@@ -101,6 +107,10 @@ static int fixed_regulator_set_enable(struct udevice *dev, bool enable) ...@@ -101,6 +107,10 @@ static int fixed_regulator_set_enable(struct udevice *dev, bool enable)
enable); enable);
return ret; return ret;
} }
if (enable && dev_pdata->startup_delay_us)
udelay(dev_pdata->startup_delay_us);
return 0; return 0;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册