diff options
-rw-r--r-- | drivers/pci/pci.c | 22 | ||||
-rw-r--r-- | include/linux/pci.h | 1 |
2 files changed, 23 insertions, 0 deletions
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index dbe9f39f4436..2797112c9400 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c | |||
@@ -1127,6 +1127,27 @@ int pci_enable_wake(struct pci_dev *dev, pci_power_t state, int enable) | |||
1127 | } | 1127 | } |
1128 | 1128 | ||
1129 | /** | 1129 | /** |
1130 | * pci_wake_from_d3 - enable/disable device to wake up from D3_hot or D3_cold | ||
1131 | * @dev: PCI device to prepare | ||
1132 | * @enable: True to enable wake-up event generation; false to disable | ||
1133 | * | ||
1134 | * Many drivers want the device to wake up the system from D3_hot or D3_cold | ||
1135 | * and this function allows them to set that up cleanly - pci_enable_wake() | ||
1136 | * should not be called twice in a row to enable wake-up due to PCI PM vs ACPI | ||
1137 | * ordering constraints. | ||
1138 | * | ||
1139 | * This function only returns error code if the device is not capable of | ||
1140 | * generating PME# from both D3_hot and D3_cold, and the platform is unable to | ||
1141 | * enable wake-up power for it. | ||
1142 | */ | ||
1143 | int pci_wake_from_d3(struct pci_dev *dev, bool enable) | ||
1144 | { | ||
1145 | return pci_pme_capable(dev, PCI_D3cold) ? | ||
1146 | pci_enable_wake(dev, PCI_D3cold, enable) : | ||
1147 | pci_enable_wake(dev, PCI_D3hot, enable); | ||
1148 | } | ||
1149 | |||
1150 | /** | ||
1130 | * pci_target_state - find an appropriate low power state for a given PCI dev | 1151 | * pci_target_state - find an appropriate low power state for a given PCI dev |
1131 | * @dev: PCI device | 1152 | * @dev: PCI device |
1132 | * | 1153 | * |
@@ -1942,6 +1963,7 @@ EXPORT_SYMBOL(pci_restore_state); | |||
1942 | EXPORT_SYMBOL(pci_pme_capable); | 1963 | EXPORT_SYMBOL(pci_pme_capable); |
1943 | EXPORT_SYMBOL(pci_pme_active); | 1964 | EXPORT_SYMBOL(pci_pme_active); |
1944 | EXPORT_SYMBOL(pci_enable_wake); | 1965 | EXPORT_SYMBOL(pci_enable_wake); |
1966 | EXPORT_SYMBOL(pci_wake_from_d3); | ||
1945 | EXPORT_SYMBOL(pci_target_state); | 1967 | EXPORT_SYMBOL(pci_target_state); |
1946 | EXPORT_SYMBOL(pci_prepare_to_sleep); | 1968 | EXPORT_SYMBOL(pci_prepare_to_sleep); |
1947 | EXPORT_SYMBOL(pci_back_from_sleep); | 1969 | EXPORT_SYMBOL(pci_back_from_sleep); |
diff --git a/include/linux/pci.h b/include/linux/pci.h index c989f58d09bf..f7e7dbc09194 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h | |||
@@ -644,6 +644,7 @@ pci_power_t pci_choose_state(struct pci_dev *dev, pm_message_t state); | |||
644 | bool pci_pme_capable(struct pci_dev *dev, pci_power_t state); | 644 | bool pci_pme_capable(struct pci_dev *dev, pci_power_t state); |
645 | void pci_pme_active(struct pci_dev *dev, bool enable); | 645 | void pci_pme_active(struct pci_dev *dev, bool enable); |
646 | int pci_enable_wake(struct pci_dev *dev, pci_power_t state, int enable); | 646 | int pci_enable_wake(struct pci_dev *dev, pci_power_t state, int enable); |
647 | int pci_wake_from_d3(struct pci_dev *dev, bool enable); | ||
647 | pci_power_t pci_target_state(struct pci_dev *dev); | 648 | pci_power_t pci_target_state(struct pci_dev *dev); |
648 | int pci_prepare_to_sleep(struct pci_dev *dev); | 649 | int pci_prepare_to_sleep(struct pci_dev *dev); |
649 | int pci_back_from_sleep(struct pci_dev *dev); | 650 | int pci_back_from_sleep(struct pci_dev *dev); |