From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CD2301F4162; Sat, 6 Sep 2025 14:37:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757169428; cv=none; b=NtIkMe7+WsH3iqGPeec9NDDtLTkEwz4RV5J7A3HDKlGgZa5sootFStpaLNNiMcT2eBtZHfXbYP2u1gtcEuKMwVnJB3AT+WNiEqB0azuwZlY63O65XiofG5b0tuKX6UO9yRVVI8vI2omzt46QKIpWo3eUjFctn89sD8qnN6Vf+7o= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757169428; c=relaxed/simple; bh=pplrqkFQTtLalZ35q5dvN936yxvSvl8ERQoDKPqGGxk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Y+bOp56vJOIAqi3V3y1dxUAOeVp4MyupqZwNein9/uiGvFM5mnpA7Qn0bifj3rqMYA+wOpT2etm5t/Mij5RcZwJbv8irsX8nV5IoJkdh87Gy9tbvFVLkCGFYSaC577peEAebxn96grU7HEMTi3M5Ue0CZ9bOIZbWk+qlBvpqb1s= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=XAOKq3V6; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="XAOKq3V6" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 66BC4C4CEFA; Sat, 6 Sep 2025 14:37:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1757169428; bh=pplrqkFQTtLalZ35q5dvN936yxvSvl8ERQoDKPqGGxk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XAOKq3V6oJArWb34lphOJZvL9RfS2hgdcttOxlUWc9/OWuRuoRn42zdrMnjE6IzlD lMRCACr0bYc5F+SrwvXNsUUFeU72skk3s9UZB8pt8sMAP+BqomCEtPMv6l0zDIsaTL ZVhFUZHuy2gj2FxTOawg4TzxOpyfnWcAIXDFK6ny+11jvf+CIY4PDkcXb0Pw+kR5oo RzltxLWOiy8kPwasCDsgRBe7Q37hGRFmVW+TuArjy0WGvrkyfbKtob1indEmoFaaSM qOUZwHks9hhDmUsGQ+NG/zprvxcaYZtBCfJGLK5bV0bQdiTTiuSpbmbbtMGSusKjyK QVmJKzQ7eZ1JA== From: "Mario Limonciello (AMD)" To: "Rafael J . Wysocki" , Greg Kroah-Hartman , Danilo Krummrich , Bjorn Helgaas Cc: Pavel Machek , Len Brown , =?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 RESEND 04/11] USB: Pass PMSG_POWEROFF event to suspend_common() for poweroff with S4 flow Date: Sat, 6 Sep 2025 09:36:35 -0500 Message-ID: <20250906143642.2590808-5-superm1@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250906143642.2590808-1-superm1@kernel.org> References: <20250906143642.2590808-1-superm1@kernel.org> Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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) --- 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