mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: <Ryan.Wanner@microchip.com>
To: <ludovic.desroches@microchip.com>, <linus.walleij@linaro.org>,
	<nicolas.ferre@microchip.com>, <alexandre.belloni@bootlin.com>,
	<claudiu.beznea@microchip.com>
Cc: <linux-arm-kernel@lists.infradead.org>,
	<linux-gpio@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	Ryan Wanner <Ryan.Wanner@microchip.com>
Subject: [linux][PATCH] pinctrl: at91-pio4: Add push-pull drive configuration
Date: Wed, 12 Apr 2023 10:51:46 -0700	[thread overview]
Message-ID: <20230412175146.886684-1-Ryan.Wanner@microchip.com> (raw)

From: Ryan Wanner <Ryan.Wanner@microchip.com>

The PIO4 does support push-pull configuration as this is the default
state of the open-drain register. Adapt the driver for this.

Signed-off-by: Ryan Wanner <Ryan.Wanner@microchip.com>
---
This patch also fixes the warning of unsupported
configuration param 8.

This was tested on both sama5d2-som1-ek and sama7g5ek. I used dbg_show
fucntion to test if the configuration was correct when adding
drive-open-drain or drive-push-pull to the dts file.

 drivers/pinctrl/pinctrl-at91-pio4.c | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/drivers/pinctrl/pinctrl-at91-pio4.c b/drivers/pinctrl/pinctrl-at91-pio4.c
index a30c6f7c9016..9a0cddfeaf92 100644
--- a/drivers/pinctrl/pinctrl-at91-pio4.c
+++ b/drivers/pinctrl/pinctrl-at91-pio4.c
@@ -776,6 +776,11 @@ static int atmel_conf_pin_config_group_get(struct pinctrl_dev *pctldev,
 			return -EINVAL;
 		arg = 1;
 		break;
+	case PIN_CONFIG_DRIVE_PUSH_PULL:
+		if ((res & ATMEL_PIO_OPD_MASK))
+			return -EINVAL;
+		arg = 1;
+		break;
 	case PIN_CONFIG_INPUT_SCHMITT_ENABLE:
 		if (!(res & ATMEL_PIO_SCHMITT_MASK))
 			return -EINVAL;
@@ -839,10 +844,10 @@ static int atmel_conf_pin_config_group_set(struct pinctrl_dev *pctldev,
 			conf &= (~ATMEL_PIO_PUEN_MASK);
 			break;
 		case PIN_CONFIG_DRIVE_OPEN_DRAIN:
-			if (arg == 0)
-				conf &= (~ATMEL_PIO_OPD_MASK);
-			else
-				conf |= ATMEL_PIO_OPD_MASK;
+			conf |= ATMEL_PIO_OPD_MASK;
+			break;
+		case PIN_CONFIG_DRIVE_PUSH_PULL:
+			conf &= (~ATMEL_PIO_OPD_MASK);
 			break;
 		case PIN_CONFIG_INPUT_SCHMITT_ENABLE:
 			if (arg == 0)
@@ -937,8 +942,10 @@ static void atmel_conf_pin_config_dbg_show(struct pinctrl_dev *pctldev,
 		seq_printf(s, "%s ", "pull-down");
 	if (conf & ATMEL_PIO_IFEN_MASK)
 		seq_printf(s, "%s ", "debounce");
-	if (conf & ATMEL_PIO_OPD_MASK)
+	if ((conf & ATMEL_PIO_OPD_MASK) > 0)
 		seq_printf(s, "%s ", "open-drain");
+	if ((conf & ATMEL_PIO_OPD_MASK) == 0)
+		seq_printf(s, "%s ", "push-pull");
 	if (conf & ATMEL_PIO_SCHMITT_MASK)
 		seq_printf(s, "%s ", "schmitt");
 	if (atmel_pioctrl->slew_rate_support && (conf & ATMEL_PIO_SR_MASK))
-- 
2.37.2


             reply	other threads:[~2023-04-12 17:51 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-12 17:51 Ryan.Wanner [this message]
2023-04-13 16:24 ` Nicolas Ferre

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230412175146.886684-1-Ryan.Wanner@microchip.com \
    --to=ryan.wanner@microchip.com \
    --cc=alexandre.belloni@bootlin.com \
    --cc=claudiu.beznea@microchip.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ludovic.desroches@microchip.com \
    --cc=nicolas.ferre@microchip.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®