diff options
Diffstat (limited to 'drivers/pci/pci.c')
-rw-r--r-- | drivers/pci/pci.c | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index d382bdb7b560..1b34fc56067e 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c | |||
@@ -235,7 +235,7 @@ pci_find_parent_resource(const struct pci_dev *dev, struct resource *res) | |||
235 | * -EIO if device does not support PCI PM. | 235 | * -EIO if device does not support PCI PM. |
236 | * 0 if we can successfully change the power state. | 236 | * 0 if we can successfully change the power state. |
237 | */ | 237 | */ |
238 | 238 | int (*platform_pci_set_power_state)(struct pci_dev *dev, pci_power_t t); | |
239 | int | 239 | int |
240 | pci_set_power_state(struct pci_dev *dev, pci_power_t state) | 240 | pci_set_power_state(struct pci_dev *dev, pci_power_t state) |
241 | { | 241 | { |
@@ -299,11 +299,20 @@ pci_set_power_state(struct pci_dev *dev, pci_power_t state) | |||
299 | msleep(10); | 299 | msleep(10); |
300 | else if (state == PCI_D2 || dev->current_state == PCI_D2) | 300 | else if (state == PCI_D2 || dev->current_state == PCI_D2) |
301 | udelay(200); | 301 | udelay(200); |
302 | dev->current_state = state; | ||
303 | 302 | ||
303 | /* | ||
304 | * Give firmware a chance to be called, such as ACPI _PRx, _PSx | ||
305 | * Firmware method after natice method ? | ||
306 | */ | ||
307 | if (platform_pci_set_power_state) | ||
308 | platform_pci_set_power_state(dev, state); | ||
309 | |||
310 | dev->current_state = state; | ||
304 | return 0; | 311 | return 0; |
305 | } | 312 | } |
306 | 313 | ||
314 | int (*platform_pci_choose_state)(struct pci_dev *dev, pm_message_t state); | ||
315 | |||
307 | /** | 316 | /** |
308 | * pci_choose_state - Choose the power state of a PCI device | 317 | * pci_choose_state - Choose the power state of a PCI device |
309 | * @dev: PCI device to be suspended | 318 | * @dev: PCI device to be suspended |
@@ -316,10 +325,17 @@ pci_set_power_state(struct pci_dev *dev, pci_power_t state) | |||
316 | 325 | ||
317 | pci_power_t pci_choose_state(struct pci_dev *dev, pm_message_t state) | 326 | pci_power_t pci_choose_state(struct pci_dev *dev, pm_message_t state) |
318 | { | 327 | { |
328 | int ret; | ||
329 | |||
319 | if (!pci_find_capability(dev, PCI_CAP_ID_PM)) | 330 | if (!pci_find_capability(dev, PCI_CAP_ID_PM)) |
320 | return PCI_D0; | 331 | return PCI_D0; |
321 | 332 | ||
322 | switch (state) { | 333 | if (platform_pci_choose_state) { |
334 | ret = platform_pci_choose_state(dev, state); | ||
335 | if (ret >= 0) | ||
336 | state = ret; | ||
337 | } | ||
338 | switch (state) { | ||
323 | case 0: return PCI_D0; | 339 | case 0: return PCI_D0; |
324 | case 3: return PCI_D3hot; | 340 | case 3: return PCI_D3hot; |
325 | default: | 341 | default: |