mirror of
https://github.com/torvalds/linux.git
synced 2026-03-08 03:44:45 +01:00
Merge branch 'pci/pm'
- Avoid redundant delay on transition from D3hot to D3cold if the device was already in D3hot (Brian Norris) - Prevent runtime suspend until devices are fully initialized to avoid saving incompletely configured device state (Brian Norris) * pci/pm: PCI/PM: Prevent runtime suspend until devices are fully initialized PCI/PM: Avoid redundant delays on D3hot->D3cold
This commit is contained in:
commit
85fdfc522a
2 changed files with 18 additions and 1 deletions
|
|
@ -15,6 +15,7 @@
|
|||
#include <linux/of.h>
|
||||
#include <linux/of_platform.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/pm_runtime.h>
|
||||
#include <linux/proc_fs.h>
|
||||
#include <linux/slab.h>
|
||||
|
||||
|
|
@ -379,6 +380,13 @@ void pci_bus_add_device(struct pci_dev *dev)
|
|||
put_device(&pdev->dev);
|
||||
}
|
||||
|
||||
/*
|
||||
* Enable runtime PM, which potentially allows the device to
|
||||
* suspend immediately, only after the PCI state has been
|
||||
* configured completely.
|
||||
*/
|
||||
pm_runtime_enable(&dev->dev);
|
||||
|
||||
if (!dn || of_device_is_available(dn))
|
||||
pci_dev_allow_binding(dev);
|
||||
|
||||
|
|
|
|||
|
|
@ -1488,6 +1488,9 @@ static int pci_set_low_power_state(struct pci_dev *dev, pci_power_t state, bool
|
|||
|| (state == PCI_D2 && !dev->d2_support))
|
||||
return -EIO;
|
||||
|
||||
if (dev->current_state == state)
|
||||
return 0;
|
||||
|
||||
pci_read_config_word(dev, dev->pm_cap + PCI_PM_CTRL, &pmcsr);
|
||||
if (PCI_POSSIBLE_ERROR(pmcsr)) {
|
||||
pci_err(dev, "Unable to change power state from %s to %s, device inaccessible\n",
|
||||
|
|
@ -3196,8 +3199,14 @@ void pci_pm_init(struct pci_dev *dev)
|
|||
poweron:
|
||||
pci_pm_power_up_and_verify_state(dev);
|
||||
pm_runtime_forbid(&dev->dev);
|
||||
|
||||
/*
|
||||
* Runtime PM will be enabled for the device when it has been fully
|
||||
* configured, but since its parent and suppliers may suspend in
|
||||
* the meantime, prevent them from doing so by changing the
|
||||
* device's runtime PM status to "active".
|
||||
*/
|
||||
pm_runtime_set_active(&dev->dev);
|
||||
pm_runtime_enable(&dev->dev);
|
||||
}
|
||||
|
||||
static unsigned long pci_ea_flags(struct pci_dev *dev, u8 prop)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue