diff options
Diffstat (limited to 'drivers/pci/pci-acpi.c')
-rw-r--r-- | drivers/pci/pci-acpi.c | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c index c8062494009f..67c63d1f1582 100644 --- a/drivers/pci/pci-acpi.c +++ b/drivers/pci/pci-acpi.c | |||
@@ -245,16 +245,33 @@ 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) |
256 | { | 272 | { |
257 | acpi_handle handle = DEVICE_ACPI_HANDLE(&dev->dev); | 273 | acpi_handle handle = DEVICE_ACPI_HANDLE(&dev->dev); |
274 | acpi_handle tmp; | ||
258 | static int state_conv[] = { | 275 | static int state_conv[] = { |
259 | [0] = 0, | 276 | [0] = 0, |
260 | [1] = 1, | 277 | [1] = 1, |
@@ -266,6 +283,9 @@ static int acpi_pci_set_power_state(struct pci_dev *dev, pci_power_t state) | |||
266 | 283 | ||
267 | if (!handle) | 284 | if (!handle) |
268 | return -ENODEV; | 285 | return -ENODEV; |
286 | /* If the ACPI device has _EJ0, ignore the device */ | ||
287 | if (ACPI_SUCCESS(acpi_get_handle(handle, "_EJ0", &tmp))) | ||
288 | return 0; | ||
269 | return acpi_bus_set_power(handle, acpi_state); | 289 | return acpi_bus_set_power(handle, acpi_state); |
270 | } | 290 | } |
271 | 291 | ||