diff options
author | David Shaohua Li <shaohua.li@intel.com> | 2005-03-19 00:16:18 -0500 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2005-07-11 23:47:06 -0400 |
commit | b913100d7304ea9596d8d85ab5f3ae04bd2b0ddb (patch) | |
tree | 270925a02dd83264fd5bd3a47fc39453798c39d5 /drivers/pci | |
parent | 0f64474b8f7f1f7f3af5b24ef997baa35f923509 (diff) | |
download | linux-b913100d7304ea9596d8d85ab5f3ae04bd2b0ddb.tar.bz2 |
[ACPI] pci_set_power_state() now calls
platform_pci_set_power_state()
and ACPI can answer
http://bugzilla.kernel.org/show_bug.cgi?id=4277
Signed-off-by: David 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 | 19 | ||||
-rw-r--r-- | drivers/pci/pci.c | 11 | ||||
-rw-r--r-- | drivers/pci/pci.h | 1 |
3 files changed, 29 insertions, 2 deletions
diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c index 8eb599708de8..a0d43ea872df 100644 --- a/drivers/pci/pci-acpi.c +++ b/drivers/pci/pci-acpi.c @@ -253,6 +253,24 @@ static int acpi_pci_choose_state(struct pci_dev *pdev, pm_message_t state) return -ENODEV; } +static int acpi_pci_set_power_state(struct pci_dev *dev, pci_power_t state) +{ + acpi_handle handle = DEVICE_ACPI_HANDLE(&dev->dev); + static int state_conv[] = { + [0] = 0, + [1] = 1, + [2] = 2, + [3] = 3, + [4] = 3 + }; + int acpi_state = state_conv[(int __force) state]; + + if (!handle) + return -ENODEV; + return acpi_bus_set_power(handle, acpi_state); +} + + /* ACPI bus type */ static int pci_acpi_find_device(struct device *dev, acpi_handle *handle) { @@ -300,6 +318,7 @@ static int __init pci_acpi_init(void) if (ret) return 0; platform_pci_choose_state = acpi_pci_choose_state; + platform_pci_set_power_state = acpi_pci_set_power_state; return 0; } arch_initcall(pci_acpi_init); diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index 5af941807785..a1c66e8ea5f2 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) * -EIO if device does not support PCI PM. * 0 if we can successfully change the power state. */ - +int (*platform_pci_set_power_state)(struct pci_dev *dev, pci_power_t t) = NULL; int pci_set_power_state(struct pci_dev *dev, pci_power_t state) { @@ -299,8 +299,15 @@ pci_set_power_state(struct pci_dev *dev, pci_power_t state) msleep(10); else if (state == PCI_D2 || dev->current_state == PCI_D2) udelay(200); - dev->current_state = state; + /* + * Give firmware a chance to be called, such as ACPI _PRx, _PSx + * Firmware method after natice method ? + */ + if (platform_pci_set_power_state) + platform_pci_set_power_state(dev, state); + + dev->current_state = state; return 0; } diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h index 25c44922f7db..d94d7af4f7a0 100644 --- a/drivers/pci/pci.h +++ b/drivers/pci/pci.h @@ -13,6 +13,7 @@ extern int pci_bus_alloc_resource(struct pci_bus *bus, struct resource *res, void *alignf_data); /* Firmware callbacks */ extern int (*platform_pci_choose_state)(struct pci_dev *dev, pm_message_t state); +extern int (*platform_pci_set_power_state)(struct pci_dev *dev, pci_power_t state); /* PCI /proc functions */ #ifdef CONFIG_PROC_FS |