[U-Boot] [PATCH] drivers: regulator: regulator-uclass: disallow disable of always-on

Jack Mitchell ml at embed.me.uk
Fri Nov 23 19:13:17 UTC 2018


On 22/11/2018 21:12, Richard Röjfors wrote:
> It does not make sense to allow disable of a regulator that
> is defined always on.
> 
> I found this because the new mmc code that tests if the mmc
> power can be switched off. That results in the rk3288
> firefly board to die since the regulator, which is always-on,
> is shared with more than just mmc.
> 
> Signed-off-by: Richard Röjfors <richard at puffinpack.se>
> ---
>  drivers/power/regulator/regulator-uclass.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/drivers/power/regulator/regulator-uclass.c b/drivers/power/regulator/regulator-uclass.c
> index 4da8e43259..d5be6ef424 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 (uc_pdata->always_on && !enable)
> +		return -EINVAL;
> +
>  	return ops->set_enable(dev, enable);
>  }
>  
> 

Hi Richard,

Please add your reviewed/tested by to this patch and an extra ping, it's
been waiting to be merged for a while.

https://lists.denx.de/pipermail/u-boot/2018-May/330186.html

Cheers,
Jack.


More information about the U-Boot mailing list