diff options
Diffstat (limited to 'drivers/pci/pci.c')
-rw-r--r-- | drivers/pci/pci.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index f04b9ffe4153..5af941807785 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c | |||
@@ -304,6 +304,8 @@ pci_set_power_state(struct pci_dev *dev, pci_power_t state) | |||
304 | return 0; | 304 | return 0; |
305 | } | 305 | } |
306 | 306 | ||
307 | int (*platform_pci_choose_state)(struct pci_dev *dev, pm_message_t state) = NULL; | ||
308 | |||
307 | /** | 309 | /** |
308 | * pci_choose_state - Choose the power state of a PCI device | 310 | * pci_choose_state - Choose the power state of a PCI device |
309 | * @dev: PCI device to be suspended | 311 | * @dev: PCI device to be suspended |
@@ -316,10 +318,17 @@ pci_set_power_state(struct pci_dev *dev, pci_power_t state) | |||
316 | 318 | ||
317 | pci_power_t pci_choose_state(struct pci_dev *dev, pm_message_t state) | 319 | pci_power_t pci_choose_state(struct pci_dev *dev, pm_message_t state) |
318 | { | 320 | { |
321 | int ret; | ||
322 | |||
319 | if (!pci_find_capability(dev, PCI_CAP_ID_PM)) | 323 | if (!pci_find_capability(dev, PCI_CAP_ID_PM)) |
320 | return PCI_D0; | 324 | return PCI_D0; |
321 | 325 | ||
322 | switch (state) { | 326 | if (platform_pci_choose_state) { |
327 | ret = platform_pci_choose_state(dev, state); | ||
328 | if (ret >= 0) | ||
329 | state = ret; | ||
330 | } | ||
331 | switch (state) { | ||
323 | case 0: return PCI_D0; | 332 | case 0: return PCI_D0; |
324 | case 3: return PCI_D3hot; | 333 | case 3: return PCI_D3hot; |
325 | default: | 334 | default: |