aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci/pci-acpi.c
diff options
context:
space:
mode:
authorShaohua Li <shaohua.li@intel.com>2007-07-19 22:03:22 -0400
committerLen Brown <len.brown@intel.com>2007-07-22 04:18:32 -0400
commitab826ca4cf2fe8ebcfd21189ca8bfeb47ca88359 (patch)
treefe98e808f9b593580979308a48d52184e59d734c /drivers/pci/pci-acpi.c
parentfc30e68e88baf463683bde43347756889ba2ffae (diff)
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: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/pci/pci-acpi.c')
-rw-r--r--drivers/pci/pci-acpi.c24
1 files changed, 20 insertions, 4 deletions
diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c
index c8062494009f..5e866b94bcab 100644
--- a/drivers/pci/pci-acpi.c
+++ b/drivers/pci/pci-acpi.c
@@ -245,11 +245,27 @@ EXPORT_SYMBOL(pci_osc_control_set);
245 * currently we simply return _SxD, if present. 245 * currently we simply return _SxD, if present.
246 */ 246 */
247 247
248static int acpi_pci_choose_state(struct pci_dev *pdev, pm_message_t state) 248static pci_power_t acpi_pci_choose_state(struct pci_dev *pdev,
249 pm_message_t state)
249{ 250{
250 /* TBD */ 251 int acpi_state;
251 252
252 return -ENODEV; 253 acpi_state = acpi_pm_device_sleep_state(&pdev->dev,
254 device_may_wakeup(&pdev->dev), NULL);
255 if (acpi_state < 0)
256 return PCI_POWER_ERROR;
257
258 switch (acpi_state) {
259 case ACPI_STATE_D0:
260 return PCI_D0;
261 case ACPI_STATE_D1:
262 return PCI_D1;
263 case ACPI_STATE_D2:
264 return PCI_D2;
265 case ACPI_STATE_D3:
266 return PCI_D3hot;
267 }
268 return PCI_POWER_ERROR;
253} 269}
254 270
255static int acpi_pci_set_power_state(struct pci_dev *dev, pci_power_t state) 271static int acpi_pci_set_power_state(struct pci_dev *dev, pci_power_t state)