summaryrefslogtreecommitdiff
path: root/drivers/power
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2015-06-23 15:38:59 -0600
committerSimon Glass <sjg@chromium.org>2015-07-21 17:39:26 -0600
commit083fc83a4e1187a3f42575c8e3df089d3be622ad (patch)
tree4c562301946c94dcfcf6e7d332a433e89a36d528 /drivers/power
parent3b55d30f6ff2f16c5fd02685bff7639211e6d326 (diff)
downloadu-boot-imx-083fc83a4e1187a3f42575c8e3df089d3be622ad.zip
u-boot-imx-083fc83a4e1187a3f42575c8e3df089d3be622ad.tar.gz
u-boot-imx-083fc83a4e1187a3f42575c8e3df089d3be622ad.tar.bz2
dm: power: Add a function to set up all regulators
The device tree provides information about which regulators should be on at boot, or always on. Use this to set them up automatically. Signed-off-by: Simon Glass <sjg@chromium.org> Tested-by: Przemyslaw Marczak <p.marczak@samsung.com> Acked-by: Przemyslaw Marczak <p.marczak@samsung.com>
Diffstat (limited to 'drivers/power')
-rw-r--r--drivers/power/regulator/regulator-uclass.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/drivers/power/regulator/regulator-uclass.c b/drivers/power/regulator/regulator-uclass.c
index 687d3b1..a2d0b9f 100644
--- a/drivers/power/regulator/regulator-uclass.c
+++ b/drivers/power/regulator/regulator-uclass.c
@@ -306,6 +306,28 @@ static int regulator_pre_probe(struct udevice *dev)
return 0;
}
+int regulators_enable_boot_on(bool verbose)
+{
+ struct udevice *dev;
+ struct uclass *uc;
+ int ret;
+
+ ret = uclass_get(UCLASS_REGULATOR, &uc);
+ if (ret)
+ return ret;
+ for (uclass_first_device(UCLASS_REGULATOR, &dev);
+ dev && !ret;
+ uclass_next_device(&dev)) {
+ ret = regulator_autoset(dev);
+ if (ret == -EMEDIUMTYPE)
+ continue;
+ if (verbose)
+ regulator_show(dev, ret);
+ }
+
+ return ret;
+}
+
UCLASS_DRIVER(regulator) = {
.id = UCLASS_REGULATOR,
.name = "regulator",