From: Patrick Delaunay Date: Thu, 15 Nov 2018 12:45:31 +0000 (+0100) Subject: power: regulator: denied disable on always-on regulator X-Git-Tag: v2019.01-rc2~28^2~7 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=4f86a724e82c0b74d9ffb7b65f8ae4b011dd0b03;p=oweals%2Fu-boot.git power: regulator: denied disable on always-on regulator Don't disable regulator which are tagged as "regulator-always-on" in DT. Signed-off-by: Patrick Delaunay Reviewed-by: Simon Glass Reviewed-by: Jack Mitchell Tested-by: Jack Mitchell Signed-off-by: Patrice Chotard Reviewed-by: Richard Röjfors Tested-by: Richard Röjfors Reviewed-by: Felix Brack Tested-by: Felix Brack --- diff --git a/drivers/power/regulator/regulator-uclass.c b/drivers/power/regulator/regulator-uclass.c index 4da8e43259..4511625ff2 100644 --- a/drivers/power/regulator/regulator-uclass.c +++ b/drivers/power/regulator/regulator-uclass.c @@ -106,10 +106,15 @@ int regulator_get_enable(struct udevice *dev) int regulator_set_enable(struct udevice *dev, bool enable) { const struct dm_regulator_ops *ops = dev_get_driver_ops(dev); + struct dm_regulator_uclass_platdata *uc_pdata; if (!ops || !ops->set_enable) return -ENOSYS; + uc_pdata = dev_get_uclass_platdata(dev); + if (!enable && uc_pdata->always_on) + return -EACCES; + return ops->set_enable(dev, enable); }