Linux GPIO subsystem development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "H. Nikolaus Schaller" <hns@goldelico.com>
Cc: linux-gpio@vger.kernel.org, devicetree@vger.kernel.org,
	robh@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH v2 2/7] pinctrl: ingenic: Fix hardware dual-edge interrupts on X1600
Date: Tue, 17 Nov 2026 18:38:47 +0000	[thread overview]
Message-ID: <sashiko-outbox-219369@kernel.org> (raw)
In-Reply-To: <b87494f8bd72efe7d4c8b8c7c6a5f37686861aff.1794940167.git.hns@goldelico.com>

Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [Low] pinctrl: ingenic: redundant checks and duplicated branch in
  irq_set_type()
- [Low] pinctrl: ingenic: missing Fixes: trailers for X2000 and X1600
  dual-edge IRQ
--

commit 478cc52f71c553d81f6fc71fbe29cdc01e47f147
Author: H. Nikolaus Schaller <hns@goldelico.com>

> pinctrl: ingenic: Fix hardware dual-edge interrupts on X1600
>
> 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.
>
> Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com>

[Severity: Low]
Should this bug fix include Fixes: tags for the commits that introduced X2000
and X1600 GPIO support?

  Fixes: 943e0da15370 ("pinctrl: Ingenic: Add pinctrl driver for X2000.")
  Fixes: 4da56f9c6f14 ("pinctrl: ingenic: add x1600 support")

> diff --git a/drivers/pinctrl/pinctrl-ingenic.c b/drivers/pinctrl/pinctrl-ingenic.c
> index 7d3f34c4fb589..f718725d84d4a 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))
> +		val2 = true;
> +
>  	if (is_soc_or_above(jzgc->jzpc, ID_JZ4770)) {
>  		reg1 = JZ4770_GPIO_PAT1;
>  		reg2 = JZ4770_GPIO_PAT0;
> @@ -3644,6 +3648,9 @@ static void irq_set_type(struct ingenic_gpio_chip *jzgc,
>  		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);
>  	} else {
>  		ingenic_gpio_set_bit(jzgc, reg2, offset, val1);
>  		ingenic_gpio_set_bit(jzgc, reg1, offset, val2);

[Severity: Low]
This isn't a bug, but both callers of irq_set_type()
(ingenic_gpio_irq_set_type() and ingenic_gpio_irq_ack()) already convert
IRQ_TYPE_EDGE_BOTH to level triggers when !is_soc_or_above(jzgc->jzpc,
ID_X1600).  Can case IRQ_TYPE_EDGE_BOTH set val2 = true directly instead of
setting val2 = false and overriding it here?

Also, with the ID_X1600 check added to the ID_X1000 branch, the preceding
is_soc_or_above(jzgc->jzpc, ID_X2000) branch in irq_set_type() is now
identical and can be dropped:

drivers/pinctrl/pinctrl-ingenic.c:irq_set_type() {
    ...
	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)) {
    ...
}

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/cover.1794940166.git.hns@goldelico.com?part=2

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

Thread overview: 9+ 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:38   ` sashiko-bot [this message]
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 ` [PATCH v2 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=sashiko-outbox-219369@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=hns@goldelico.com \
    --cc=linux-gpio@vger.kernel.org \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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