diff options
author | Huang Ying <ying.huang@intel.com> | 2012-12-26 12:39:23 -0500 |
---|---|---|
committer | Bjorn Helgaas <bhelgaas@google.com> | 2012-12-26 12:39:23 -0500 |
commit | c733b77475707cc3980542c86ee0ad5c841d544c (patch) | |
tree | 5a2fed17d994e0e88737283b3af5f0fa20375cb1 /drivers/pci | |
parent | 130f1b8f35f14d27c43da755f3c9226318c17f57 (diff) |
PCI/PM: Do not suspend port if any subordinate device needs PME polling
Ulrich reported that his USB3 cardreader does not work reliably when
connected to the USB3 port. It turns out that USB3 controller failed to
awaken when plugging in the USB3 cardreader. Further experiments found
that the USB3 host controller can only be awakened via polling, not via PME
interrupt. But if the PCIe port to which the USB3 host controller is
connected is suspended, we cannot poll the controller because its config
space is not accessible when the PCIe port is in a low power state.
To solve the issue, the PCIe port will not be suspended if any subordinate
device needs PME polling.
[bhelgaas: use bool consistently rather than mixing int/bool]
Reference: http://lkml.kernel.org/r/50841CCC.9030809@uli-eckhardt.de
Reported-by: Ulrich Eckhardt <usb@uli-eckhardt.de>
Tested-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Signed-off-by: Huang Ying <ying.huang@intel.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
CC: stable@vger.kernel.org # v3.6+
Diffstat (limited to 'drivers/pci')
-rw-r--r-- | drivers/pci/pcie/portdrv_pci.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/drivers/pci/pcie/portdrv_pci.c b/drivers/pci/pcie/portdrv_pci.c index d4824cb78b49..08c243ab034e 100644 --- a/drivers/pci/pcie/portdrv_pci.c +++ b/drivers/pci/pcie/portdrv_pci.c | |||
@@ -134,10 +134,28 @@ static int pcie_port_runtime_resume(struct device *dev) | |||
134 | return 0; | 134 | return 0; |
135 | } | 135 | } |
136 | 136 | ||
137 | static int pci_dev_pme_poll(struct pci_dev *pdev, void *data) | ||
138 | { | ||
139 | bool *pme_poll = data; | ||
140 | |||
141 | if (pdev->pme_poll) | ||
142 | *pme_poll = true; | ||
143 | return 0; | ||
144 | } | ||
145 | |||
137 | static int pcie_port_runtime_idle(struct device *dev) | 146 | static int pcie_port_runtime_idle(struct device *dev) |
138 | { | 147 | { |
148 | struct pci_dev *pdev = to_pci_dev(dev); | ||
149 | bool pme_poll = false; | ||
150 | |||
151 | /* | ||
152 | * If any subordinate device needs pme poll, we should keep | ||
153 | * the port in D0, because we need port in D0 to poll it. | ||
154 | */ | ||
155 | pci_walk_bus(pdev->subordinate, pci_dev_pme_poll, &pme_poll); | ||
139 | /* Delay for a short while to prevent too frequent suspend/resume */ | 156 | /* Delay for a short while to prevent too frequent suspend/resume */ |
140 | pm_schedule_suspend(dev, 10); | 157 | if (!pme_poll) |
158 | pm_schedule_suspend(dev, 10); | ||
141 | return -EBUSY; | 159 | return -EBUSY; |
142 | } | 160 | } |
143 | #else | 161 | #else |