diff options
author | Lukas Wunner <lukas@wunner.de> | 2016-09-18 05:39:20 +0200 |
---|---|---|
committer | Bjorn Helgaas <bhelgaas@google.com> | 2016-09-28 11:46:51 -0500 |
commit | cc7cc02bada84f0d707aa5b6d2ef8728a2e1f911 (patch) | |
tree | f1d963b141e5d6fae283afa49e4841faeeedb6e8 /drivers/pci/pci.h | |
parent | 4132a577a0a7e75b938d2ae49c7a16b358f60661 (diff) | |
download | linux-cc7cc02bada84f0d707aa5b6d2ef8728a2e1f911.tar.gz linux-cc7cc02bada84f0d707aa5b6d2ef8728a2e1f911.tar.bz2 linux-cc7cc02bada84f0d707aa5b6d2ef8728a2e1f911.zip |
PCI: Query platform firmware for device power state
Usually the most accurate way to determine a PCI device's power state is to
read its PM Control & Status Register. There are two cases however when
this is not an option: If the device doesn't have the PM capability at
all, or if it is in D3cold (in which case its config space is
inaccessible).
In both cases, we can alternatively query the platform firmware for its
opinion on the device's power state. To facilitate this, augment struct
pci_platform_pm_ops with a ->get_power callback and implement it for
acpi_pci_platform_pm (the only pci_platform_pm_ops existing so far).
It is used by a forthcoming commit to let pci_update_current_state()
recognize D3cold.
Signed-off-by: Lukas Wunner <lukas@wunner.de>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/pci/pci.h')
-rw-r--r-- | drivers/pci/pci.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h index 9730c474b016..01d520648e1d 100644 --- a/drivers/pci/pci.h +++ b/drivers/pci/pci.h @@ -42,6 +42,8 @@ int pci_probe_reset_function(struct pci_dev *dev); * * @set_state: invokes the platform firmware to set the device's power state * + * @get_state: queries the platform firmware for a device's current power state + * * @choose_state: returns PCI power state of given device preferred by the * platform; to be used during system-wide transitions from a * sleeping state to the working state and vice versa @@ -62,6 +64,7 @@ int pci_probe_reset_function(struct pci_dev *dev); struct pci_platform_pm_ops { bool (*is_manageable)(struct pci_dev *dev); int (*set_state)(struct pci_dev *dev, pci_power_t state); + pci_power_t (*get_state)(struct pci_dev *dev); pci_power_t (*choose_state)(struct pci_dev *dev); int (*sleep_wake)(struct pci_dev *dev, bool enable); int (*run_wake)(struct pci_dev *dev, bool enable); |