From: Geert Uytterhoeven <geert@linux-m68k.org>
To: claudiu beznea <claudiu.beznea@tuxon.dev>
Cc: magnus.damm@gmail.com, robh@kernel.org,
krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org,
linus.walleij@linaro.org, linux-renesas-soc@vger.kernel.org,
devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-gpio@vger.kernel.org,
Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Subject: Re: [PATCH 1/2] pinctrl: renesas: rzg2l: Add suspend/resume support
Date: Thu, 15 Feb 2024 10:27:04 +0100 [thread overview]
Message-ID: <CAMuHMdXc1_P_9o4aMqZU2e2Rsa5B6TfPLv1oXp_sOzSNQPHn2w@mail.gmail.com> (raw)
In-Reply-To: <cdaffd20-1df4-4f73-ba96-9625e0749269@tuxon.dev>
Hi Claudiu,
On Thu, Feb 15, 2024 at 10:15 AM claudiu beznea
<claudiu.beznea@tuxon.dev> wrote:
> On 12.02.2024 17:35, claudiu beznea wrote:
> >>> static const u16 available_ps[] = { 1800, 2500, 3300 };
> >>> @@ -1880,6 +1938,19 @@ static void rzg2l_gpio_irq_print_chip(struct irq_data *data, struct seq_file *p)
> >>> seq_printf(p, dev_name(gc->parent));
> >>> }
> >>>
> >>> +static int rzg2l_gpio_irq_set_wake(struct irq_data *data, unsigned int on)
> >>> +{
> >>> + struct gpio_chip *gc = irq_data_get_irq_chip_data(data);
> >>> + struct rzg2l_pinctrl *pctrl = container_of(gc, struct rzg2l_pinctrl, gpio_chip);
> >>> +
> >> I think you also have to call irq_set_irq_wake(pctrl->hwirq[...]) here.
> >> Cfr. drivers/gpio/gpio-rcar.c (which is simpler, as it has a single interrupt
> >> parent, instead of a parent irq_domain with multiple interrupts).
> > I had it in my initial implementation (done long time ago) but I don't
> > remember why I removed it. I'll re-add it anyway.
>
> I did some investigation on this. It seems adding irq_set_irq_wake() is not
> necessary as the pinctrl has no virq requested on behalf of itself.
>
> With this irqchip hierarchy (pinctrl-rzg2l -> irq-renesas-rzg2l -> gic) if
> an IRQ consumer, e.g., the gpio-keys, request an interrupt then it may call
> irq_set_irq_wake(virq) (gpio-keys does that).
>
> irq_set_irq_wake(virq) is forwarded to pinctrl as follows:
>
> irq_set_irq_wake(virq, on) ->
> set_irq_wake_real(virq, ono) ->
> rzg2l_gpio_irq_set_wake(irq, on)
>
> As the irq_set_irq_wake() gets a virq as argument and as we have no virq
> requested by pinctrl driver there is no need to call irq_set_irq_wake(), as
> of my investigation. Calling it with hwirq will return with -22 and calling
> it with virq received as argument leads to deadlock (as it's the same virq
> that consumer already is configuring with irq_set_irq_wake()) due the
> following line from irq_set_irq_wake():
>
> struct irq_desc *desc = irq_get_desc_buslock(irq, &flags,
> IRQ_GET_DESC_CHECK_GLOBAL);
>
> What we can do is to forward irq_set_wake() to the parent IRQ chip
> (irq-renesas-rzg2l) with irq_chip_set_wake_parent() to let him set its
> wakeup_path, if any. But, at the moment the irq-renesas-rzg2l has
> IRQCHIP_SKIP_SET_WAKE thus the irq_chip_set_wake_parent() does nothing (but
> it can be updated for that). Now I remember that irq_chip_set_wake_parent()
> is what I've called in my initial implementation and removed it due to
> IRQCHIP_SKIP_SET_WAKE.
>
> Please let me know if you are OK to add irq_chip_set_wake_parent() and
> update the irq-renesas-rzg2l driver.
I think calling irq_chip_set_wake_parent() regardless is a good thing
to do. Whether the irq-renesas-rzg2l needs an update for wake-up
handling, I don't know (and that is orthogonal to the above).
If you haven't already done so, you may want to browse the wake-related
git history of e.g. drivers/gpio/gpio-rcar.c.
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
next prev parent reply other threads:[~2024-02-15 9:27 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-08 13:56 [PATCH 0/2] pinctrl: renesas: rzg2l: Add suspend to RAM support Claudiu
2024-02-08 13:56 ` [PATCH 1/2] pinctrl: renesas: rzg2l: Add suspend/resume support Claudiu
2024-02-09 5:54 ` claudiu beznea
2024-02-12 15:06 ` Geert Uytterhoeven
2024-02-12 15:35 ` claudiu beznea
2024-02-15 9:14 ` claudiu beznea
2024-02-15 9:27 ` Geert Uytterhoeven [this message]
2024-02-08 13:56 ` [PATCH 2/2] arm64: dts: renesas: r9a08g045: add PSCI support Claudiu
2024-02-12 14:03 ` Geert Uytterhoeven
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=CAMuHMdXc1_P_9o4aMqZU2e2Rsa5B6TfPLv1oXp_sOzSNQPHn2w@mail.gmail.com \
--to=geert@linux-m68k.org \
--cc=claudiu.beznea.uj@bp.renesas.com \
--cc=claudiu.beznea@tuxon.dev \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=magnus.damm@gmail.com \
--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;
as well as URLs for NNTP newsgroup(s).