linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH] regulator: core: do not disable regulator if boot_on is set
@ 2014-11-25 10:53 Pramod Gurav
  2014-11-25 10:57 ` Lucas Stach
  2014-11-25 11:05 ` Mark Brown
  0 siblings, 2 replies; 5+ messages in thread
From: Pramod Gurav @ 2014-11-25 10:53 UTC (permalink / raw)
  To: linux-kernel; +Cc: linux-arm-kernel, lgirdwood, broonie, Pramod Gurav

Currently the regulator core disables the regulators which are unused
or whose reference count is zero or if they are configured always_on.
This change adds a check in this logic to see if a regulator is
configured as boot_on and does not disable it if found true.

Signed-off-by: Pramod Gurav <pramod.gurav@smartplayin.com>

---

The issue was found on apq8064 based IFC6410 on which a fixed regulator
configured as regulator-boot-on in DT and was being disabled when not in
use. Tested this change on this board and found working.

 drivers/regulator/core.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index cd87c0c..9f7a13f 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -4019,7 +4019,7 @@ static int __init regulator_init_complete(void)
 		ops = rdev->desc->ops;
 		c = rdev->constraints;
 
-		if (c && c->always_on)
+		if (c && (c->always_on || c->boot_on))
 			continue;
 
 		if (c && !(c->valid_ops_mask & REGULATOR_CHANGE_STATUS))
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [RFC PATCH] regulator: core: do not disable regulator if boot_on is set
  2014-11-25 10:53 [RFC PATCH] regulator: core: do not disable regulator if boot_on is set Pramod Gurav
@ 2014-11-25 10:57 ` Lucas Stach
  2014-11-25 11:17   ` Pramod Gurav
  2014-11-25 11:05 ` Mark Brown
  1 sibling, 1 reply; 5+ messages in thread
From: Lucas Stach @ 2014-11-25 10:57 UTC (permalink / raw)
  To: Pramod Gurav; +Cc: linux-kernel, broonie, lgirdwood, linux-arm-kernel

Am Dienstag, den 25.11.2014, 16:23 +0530 schrieb Pramod Gurav:
> Currently the regulator core disables the regulators which are unused
> or whose reference count is zero or if they are configured always_on.
> This change adds a check in this logic to see if a regulator is
> configured as boot_on and does not disable it if found true.
> 
> Signed-off-by: Pramod Gurav <pramod.gurav@smartplayin.com>
> 
> ---
> 
> The issue was found on apq8064 based IFC6410 on which a fixed regulator
> configured as regulator-boot-on in DT and was being disabled when not in
> use. Tested this change on this board and found working.
> 
Um, why would this be the correct fix? regulator-boot-on just tells the
regulator core that the bootloader might have left this regulator
enabled. If you want it to stay on after the kernel finished init you
need to mark it as always-on.

>  drivers/regulator/core.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
> index cd87c0c..9f7a13f 100644
> --- a/drivers/regulator/core.c
> +++ b/drivers/regulator/core.c
> @@ -4019,7 +4019,7 @@ static int __init regulator_init_complete(void)
>  		ops = rdev->desc->ops;
>  		c = rdev->constraints;
>  
> -		if (c && c->always_on)
> +		if (c && (c->always_on || c->boot_on))
>  			continue;
>  
>  		if (c && !(c->valid_ops_mask & REGULATOR_CHANGE_STATUS))

-- 
Pengutronix e.K.             | Lucas Stach                 |
Industrial Linux Solutions   | http://www.pengutronix.de/  |


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [RFC PATCH] regulator: core: do not disable regulator if boot_on is set
  2014-11-25 10:53 [RFC PATCH] regulator: core: do not disable regulator if boot_on is set Pramod Gurav
  2014-11-25 10:57 ` Lucas Stach
@ 2014-11-25 11:05 ` Mark Brown
  2014-11-25 11:17   ` Pramod Gurav
  1 sibling, 1 reply; 5+ messages in thread
From: Mark Brown @ 2014-11-25 11:05 UTC (permalink / raw)
  To: Pramod Gurav; +Cc: linux-kernel, linux-arm-kernel, lgirdwood

[-- Attachment #1: Type: text/plain, Size: 762 bytes --]

On Tue, Nov 25, 2014 at 04:23:23PM +0530, Pramod Gurav wrote:
> Currently the regulator core disables the regulators which are unused
> or whose reference count is zero or if they are configured always_on.

No, it does *not* disable them if they are configured always_on (as the
code you're modifying shows).

> This change adds a check in this logic to see if a regulator is
> configured as boot_on and does not disable it if found true.

> -		if (c && c->always_on)
> +		if (c && (c->always_on || c->boot_on))
>  			continue;

This isn't what boot_on means.  It just means that the regulator is
expected to be enabled at initial power on, it doesn't mean it needs to
be enabled all the time.  Otherwise there'd be no point in having a
separate always_on flag.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [RFC PATCH] regulator: core: do not disable regulator if boot_on is set
  2014-11-25 11:05 ` Mark Brown
@ 2014-11-25 11:17   ` Pramod Gurav
  0 siblings, 0 replies; 5+ messages in thread
From: Pramod Gurav @ 2014-11-25 11:17 UTC (permalink / raw)
  To: Mark Brown; +Cc: linux-kernel, linux-arm-kernel, lgirdwood

Hi Mark,

On Tuesday 25 November 2014 04:35 PM, Mark Brown wrote:
> On Tue, Nov 25, 2014 at 04:23:23PM +0530, Pramod Gurav wrote:
>> Currently the regulator core disables the regulators which are unused
>> or whose reference count is zero or if they are configured always_on.
> 
> No, it does *not* disable them if they are configured always_on (as the
> code you're modifying shows).

Yes, thats a typo.
> 
>> This change adds a check in this logic to see if a regulator is
>> configured as boot_on and does not disable it if found true.
> 
>> -		if (c && c->always_on)
>> +		if (c && (c->always_on || c->boot_on))
>>  			continue;
> 
> This isn't what boot_on means.  It just means that the regulator is
> expected to be enabled at initial power on, it doesn't mean it needs to
> be enabled all the time.  Otherwise there'd be no point in having a
> separate always_on flag.

Thanks for the comment. :-)
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [RFC PATCH] regulator: core: do not disable regulator if boot_on is set
  2014-11-25 10:57 ` Lucas Stach
@ 2014-11-25 11:17   ` Pramod Gurav
  0 siblings, 0 replies; 5+ messages in thread
From: Pramod Gurav @ 2014-11-25 11:17 UTC (permalink / raw)
  To: Lucas Stach; +Cc: linux-kernel, broonie, lgirdwood, linux-arm-kernel

On Tuesday 25 November 2014 04:27 PM, Lucas Stach wrote:
> Am Dienstag, den 25.11.2014, 16:23 +0530 schrieb Pramod Gurav:
>> Currently the regulator core disables the regulators which are unused
>> or whose reference count is zero or if they are configured always_on.
>> This change adds a check in this logic to see if a regulator is
>> configured as boot_on and does not disable it if found true.
>>
>> Signed-off-by: Pramod Gurav <pramod.gurav@smartplayin.com>
>>
>> ---
>>
>> The issue was found on apq8064 based IFC6410 on which a fixed regulator
>> configured as regulator-boot-on in DT and was being disabled when not in
>> use. Tested this change on this board and found working.
>>
> Um, why would this be the correct fix? regulator-boot-on just tells the
> regulator core that the bootloader might have left this regulator
> enabled. If you want it to stay on after the kernel finished init you
> need to mark it as always-on.

Thanks Lucas. Shall mark it as alway_on.
> 
>>  drivers/regulator/core.c |    2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
>> index cd87c0c..9f7a13f 100644
>> --- a/drivers/regulator/core.c
>> +++ b/drivers/regulator/core.c
>> @@ -4019,7 +4019,7 @@ static int __init regulator_init_complete(void)
>>  		ops = rdev->desc->ops;
>>  		c = rdev->constraints;
>>  
>> -		if (c && c->always_on)
>> +		if (c && (c->always_on || c->boot_on))
>>  			continue;
>>  
>>  		if (c && !(c->valid_ops_mask & REGULATOR_CHANGE_STATUS))
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-11-25 11:14 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-11-25 10:53 [RFC PATCH] regulator: core: do not disable regulator if boot_on is set Pramod Gurav
2014-11-25 10:57 ` Lucas Stach
2014-11-25 11:17   ` Pramod Gurav
2014-11-25 11:05 ` Mark Brown
2014-11-25 11:17   ` Pramod Gurav

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).