diff options
author | Shaohua Li <shaohua.li@intel.com> | 2007-07-19 22:03:22 -0400 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2007-07-22 04:18:32 -0400 |
commit | ab826ca4cf2fe8ebcfd21189ca8bfeb47ca88359 (patch) | |
tree | fe98e808f9b593580979308a48d52184e59d734c /drivers/pci | |
parent | fc30e68e88baf463683bde43347756889ba2ffae (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')
-rw-r--r-- | drivers/pci/pci-acpi.c | 24 | ||||
-rw-r--r-- | drivers/pci/pci.c | 8 | ||||
-rw-r--r-- | drivers/pci/pci.h | 2 |
3 files changed, 25 insertions, 9 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 | ||
248 | static int acpi_pci_choose_state(struct pci_dev *pdev, pm_message_t state) | 248 | static 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 | ||
255 | static int acpi_pci_set_power_state(struct pci_dev *dev, pci_power_t state) | 271 | static int acpi_pci_set_power_state(struct pci_dev *dev, pci_power_t state) |
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index 03fd59e80fef..1458fd69e670 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c | |||
@@ -499,7 +499,7 @@ pci_set_power_state(struct pci_dev *dev, pci_power_t state) | |||
499 | return 0; | 499 | return 0; |
500 | } | 500 | } |
501 | 501 | ||
502 | int (*platform_pci_choose_state)(struct pci_dev *dev, pm_message_t state); | 502 | pci_power_t (*platform_pci_choose_state)(struct pci_dev *dev, pm_message_t state); |
503 | 503 | ||
504 | /** | 504 | /** |
505 | * pci_choose_state - Choose the power state of a PCI device | 505 | * 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 | 513 | ||
514 | pci_power_t pci_choose_state(struct pci_dev *dev, pm_message_t state) | 514 | pci_power_t pci_choose_state(struct pci_dev *dev, pm_message_t state) |
515 | { | 515 | { |
516 | int ret; | 516 | pci_power_t ret; |
517 | 517 | ||
518 | if (!pci_find_capability(dev, PCI_CAP_ID_PM)) | 518 | if (!pci_find_capability(dev, PCI_CAP_ID_PM)) |
519 | return PCI_D0; | 519 | return PCI_D0; |
520 | 520 | ||
521 | if (platform_pci_choose_state) { | 521 | if (platform_pci_choose_state) { |
522 | ret = platform_pci_choose_state(dev, state); | 522 | ret = platform_pci_choose_state(dev, state); |
523 | if (ret >= 0) | 523 | if (ret != PCI_POWER_ERROR) |
524 | state.event = ret; | 524 | return ret; |
525 | } | 525 | } |
526 | 526 | ||
527 | switch (state.event) { | 527 | switch (state.event) { |
diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h index 3fec13d3add7..c293ba1f274a 100644 --- a/drivers/pci/pci.h +++ b/drivers/pci/pci.h | |||
@@ -13,7 +13,7 @@ extern int pci_bus_alloc_resource(struct pci_bus *bus, struct resource *res, | |||
13 | resource_size_t, resource_size_t), | 13 | resource_size_t, resource_size_t), |
14 | void *alignf_data); | 14 | void *alignf_data); |
15 | /* Firmware callbacks */ | 15 | /* Firmware callbacks */ |
16 | extern int (*platform_pci_choose_state)(struct pci_dev *dev, pm_message_t state); | 16 | extern pci_power_t (*platform_pci_choose_state)(struct pci_dev *dev, pm_message_t state); |
17 | extern int (*platform_pci_set_power_state)(struct pci_dev *dev, pci_power_t state); | 17 | extern int (*platform_pci_set_power_state)(struct pci_dev *dev, pci_power_t state); |
18 | 18 | ||
19 | extern int pci_user_read_config_byte(struct pci_dev *dev, int where, u8 *val); | 19 | extern int pci_user_read_config_byte(struct pci_dev *dev, int where, u8 *val); |