From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E3252606A32C for ; Tue, 1 Dec 2026 07:41:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=KGZKCG2r; dkim=fail reason="signature verification failed" (2048-bit key) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=VyaXAAAZ DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Unsubscribe-Post:List-Owner; bh=KdBrn3WMl0r3R4UaPlH3diDOsKKzg8GN7zWipgW9CmU=; b=KGZKCG2rhc9VYDRQ4NjNgCaezg KeCGswle3+8jE35m00g19bTDwi/ZnOObBw4D3S2K90RZnH728Ym1Z1aPjmRU/650paCtGj5kyNih5 q5lYz0GO8/3Ywslk39CffezaqsjS6MOzRd5emgoEhKMLeHhv5nLPXCusEUEEVgVmklHEyzS7sKqan xcr/SC472UZj/+uqIfjcj8+lY7mMI76WMT/cxisWhVlveOQoVC4ivhwnlELjNLCsPJNmDvTvB9BVN XlTJnZy8i1sikoRNCB9utYFpTLd2v5ga2vrmx5TZxA2aiA1qGgEvQoeSCz5ETkjCuJt/pUAvJ/VhC R+uQ0KXA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.100.1 #2 (Red Hat Linux)) id 1xYIUl-00000006vmq-1IlP; Tue, 01 Dec 2026 07:41:47 +0000 Received: from mgamail.intel.com ([192.198.163.12]) by bombadil.infradead.org with esmtps (Exim 4.100.1 #2 (Red Hat Linux)) id 1xYIUd-00000006vmV-1mFf for linux-phy@lists.infradead.org; Tue, 01 Dec 2026 07:41:41 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1796110899; x=1827646899; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=BSk31GnYt2eAxMowDfPDv+DcW7N5pMfBENkwr7GQeV8=; b=VyaXAAAZCRO7gTug2RYl0DqQ1+5rcjhbiz1/xmRGY/IW/+Z5gOmDW50V 6PjEx2jLL5bTWr1mnYLZVbi420f+fIIcCE6U2+KcroRZa0GfXE/ALc4Tm dA07C6FWjD0aG4O+8DcDAqYDohdycq1NvEI9Rq0fjtmBXAARHu5rztzFs 4gfK7LiZDqiLb6U9509l9jWXICIqIpYibcDborXzpgIWkxMhtpAqIr3N9 bcAoM+7Z+afnJEgl1LYAmGvMFxD3Vzk7GywSk1syMCAuPIKmSdPdHn43z LgxQhhORK8fcWZ6syhPx/mqmITSZVsUFXdMm+GuBxyuXNe/Rl4oeUcgR7 A==; X-CSE-ConnectionGUID: wczmnDjyS9GPskuBhtsTxg== X-CSE-MsgGUID: E89iXH5WSs6bMtE47EcECQ== X-IronPort-AV: E=McAfee;i="6800,10657,11982"; a="4879154" X-IronPort-AV: E=Sophos;i="6.27,244,1787036400"; d="scan'208";a="4879154" Received: from fmviesa002.fm.intel.com ([10.60.135.142]) by fmvoesa106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Nov 2026 23:41:39 -0800 X-CSE-ConnectionGUID: fkGJDarrS1SOSVm6oCfq0A== X-CSE-MsgGUID: SuCSbL19Qou+LBkMeo/Scg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.27,244,1787036400"; d="scan'208";a="13387101" Received: from black.igk.intel.com ([10.91.253.5]) by fmviesa002.fm.intel.com with ESMTP; 30 Nov 2026 23:41:34 -0800 Received: by black.igk.intel.com (Postfix, from userid 1001) id 9840398; Tue, 01 Dec 2026 08:41:32 +0100 (CET) Date: Tue, 1 Dec 2026 08:41:32 +0100 From: Mika Westerberg To: Konrad Dybcio Cc: Vinod Koul , Neil Armstrong , Manivannan Sadhasivam , Bjorn Andersson , Konrad Dybcio , Abel Vesa , Stephen Boyd , Brian Masney , Jerome Brunet , Andreas Noever , Mika Westerberg , Yehezkel Bernat , Mario Limonciello , Philipp Zabel , Rob Herring , Krzysztof Kozlowski , Conor Dooley , 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 Message-ID: <20261201074132.GS953667@black.igk.intel.com> References: <20261124-topic-next-20261116-fsm-mvp-v1-0-a9b45c69cd38@oss.qualcomm.com> <20261124-topic-next-20261116-fsm-mvp-v1-8-a9b45c69cd38@oss.qualcomm.com> X-Archived-By: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20261124-topic-next-20261116-fsm-mvp-v1-8-a9b45c69cd38@oss.qualcomm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20261130_234140_684034_1600F51F X-CRM114-Status: GOOD ( 21.27 ) X-Spam-Score: -4.2 (----) X-BeenThere: linux-phy@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux Phy Mailing list List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-phy" X-Spam-Status: No, score=-13.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 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 > --- > 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 -- linux-phy mailing list linux-phy@lists.infradead.org https://lists.infradead.org/mailman/listinfo/linux-phy