Skip to content

Commit 2a821fc

Browse files
superm1gregkh
authored andcommitted
xhci-pci: Only run d3cold avoidance quirk for s2idle
Donghun reports that a notebook that has an AMD Ryzen 5700U but supports S3 has problems with USB after resuming from suspend. The issue was bisected down to commit d165826 ("usb: pci-quirks: disable D3cold on xhci suspend for s2idle on AMD Renoir"). As this issue only happens on S3, narrow the broken D3cold quirk to only run in s2idle. Fixes: d165826 ("usb: pci-quirks: disable D3cold on xhci suspend for s2idle on AMD Renoir") Reported-and-tested-by: Donghun Yoon <[email protected]> Cc: [email protected] Signed-off-by: Mario Limonciello <[email protected]> Signed-off-by: Mathias Nyman <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent a398d5e commit 2a821fc

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

drivers/usb/host/xhci-pci.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include <linux/module.h>
1414
#include <linux/acpi.h>
1515
#include <linux/reset.h>
16+
#include <linux/suspend.h>
1617

1718
#include "xhci.h"
1819
#include "xhci-trace.h"
@@ -387,7 +388,7 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci)
387388

388389
if (pdev->vendor == PCI_VENDOR_ID_AMD &&
389390
pdev->device == PCI_DEVICE_ID_AMD_RENOIR_XHCI)
390-
xhci->quirks |= XHCI_BROKEN_D3COLD;
391+
xhci->quirks |= XHCI_BROKEN_D3COLD_S2I;
391392

392393
if (pdev->vendor == PCI_VENDOR_ID_INTEL) {
393394
xhci->quirks |= XHCI_LPM_SUPPORT;
@@ -801,9 +802,16 @@ static int xhci_pci_suspend(struct usb_hcd *hcd, bool do_wakeup)
801802
* Systems with the TI redriver that loses port status change events
802803
* need to have the registers polled during D3, so avoid D3cold.
803804
*/
804-
if (xhci->quirks & (XHCI_COMP_MODE_QUIRK | XHCI_BROKEN_D3COLD))
805+
if (xhci->quirks & XHCI_COMP_MODE_QUIRK)
805806
pci_d3cold_disable(pdev);
806807

808+
#ifdef CONFIG_SUSPEND
809+
/* d3cold is broken, but only when s2idle is used */
810+
if (pm_suspend_target_state == PM_SUSPEND_TO_IDLE &&
811+
xhci->quirks & (XHCI_BROKEN_D3COLD_S2I))
812+
pci_d3cold_disable(pdev);
813+
#endif
814+
807815
if (xhci->quirks & XHCI_PME_STUCK_QUIRK)
808816
xhci_pme_quirk(hcd);
809817

drivers/usb/host/xhci.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1901,7 +1901,7 @@ struct xhci_hcd {
19011901
#define XHCI_DISABLE_SPARSE BIT_ULL(38)
19021902
#define XHCI_SG_TRB_CACHE_SIZE_QUIRK BIT_ULL(39)
19031903
#define XHCI_NO_SOFT_RETRY BIT_ULL(40)
1904-
#define XHCI_BROKEN_D3COLD BIT_ULL(41)
1904+
#define XHCI_BROKEN_D3COLD_S2I BIT_ULL(41)
19051905
#define XHCI_EP_CTX_BROKEN_DCS BIT_ULL(42)
19061906
#define XHCI_SUSPEND_RESUME_CLKS BIT_ULL(43)
19071907
#define XHCI_RESET_TO_DEFAULT BIT_ULL(44)

0 commit comments

Comments
 (0)