Received: by 2002:a05:7412:9c07:b0:fa:6e18:a558 with SMTP id lr7csp776545rdb; Sun, 28 Jan 2024 08:26:11 -0800 (PST) X-Google-Smtp-Source: AGHT+IFm3iQmPTjXBwHvUeiOYBv3ArTLuDs+CRrfmZjTqur0BXkO2EgLTqzfTQGHiUhXHQ+4gfro X-Received: by 2002:a17:906:5959:b0:a35:756b:529f with SMTP id g25-20020a170906595900b00a35756b529fmr1412290ejr.27.1706459171700; Sun, 28 Jan 2024 08:26:11 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706459171; cv=pass; d=google.com; s=arc-20160816; b=MnHRyeBV+mc1mdNoRCWN3AoAFYRyooNVGYSV1iVvipwDF5BPLlAO5bBn73vJfuZc1I JLVuyyWuNRb58Wo128u1ybLTdZrpNfMCQupcMRWChqa3T6c3EeqMa33f+G4QIOH45Od7 XviCmzlShRL4QHr1VJDg8U4hHTwj87Wq0oiUEIwizC1dEoOTGYW5mLMnw6RRjYBxAUBk MId/np3E/79ChUt6IcoU2I+dfYb6M53DRdLtfeEOZ6EAx0WLmftem8CLOC7HWwuaps0h pD6W6RM6Hnb/AB0UCyqPFy1kLuOrBHGWouTECx2JGfu8BDCMRDTg3B7dSQv8xkq5wvnu 9RoQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=i0Wol1ArHuDyWgD2zLYIv7HXuVEIqgnqRq36eq9ssnk=; fh=jreXZwK9VW6IdMHQxVde+khc1SB9OabQ7r4B44l2eVA=; b=02m6amK822nP/O6XO6GnsNrZBhjjxZvSceozMWfcVWsQ30qZQYtQqZmltsw2LIO9jF MOuuLJjMcUm61lXi6TsJZPsb1XZvte9ipBMDte4fATPP3UyvBHruBfAOFbFOloTFSsvz SjkW2wRKaTnnydpsqwPp1aZA+jmZeufS6BwEsZYO7Hp/0mooYegyzaeDmB4uOg3rWb9H aaTq/fMFu0ktEzV3KVcGaxianBBrfYJNGUMphAD7jxT/7UH6Gxx3y+AzDnOAbDHc3X9q uHbZuaGjOGSj9c5s+XiZKMxC2ZOAdRcEVyePvBi2I1eIZeLiqCnbTeKndILk4ff3P7UT 7puQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=jzDFgHKp; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-41702-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-41702-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id ef7-20020a17090697c700b00a316e395165si2462890ejb.529.2024.01.28.08.26.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 28 Jan 2024 08:26:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-41702-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=jzDFgHKp; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-41702-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-41702-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id A82811F255A9 for ; Sun, 28 Jan 2024 16:17:13 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BFE2B52F6F; Sun, 28 Jan 2024 16:12:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="jzDFgHKp" 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 DFDE2524CC; Sun, 28 Jan 2024 16:12:06 +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=1706458327; cv=none; b=m5qKnB4VeAde83Zk+g5VFuQ09MvDHvMYSBU2VTU5k1fPtn1SzXYckwgbA93yffzB2zuE1pl1WAXy0IMdTDCVLPreBVxpSUb9KoRERxWVRiOv7Nmy0o5ifJms+5LShOuA0HAiQYo3f1VrNE+6ao2ZyZZq+UEjgNJrQgCbB9xn8rs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706458327; c=relaxed/simple; bh=ix8XBCGUm23P7dIAwb+lQE/fHDfnA07Y2g69GvMJYpU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=mo2CzbuMlH8DolGafKijQRcMl0XIf83aVVFsOCvfiHgmir6O9zvVsTpdDJ1YB9XbGpBB4JNmafOx3eSUH0esMGa5JbwmLwEasZAd7zpj5wImnwMJBa5ZGNdwSdbRpwXHOw/aN7g3DPzSaZd1HLKUBNQCwtiwdLcZOp7bz35K/FU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=jzDFgHKp; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id B2541C433B2; Sun, 28 Jan 2024 16:12:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1706458326; bh=ix8XBCGUm23P7dIAwb+lQE/fHDfnA07Y2g69GvMJYpU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jzDFgHKpoBhdxNKBHijKbQPj/rtRnky77mXtQGkBiWkS/rG/vdff2FlXmdhHiTBZm 13k1PPCdjW8x69XQThZ7RBmigLeo8w6Fx2IrlnVe2AorM9B8JT+6v6IKAYBZEX31N0 ayPPw9JUHMJA9YTttu80FEuUhNvVkFqiGzm3gvnprmkiOdK8fF3zYVi0iFAogA0B0g Wti4IAZiNk6OIoiam1OEVIagSDMP/tbFKCNi0fJHDPjbHQ/f2fSyJ7QiDN0YOua73F ZImn9+VRi7x3rNTd7Bkx9RoBBM4BIvkHfp1qR9UrAGT4cBdacE+LKO02IHs+ZyFVqB a+6a52K074yxw== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Yinbo Zhu , Greg Kroah-Hartman , Sasha Levin , mathias.nyman@intel.com, linux-usb@vger.kernel.org Subject: [PATCH AUTOSEL 6.7 20/39] usb: xhci-plat: fix usb disconnect issue after s4 Date: Sun, 28 Jan 2024 11:10:40 -0500 Message-ID: <20240128161130.200783-20-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240128161130.200783-1-sashal@kernel.org> References: <20240128161130.200783-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore X-stable-base: Linux 6.7.2 Content-Transfer-Encoding: 8bit From: Yinbo Zhu [ Upstream commit 6d6887c42e946f43bed2e64571a40c8476a1e4a9 ] The xhci retaining bogus hardware states cause usb disconnect devices connected before hibernation(s4) and refer to the commit 'f3d478858be ("usb: ohci-platform: fix usb disconnect issue after s4")' which set flag "hibernated" as true when resume-from-hibernation and that the drivers will reset the hardware to get rid of any existing state and make sure resume from hibernation re-enumerates everything for xhci. Signed-off-by: Yinbo Zhu Link: https://lore.kernel.org/r/20231228071113.1719-1-zhuyinbo@loongson.cn Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/usb/host/xhci-plat.c | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c index 732cdeb73920..f0853c4478f5 100644 --- a/drivers/usb/host/xhci-plat.c +++ b/drivers/usb/host/xhci-plat.c @@ -433,7 +433,7 @@ void xhci_plat_remove(struct platform_device *dev) } EXPORT_SYMBOL_GPL(xhci_plat_remove); -static int __maybe_unused xhci_plat_suspend(struct device *dev) +static int xhci_plat_suspend(struct device *dev) { struct usb_hcd *hcd = dev_get_drvdata(dev); struct xhci_hcd *xhci = hcd_to_xhci(hcd); @@ -461,7 +461,7 @@ static int __maybe_unused xhci_plat_suspend(struct device *dev) return 0; } -static int __maybe_unused xhci_plat_resume(struct device *dev) +static int xhci_plat_resume_common(struct device *dev, struct pm_message pmsg) { struct usb_hcd *hcd = dev_get_drvdata(dev); struct xhci_hcd *xhci = hcd_to_xhci(hcd); @@ -483,7 +483,7 @@ static int __maybe_unused xhci_plat_resume(struct device *dev) if (ret) goto disable_clks; - ret = xhci_resume(xhci, PMSG_RESUME); + ret = xhci_resume(xhci, pmsg); if (ret) goto disable_clks; @@ -502,6 +502,16 @@ static int __maybe_unused xhci_plat_resume(struct device *dev) return ret; } +static int xhci_plat_resume(struct device *dev) +{ + return xhci_plat_resume_common(dev, PMSG_RESUME); +} + +static int xhci_plat_restore(struct device *dev) +{ + return xhci_plat_resume_common(dev, PMSG_RESTORE); +} + static int __maybe_unused xhci_plat_runtime_suspend(struct device *dev) { struct usb_hcd *hcd = dev_get_drvdata(dev); @@ -524,7 +534,12 @@ static int __maybe_unused xhci_plat_runtime_resume(struct device *dev) } const struct dev_pm_ops xhci_plat_pm_ops = { - SET_SYSTEM_SLEEP_PM_OPS(xhci_plat_suspend, xhci_plat_resume) + .suspend = pm_sleep_ptr(xhci_plat_suspend), + .resume = pm_sleep_ptr(xhci_plat_resume), + .freeze = pm_sleep_ptr(xhci_plat_suspend), + .thaw = pm_sleep_ptr(xhci_plat_resume), + .poweroff = pm_sleep_ptr(xhci_plat_suspend), + .restore = pm_sleep_ptr(xhci_plat_restore), SET_RUNTIME_PM_OPS(xhci_plat_runtime_suspend, xhci_plat_runtime_resume, -- 2.43.0