All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Chunfeng Yun (云春峰)" <Chunfeng.Yun@mediatek.com>
To: "mika.westerberg@linux.intel.com" <mika.westerberg@linux.intel.com>
Cc: "konrad.dybcio@oss.qualcomm.com" <konrad.dybcio@oss.qualcomm.com>,
	"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
	"westeri@kernel.org" <westeri@kernel.org>,
	"gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>,
	AngeloGioacchino Del Regno
	<angelogioacchino.delregno@collabora.com>,
	"YehezkelShB@gmail.com" <YehezkelShB@gmail.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"sven@kernel.org" <sven@kernel.org>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	"andreas.noever@gmail.com" <andreas.noever@gmail.com>,
	"matthias.bgg@gmail.com" <matthias.bgg@gmail.com>,
	"linux-mediatek@lists.infradead.org"
	<linux-mediatek@lists.infradead.org>
Subject: Re: [PATCH v3 5/8] thunderbolt: Add platform NHI driver
Date: Tue, 1 Dec 2026 08:53:51 +0000	[thread overview]
Message-ID: <179ff0bf02ae2f815ac48896bcb605ad16cfd88a.camel@mediatek.com> (raw)
In-Reply-To: <20261124155551.GQ229695@black.igk.intel.com>

hi,
On 二, 2026-11-24 at 16:55 +0100, Mika Westerberg wrote:
> 
> >  thunderbolt-${CONFIG_ACPI} += acpi.o
> >  thunderbolt-$(CONFIG_DEBUG_FS) += debugfs.o
> >  thunderbolt-$(CONFIG_USB4_CONFIGFS) += configfs.o
> > diff --git a/drivers/thunderbolt/nhi.c b/drivers/thunderbolt/nhi.c
> > index f687b37aac91..e083493c50e0 100644
> > --- a/drivers/thunderbolt/nhi.c
> > +++ b/drivers/thunderbolt/nhi.c
> > @@ -1107,6 +1107,14 @@ static int nhi_suspend(struct device *dev)
> >  {
> >  	struct tb *tb = dev_get_drvdata(dev);
> >  
> > +	/*
> > +	 * Unlike the PCI bus, the platform bus does not
> > automatically
> > +	 * runtime-resume the device before invoking system
> > suspend callbacks.
> > +	 * Ensure the device is runtime-active before suspending
> > the domain.
> > +	 */
> > +	if (pm_runtime_suspended(dev))
> > +		pm_runtime_resume(dev);
> 
> PCI does not do that either if the drivers allow that and I don't
> think we
> should do it here. There is no reason to wake it up here. The domain
> sleep
> is same for both cases anyway.

  The deciding factor is the attached PM domain.

  • Device Tree platform device: The platform bus and a typical genpd
power domain do not guarantee a runtime resume before the driver’s
system suspend callback. If the NHI callback needs the controller
active, it should resume it and check for failure.

  • ACPI platform device: When the general ACPI PM domain is attached,
its suspend callback calls pm_runtime_resume() before the driver
callback, much like PCI does.

Due to only test on platform based on ACPI, I will drop it. may add it
back if need it when use DTS.

> 
> > +
> >  	return tb_domain_suspend(tb);
> >  }
> >  
> > 
> > +
> > +static const struct tb_nhi_ops nhi_platform_default_ops = {
> > +	.init = nhi_platform_init,
> > +	.shutdown = nhi_platform_exit,
> 
> nhi_platform_shutdown? Okay you use it below already but we should
> really
> look at what goes into these "ops" structs so that they actually make
> sense. It is not just a garbage bin where we can throw all random
> callbacks. I feel we are already crossing that line :-(
> 
 I will try to simplify struct tb_nhi_ops by handling the interrupt
setup and teardown directly in the PCI/platform glue layers
(prior to calling tb_nhi_probe() and during remove/shutdown), instead
of routing them through .init_interrupts and .shutdown callbacks.

That way, we can drop .init_interrupts, keep .shutdown strictly for
hardware-specific quirks (like icl_nhi_ops), and the platform driver
won't need its own tb_nhi_ops at all. 

Thanks

> > +	.init_interrupts = nhi_platform_init_irq,
> > +};
> > +
> > 
> 
> 
> > -- 
> > 2.45.2
> 


  parent reply	other threads:[~2026-12-01  8:54 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-23 11:36 [PATCH 0/8] thunderbolt: Add support platform NHI driver Chunfeng Yun
2026-11-23 11:36 ` [PATCH v3 1/8] thunderbolt: Prefix NHI core functions with tb_ and tb_ring_ Chunfeng Yun
2026-11-23 11:54   ` sashiko-bot
2026-11-24 16:11   ` Mika Westerberg
2026-11-25  6:43     ` Chunfeng Yun (云春峰)
2026-11-25  7:13       ` mika.westerberg
2026-11-25 12:03         ` mika.westerberg
2026-11-26  7:58           ` Chunfeng Yun (云春峰)
2026-11-23 11:36 ` [PATCH v3 2/8] thunderbolt: Move ICM mailbox functions to icm.c and internalize interrupt work Chunfeng Yun
2026-11-23 11:36 ` [PATCH v3 3/8] thunderbolt: Make PCIe NHI support opt-in Chunfeng Yun
2026-11-24 16:06   ` Mika Westerberg
2026-11-25  6:53     ` Chunfeng Yun (云春峰)
2026-11-23 11:36 ` [PATCH v3 4/8] thunderbolt: Fix error handling and unwind paths in tb_nhi_probe() Chunfeng Yun
2026-11-23 11:36 ` [PATCH v3 5/8] thunderbolt: Add platform NHI driver Chunfeng Yun
2026-11-23 11:54   ` sashiko-bot
2026-11-24  6:37     ` Chunfeng Yun (云春峰)
2026-11-24  7:15       ` Mika Westerberg
2026-11-25  6:44         ` Chunfeng Yun (云春峰)
2026-11-24 15:55   ` Mika Westerberg
2026-11-25  8:47     ` Chunfeng Yun (云春峰)
2026-12-01  8:53     ` Chunfeng Yun (云春峰) [this message]
2026-11-23 11:36 ` [PATCH v3 6/8] thunderbolt: Increase the lane adapter link-up timeout value Chunfeng Yun
2026-11-23 11:36 ` [PATCH v3 7/8] thunderbolt: Decouple the waiting time of TB_PORT_UNPLUGGED and TB_PORT_UP Chunfeng Yun
2026-11-24 16:00   ` Mika Westerberg
2026-11-26  8:48     ` Chunfeng Yun (云春峰)
2026-11-26  9:21       ` mika.westerberg
2026-11-23 11:36 ` [PATCH v3 8/8] thunderbolt: Drop WARN_ON() in tb_disconnect_pci() Chunfeng Yun
2026-11-23 11:42   ` sashiko-bot
2026-11-24  6:32     ` Chunfeng Yun (云春峰)

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=179ff0bf02ae2f815ac48896bcb605ad16cfd88a.camel@mediatek.com \
    --to=chunfeng.yun@mediatek.com \
    --cc=YehezkelShB@gmail.com \
    --cc=andreas.noever@gmail.com \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=konrad.dybcio@oss.qualcomm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=matthias.bgg@gmail.com \
    --cc=mika.westerberg@linux.intel.com \
    --cc=sven@kernel.org \
    --cc=westeri@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.