aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMika Westerberg <mika.westerberg@linux.intel.com>2018-09-27 17:41:49 -0400
committerBjorn Helgaas <bhelgaas@google.com>2018-10-02 17:04:40 -0400
commit9c62f0bfb83260cb2469eb84d3185c9728e36900 (patch)
treef8c65c20da79e5e4d259db22bef7773591ab658f
parent94c7993fb5bd1e3c20f67a2d24ba05bbdc938340 (diff)
PCI: pciehp: Implement runtime PM callbacks
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>
-rw-r--r--drivers/pci/hotplug/pciehp_core.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/drivers/pci/hotplug/pciehp_core.c b/drivers/pci/hotplug/pciehp_core.c
index df5ae02f4e12..fc5366b50e95 100644
--- a/drivers/pci/hotplug/pciehp_core.c
+++ b/drivers/pci/hotplug/pciehp_core.c
@@ -288,6 +288,22 @@ static int pciehp_resume(struct pcie_device *dev)
288 288
289 return 0; 289 return 0;
290} 290}
291
292static int pciehp_runtime_resume(struct pcie_device *dev)
293{
294 struct controller *ctrl = get_service_data(dev);
295
296 /* pci_restore_state() just wrote to the Slot Control register */
297 ctrl->cmd_started = jiffies;
298 ctrl->cmd_busy = true;
299
300 /* clear spurious events from rediscovery of inserted card */
301 if ((ctrl->state == ON_STATE || ctrl->state == BLINKINGOFF_STATE) &&
302 pme_is_native(dev))
303 pcie_clear_hotplug_events(ctrl);
304
305 return pciehp_resume(dev);
306}
291#endif /* PM */ 307#endif /* PM */
292 308
293static struct pcie_port_service_driver hpdriver_portdrv = { 309static struct pcie_port_service_driver hpdriver_portdrv = {
@@ -302,6 +318,8 @@ static struct pcie_port_service_driver hpdriver_portdrv = {
302 .suspend = pciehp_suspend, 318 .suspend = pciehp_suspend,
303 .resume_noirq = pciehp_resume_noirq, 319 .resume_noirq = pciehp_resume_noirq,
304 .resume = pciehp_resume, 320 .resume = pciehp_resume,
321 .runtime_suspend = pciehp_suspend,
322 .runtime_resume = pciehp_runtime_resume,
305#endif /* PM */ 323#endif /* PM */
306}; 324};
307 325