diff options
Diffstat (limited to 'drivers/pci/pci.c')
-rw-r--r-- | drivers/pci/pci.c | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index ce2ab62b64cf..d4438e7bb761 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -985,45 +985,66 @@ int pci_set_platform_pm(const struct pci_platform_pm_ops *ops) static inline bool platform_pci_power_manageable(struct pci_dev *dev) { + if (pci_use_mid_pm()) + return true; + return pci_platform_pm ? pci_platform_pm->is_manageable(dev) : false; } static inline int platform_pci_set_power_state(struct pci_dev *dev, pci_power_t t) { + if (pci_use_mid_pm()) + return mid_pci_set_power_state(dev, t); + return pci_platform_pm ? pci_platform_pm->set_state(dev, t) : -ENOSYS; } static inline pci_power_t platform_pci_get_power_state(struct pci_dev *dev) { + if (pci_use_mid_pm()) + return mid_pci_get_power_state(dev); + return pci_platform_pm ? pci_platform_pm->get_state(dev) : PCI_UNKNOWN; } static inline void platform_pci_refresh_power_state(struct pci_dev *dev) { - if (pci_platform_pm && pci_platform_pm->refresh_state) + if (!pci_use_mid_pm() && pci_platform_pm && pci_platform_pm->refresh_state) pci_platform_pm->refresh_state(dev); } static inline pci_power_t platform_pci_choose_state(struct pci_dev *dev) { + if (pci_use_mid_pm()) + return PCI_POWER_ERROR; + return pci_platform_pm ? pci_platform_pm->choose_state(dev) : PCI_POWER_ERROR; } static inline int platform_pci_set_wakeup(struct pci_dev *dev, bool enable) { + if (pci_use_mid_pm()) + return PCI_POWER_ERROR; + return pci_platform_pm ? pci_platform_pm->set_wakeup(dev, enable) : -ENODEV; } static inline bool platform_pci_need_resume(struct pci_dev *dev) { + if (pci_use_mid_pm()) + return false; + return pci_platform_pm ? pci_platform_pm->need_resume(dev) : false; } static inline bool platform_pci_bridge_d3(struct pci_dev *dev) { + if (pci_use_mid_pm()) + return false; + if (pci_platform_pm && pci_platform_pm->bridge_d3) return pci_platform_pm->bridge_d3(dev); return false; |