Browse Source

MLK-16188-4: drivers: regulator: fixed: add off-on-delay-us

Add off-on-delay-us for fixed regulator.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
(cherry picked from commit 17071015cd)
Peng Fan 3 years ago
parent
commit
e71d5e67e3
1 changed files with 9 additions and 0 deletions
  1. +9
    -0
      drivers/power/regulator/fixed.c

+ 9
- 0
drivers/power/regulator/fixed.c View File

@ -1,5 +1,6 @@
/*
* Copyright (C) 2015 Samsung Electronics
* Copyright 2017 NXP
*
* Przemyslaw Marczak <p.marczak@samsung.com>
*
@ -20,6 +21,7 @@ DECLARE_GLOBAL_DATA_PTR;
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)
@ -56,6 +58,9 @@ static int fixed_regulator_ofdata_to_platdata(struct udevice *dev)
dev_pdata->startup_delay_us = fdtdec_get_uint(gd->fdt_blob,
dev_of_offset(dev),
"startup-delay-us", 0);
dev_pdata->off_on_delay_us = fdtdec_get_uint(gd->fdt_blob,
dev_of_offset(dev),
"off-on-delay-us", 0);
return 0;
}
@ -125,6 +130,10 @@ static int fixed_regulator_set_enable(struct udevice *dev, bool enable)
if (enable && dev_pdata->startup_delay_us)
udelay(dev_pdata->startup_delay_us);
if (!enable && dev_pdata->off_on_delay_us) {
udelay(dev_pdata->off_on_delay_us);
}
return 0;
}


Loading…
Cancel
Save