[1/1,SRU,B] UBUNTU: SAUCE: PCI: Avoid ASMedia XHCI USB PME# from D0 defect
diff mbox series

Message ID 20200110031825.14925-3-acelan.kao@canonical.com
State New
Headers show
Series
  • USB key cannot be detected by hotplug on Sunix USB Type-A 3.1 Gen 2 card [1b21:2142]
Related show

Commit Message

AceLan Kao Jan. 10, 2020, 3:18 a.m. UTC
From: Kai-Heng Feng <kai.heng.feng@canonical.com>

BugLink: https://bugs.launchpad.net/bugs/1858988

The ASMedia USB XHCI Controller claims to support generating PME# while
in D0:

01:00.0 USB controller: ASMedia Technology Inc. Device 2142 (prog-if 30 [XHCI])
        Subsystem: SUNIX Co., Ltd. Device 312b
        Capabilities: [78] Power Management version 3
                Flags: PMEClk- DSI- D1- D2- AuxCurrent=55mA PME(D0+,D1-,D2-,D3hot-,D3cold-)
                Status: D0 NoSoftRst+ PME-Enable+ DSel=0 DScale=0 PME-

However PME# only gets asserted when plugging USB 2.0 or USB 1.1
devices, but not for USB 3.0 devices.

So remove PCI_PM_CAP_PME_D0 to avoid using PME under D0.

(backported from https://lkml.org/lkml/2019/12/19/1249)

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=205919
Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
---
 drivers/pci/quirks.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

Patch
diff mbox series

diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index 0ef7711d3394..6131aedf6487 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -4951,3 +4951,14 @@  DECLARE_PCI_FIXUP_CLASS_HEADER(PCI_VENDOR_ID_NVIDIA, PCI_ANY_ID,
 			       PCI_BASE_CLASS_DISPLAY, 16, quirk_nvidia_hda);
 DECLARE_PCI_FIXUP_CLASS_RESUME_EARLY(PCI_VENDOR_ID_NVIDIA, PCI_ANY_ID,
 			       PCI_BASE_CLASS_DISPLAY, 16, quirk_nvidia_hda);
+
+/*
+ * Device [1b21:2142]
+ * When in D0, PME# doesn't get asserted when plugging USB 3.0 device.
+ */
+static void pci_fixup_no_d0_pme(struct pci_dev *dev)
+{
+	pci_info(dev, "PME# does not work under D0, disabling it\n");
+	dev->pme_support &= ~(PCI_PM_CAP_PME_D0 >> PCI_PM_CAP_PME_SHIFT);
+}
+DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ASMEDIA, 0x2142, pci_fixup_no_d0_pme);