mirror of
https://github.com/Fishwaldo/u-boot.git
synced 2025-03-19 13:41:31 +00:00
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 <patrick.delaunay@st.com> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Jack Mitchell <jack@embed.me.uk> Tested-by: Jack Mitchell <jack@embed.me.uk> Signed-off-by: Patrice Chotard <patrice.chotard@st.com> Reviewed-by: Richard Röjfors <richard@puffinpack.se> Tested-by: Richard Röjfors <richard@puffinpack.se> Reviewed-by: Felix Brack <fb@ltec.ch> Tested-by: Felix Brack <fb@ltec.ch>
This commit is contained in:
parent
7959882049
commit
4f86a724e8
1 changed files with 5 additions and 0 deletions
|
@ -106,10 +106,15 @@ int regulator_get_enable(struct udevice *dev)
|
||||||
int regulator_set_enable(struct udevice *dev, bool enable)
|
int regulator_set_enable(struct udevice *dev, bool enable)
|
||||||
{
|
{
|
||||||
const struct dm_regulator_ops *ops = dev_get_driver_ops(dev);
|
const struct dm_regulator_ops *ops = dev_get_driver_ops(dev);
|
||||||
|
struct dm_regulator_uclass_platdata *uc_pdata;
|
||||||
|
|
||||||
if (!ops || !ops->set_enable)
|
if (!ops || !ops->set_enable)
|
||||||
return -ENOSYS;
|
return -ENOSYS;
|
||||||
|
|
||||||
|
uc_pdata = dev_get_uclass_platdata(dev);
|
||||||
|
if (!enable && uc_pdata->always_on)
|
||||||
|
return -EACCES;
|
||||||
|
|
||||||
return ops->set_enable(dev, enable);
|
return ops->set_enable(dev, enable);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue