[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAJZ5v0irVZ8Y+NmkyP9Sde94BtJPsAO+yH8XXWLR5AU7ktN3aw@mail.gmail.com>
Date: Thu, 27 Nov 2025 14:01:00 +0100
From: "Rafael J. Wysocki" <rafael@...nel.org>
To: Krishna Chaitanya Chundru <krishna.chundru@....qualcomm.com>
Cc: "Rafael J. Wysocki" <rafael@...nel.org>, Len Brown <lenb@...nel.org>, Pavel Machek <pavel@...nel.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>, Danilo Krummrich <dakr@...nel.org>,
Bjorn Helgaas <bhelgaas@...gle.com>, Linus Walleij <linus.walleij@...aro.org>,
Bartosz Golaszewski <brgl@...ev.pl>, linux-pm@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-pci@...r.kernel.org, linux-gpio@...r.kernel.org,
quic_vbadigan@...cinc.com, quic_mrana@...cinc.com, sherry.sun@....com
Subject: Re: [PATCH v6 1/2] PM: sleep: wakeirq: Add support for dedicated
shared wake IRQ setup
On Thu, Nov 27, 2025 at 1:46 PM Krishna Chaitanya Chundru
<krishna.chundru@....qualcomm.com> wrote:
>
> Some devices require more flexibility when configuring their dedicated
> wake-up interrupts, such as support for IRQF_SHARED or other IRQ flags.
> This is particularly useful in PCIe systems where multiple endpoints
> (e.g., Wi-Fi and Bluetooth controllers) share a common WAKE# signal
> line which requests platform to re-establish power and reference clocks
> to the components. In such cases, drivers can use this new API
> dev_pm_set_dedicated_shared_wake_irq() to register a shared wake IRQ.
>
> Update the internal helper __dev_pm_set_dedicated_wake_irq() to accept an
> irq_flags argument. Modify the existing dev_pm_set_dedicated_wake_irq()
> and dev_pm_set_dedicated_wake_irq_reverse() to preserve current behavior.
>
> When IRQ regitsered with IRQF_SHARED we can't use IRQF_NO_AUTOEN flag,
registered
> so after registering for irq, disable it explicitly.
>
> Signed-off-by: Krishna Chaitanya Chundru <krishna.chundru@....qualcomm.com>
Overall
Acked-by: Rafael J. Wysocki (Intel) <rafael@...nel.org>
with a couple of minor nits (one above).
You could have said what changed between different versions of the patchset.
> ---
> drivers/base/power/wakeirq.c | 39 ++++++++++++++++++++++++++++++++++-----
> include/linux/pm_wakeirq.h | 6 ++++++
> 2 files changed, 40 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/base/power/wakeirq.c b/drivers/base/power/wakeirq.c
> index 8aa28c08b2891f3af490175362cc1a759069bd50..df34a891d54bec8737a3ef174bdfa469c19133c4 100644
> --- a/drivers/base/power/wakeirq.c
> +++ b/drivers/base/power/wakeirq.c
> @@ -168,7 +168,8 @@ static irqreturn_t handle_threaded_wake_irq(int irq, void *_wirq)
> return IRQ_HANDLED;
> }
>
> -static int __dev_pm_set_dedicated_wake_irq(struct device *dev, int irq, unsigned int flag)
> +static int __dev_pm_set_dedicated_wake_irq(struct device *dev, int irq, unsigned int flag,
> + unsigned int irq_flags)
> {
> struct wake_irq *wirq;
> int err;
> @@ -197,8 +198,7 @@ static int __dev_pm_set_dedicated_wake_irq(struct device *dev, int irq, unsigned
> * so we use a threaded irq.
> */
> err = request_threaded_irq(irq, NULL, handle_threaded_wake_irq,
> - IRQF_ONESHOT | IRQF_NO_AUTOEN,
> - wirq->name, wirq);
> + IRQF_ONESHOT | irq_flags, wirq->name, wirq);
> if (err)
> goto err_free_name;
>
> @@ -234,7 +234,7 @@ static int __dev_pm_set_dedicated_wake_irq(struct device *dev, int irq, unsigned
> */
> int dev_pm_set_dedicated_wake_irq(struct device *dev, int irq)
> {
> - return __dev_pm_set_dedicated_wake_irq(dev, irq, 0);
> + return __dev_pm_set_dedicated_wake_irq(dev, irq, 0, IRQF_NO_AUTOEN);
> }
> EXPORT_SYMBOL_GPL(dev_pm_set_dedicated_wake_irq);
>
> @@ -255,10 +255,39 @@ EXPORT_SYMBOL_GPL(dev_pm_set_dedicated_wake_irq);
> */
> int dev_pm_set_dedicated_wake_irq_reverse(struct device *dev, int irq)
> {
> - return __dev_pm_set_dedicated_wake_irq(dev, irq, WAKE_IRQ_DEDICATED_REVERSE);
> + return __dev_pm_set_dedicated_wake_irq(dev, irq, WAKE_IRQ_DEDICATED_REVERSE,
> + IRQF_NO_AUTOEN);
> }
> EXPORT_SYMBOL_GPL(dev_pm_set_dedicated_wake_irq_reverse);
>
> +/**
> + * dev_pm_set_dedicated_shared_wake_irq - Request a dedicated shared wake-up interrupt
> + * with custom flags
I'd drop the "with custom flags" part from here.
> + * @dev: Device entry
> + * @irq: Device wake-up interrupt
> + * @flags: IRQ flags (e.g., IRQ_TYPE_EDGE_FALLING)
And I'd say "Custom IRQ flags (e.g., IRQ_TYPE_EDGE_FALLING)" here.
> + *
> + * This API sets up a threaded interrupt handler for a device that has
> + * a shared wake-up interrupt in addition to the device IO interrupt. It also
> + * sets IRQ flags like IRQ_TYPE_EDGE_FALLING passed by the caller.
> + *
> + * Returns 0 on success or a negative error code on failure.
> + */
> +int dev_pm_set_dedicated_shared_wake_irq(struct device *dev, int irq, unsigned long flags)
> +{
> + struct wake_irq *wirq;
> + int ret;
> +
> + ret = __dev_pm_set_dedicated_wake_irq(dev, irq, 0, IRQF_SHARED | flags);
> + if (!ret) {
> + wirq = dev->power.wakeirq;
> + disable_irq_nosync(wirq->irq);
> + }
> +
> + return ret;
> +}
> +EXPORT_SYMBOL_GPL(dev_pm_set_dedicated_shared_wake_irq);
> +
> /**
> * dev_pm_enable_wake_irq_check - Checks and enables wake-up interrupt
> * @dev: Device
> diff --git a/include/linux/pm_wakeirq.h b/include/linux/pm_wakeirq.h
> index 25b63ed51b765c2c6919f259668a12675330835e..61f1e840745b56baa57db37563e450cb2d757a85 100644
> --- a/include/linux/pm_wakeirq.h
> +++ b/include/linux/pm_wakeirq.h
> @@ -11,6 +11,7 @@ extern int dev_pm_set_dedicated_wake_irq(struct device *dev, int irq);
> extern int dev_pm_set_dedicated_wake_irq_reverse(struct device *dev, int irq);
> extern void dev_pm_clear_wake_irq(struct device *dev);
> extern int devm_pm_set_wake_irq(struct device *dev, int irq);
> +extern int dev_pm_set_dedicated_shared_wake_irq(struct device *dev, int irq, unsigned long flags);
>
> #else /* !CONFIG_PM */
>
> @@ -38,5 +39,10 @@ static inline int devm_pm_set_wake_irq(struct device *dev, int irq)
> return 0;
> }
>
> +static inline int dev_pm_set_dedicated_shared_wake_irq(struct device *dev,
> + int irq, unsigned long flags)
> +{
> + return 0;
> +}
> #endif /* CONFIG_PM */
> #endif /* _LINUX_PM_WAKEIRQ_H */
>
> --
Powered by blists - more mailing lists