Re: [PATCH 2/4] thunderbolt: add support optional dedicated wakeup irq
From: Chunfeng Yun (云春峰)
Date: Tue Nov 03 2026 - 04:09:43 EST
On Fri, 2026-10-30 at 09:48 +0100, Mika Westerberg wrote:
> On Fri, Oct 30, 2026 at 04:25:37PM +0800, Chunfeng Yun wrote:
> > There is a dedicated wakeup irq on nvidia n1/n2 SoCs.
>
> Okay but why it is needed?
due to mac/phy is in power domain which its power/clock will be turn
off when enter into sleep mode, so can not use the mac's irq to trigger
wakeup signal, instead add a dedicated irq to send wake signal which
stay in always-on power domain.
> Can you add this to the commit message?
OK, will add more info
>
> And why you did not add it already in the first commit that added the
> platform driver there anyway?
OK.
because I test base funtion first, then support suspend/resume
Thank you
>
> >
> > Signed-off-by: Chunfeng Yun <chunfeng.yun@xxxxxxxxxxxx>
> > ---
> > drivers/thunderbolt/plat.c | 16 ++++++++++++++++
> > include/linux/thunderbolt.h | 1 +
> > 2 files changed, 17 insertions(+)
> >
> > diff --git a/drivers/thunderbolt/plat.c
> > b/drivers/thunderbolt/plat.c
> > index 85a00cd391d4..8d83b484d942 100644
> > --- a/drivers/thunderbolt/plat.c
> > +++ b/drivers/thunderbolt/plat.c
> > @@ -11,6 +11,7 @@
> > #include <linux/of.h>
> > #include <linux/platform_device.h>
> > #include <linux/pm_runtime.h>
> > +#include <linux/pm_wakeirq.h>
> > #include <linux/slab.h>
> >
> > #include "nhi.h"
> > @@ -46,6 +47,15 @@ static int nhi_plat_init_irq(struct tb_nhi *nhi)
> > if (ret)
> > return dev_err_probe(nhi->dev, ret, "request irq
> > failed\n");
> >
> > + if (nhi->wake_irq) {
> > + ret = dev_pm_set_dedicated_wake_irq(nhi->dev, nhi-
> > >wake_irq);
> > + if (ret) {
> > + dev_err_probe(nhi->dev, ret, "set wake irq
> > %d failed\n", nhi->wake_irq);
> > + return ret;
> > + }
> > + dev_info(nhi->dev, "wake irq %d\n", nhi-
> > >wake_irq);
> > + }
> > +
> > return 0;
> > }
> >
> > @@ -53,6 +63,7 @@ static void nhi_plat_exit(struct tb_nhi *nhi)
> > {
> > devm_free_irq(nhi->dev, nhi->irq, nhi);
> > flush_work(&nhi->interrupt_work);
> > + dev_pm_clear_wake_irq(nhi->dev);
> >
> > pm_runtime_put_noidle(nhi->dev);
> > pm_runtime_disable(nhi->dev);
> > @@ -85,6 +96,11 @@ static int nhi_plat_probe(struct platform_device
> > *pdev)
> > if (nhi->irq < 0)
> > return dev_err_probe(dev, nhi->irq, "get irq
> > failed\n");
> >
> > + /* ignore error */
> > + nhi->wake_irq = platform_get_irq_optional(pdev, 1);
> > + if (nhi->wake_irq < 0)
> > + nhi->wake_irq = 0;
> > +
> > return nhi_probe(nhi);
> > }
> >
> > diff --git a/include/linux/thunderbolt.h
> > b/include/linux/thunderbolt.h
> > index 212c8fea6571..06b90d452ee2 100644
> > --- a/include/linux/thunderbolt.h
> > +++ b/include/linux/thunderbolt.h
> > @@ -533,6 +533,7 @@ struct tb_nhi {
> > bool going_away;
> > bool iommu_dma_protection;
> > int irq;
> > + int wake_irq;
> > struct work_struct interrupt_work;
> > u32 hop_count;
> > unsigned long quirks;
> > --
> > 2.43.0