linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] pinctrl: at91-pio4: Fix slew rate disablement
@ 2021-04-09  8:25 Tudor Ambarus
  2021-04-09  9:59 ` Claudiu.Beznea
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Tudor Ambarus @ 2021-04-09  8:25 UTC (permalink / raw)
  To: ludovic.desroches, linus.walleij, claudiu.beznea
  Cc: alexandre.belloni, Tudor Ambarus, linux-kernel, linux-gpio,
	linux-arm-kernel

The slew rate was enabled by default for each configuration of the
pin. In case the pin had more than one configuration, even if
we set the slew rate as disabled in the device tree, the next pin
configuration would set again the slew rate enabled by default,
overwriting the slew rate disablement.
Instead of enabling the slew rate by default for each pin configuration,
enable the slew rate by default just once per pin, regardless of the
number of configurations. This way the slew rate disablement will also
work for cases where pins have multiple configurations.

Fixes: 440b144978ba ("pinctrl: at91-pio4: add support for slew-rate")
Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com>
---
 drivers/pinctrl/pinctrl-at91-pio4.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/pinctrl/pinctrl-at91-pio4.c b/drivers/pinctrl/pinctrl-at91-pio4.c
index a5d328808e4c..4c01d8471ffa 100644
--- a/drivers/pinctrl/pinctrl-at91-pio4.c
+++ b/drivers/pinctrl/pinctrl-at91-pio4.c
@@ -801,6 +801,10 @@ static int atmel_conf_pin_config_group_set(struct pinctrl_dev *pctldev,
 
 	conf = atmel_pin_config_read(pctldev, pin_id);
 
+	/* Keep slew rate enabled by default. */
+	if (atmel_pioctrl->slew_rate_support)
+		conf |= ATMEL_PIO_SR_MASK;
+
 	for (i = 0; i < num_configs; i++) {
 		unsigned int param = pinconf_to_config_param(configs[i]);
 		unsigned int arg = pinconf_to_config_argument(configs[i]);
@@ -808,10 +812,6 @@ static int atmel_conf_pin_config_group_set(struct pinctrl_dev *pctldev,
 		dev_dbg(pctldev->dev, "%s: pin=%u, config=0x%lx\n",
 			__func__, pin_id, configs[i]);
 
-		/* Keep slew rate enabled by default. */
-		if (atmel_pioctrl->slew_rate_support)
-			conf |= ATMEL_PIO_SR_MASK;
-
 		switch (param) {
 		case PIN_CONFIG_BIAS_DISABLE:
 			conf &= (~ATMEL_PIO_PUEN_MASK);
-- 
2.25.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] pinctrl: at91-pio4: Fix slew rate disablement
  2021-04-09  8:25 [PATCH] pinctrl: at91-pio4: Fix slew rate disablement Tudor Ambarus
@ 2021-04-09  9:59 ` Claudiu.Beznea
  2021-04-09 12:11 ` Ludovic.Desroches
  2021-04-10  0:08 ` Linus Walleij
  2 siblings, 0 replies; 4+ messages in thread
From: Claudiu.Beznea @ 2021-04-09  9:59 UTC (permalink / raw)
  To: Tudor.Ambarus, Ludovic.Desroches, linus.walleij
  Cc: linux-gpio, alexandre.belloni, linux-arm-kernel, linux-kernel

On 09.04.2021 11:25, Tudor Ambarus wrote:
> The slew rate was enabled by default for each configuration of the
> pin. In case the pin had more than one configuration, even if
> we set the slew rate as disabled in the device tree, the next pin
> configuration would set again the slew rate enabled by default,
> overwriting the slew rate disablement.
> Instead of enabling the slew rate by default for each pin configuration,
> enable the slew rate by default just once per pin, regardless of the
> number of configurations. This way the slew rate disablement will also
> work for cases where pins have multiple configurations.
> 
> Fixes: 440b144978ba ("pinctrl: at91-pio4: add support for slew-rate")
> Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com>

Reviewed-by: Claudiu Beznea <claudiu.beznea@microchip.com>


> ---
>  drivers/pinctrl/pinctrl-at91-pio4.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/pinctrl/pinctrl-at91-pio4.c b/drivers/pinctrl/pinctrl-at91-pio4.c
> index a5d328808e4c..4c01d8471ffa 100644
> --- a/drivers/pinctrl/pinctrl-at91-pio4.c
> +++ b/drivers/pinctrl/pinctrl-at91-pio4.c
> @@ -801,6 +801,10 @@ static int atmel_conf_pin_config_group_set(struct pinctrl_dev *pctldev,
>  
>  	conf = atmel_pin_config_read(pctldev, pin_id);
>  
> +	/* Keep slew rate enabled by default. */
> +	if (atmel_pioctrl->slew_rate_support)
> +		conf |= ATMEL_PIO_SR_MASK;
> +
>  	for (i = 0; i < num_configs; i++) {
>  		unsigned int param = pinconf_to_config_param(configs[i]);
>  		unsigned int arg = pinconf_to_config_argument(configs[i]);
> @@ -808,10 +812,6 @@ static int atmel_conf_pin_config_group_set(struct pinctrl_dev *pctldev,
>  		dev_dbg(pctldev->dev, "%s: pin=%u, config=0x%lx\n",
>  			__func__, pin_id, configs[i]);
>  
> -		/* Keep slew rate enabled by default. */
> -		if (atmel_pioctrl->slew_rate_support)
> -			conf |= ATMEL_PIO_SR_MASK;
> -
>  		switch (param) {
>  		case PIN_CONFIG_BIAS_DISABLE:
>  			conf &= (~ATMEL_PIO_PUEN_MASK);
> 

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] pinctrl: at91-pio4: Fix slew rate disablement
  2021-04-09  8:25 [PATCH] pinctrl: at91-pio4: Fix slew rate disablement Tudor Ambarus
  2021-04-09  9:59 ` Claudiu.Beznea
@ 2021-04-09 12:11 ` Ludovic.Desroches
  2021-04-10  0:08 ` Linus Walleij
  2 siblings, 0 replies; 4+ messages in thread
From: Ludovic.Desroches @ 2021-04-09 12:11 UTC (permalink / raw)
  To: Tudor.Ambarus
  Cc: alexandre.belloni, linus.walleij, linux-kernel, linux-gpio,
	Claudiu.Beznea, linux-arm-kernel

On Fri, Apr 09, 2021 at 11:25:22AM +0300, Tudor Ambarus wrote:
> The slew rate was enabled by default for each configuration of the
> pin. In case the pin had more than one configuration, even if
> we set the slew rate as disabled in the device tree, the next pin
> configuration would set again the slew rate enabled by default,
> overwriting the slew rate disablement.
> Instead of enabling the slew rate by default for each pin configuration,
> enable the slew rate by default just once per pin, regardless of the
> number of configurations. This way the slew rate disablement will also
> work for cases where pins have multiple configurations.
> 
> Fixes: 440b144978ba ("pinctrl: at91-pio4: add support for slew-rate")
> Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com>

Acked-by: Ludovic Desroches <ludovic.desroches@microchip.com>

Thanks.

> ---
>  drivers/pinctrl/pinctrl-at91-pio4.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/pinctrl/pinctrl-at91-pio4.c b/drivers/pinctrl/pinctrl-at91-pio4.c
> index a5d328808e4c..4c01d8471ffa 100644
> --- a/drivers/pinctrl/pinctrl-at91-pio4.c
> +++ b/drivers/pinctrl/pinctrl-at91-pio4.c
> @@ -801,6 +801,10 @@ static int atmel_conf_pin_config_group_set(struct pinctrl_dev *pctldev,
>  
>  	conf = atmel_pin_config_read(pctldev, pin_id);
>  
> +	/* Keep slew rate enabled by default. */
> +	if (atmel_pioctrl->slew_rate_support)
> +		conf |= ATMEL_PIO_SR_MASK;
> +
>  	for (i = 0; i < num_configs; i++) {
>  		unsigned int param = pinconf_to_config_param(configs[i]);
>  		unsigned int arg = pinconf_to_config_argument(configs[i]);
> @@ -808,10 +812,6 @@ static int atmel_conf_pin_config_group_set(struct pinctrl_dev *pctldev,
>  		dev_dbg(pctldev->dev, "%s: pin=%u, config=0x%lx\n",
>  			__func__, pin_id, configs[i]);
>  
> -		/* Keep slew rate enabled by default. */
> -		if (atmel_pioctrl->slew_rate_support)
> -			conf |= ATMEL_PIO_SR_MASK;
> -
>  		switch (param) {
>  		case PIN_CONFIG_BIAS_DISABLE:
>  			conf &= (~ATMEL_PIO_PUEN_MASK);
> -- 
> 2.25.1
> 
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] pinctrl: at91-pio4: Fix slew rate disablement
  2021-04-09  8:25 [PATCH] pinctrl: at91-pio4: Fix slew rate disablement Tudor Ambarus
  2021-04-09  9:59 ` Claudiu.Beznea
  2021-04-09 12:11 ` Ludovic.Desroches
@ 2021-04-10  0:08 ` Linus Walleij
  2 siblings, 0 replies; 4+ messages in thread
From: Linus Walleij @ 2021-04-10  0:08 UTC (permalink / raw)
  To: Tudor Ambarus
  Cc: Alexandre Belloni, linux-kernel, open list:GPIO SUBSYSTEM,
	Ludovic Desroches, Claudiu Beznea, Linux ARM

On Fri, Apr 9, 2021 at 10:25 AM Tudor Ambarus
<tudor.ambarus@microchip.com> wrote:

> The slew rate was enabled by default for each configuration of the
> pin. In case the pin had more than one configuration, even if
> we set the slew rate as disabled in the device tree, the next pin
> configuration would set again the slew rate enabled by default,
> overwriting the slew rate disablement.
> Instead of enabling the slew rate by default for each pin configuration,
> enable the slew rate by default just once per pin, regardless of the
> number of configurations. This way the slew rate disablement will also
> work for cases where pins have multiple configurations.
>
> Fixes: 440b144978ba ("pinctrl: at91-pio4: add support for slew-rate")
> Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com>

Patch applied!

Yours,
Linus Walleij

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

end of thread, other threads:[~2021-04-10  0:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-09  8:25 [PATCH] pinctrl: at91-pio4: Fix slew rate disablement Tudor Ambarus
2021-04-09  9:59 ` Claudiu.Beznea
2021-04-09 12:11 ` Ludovic.Desroches
2021-04-10  0:08 ` Linus Walleij

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