]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
PCI: pciehp: Implement runtime PM callbacks
authorMika Westerberg <mika.westerberg@linux.intel.com>
Thu, 27 Sep 2018 21:41:49 +0000 (16:41 -0500)
committerBjorn Helgaas <bhelgaas@google.com>
Tue, 2 Oct 2018 21:04:40 +0000 (16:04 -0500)
Basically we need to do the same thing when runtime suspending than with
system sleep so re-use those operations here. This makes sure hotplug
interrupt does not trigger immediately when the link goes down.

Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/pci/hotplug/pciehp_core.c

index df5ae02f4e12a1f96e623adf6c3fb8ef47611938..fc5366b50e9565cc4ad0d9d193ab42d926d1dfef 100644 (file)
@@ -288,6 +288,22 @@ static int pciehp_resume(struct pcie_device *dev)
 
        return 0;
 }
+
+static int pciehp_runtime_resume(struct pcie_device *dev)
+{
+       struct controller *ctrl = get_service_data(dev);
+
+       /* pci_restore_state() just wrote to the Slot Control register */
+       ctrl->cmd_started = jiffies;
+       ctrl->cmd_busy = true;
+
+       /* clear spurious events from rediscovery of inserted card */
+       if ((ctrl->state == ON_STATE || ctrl->state == BLINKINGOFF_STATE) &&
+            pme_is_native(dev))
+               pcie_clear_hotplug_events(ctrl);
+
+       return pciehp_resume(dev);
+}
 #endif /* PM */
 
 static struct pcie_port_service_driver hpdriver_portdrv = {
@@ -302,6 +318,8 @@ static struct pcie_port_service_driver hpdriver_portdrv = {
        .suspend        = pciehp_suspend,
        .resume_noirq   = pciehp_resume_noirq,
        .resume         = pciehp_resume,
+       .runtime_suspend = pciehp_suspend,
+       .runtime_resume = pciehp_runtime_resume,
 #endif /* PM */
 };