diff mbox series

[U-Boot,RESEND] power: regulator: denied disable on always-on regulator

Message ID 1542285931-14978-1-git-send-email-patrice.chotard@st.com
State Accepted
Delegated to: Simon Glass
Headers show
Series [U-Boot,RESEND] power: regulator: denied disable on always-on regulator | expand

Commit Message

Patrice CHOTARD Nov. 15, 2018, 12:45 p.m. UTC
From: Patrick Delaunay <patrick.delaunay@st.com>

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>
---

 drivers/power/regulator/regulator-uclass.c | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Richard Röjfors Nov. 27, 2018, 4:08 p.m. UTC | #1
On Thu, Nov 15, 2018 at 1:46 PM Patrice Chotard <patrice.chotard@st.com> wrote:
>
> From: Patrick Delaunay <patrick.delaunay@st.com>
>
> 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>
Felix Brack Nov. 29, 2018, 11:08 a.m. UTC | #2
On 15.11.2018 13:45, Patrice Chotard wrote:
> From: Patrick Delaunay <patrick.delaunay@st.com>
> 
> 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: Felix Brack <fb@ltec.ch>
Tested-by: Felix Brack <fb@ltec.ch>
Felix Brack Dec. 3, 2018, 11:07 a.m. UTC | #3
On 15.11.2018 13:45, Patrice Chotard wrote:
> From: Patrick Delaunay <patrick.delaunay@st.com>
> 
> 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>
> ---
> 
>  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 4da8e43259fc..4511625ff251 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);
>  }
>  
> 
This patch has been around since May 2018 (albeit superseded). A request
from Patrice Chotard to Jaehoon Chung about the patch status change
never got answered. Looking Patchwork I don't see any post from Jaehoon
after May 8. 2018.
Please don't get me wrong: I just want to make sure this patch doesn't
get forgotten, knowing very well, that it was posted (resent) just 2
weeks ago. Expecting quite a few board maintainers to enable DM_MMC in
the coming weeks and months this patch might get important to more
people as it prevents powering off the MMC supply voltage during power
cycling.
If the patch is on someones radar that's fine with me.

regards, Felix
Simon Glass Dec. 3, 2018, 6:20 p.m. UTC | #4
Hi,

On Mon, 3 Dec 2018 at 04:07, Felix Brack <fb@ltec.ch> wrote:
>
> On 15.11.2018 13:45, Patrice Chotard wrote:
> > From: Patrick Delaunay <patrick.delaunay@st.com>
> >
> > 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>
> > ---
> >
> >  drivers/power/regulator/regulator-uclass.c | 5 +++++
> >  1 file changed, 5 insertions(+)
> >

I'm happy to pick it up if that helps.

Regards,
Simon
Tom Rini Dec. 3, 2018, 6:45 p.m. UTC | #5
On Mon, Dec 03, 2018 at 11:20:13AM -0700, Simon Glass wrote:
> Hi,
> 
> On Mon, 3 Dec 2018 at 04:07, Felix Brack <fb@ltec.ch> wrote:
> >
> > On 15.11.2018 13:45, Patrice Chotard wrote:
> > > From: Patrick Delaunay <patrick.delaunay@st.com>
> > >
> > > 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>
> > > ---
> > >
> > >  drivers/power/regulator/regulator-uclass.c | 5 +++++
> > >  1 file changed, 5 insertions(+)
> > >
> 
> I'm happy to pick it up if that helps.

Please, thanks!
Felix Brack Dec. 3, 2018, 6:53 p.m. UTC | #6
Hello Simon,

On 03.12.18 19:20, Simon Glass wrote:
> Hi,
> 
> On Mon, 3 Dec 2018 at 04:07, Felix Brack <fb@ltec.ch> wrote:
>>
>> On 15.11.2018 13:45, Patrice Chotard wrote:
>>> From: Patrick Delaunay <patrick.delaunay@st.com>
>>>
>>> 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>
>>> ---
>>>
>>>   drivers/power/regulator/regulator-uclass.c | 5 +++++
>>>   1 file changed, 5 insertions(+)
>>>
> 
> I'm happy to pick it up if that helps.
> 
Excellent! Thank you very much for taking care.

Regards, Felix
Patrice CHOTARD Dec. 4, 2018, 8:02 a.m. UTC | #7
Hi Simon

On 12/3/18 7:20 PM, Simon Glass wrote:
> Hi,
> 
> On Mon, 3 Dec 2018 at 04:07, Felix Brack <fb@ltec.ch> wrote:
>>
>> On 15.11.2018 13:45, Patrice Chotard wrote:
>>> From: Patrick Delaunay <patrick.delaunay@st.com>
>>>
>>> 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>
>>> ---
>>>
>>>  drivers/power/regulator/regulator-uclass.c | 5 +++++
>>>  1 file changed, 5 insertions(+)
>>>
> 
> I'm happy to pick it up if that helps.

Thank you ;-)

> 
> Regards,
> Simon
>
Simon Glass Dec. 6, 2018, 1:22 a.m. UTC | #8
On Tue, 4 Dec 2018 at 01:02, Patrice CHOTARD <patrice.chotard@st.com> wrote:
>
> Hi Simon
>
> On 12/3/18 7:20 PM, Simon Glass wrote:
> > Hi,
> >
> > On Mon, 3 Dec 2018 at 04:07, Felix Brack <fb@ltec.ch> wrote:
> >>
> >> On 15.11.2018 13:45, Patrice Chotard wrote:
> >>> From: Patrick Delaunay <patrick.delaunay@st.com>
> >>>
> >>> 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>
> >>> ---
> >>>
> >>>  drivers/power/regulator/regulator-uclass.c | 5 +++++
> >>>  1 file changed, 5 insertions(+)
> >>>
> >
> > I'm happy to pick it up if that helps.
>
> Thank you ;-)

Applied to u-boot-dm, thanks!
diff mbox series

Patch

diff --git a/drivers/power/regulator/regulator-uclass.c b/drivers/power/regulator/regulator-uclass.c
index 4da8e43259fc..4511625ff251 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);
 }