* [PATCH v3] pinctrl: renesas: rzg2l: Configure the interrupt type on resume
@ 2024-04-19 6:19 Claudiu
2024-04-19 6:35 ` claudiu beznea
0 siblings, 1 reply; 2+ messages in thread
From: Claudiu @ 2024-04-19 6:19 UTC (permalink / raw)
To: geert+renesas, linus.walleij, biju.das.jz, tglx
Cc: linux-renesas-soc, linux-gpio, linux-kernel, Claudiu Beznea
From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Commit dce0919c83c3 ("irqchip/renesas-rzg2l: Do not set TIEN and TINT
source at the same time") removed the setup of TINT from
rzg2l_irqc_irq_enable(). To address the spourious interrupt issue the setup
of TINT has been moved in rzg2l_tint_set_edge() though
rzg2l_disable_tint_and_set_tint_source(). With this, the interrupts are
not properly re-configured after a suspend-to-RAM cycle. To address
this issue and avoid spurious interrupts while resumming set the
interrupt type before enabling it.
Fixes: dce0919c83c3 ("irqchip/renesas-rzg2l: Do not set TIEN and TINT source at the same time")
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
---
Changes in v3:
- moved dev_crit() out of critical section
Changes in v2:
- none; this patch was part of series at [1] and added in v2 of that
series
[1] https://lore.kernel.org/all/20240320104230.446400-1-claudiu.beznea.uj@bp.renesas.com/
drivers/pinctrl/renesas/pinctrl-rzg2l.c | 23 +++++++++++++----------
1 file changed, 13 insertions(+), 10 deletions(-)
diff --git a/drivers/pinctrl/renesas/pinctrl-rzg2l.c b/drivers/pinctrl/renesas/pinctrl-rzg2l.c
index 93916553bcc7..20425afc6b33 100644
--- a/drivers/pinctrl/renesas/pinctrl-rzg2l.c
+++ b/drivers/pinctrl/renesas/pinctrl-rzg2l.c
@@ -2045,7 +2045,9 @@ static void rzg2l_gpio_irq_restore(struct rzg2l_pinctrl *pctrl)
for (unsigned int i = 0; i < RZG2L_TINT_MAX_INTERRUPT; i++) {
struct irq_data *data;
+ unsigned long flags;
unsigned int virq;
+ int ret;
if (!pctrl->hwirq[i])
continue;
@@ -2063,17 +2065,18 @@ static void rzg2l_gpio_irq_restore(struct rzg2l_pinctrl *pctrl)
continue;
}
- if (!irqd_irq_disabled(data)) {
- unsigned long flags;
-
- /*
- * This has to be atomically executed to protect against a concurrent
- * interrupt.
- */
- raw_spin_lock_irqsave(&pctrl->lock.rlock, flags);
+ /*
+ * This has to be atomically executed to protect against a concurrent
+ * interrupt.
+ */
+ raw_spin_lock_irqsave(&pctrl->lock.rlock, flags);
+ ret = rzg2l_gpio_irq_set_type(data, irqd_get_trigger_type(data));
+ if (!ret && !irqd_irq_disabled(data))
rzg2l_gpio_irq_enable(data);
- raw_spin_unlock_irqrestore(&pctrl->lock.rlock, flags);
- }
+ raw_spin_unlock_irqrestore(&pctrl->lock.rlock, flags);
+
+ if (ret)
+ dev_crit(pctrl->dev, "Failed to set IRQ type for virq=%u\n", virq);
}
}
--
2.39.2
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH v3] pinctrl: renesas: rzg2l: Configure the interrupt type on resume
2024-04-19 6:19 [PATCH v3] pinctrl: renesas: rzg2l: Configure the interrupt type on resume Claudiu
@ 2024-04-19 6:35 ` claudiu beznea
0 siblings, 0 replies; 2+ messages in thread
From: claudiu beznea @ 2024-04-19 6:35 UTC (permalink / raw)
To: geert+renesas, linus.walleij, biju.das.jz, tglx
Cc: linux-renesas-soc, linux-gpio, linux-kernel, Claudiu Beznea
On 19.04.2024 09:19, Claudiu wrote:
> From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
>
> Commit dce0919c83c3 ("irqchip/renesas-rzg2l: Do not set TIEN and TINT
> source at the same time") removed the setup of TINT from
> rzg2l_irqc_irq_enable(). To address the spourious interrupt issue the setup
> of TINT has been moved in rzg2l_tint_set_edge() though
> rzg2l_disable_tint_and_set_tint_source(). With this, the interrupts are
> not properly re-configured after a suspend-to-RAM cycle. To address
> this issue and avoid spurious interrupts while resumming set the
> interrupt type before enabling it.
>
> Fixes: dce0919c83c3 ("irqchip/renesas-rzg2l: Do not set TIEN and TINT source at the same time")
> Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
> ---
>
> Changes in v3:
I just noticed I used the wrong versioning here and in patch title. Sorry
for that. I'll send an update.
Please ignore this patch.
Thank you,
Claudiu Beznea
> - moved dev_crit() out of critical section
>
> Changes in v2:
> - none; this patch was part of series at [1] and added in v2 of that
> series
>
> [1] https://lore.kernel.org/all/20240320104230.446400-1-claudiu.beznea.uj@bp.renesas.com/
>
> drivers/pinctrl/renesas/pinctrl-rzg2l.c | 23 +++++++++++++----------
> 1 file changed, 13 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/pinctrl/renesas/pinctrl-rzg2l.c b/drivers/pinctrl/renesas/pinctrl-rzg2l.c
> index 93916553bcc7..20425afc6b33 100644
> --- a/drivers/pinctrl/renesas/pinctrl-rzg2l.c
> +++ b/drivers/pinctrl/renesas/pinctrl-rzg2l.c
> @@ -2045,7 +2045,9 @@ static void rzg2l_gpio_irq_restore(struct rzg2l_pinctrl *pctrl)
>
> for (unsigned int i = 0; i < RZG2L_TINT_MAX_INTERRUPT; i++) {
> struct irq_data *data;
> + unsigned long flags;
> unsigned int virq;
> + int ret;
>
> if (!pctrl->hwirq[i])
> continue;
> @@ -2063,17 +2065,18 @@ static void rzg2l_gpio_irq_restore(struct rzg2l_pinctrl *pctrl)
> continue;
> }
>
> - if (!irqd_irq_disabled(data)) {
> - unsigned long flags;
> -
> - /*
> - * This has to be atomically executed to protect against a concurrent
> - * interrupt.
> - */
> - raw_spin_lock_irqsave(&pctrl->lock.rlock, flags);
> + /*
> + * This has to be atomically executed to protect against a concurrent
> + * interrupt.
> + */
> + raw_spin_lock_irqsave(&pctrl->lock.rlock, flags);
> + ret = rzg2l_gpio_irq_set_type(data, irqd_get_trigger_type(data));
> + if (!ret && !irqd_irq_disabled(data))
> rzg2l_gpio_irq_enable(data);
> - raw_spin_unlock_irqrestore(&pctrl->lock.rlock, flags);
> - }
> + raw_spin_unlock_irqrestore(&pctrl->lock.rlock, flags);
> +
> + if (ret)
> + dev_crit(pctrl->dev, "Failed to set IRQ type for virq=%u\n", virq);
> }
> }
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-04-19 6:35 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-19 6:19 [PATCH v3] pinctrl: renesas: rzg2l: Configure the interrupt type on resume Claudiu
2024-04-19 6:35 ` claudiu beznea
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).