From: Paul Cercueil <paul@crapouillou.net>
To: "H. Nikolaus Schaller" <hns@goldelico.com>,
Linus Walleij <linusw@kernel.org>, Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
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
Subject: Re: [PATCH v3 2/7] pinctrl: ingenic: Fix hardware dual-edge interrupts on X1600
Date: Wed, 18 Nov 2026 10:13:31 +0100 [thread overview]
Message-ID: <eb60698d243da29c61b3ffded6acca90dfcb3475.camel@crapouillou.net> (raw)
In-Reply-To: <29961993f8fdc1db97854f940ecf3883c2d32cf6.1794987700.git.hns@goldelico.com>
Hi Nikolaus,
Le mercredi 18 novembre 2026 à 08:41 +0100, H. Nikolaus Schaller a écrit :
> Use the hardware dual-edge detector on X1600 and X2000.
>
> Set PAT1 when configuring both edges and program EDG on X1600.
> Keep software edge switching for older SoCs without EDG.
>
> Tested on X1600 and X2000 using GPIO buttons and register readback.
>
> Fixes: 943e0da15370 ("pinctrl: Ingenic: Add pinctrl driver for X2000.")
> Fixes: 4da56f9c6f14 ("pinctrl: ingenic: add x1600 support")
You'll have to decide, I don't think you can have two Fixes: lines.
You also need to add:
Cc: stable@vger.kernel.org
> Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com>
> ---
> drivers/pinctrl/pinctrl-ingenic.c | 19 +++++++++++--------
> 1 file changed, 11 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/pinctrl/pinctrl-ingenic.c b/drivers/pinctrl/pinctrl-
> ingenic.c
> index 88c5edeaaddcc..dc5d38c16e18d 100644
> --- a/drivers/pinctrl/pinctrl-ingenic.c
> +++ b/drivers/pinctrl/pinctrl-ingenic.c
> @@ -3622,6 +3622,10 @@ static void irq_set_type(struct ingenic_gpio_chip
> *jzgc,
> break;
> }
>
> + if (type == IRQ_TYPE_EDGE_BOTH &&
> + is_soc_or_above(jzgc->jzpc, ID_X1600))
That actually fits in one line of 80 chars.
But you can do even better and move that to the switch above, and replace the
val1 = val2 = false;
with:
val1 = false;
val2 = is_soc_or_above(jzgc->jzpc, ID_X1600);
> + val2 = true;
> +
> if (is_soc_or_above(jzgc->jzpc, ID_JZ4770)) {
> reg1 = JZ4770_GPIO_PAT1;
> reg2 = JZ4770_GPIO_PAT0;
> @@ -3635,15 +3639,13 @@ static void irq_set_type(struct ingenic_gpio_chip
> *jzgc,
> return;
> }
>
> - if (is_soc_or_above(jzgc->jzpc, ID_X2000)) {
> - ingenic_gpio_shadow_set_bit(jzgc, reg2, offset, val1);
> - ingenic_gpio_shadow_set_bit(jzgc, reg1, offset, val2);
> - ingenic_gpio_shadow_set_bit_load(jzgc);
> - ingenic_gpio_set_bit(jzgc, X2000_GPIO_EDG, offset, val3);
> - } else if (is_soc_or_above(jzgc->jzpc, ID_X1000)) {
> + if (is_soc_or_above(jzgc->jzpc, ID_X1000)) {
> ingenic_gpio_shadow_set_bit(jzgc, reg2, offset, val1);
> ingenic_gpio_shadow_set_bit(jzgc, reg1, offset, val2);
> ingenic_gpio_shadow_set_bit_load(jzgc);
> +
> + if (is_soc_or_above(jzgc->jzpc, ID_X1600))
> + ingenic_gpio_set_bit(jzgc, X2000_GPIO_EDG, offset,
> val3);
The minimal diff would have been to change the check for ID_X2000 to ID_X1600
above. But the code does look better this way so I take it.
> } else {
> ingenic_gpio_set_bit(jzgc, reg2, offset, val1);
> ingenic_gpio_set_bit(jzgc, reg1, offset, val2);
> @@ -3718,7 +3720,7 @@ static void ingenic_gpio_irq_ack(struct irq_data *irqd)
> bool high;
>
> if ((irqd_get_trigger_type(irqd) == IRQ_TYPE_EDGE_BOTH) &&
> - !is_soc_or_above(jzgc->jzpc, ID_X2000)) {
> + !is_soc_or_above(jzgc->jzpc, ID_X1600)) {
> /*
> * Switch to an interrupt for the opposite edge to the one
> that
> * triggered the interrupt being ACKed.
> @@ -3758,7 +3760,8 @@ static int ingenic_gpio_irq_set_type(struct irq_data
> *irqd, unsigned int type)
> irq_set_handler_locked(irqd, handle_bad_irq);
> }
>
> - if ((type == IRQ_TYPE_EDGE_BOTH) && !is_soc_or_above(jzgc->jzpc,
> ID_X2000)) {
> + if (type == IRQ_TYPE_EDGE_BOTH &&
> + !is_soc_or_above(jzgc->jzpc, ID_X1600)) {
Keep it on line line.
Cheers,
-Paul
next prev parent reply other threads:[~2026-11-18 9:13 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-18 7:41 [PATCH v3 0/7] pinctrl: ingenic: Add X2600 support H. Nikolaus Schaller
2026-11-18 7:41 ` [PATCH v3 1/7] pinctrl: ingenic: Swap ID_X1600 and ID_X1830 H. Nikolaus Schaller
2026-11-18 7:41 ` [PATCH v3 2/7] pinctrl: ingenic: Fix hardware dual-edge interrupts on X1600 H. Nikolaus Schaller
2026-11-18 9:13 ` Paul Cercueil [this message]
2026-11-18 9:18 ` H. Nikolaus Schaller
2026-11-18 7:41 ` [PATCH v3 3/7] dt-bindings: pinctrl: ingenic: Add X2600 support H. Nikolaus Schaller
2026-11-18 7:41 ` [PATCH v3 4/7] pinctrl: ingenic: Add X2600 register and GPIO IRQ support H. Nikolaus Schaller
2026-11-18 9:23 ` Paul Cercueil
2026-11-18 7:41 ` [PATCH v3 5/7] pinctrl: ingenic: Add X2600 pin groups and functions H. Nikolaus Schaller
2026-11-18 7:41 ` [PATCH v3 6/7] pinctrl: ingenic: Handle X2600 Port E Schmitt trigger H. Nikolaus Schaller
2026-11-18 7:41 ` [PATCH v3 7/7] pinctrl: ingenic: Handle X2600 Port E pull configuration H. Nikolaus Schaller
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=eb60698d243da29c61b3ffded6acca90dfcb3475.camel@crapouillou.net \
--to=paul@crapouillou.net \
--cc=brgl@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=hns@goldelico.com \
--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=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®