Commit ab826ca4 authored by Shaohua Li's avatar Shaohua Li Committed by Len Brown

ACPI: Use ACPI methods to select PCI device suspend state

applied after Rafel's 'PM: Update global suspend and hibernation
operations framework' patch set

Signed-off-by: Shaohua Li<shaohua.li@intel.com>
Signed-off-by: default avatarLen Brown <len.brown@intel.com>
parent fc30e68e
...@@ -245,11 +245,27 @@ EXPORT_SYMBOL(pci_osc_control_set); ...@@ -245,11 +245,27 @@ EXPORT_SYMBOL(pci_osc_control_set);
* currently we simply return _SxD, if present. * currently we simply return _SxD, if present.
*/ */
static int acpi_pci_choose_state(struct pci_dev *pdev, pm_message_t state) static pci_power_t acpi_pci_choose_state(struct pci_dev *pdev,
pm_message_t state)
{ {
/* TBD */ int acpi_state;
return -ENODEV; acpi_state = acpi_pm_device_sleep_state(&pdev->dev,
device_may_wakeup(&pdev->dev), NULL);
if (acpi_state < 0)
return PCI_POWER_ERROR;
switch (acpi_state) {
case ACPI_STATE_D0:
return PCI_D0;
case ACPI_STATE_D1:
return PCI_D1;
case ACPI_STATE_D2:
return PCI_D2;
case ACPI_STATE_D3:
return PCI_D3hot;
}
return PCI_POWER_ERROR;
} }
static int acpi_pci_set_power_state(struct pci_dev *dev, pci_power_t state) static int acpi_pci_set_power_state(struct pci_dev *dev, pci_power_t state)
......
...@@ -499,7 +499,7 @@ pci_set_power_state(struct pci_dev *dev, pci_power_t state) ...@@ -499,7 +499,7 @@ pci_set_power_state(struct pci_dev *dev, pci_power_t state)
return 0; return 0;
} }
int (*platform_pci_choose_state)(struct pci_dev *dev, pm_message_t state); pci_power_t (*platform_pci_choose_state)(struct pci_dev *dev, pm_message_t state);
/** /**
* pci_choose_state - Choose the power state of a PCI device * pci_choose_state - Choose the power state of a PCI device
...@@ -513,15 +513,15 @@ int (*platform_pci_choose_state)(struct pci_dev *dev, pm_message_t state); ...@@ -513,15 +513,15 @@ int (*platform_pci_choose_state)(struct pci_dev *dev, pm_message_t state);
pci_power_t pci_choose_state(struct pci_dev *dev, pm_message_t state) pci_power_t pci_choose_state(struct pci_dev *dev, pm_message_t state)
{ {
int ret; pci_power_t ret;
if (!pci_find_capability(dev, PCI_CAP_ID_PM)) if (!pci_find_capability(dev, PCI_CAP_ID_PM))
return PCI_D0; return PCI_D0;
if (platform_pci_choose_state) { if (platform_pci_choose_state) {
ret = platform_pci_choose_state(dev, state); ret = platform_pci_choose_state(dev, state);
if (ret >= 0) if (ret != PCI_POWER_ERROR)
state.event = ret; return ret;
} }
switch (state.event) { switch (state.event) {
......
...@@ -13,7 +13,7 @@ extern int pci_bus_alloc_resource(struct pci_bus *bus, struct resource *res, ...@@ -13,7 +13,7 @@ extern int pci_bus_alloc_resource(struct pci_bus *bus, struct resource *res,
resource_size_t, resource_size_t), resource_size_t, resource_size_t),
void *alignf_data); void *alignf_data);
/* Firmware callbacks */ /* Firmware callbacks */
extern int (*platform_pci_choose_state)(struct pci_dev *dev, pm_message_t state); extern pci_power_t (*platform_pci_choose_state)(struct pci_dev *dev, pm_message_t state);
extern int (*platform_pci_set_power_state)(struct pci_dev *dev, pci_power_t state); extern int (*platform_pci_set_power_state)(struct pci_dev *dev, pci_power_t state);
extern int pci_user_read_config_byte(struct pci_dev *dev, int where, u8 *val); extern int pci_user_read_config_byte(struct pci_dev *dev, int where, u8 *val);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment