From: Lucas Stach <l.stach@pengutronix.de>
To: Liu Ying <victor.liu@nxp.com>,
linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org
Cc: Thomas Gleixner <tglx@linutronix.de>,
Marc Zyngier <maz@kernel.org>, Shawn Guo <shawnguo@kernel.org>,
Sascha Hauer <s.hauer@pengutronix.de>,
Pengutronix Kernel Team <kernel@pengutronix.de>,
Fabio Estevam <festevam@gmail.com>,
NXP Linux Team <linux-imx@nxp.com>
Subject: Re: [PATCH] irqchip/irq-imx-irqsteer: Get/put PM runtime in ->irq_unmask()/irq_mask()
Date: Wed, 08 Jun 2022 12:56:41 +0200 [thread overview]
Message-ID: <2d79719b8670a3693b210af5ab45716dba23999a.camel@pengutronix.de> (raw)
In-Reply-To: <20220608105057.2607812-1-victor.liu@nxp.com>
Am Mittwoch, dem 08.06.2022 um 18:50 +0800 schrieb Liu Ying:
> Now that runtime PM support was added in this driver, we have
> to enable power before accessing irqchip registers. And, after
> the access is done, we should disable power. This patch calls
> pm_runtime_get_sync() in ->irq_unmask() and pm_runtime_put() in
> ->irq_mask() to make sure power is managed for the register access.
>
Can you tell me in which case this is necessary? IIRC the IRQ core
already keeps the chip runtime resumed as soon as a IRQ is requested,
so why would it be in runtime suspend at mask/unmask?
Regards,
Lucas
> Fixes: 4730d2233311 ("irqchip/imx-irqsteer: Add runtime PM support")
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: Marc Zyngier <maz@kernel.org>
> Cc: Shawn Guo <shawnguo@kernel.org>
> Cc: Sascha Hauer <s.hauer@pengutronix.de>
> Cc: Pengutronix Kernel Team <kernel@pengutronix.de>
> Cc: Fabio Estevam <festevam@gmail.com>
> Cc: NXP Linux Team <linux-imx@nxp.com>
> Cc: Lucas Stach <l.stach@pengutronix.de>
> Signed-off-by: Liu Ying <victor.liu@nxp.com>
> ---
> drivers/irqchip/irq-imx-irqsteer.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/drivers/irqchip/irq-imx-irqsteer.c b/drivers/irqchip/irq-imx-irqsteer.c
> index 96230a04ec23..a5eabe71e8ab 100644
> --- a/drivers/irqchip/irq-imx-irqsteer.c
> +++ b/drivers/irqchip/irq-imx-irqsteer.c
> @@ -45,11 +45,14 @@ static int imx_irqsteer_get_reg_index(struct irqsteer_data *data,
>
> static void imx_irqsteer_irq_unmask(struct irq_data *d)
> {
> + struct device *dev = d->domain->dev;
> struct irqsteer_data *data = d->chip_data;
> int idx = imx_irqsteer_get_reg_index(data, d->hwirq);
> unsigned long flags;
> u32 val;
>
> + pm_runtime_get_sync(dev);
> +
> raw_spin_lock_irqsave(&data->lock, flags);
> val = readl_relaxed(data->regs + CHANMASK(idx, data->reg_num));
> val |= BIT(d->hwirq % 32);
> @@ -59,6 +62,7 @@ static void imx_irqsteer_irq_unmask(struct irq_data *d)
>
> static void imx_irqsteer_irq_mask(struct irq_data *d)
> {
> + struct device *dev = d->domain->dev;
> struct irqsteer_data *data = d->chip_data;
> int idx = imx_irqsteer_get_reg_index(data, d->hwirq);
> unsigned long flags;
> @@ -69,6 +73,8 @@ static void imx_irqsteer_irq_mask(struct irq_data *d)
> val &= ~BIT(d->hwirq % 32);
> writel_relaxed(val, data->regs + CHANMASK(idx, data->reg_num));
> raw_spin_unlock_irqrestore(&data->lock, flags);
> +
> + pm_runtime_put(dev);
> }
>
> static const struct irq_chip imx_irqsteer_irq_chip = {
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2022-06-08 10:57 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-08 10:50 [PATCH] irqchip/irq-imx-irqsteer: Get/put PM runtime in ->irq_unmask()/irq_mask() Liu Ying
2022-06-08 10:56 ` Lucas Stach [this message]
2022-06-08 11:29 ` Liu Ying
2022-06-08 12:02 ` Lucas Stach
2022-06-08 13:54 ` Marc Zyngier
2022-06-09 1:41 ` Liu Ying
2022-06-09 11:25 ` Marc Zyngier
2022-06-09 13:47 ` Liu Ying
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=2d79719b8670a3693b210af5ab45716dba23999a.camel@pengutronix.de \
--to=l.stach@pengutronix.de \
--cc=festevam@gmail.com \
--cc=kernel@pengutronix.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-imx@nxp.com \
--cc=linux-kernel@vger.kernel.org \
--cc=maz@kernel.org \
--cc=s.hauer@pengutronix.de \
--cc=shawnguo@kernel.org \
--cc=tglx@linutronix.de \
--cc=victor.liu@nxp.com \
/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).