mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "H. Nikolaus Schaller" <hns@goldelico.com>
To: Linus Walleij <linusw@kernel.org>, Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	Paul Cercueil <paul@crapouillou.net>,
	Bartosz Golaszewski <brgl@kernel.org>
Cc: linux-gpio@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-mips@vger.kernel.org,
	letux-kernel@openphoenux.org,
	"H. Nikolaus Schaller" <hns@goldelico.com>
Subject: [PATCH v2 7/7] pinctrl: ingenic: Handle X2600 Port E pull configuration
Date: Tue, 17 Nov 2026 19:29:28 +0100	[thread overview]
Message-ID: <8b8e17aa82e7912de8fedea404e6936cf8e2039b.1794940167.git.hns@goldelico.com> (raw)
In-Reply-To: <cover.1794940166.git.hns@goldelico.com>

Port E uses PEPE as pull enable and PEPS as pull direction
selection, unlike ports A-D with independent pull registers.
Update both pinconf get and set while leaving other ports unchanged.

Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com>
---
 drivers/pinctrl/pinctrl-ingenic.c | 33 ++++++++++++++++++++++++++++---
 1 file changed, 30 insertions(+), 3 deletions(-)

diff --git a/drivers/pinctrl/pinctrl-ingenic.c b/drivers/pinctrl/pinctrl-ingenic.c
index 529bb31cbbec0..763201bc14830 100644
--- a/drivers/pinctrl/pinctrl-ingenic.c
+++ b/drivers/pinctrl/pinctrl-ingenic.c
@@ -4642,7 +4642,16 @@ static int ingenic_pinconf_get(struct pinctrl_dev *pctldev,
 	unsigned int bias, reg;
 	bool pull, pullup, pulldown;
 
-	if (is_soc_or_above(jzpc, ID_X2000)) {
+	if (is_soc(jzpc, ID_X2600) && offt == 4) {
+		pull = ingenic_get_pin_config(jzpc, pin, X2000_GPIO_PEPU);
+		pullup = pull &&
+			 ingenic_get_pin_config(jzpc, pin, X2000_GPIO_PEPD) &&
+			 (jzpc->info->pull_ups[offt] & BIT(idx));
+		pulldown = pull &&
+			   !ingenic_get_pin_config(jzpc, pin, X2000_GPIO_PEPD) &&
+			   (jzpc->info->pull_downs[offt] & BIT(idx));
+
+	} else if (is_soc_or_above(jzpc, ID_X2000)) {
 		pullup = ingenic_get_pin_config(jzpc, pin, X2000_GPIO_PEPU) &&
 				!ingenic_get_pin_config(jzpc, pin, X2000_GPIO_PEPD) &&
 				(jzpc->info->pull_ups[offt] & BIT(idx));
@@ -4711,7 +4720,7 @@ static int ingenic_pinconf_get(struct pinctrl_dev *pctldev,
 		if (is_soc(jzpc, ID_X2600) &&
 		    pin / PINS_PER_GPIO_CHIP == 4)
 			arg |= !!ingenic_get_pin_config(jzpc, pin,
-						X2600_GPIO_SMT1);
+							X2600_GPIO_SMT1);
 		break;
 
 	case PIN_CONFIG_SLEW_RATE:
@@ -4736,7 +4745,25 @@ static int ingenic_pinconf_get(struct pinctrl_dev *pctldev,
 static void ingenic_set_bias(struct ingenic_pinctrl *jzpc,
 		unsigned int pin, unsigned int bias)
 {
-	if (is_soc_or_above(jzpc, ID_X2000)) {
+	if (is_soc(jzpc, ID_X2600) && pin / PINS_PER_GPIO_CHIP == 4) {
+		/* X2600 Port E: PEPS selects direction, PEPE enables pull */
+		switch (bias) {
+		case GPIO_PULL_UP:
+			ingenic_config_pin(jzpc, pin, X2000_GPIO_PEPD, true);
+			ingenic_config_pin(jzpc, pin, X2000_GPIO_PEPU, true);
+			break;
+
+		case GPIO_PULL_DOWN:
+			ingenic_config_pin(jzpc, pin, X2000_GPIO_PEPD, false);
+			ingenic_config_pin(jzpc, pin, X2000_GPIO_PEPU, true);
+			break;
+
+		case GPIO_PULL_DIS:
+		default:
+			ingenic_config_pin(jzpc, pin, X2000_GPIO_PEPU, false);
+			break;
+		}
+	} else if (is_soc_or_above(jzpc, ID_X2000)) {
 		switch (bias) {
 		case GPIO_PULL_UP:
 			ingenic_config_pin(jzpc, pin, X2000_GPIO_PEPD, false);
-- 
2.56.0


      parent reply	other threads:[~2026-11-17 18:29 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-17 18:29 [PATCH v2 0/7] pinctrl: ingenic: Add X2600 support H. Nikolaus Schaller
2026-11-17 18:29 ` [PATCH v2 1/7] pinctrl: ingenic: Swap ID_X1600 and ID_X1830 H. Nikolaus Schaller
2026-11-17 18:29 ` [PATCH v2 2/7] pinctrl: ingenic: Fix hardware dual-edge interrupts on X1600 H. Nikolaus Schaller
2026-11-17 18:29 ` [PATCH v2 3/7] dt-bindings: pinctrl: ingenic: Add X2600 support H. Nikolaus Schaller
2026-11-17 18:29 ` [PATCH v2 4/7] pinctrl: ingenic: Add X2600 register and GPIO IRQ support H. Nikolaus Schaller
2026-11-17 18:29 ` [PATCH v2 5/7] pinctrl: ingenic: Add X2600 pin groups and functions H. Nikolaus Schaller
2026-11-17 18:29 ` [PATCH v2 6/7] pinctrl: ingenic: Handle X2600 Port E Schmitt trigger H. Nikolaus Schaller
2026-11-17 18:29 ` H. Nikolaus Schaller [this message]

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=8b8e17aa82e7912de8fedea404e6936cf8e2039b.1794940167.git.hns@goldelico.com \
    --to=hns@goldelico.com \
    --cc=brgl@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=letux-kernel@openphoenux.org \
    --cc=linusw@kernel.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@vger.kernel.org \
    --cc=paul@crapouillou.net \
    --cc=robh@kernel.org \
    /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®