On Macbook 2013 resuming from s2idle results in external monitor no longer being detected, and dmesg having errors like: pcieport 0000:06:00.0: can't change power state from D3hot to D0 (config space inaccessible) and a stacktrace. The reason turned out that the hw that the quirk powers off does not get powered on back on resume. Thus, add a check for s2idle to the quirk, and do nothing if the suspend mode is s2idle. Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=212767 Signed-off-by: Konstantin Kharlamov <Hi-Angel@xxxxxxxxx> --- drivers/pci/quirks.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c index 653660e3ba9e..86fedcec37e2 100644 --- a/drivers/pci/quirks.c +++ b/drivers/pci/quirks.c @@ -27,6 +27,7 @@ #include <linux/nvme.h> #include <linux/platform_data/x86/apple.h> #include <linux/pm_runtime.h> +#include <linux/suspend.h> #include <linux/switchtec.h> #include <asm/dma.h> /* isa_dma_bridge_buggy */ #include "pci.h" @@ -3646,6 +3647,13 @@ static void quirk_apple_poweroff_thunderbolt(struct pci_dev *dev) return; if (pci_pcie_type(dev) != PCI_EXP_TYPE_UPSTREAM) return; + + /* + * If suspend mode is s2idle, power won't get restored on resume. + */ + if (!pm_suspend_via_firmware()) + return; + bridge = ACPI_HANDLE(&dev->dev); if (!bridge) return; -- 2.31.1