[PATCH 2/4] thunderbolt: add support optional dedicated wakeup irq

Mika Westerberg mika.westerberg at linux.intel.com
Fri Oct 30 01:48:54 PDT 2026


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? Can you add this to the commit message?

And why you did not add it already in the first commit that added the
platform driver there anyway?

> 
> Signed-off-by: Chunfeng Yun <chunfeng.yun at mediatek.com>
> ---
>  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



More information about the Linux-mediatek mailing list