From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 68B97CA0EE9 for ; Mon, 18 Aug 2025 02:01:23 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 01B2610E327; Mon, 18 Aug 2025 02:01:23 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.b="TjtZEGJa"; dkim-atps=neutral Received: from tor.source.kernel.org (tor.source.kernel.org [172.105.4.254]) by gabe.freedesktop.org (Postfix) with ESMTPS id 7002410E325; Mon, 18 Aug 2025 02:01:21 +0000 (UTC) Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by tor.source.kernel.org (Postfix) with ESMTP id E3AEB6000A; Mon, 18 Aug 2025 02:01:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C42FDC16AAE; Mon, 18 Aug 2025 02:01:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1755482480; bh=EKBZFU3AE4FMHSQLwCN6JL9rKAChLt1JY5sv1iHKm6w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TjtZEGJau5mIajsRb/B7g3oBqa5NIBZ2VgA4bM3FSkjrSC+MrWBJqBF9F/Yr5EEhl hRt1kJt3uXV7bmgnOFtBXCNfYmxOyraqkXZWZ6GwtUsxDoLwbxw7jSexvLO5dXqKZ6 2FX60Zzxk8sfYwNTqUzbq0RwsPrRJPWmHvqTGDMzh4qZEGZKA/KOvUmSrp6tgZKnNZ CLd+LMaqSegpr5cWI8UzRFxUB1gS8jk0iNq52G77Go5Be+cjWa7OdlLtWVHPbloc4u zFTl+EVh+37Gl5Sp875DbfHH4aM/cP3S1kZXAt/HyMu/do03ahrHqP01+USKmC+IVB xgywrgPq27+3g== From: "Mario Limonciello (AMD)" To: "Rafael J . Wysocki" , Bjorn Helgaas Cc: Pavel Machek , Len Brown , Greg Kroah-Hartman , Danilo Krummrich , =?UTF-8?q?Christian=20K=C3=B6nig?= , "James E . J . Bottomley" , "Martin K . Petersen" , Steven Rostedt , linux-pm@vger.kernel.org (open list:HIBERNATION (aka Software Suspend, aka swsusp)), amd-gfx@lists.freedesktop.org (open list:RADEON and AMDGPU DRM DRIVERS), dri-devel@lists.freedesktop.org (open list:DRM DRIVERS), linux-pci@vger.kernel.org (open list:PCI SUBSYSTEM), linux-scsi@vger.kernel.org (open list:SCSI SUBSYSTEM), linux-usb@vger.kernel.org (open list:USB SUBSYSTEM), linux-trace-kernel@vger.kernel.org (open list:TRACING), AceLan Kao , Kai-Heng Feng , Mark Pearson , =?UTF-8?q?Merthan=20Karaka=C5=9F?= , Eric Naim , "Mario Limonciello (AMD)" Subject: [PATCH v6 04/11] USB: Pass PMSG_POWEROFF event to suspend_common() for poweroff with S4 flow Date: Sun, 17 Aug 2025 21:00:54 -0500 Message-ID: <20250818020101.3619237-5-superm1@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250818020101.3619237-1-superm1@kernel.org> References: <20250818020101.3619237-1-superm1@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: amd-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion list for AMD gfx List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: amd-gfx-bounces@lists.freedesktop.org Sender: "amd-gfx" If powering off the system with the S4 flow USB wakeup sources should be ignored. Add a new callback hcd_pci_poweroff() which will differentiate whether target state is S5 and pass PMSG_POWEROFF as the message so that suspend_common() will avoid doing wakeups. Signed-off-by: Mario Limonciello (AMD) --- v6: * Fix LKP robot issue without CONFIG_PM_SLEEP v5: * New patch v4: * https://lore.kernel.org/linux-pci/20250616175019.3471583-1-superm1@kernel.org/ Fix lkp robot issue --- drivers/usb/core/hcd-pci.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/usb/core/hcd-pci.c b/drivers/usb/core/hcd-pci.c index cd223475917ef..921d1d0940016 100644 --- a/drivers/usb/core/hcd-pci.c +++ b/drivers/usb/core/hcd-pci.c @@ -6,6 +6,7 @@ #include #include #include +#include #include #include @@ -531,6 +532,13 @@ static int hcd_pci_freeze(struct device *dev) return suspend_common(dev, PMSG_FREEZE); } +static int hcd_pci_poweroff(struct device *dev) +{ + if (system_state == SYSTEM_HALT || system_state == SYSTEM_POWER_OFF) + return suspend_common(dev, PMSG_POWEROFF); + return suspend_common(dev, PMSG_SUSPEND); +} + static int hcd_pci_suspend_noirq(struct device *dev) { struct pci_dev *pci_dev = to_pci_dev(dev); @@ -602,6 +610,7 @@ static int hcd_pci_restore(struct device *dev) #define hcd_pci_suspend NULL #define hcd_pci_freeze NULL #define hcd_pci_suspend_noirq NULL +#define hcd_pci_poweroff NULL #define hcd_pci_poweroff_late NULL #define hcd_pci_resume_noirq NULL #define hcd_pci_resume NULL @@ -639,7 +648,7 @@ const struct dev_pm_ops usb_hcd_pci_pm_ops = { .freeze_noirq = check_root_hub_suspended, .thaw_noirq = NULL, .thaw = hcd_pci_resume, - .poweroff = hcd_pci_suspend, + .poweroff = hcd_pci_poweroff, .poweroff_late = hcd_pci_poweroff_late, .poweroff_noirq = hcd_pci_suspend_noirq, .restore_noirq = hcd_pci_resume_noirq, -- 2.43.0