diff options
author | Simon Glass <sjg@chromium.org> | 2015-06-23 15:38:57 -0600 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2015-07-21 17:39:26 -0600 |
commit | 7837ceab1ef8d4a88fb218bfa6b042b0b865b15f (patch) | |
tree | f05380c28bf5c0e119553a25482de6aa7d9db485 /drivers/power | |
parent | 23ec2b570d948519109c284eddd14146c84d1f62 (diff) | |
download | u-boot-imx-7837ceab1ef8d4a88fb218bfa6b042b0b865b15f.zip u-boot-imx-7837ceab1ef8d4a88fb218bfa6b042b0b865b15f.tar.gz u-boot-imx-7837ceab1ef8d4a88fb218bfa6b042b0b865b15f.tar.bz2 |
dm: power: Add regulator flags to centralise auto-set logic
Decide when the regulator is set up whether we want to auto-set the voltage
or current. This avoids the complex logic spilling into the processing code.
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.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/drivers/power/regulator/regulator-uclass.c b/drivers/power/regulator/regulator-uclass.c index 31ffd44..0f1ca77 100644 --- a/drivers/power/regulator/regulator-uclass.c +++ b/drivers/power/regulator/regulator-uclass.c @@ -319,6 +319,18 @@ static int regulator_pre_probe(struct udevice *dev) uc_pdata->boot_on = fdtdec_get_bool(gd->fdt_blob, offset, "regulator-boot-on"); + /* Those values are optional (-ENODATA if unset) */ + if ((uc_pdata->min_uV != -ENODATA) && + (uc_pdata->max_uV != -ENODATA) && + (uc_pdata->min_uV == uc_pdata->max_uV)) + uc_pdata->flags |= REGULATOR_FLAG_AUTOSET_UV; + + /* Those values are optional (-ENODATA if unset) */ + if ((uc_pdata->min_uA != -ENODATA) && + (uc_pdata->max_uA != -ENODATA) && + (uc_pdata->min_uA == uc_pdata->max_uA)) + uc_pdata->flags |= REGULATOR_FLAG_AUTOSET_UA; + return 0; } |