diff options
author | John Keeping <john@metanate.com> | 2016-08-22 15:10:09 +0100 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2016-09-06 13:18:21 -0400 |
commit | 7302fbb31d1ba8b208ae5e400028c692167c7072 (patch) | |
tree | eb647d4a9362026c43e16bb4fcf6453a9bcedc52 /drivers | |
parent | 07913d1e42c1db77acd653fb4aa671b664c59db2 (diff) |
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: John Keeping <john@metanate.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/power/regulator/fixed.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/power/regulator/fixed.c b/drivers/power/regulator/fixed.c index d053817fc22..37b8400903f 100644 --- a/drivers/power/regulator/fixed.c +++ b/drivers/power/regulator/fixed.c @@ -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; } |