diff options
Diffstat (limited to 'drivers/pci/pci-acpi.c')
-rw-r--r-- | drivers/pci/pci-acpi.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c index 9a033e8ee9a4..d966d47c9e80 100644 --- a/drivers/pci/pci-acpi.c +++ b/drivers/pci/pci-acpi.c | |||
@@ -452,6 +452,27 @@ static int acpi_pci_set_power_state(struct pci_dev *dev, pci_power_t state) | |||
452 | return error; | 452 | return error; |
453 | } | 453 | } |
454 | 454 | ||
455 | static pci_power_t acpi_pci_get_power_state(struct pci_dev *dev) | ||
456 | { | ||
457 | struct acpi_device *adev = ACPI_COMPANION(&dev->dev); | ||
458 | static const pci_power_t state_conv[] = { | ||
459 | [ACPI_STATE_D0] = PCI_D0, | ||
460 | [ACPI_STATE_D1] = PCI_D1, | ||
461 | [ACPI_STATE_D2] = PCI_D2, | ||
462 | [ACPI_STATE_D3_HOT] = PCI_D3hot, | ||
463 | [ACPI_STATE_D3_COLD] = PCI_D3cold, | ||
464 | }; | ||
465 | int state; | ||
466 | |||
467 | if (!adev || !acpi_device_power_manageable(adev)) | ||
468 | return PCI_UNKNOWN; | ||
469 | |||
470 | if (acpi_device_get_power(adev, &state) || state == ACPI_STATE_UNKNOWN) | ||
471 | return PCI_UNKNOWN; | ||
472 | |||
473 | return state_conv[state]; | ||
474 | } | ||
475 | |||
455 | static bool acpi_pci_can_wakeup(struct pci_dev *dev) | 476 | static bool acpi_pci_can_wakeup(struct pci_dev *dev) |
456 | { | 477 | { |
457 | struct acpi_device *adev = ACPI_COMPANION(&dev->dev); | 478 | struct acpi_device *adev = ACPI_COMPANION(&dev->dev); |
@@ -534,6 +555,7 @@ static bool acpi_pci_need_resume(struct pci_dev *dev) | |||
534 | static const struct pci_platform_pm_ops acpi_pci_platform_pm = { | 555 | static const struct pci_platform_pm_ops acpi_pci_platform_pm = { |
535 | .is_manageable = acpi_pci_power_manageable, | 556 | .is_manageable = acpi_pci_power_manageable, |
536 | .set_state = acpi_pci_set_power_state, | 557 | .set_state = acpi_pci_set_power_state, |
558 | .get_state = acpi_pci_get_power_state, | ||
537 | .choose_state = acpi_pci_choose_state, | 559 | .choose_state = acpi_pci_choose_state, |
538 | .sleep_wake = acpi_pci_sleep_wake, | 560 | .sleep_wake = acpi_pci_sleep_wake, |
539 | .run_wake = acpi_pci_run_wake, | 561 | .run_wake = acpi_pci_run_wake, |