mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mika Westerberg <mika.westerberg@linux.intel.com>
To: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Cc: Vinod Koul <vkoul@kernel.org>,
	Neil Armstrong <neil.armstrong@linaro.org>,
	Manivannan Sadhasivam <mani@kernel.org>,
	Bjorn Andersson <andersson@kernel.org>,
	Konrad Dybcio <konradybcio@kernel.org>,
	Abel Vesa <abelvesa@kernel.org>, Stephen Boyd <sboyd@kernel.org>,
	Brian Masney <bmasney+clk@redhat.com>,
	Jerome Brunet <jbrunet+clk@baylibre.com>,
	Andreas Noever <andreas.noever@gmail.com>,
	Mika Westerberg <westeri@kernel.org>,
	Yehezkel Bernat <YehezkelShB@gmail.com>,
	Mario Limonciello <mario.limonciello@amd.com>,
	Philipp Zabel <p.zabel@pengutronix.de>,
	Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	linux-arm-msm@vger.kernel.org, linux-phy@lists.infradead.org,
	linux-clk@vger.kernel.org, linux-usb@vger.kernel.org,
	linux-kernel@vger.kernel.org, devicetree@vger.kernel.org,
	usb4-upstream@oss.qualcomm.com
Subject: Re: [PATCH RFC DNM 08/15] thunderbolt: nhi: Add pre_switch_suspend hook
Date: Tue, 1 Dec 2026 08:41:32 +0100	[thread overview]
Message-ID: <20261201074132.GS953667@black.igk.intel.com> (raw)
In-Reply-To: <20261124-topic-next-20261116-fsm-mvp-v1-8-a9b45c69cd38@oss.qualcomm.com>

On Tue, Nov 24, 2026 at 09:01:37PM +0100, Konrad Dybcio wrote:
> The Qualcomm router firmware requires a three-way handshake during its
> suspend routines as the OS writes the SLP bit to a connected device.
> 
> Add a hook right beforehand to allow synchronizing right as it happens.
> 
> Signed-off-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
> ---
>  drivers/thunderbolt/nhi.h    | 2 ++
>  drivers/thunderbolt/switch.c | 4 ++++
>  2 files changed, 6 insertions(+)
> 
> diff --git a/drivers/thunderbolt/nhi.h b/drivers/thunderbolt/nhi.h
> index 71f750451aacae6ca2f8cb37bd8ae7fc5a029818..9bafb84cf60adbdee1f1f083732719e951b88c20 100644
> --- a/drivers/thunderbolt/nhi.h
> +++ b/drivers/thunderbolt/nhi.h
> @@ -53,6 +53,7 @@ extern const struct dev_pm_ops nhi_pm_ops;
>   * @release_ring_irq: NHI specific interrupt release hook
>   * @is_present: Whether the device is currently present on the parent bus
>   * @init_interrupts: NHI specific interrupt initialization hook
> + * @post_switch_suspend: NHI specific hook to call before suspending a switch

pre?

Also the tb_nhi_ops starts to look like a collection of random hooks. I
would really like there to be some logic in it rather that let's put there
everything.

>   */
>  struct tb_nhi_ops {
>  	int (*init)(struct tb_nhi *nhi);
> @@ -68,6 +69,7 @@ struct tb_nhi_ops {
>  	void (*release_ring_irq)(struct tb_ring *ring);
>  	bool (*is_present)(struct tb_nhi *nhi);
>  	int (*init_interrupts)(struct tb_nhi *nhi);
> +	void (*pre_switch_suspend)(struct tb_nhi *nhi);
>  };
>  
>  /*
> diff --git a/drivers/thunderbolt/switch.c b/drivers/thunderbolt/switch.c
> index d22d8db8f89064b3ed9c2b8beb8d5f0398640f11..4908c8b0e580a500acf9cac000e66a25e2102d47 100644
> --- a/drivers/thunderbolt/switch.c
> +++ b/drivers/thunderbolt/switch.c
> @@ -3660,6 +3660,7 @@ int tb_switch_resume(struct tb_switch *sw, bool runtime)
>   */
>  void tb_switch_suspend(struct tb_switch *sw, bool runtime)
>  {
> +	struct tb_nhi *nhi = sw->tb->nhi;

USB4 side should not call into the NHI like this.

>  	unsigned int flags = 0;
>  	struct tb_port *port;
>  	int err;
> @@ -3693,6 +3694,9 @@ void tb_switch_suspend(struct tb_switch *sw, bool runtime)
>  
>  	tb_switch_set_wake(sw, flags, runtime);
>  
> +	if (nhi->ops->pre_switch_suspend)
> +		nhi->ops->pre_switch_suspend(nhi);
> +
>  	if (tb_switch_is_usb4(sw))
>  		usb4_switch_set_sleep(sw);
>  	else
> 
> -- 
> 2.55.0

  reply	other threads:[~2026-12-01  7:41 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-24 20:01 [RFC DNM PATCH 00/15] Qualcomm USB4 host router Konrad Dybcio
2026-11-24 20:01 ` [PATCH RFC DNM 01/15] phy: qualcomm: qmp-combo: Add Glymur USB4v1 PHY sequences Konrad Dybcio
2026-11-24 20:01 ` [PATCH RFC DNM 02/15] phy: qualcomm: qmp-combo: Add USB4 power_on/off to de/assert USB4 clamps Konrad Dybcio
2026-11-24 20:01 ` [PATCH RFC DNM 03/15] soc: qcom: smem: Add and export qcom_smem_get_serial_no() Konrad Dybcio
2026-11-24 20:01 ` [PATCH RFC DNM 04/15] soc: qcom: pmic_glink_altmode: Enable TBT/USB4 negotiation Konrad Dybcio
2026-11-24 20:01 ` [PATCH RFC DNM 05/15] clk: qcom: gcc-glymur: Don't poll the status bit of some USB4 clocks Konrad Dybcio
2026-11-24 20:01 ` [PATCH RFC DNM 06/15] thunderbolt: nhi: Clear ring interrupts when not using MSI-X Konrad Dybcio
2026-12-01  7:16   ` Mika Westerberg
2026-11-24 20:01 ` [PATCH RFC DNM 07/15] thunderbolt: nhi: Process ring completions in the threaded IRQ Konrad Dybcio
2026-12-01  7:33   ` Mika Westerberg
2026-11-24 20:01 ` [PATCH RFC DNM 08/15] thunderbolt: nhi: Add pre_switch_suspend hook Konrad Dybcio
2026-12-01  7:41   ` Mika Westerberg [this message]
2026-11-24 20:01 ` [PATCH RFC DNM 09/15] thunderbolt: nhi: Resume the domain if the NHI suspend op fails Konrad Dybcio
2026-12-01  7:44   ` Mika Westerberg
2026-11-24 20:01 ` [PATCH RFC DNM 10/15] thunderbolt: nhi: Resume a runtime suspended NHI for system suspend Konrad Dybcio
2026-12-01  7:49   ` Mika Westerberg
2026-11-24 20:01 ` [PATCH RFC DNM 11/15] thunderbolt: Raise TB_TIMEOUT to 500 ms Konrad Dybcio
2026-11-24 20:01 ` [PATCH HACK RFC DNM 12/15] thunderbolt: Refuse to activate DP/USB3/PCIe tunnels Konrad Dybcio
2026-11-24 20:01 ` [PATCH RFC DNM 13/15] thunderbolt: Introduce Qualcomm USB4 router driver Konrad Dybcio
2026-11-28 13:54   ` Troels Vognbjerg
2026-12-01  8:36   ` Mika Westerberg
2026-11-24 20:01 ` [PATCH RFC DNM 14/15] arm64: dts: qcom: glymur: Add USB4 topology Konrad Dybcio
2026-11-24 20:01 ` [PATCH RFC DNM 15/15] arm64: dts: qcom: glymur-crd: Enable the tertiary Type-C Konrad Dybcio

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=20261201074132.GS953667@black.igk.intel.com \
    --to=mika.westerberg@linux.intel.com \
    --cc=YehezkelShB@gmail.com \
    --cc=abelvesa@kernel.org \
    --cc=andersson@kernel.org \
    --cc=andreas.noever@gmail.com \
    --cc=bmasney+clk@redhat.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=jbrunet+clk@baylibre.com \
    --cc=konrad.dybcio@oss.qualcomm.com \
    --cc=konradybcio@kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-phy@lists.infradead.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=mani@kernel.org \
    --cc=mario.limonciello@amd.com \
    --cc=neil.armstrong@linaro.org \
    --cc=p.zabel@pengutronix.de \
    --cc=robh@kernel.org \
    --cc=sboyd@kernel.org \
    --cc=usb4-upstream@oss.qualcomm.com \
    --cc=vkoul@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®