diff mbox series

[U-Boot] regulator: fixed: Modify enable-active-high behavior

Message ID 20190725071239.31398-1-patrice.chotard@st.com
State Changes Requested
Delegated to: Tom Rini
Headers show
Series [U-Boot] regulator: fixed: Modify enable-active-high behavior | expand

Commit Message

Patrice CHOTARD July 25, 2019, 7:12 a.m. UTC
Regulator should not be enabled at probe time if regulator-boot-on
property is not in the dt node.

"enable-active-high" property is only used to indicate the GPIO
polarity.

See kernel documentation :
 - Documentation/devicetree/bindings/regulator/fixed-regulator.yaml
 - Documentation/devicetree/bindings/regulator/gpio-regulator.yaml

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
---

 drivers/power/regulator/regulator_common.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Tom Rini Aug. 7, 2019, 5:20 p.m. UTC | #1
On Thu, Jul 25, 2019 at 09:12:39AM +0200, Patrice Chotard wrote:

> Regulator should not be enabled at probe time if regulator-boot-on
> property is not in the dt node.
> 
> "enable-active-high" property is only used to indicate the GPIO
> polarity.
> 
> See kernel documentation :
>  - Documentation/devicetree/bindings/regulator/fixed-regulator.yaml
>  - Documentation/devicetree/bindings/regulator/gpio-regulator.yaml
> 
> Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
> Signed-off-by: Patrice Chotard <patrice.chotard@st.com>

This breaks building on a number of platforms including khadas-vim
Patrice CHOTARD Sept. 10, 2019, 9:54 a.m. UTC | #2
Hi,

It's a gentle reminder to not forgot this patch

Thanks

Patrice

On 7/25/19 9:12 AM, Patrice Chotard wrote:
> Regulator should not be enabled at probe time if regulator-boot-on
> property is not in the dt node.
>
> "enable-active-high" property is only used to indicate the GPIO
> polarity.
>
> See kernel documentation :
>  - Documentation/devicetree/bindings/regulator/fixed-regulator.yaml
>  - Documentation/devicetree/bindings/regulator/gpio-regulator.yaml
>
> Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
> Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
> ---
>
>  drivers/power/regulator/regulator_common.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/power/regulator/regulator_common.c b/drivers/power/regulator/regulator_common.c
> index 3dabbe2a85..2e8a083c75 100644
> --- a/drivers/power/regulator/regulator_common.c
> +++ b/drivers/power/regulator/regulator_common.c
> @@ -15,7 +15,9 @@ int regulator_common_ofdata_to_platdata(struct udevice *dev,
>  	int flags = GPIOD_IS_OUT;
>  	int ret;
>  
> -	if (dev_read_bool(dev, "enable-active-high"))
> +	if (!dev_read_bool(dev, "enable-active-high"))
> +		flags |= GPIOD_ACTIVE_LOW;
> +	if (uc_pdata->boot_on)
>  		flags |= GPIOD_IS_OUT_ACTIVE;
>  
>  	/* Get optional enable GPIO desc */
Patrice CHOTARD Sept. 10, 2019, 11:37 a.m. UTC | #3
Sorry it's not the correct patch version. I will send the reminder on the correct one (v2).

Patrice

On 9/10/19 11:54 AM, Patrice CHOTARD wrote:
> Hi,
>
> It's a gentle reminder to not forgot this patch
>
> Thanks
>
> Patrice
>
> On 7/25/19 9:12 AM, Patrice Chotard wrote:
>> Regulator should not be enabled at probe time if regulator-boot-on
>> property is not in the dt node.
>>
>> "enable-active-high" property is only used to indicate the GPIO
>> polarity.
>>
>> See kernel documentation :
>>  - Documentation/devicetree/bindings/regulator/fixed-regulator.yaml
>>  - Documentation/devicetree/bindings/regulator/gpio-regulator.yaml
>>
>> Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
>> Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
>> ---
>>
>>  drivers/power/regulator/regulator_common.c | 4 +++-
>>  1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/power/regulator/regulator_common.c b/drivers/power/regulator/regulator_common.c
>> index 3dabbe2a85..2e8a083c75 100644
>> --- a/drivers/power/regulator/regulator_common.c
>> +++ b/drivers/power/regulator/regulator_common.c
>> @@ -15,7 +15,9 @@ int regulator_common_ofdata_to_platdata(struct udevice *dev,
>>  	int flags = GPIOD_IS_OUT;
>>  	int ret;
>>  
>> -	if (dev_read_bool(dev, "enable-active-high"))
>> +	if (!dev_read_bool(dev, "enable-active-high"))
>> +		flags |= GPIOD_ACTIVE_LOW;
>> +	if (uc_pdata->boot_on)
>>  		flags |= GPIOD_IS_OUT_ACTIVE;
>>  
>>  	/* Get optional enable GPIO desc */
diff mbox series

Patch

diff --git a/drivers/power/regulator/regulator_common.c b/drivers/power/regulator/regulator_common.c
index 3dabbe2a85..2e8a083c75 100644
--- a/drivers/power/regulator/regulator_common.c
+++ b/drivers/power/regulator/regulator_common.c
@@ -15,7 +15,9 @@  int regulator_common_ofdata_to_platdata(struct udevice *dev,
 	int flags = GPIOD_IS_OUT;
 	int ret;
 
-	if (dev_read_bool(dev, "enable-active-high"))
+	if (!dev_read_bool(dev, "enable-active-high"))
+		flags |= GPIOD_ACTIVE_LOW;
+	if (uc_pdata->boot_on)
 		flags |= GPIOD_IS_OUT_ACTIVE;
 
 	/* Get optional enable GPIO desc */