linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1 1/2] pinctrl: merrifield: Fix open-drain pin mode configuration
@ 2023-06-05 15:45 Andy Shevchenko
  2023-06-05 15:45 ` [PATCH v1 2/2] pinctrl: merrifield: Use BUFCFG_PINMODE_GPIO in ->pin_dbg_show() Andy Shevchenko
  2023-06-06  5:12 ` [PATCH v1 1/2] pinctrl: merrifield: Fix open-drain pin mode configuration Mika Westerberg
  0 siblings, 2 replies; 5+ messages in thread
From: Andy Shevchenko @ 2023-06-05 15:45 UTC (permalink / raw)
  To: Andy Shevchenko, linux-gpio, linux-kernel
  Cc: Mika Westerberg, Andy Shevchenko, Linus Walleij

Currently the pin may not be configured as open-drain in some
cases because the argument may be 0 for the boolean types of
the pin configurations. Fix this by ignoring the argument.

With that, allow to actually restore pin to the push-pull mode.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/pinctrl/intel/pinctrl-merrifield.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/drivers/pinctrl/intel/pinctrl-merrifield.c b/drivers/pinctrl/intel/pinctrl-merrifield.c
index 365c391c97a3..f1d0b7576703 100644
--- a/drivers/pinctrl/intel/pinctrl-merrifield.c
+++ b/drivers/pinctrl/intel/pinctrl-merrifield.c
@@ -710,6 +710,11 @@ static int mrfld_config_get(struct pinctrl_dev *pctldev, unsigned int pin,
 
 		break;
 
+	case PIN_CONFIG_DRIVE_PUSH_PULL:
+		if (value & BUFCFG_OD_EN)
+			return -EINVAL;
+		break;
+
 	case PIN_CONFIG_DRIVE_OPEN_DRAIN:
 		if (!(value & BUFCFG_OD_EN))
 			return -EINVAL;
@@ -791,10 +796,14 @@ static int mrfld_config_set_pin(struct mrfld_pinctrl *mp, unsigned int pin,
 
 		break;
 
+	case PIN_CONFIG_DRIVE_PUSH_PULL:
+		mask |= BUFCFG_OD_EN;
+		bits &= ~BUFCFG_OD_EN;
+		break;
+
 	case PIN_CONFIG_DRIVE_OPEN_DRAIN:
 		mask |= BUFCFG_OD_EN;
-		if (arg)
-			bits |= BUFCFG_OD_EN;
+		bits |= BUFCFG_OD_EN;
 		break;
 
 	case PIN_CONFIG_SLEW_RATE:
@@ -826,6 +835,7 @@ static int mrfld_config_set(struct pinctrl_dev *pctldev, unsigned int pin,
 		case PIN_CONFIG_BIAS_DISABLE:
 		case PIN_CONFIG_BIAS_PULL_UP:
 		case PIN_CONFIG_BIAS_PULL_DOWN:
+		case PIN_CONFIG_DRIVE_PUSH_PULL:
 		case PIN_CONFIG_DRIVE_OPEN_DRAIN:
 		case PIN_CONFIG_SLEW_RATE:
 			ret = mrfld_config_set_pin(mp, pin, configs[i]);
-- 
2.40.0.1.gaa8946217a0b


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

* [PATCH v1 2/2] pinctrl: merrifield: Use BUFCFG_PINMODE_GPIO in ->pin_dbg_show()
  2023-06-05 15:45 [PATCH v1 1/2] pinctrl: merrifield: Fix open-drain pin mode configuration Andy Shevchenko
@ 2023-06-05 15:45 ` Andy Shevchenko
  2023-06-06  5:12   ` Mika Westerberg
  2023-06-06  5:12 ` [PATCH v1 1/2] pinctrl: merrifield: Fix open-drain pin mode configuration Mika Westerberg
  1 sibling, 1 reply; 5+ messages in thread
From: Andy Shevchenko @ 2023-06-05 15:45 UTC (permalink / raw)
  To: Andy Shevchenko, linux-gpio, linux-kernel
  Cc: Mika Westerberg, Andy Shevchenko, Linus Walleij

Use explicit comparison to BUFCFG_PINMODE_GPIO instead of implying it.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/pinctrl/intel/pinctrl-merrifield.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pinctrl/intel/pinctrl-merrifield.c b/drivers/pinctrl/intel/pinctrl-merrifield.c
index f1d0b7576703..fb6de38b1c50 100644
--- a/drivers/pinctrl/intel/pinctrl-merrifield.c
+++ b/drivers/pinctrl/intel/pinctrl-merrifield.c
@@ -549,7 +549,7 @@ static void mrfld_pin_dbg_show(struct pinctrl_dev *pctldev, struct seq_file *s,
 	}
 
 	mode = (value & BUFCFG_PINMODE_MASK) >> BUFCFG_PINMODE_SHIFT;
-	if (!mode)
+	if (mode == BUFCFG_PINMODE_GPIO)
 		seq_puts(s, "GPIO ");
 	else
 		seq_printf(s, "mode %d ", mode);
-- 
2.40.0.1.gaa8946217a0b


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

* Re: [PATCH v1 1/2] pinctrl: merrifield: Fix open-drain pin mode configuration
  2023-06-05 15:45 [PATCH v1 1/2] pinctrl: merrifield: Fix open-drain pin mode configuration Andy Shevchenko
  2023-06-05 15:45 ` [PATCH v1 2/2] pinctrl: merrifield: Use BUFCFG_PINMODE_GPIO in ->pin_dbg_show() Andy Shevchenko
@ 2023-06-06  5:12 ` Mika Westerberg
  2023-06-06 13:07   ` Andy Shevchenko
  1 sibling, 1 reply; 5+ messages in thread
From: Mika Westerberg @ 2023-06-06  5:12 UTC (permalink / raw)
  To: Andy Shevchenko; +Cc: linux-gpio, linux-kernel, Andy Shevchenko, Linus Walleij

On Mon, Jun 05, 2023 at 06:45:08PM +0300, Andy Shevchenko wrote:
> Currently the pin may not be configured as open-drain in some
> cases because the argument may be 0 for the boolean types of
> the pin configurations. Fix this by ignoring the argument.
> 
> With that, allow to actually restore pin to the push-pull mode.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>

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

* Re: [PATCH v1 2/2] pinctrl: merrifield: Use BUFCFG_PINMODE_GPIO in ->pin_dbg_show()
  2023-06-05 15:45 ` [PATCH v1 2/2] pinctrl: merrifield: Use BUFCFG_PINMODE_GPIO in ->pin_dbg_show() Andy Shevchenko
@ 2023-06-06  5:12   ` Mika Westerberg
  0 siblings, 0 replies; 5+ messages in thread
From: Mika Westerberg @ 2023-06-06  5:12 UTC (permalink / raw)
  To: Andy Shevchenko; +Cc: linux-gpio, linux-kernel, Andy Shevchenko, Linus Walleij

On Mon, Jun 05, 2023 at 06:45:09PM +0300, Andy Shevchenko wrote:
> Use explicit comparison to BUFCFG_PINMODE_GPIO instead of implying it.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>

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

* Re: [PATCH v1 1/2] pinctrl: merrifield: Fix open-drain pin mode configuration
  2023-06-06  5:12 ` [PATCH v1 1/2] pinctrl: merrifield: Fix open-drain pin mode configuration Mika Westerberg
@ 2023-06-06 13:07   ` Andy Shevchenko
  0 siblings, 0 replies; 5+ messages in thread
From: Andy Shevchenko @ 2023-06-06 13:07 UTC (permalink / raw)
  To: Mika Westerberg; +Cc: linux-gpio, linux-kernel, Linus Walleij

On Tue, Jun 06, 2023 at 08:12:10AM +0300, Mika Westerberg wrote:
> On Mon, Jun 05, 2023 at 06:45:08PM +0300, Andy Shevchenko wrote:
> > Currently the pin may not be configured as open-drain in some
> > cases because the argument may be 0 for the boolean types of
> > the pin configurations. Fix this by ignoring the argument.
> > 
> > With that, allow to actually restore pin to the push-pull mode.
> > 
> > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> 
> Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>

Both pushed to my review and testing queue, thanks!

-- 
With Best Regards,
Andy Shevchenko



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

end of thread, other threads:[~2023-06-06 13:08 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-05 15:45 [PATCH v1 1/2] pinctrl: merrifield: Fix open-drain pin mode configuration Andy Shevchenko
2023-06-05 15:45 ` [PATCH v1 2/2] pinctrl: merrifield: Use BUFCFG_PINMODE_GPIO in ->pin_dbg_show() Andy Shevchenko
2023-06-06  5:12   ` Mika Westerberg
2023-06-06  5:12 ` [PATCH v1 1/2] pinctrl: merrifield: Fix open-drain pin mode configuration Mika Westerberg
2023-06-06 13:07   ` Andy Shevchenko

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