summaryrefslogtreecommitdiff
path: root/drivers/pci
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2007-07-25 11:28:00 -0700
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-07-25 11:28:00 -0700
commita4fb2122f1fc4a22bd6a5b8a195b952c2d31c54d (patch)
treedb24e2160fe8eb8d787ad67bd3e08d3284806330 /drivers/pci
parentbc72450aebe73587f80bbae8fc0b62c3d81b85fe (diff)
parent323ef30af3a0da47cc761b04b262d98d0fe79126 (diff)
Merge branch 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6
* 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6: ACPI: Kconfig: remove CONFIG_ACPI_SLEEP from source ACPI: quiet ACPI Exceptions due to no _PTC or _TSS ACPI: Remove references to ACPI_STATE_S2 from acpi_pm_enter ACPI: Kconfig: always enable CONFIG_ACPI_SLEEP on X86 ACPI: Kconfig: fold /proc/acpi/sleep under CONFIG_ACPI_PROCFS ACPI: Kconfig: CONFIG_ACPI_PROCFS now defaults to N ACPI: autoload modules - Create __mod_acpi_device_table symbol for all ACPI drivers ACPI: autoload modules - Create ACPI alias interface ACPI: autoload modules - ACPICA modifications ACPI: asus-laptop: Fix failure exits ACPI: fix oops due to typo in new throttling code ACPI: ignore _PSx method for hotplugable PCI devices ACPI: Use ACPI methods to select PCI device suspend state ACPI, PNP: hook ACPI D-state to PNP suspend/resume ACPI: Add acpi_pm_device_sleep_state helper routine ACPI: Implement the set_target() callback from pm_ops
Diffstat (limited to 'drivers/pci')
-rw-r--r--drivers/pci/pci-acpi.c28
-rw-r--r--drivers/pci/pci.c8
-rw-r--r--drivers/pci/pci.h2
3 files changed, 29 insertions, 9 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);
* currently we simply return _SxD, if present.
*/
-static int acpi_pci_choose_state(struct pci_dev *pdev, pm_message_t state)
+static pci_power_t acpi_pci_choose_state(struct pci_dev *pdev,
+ pm_message_t state)
{
- /* TBD */
-
- return -ENODEV;
+ int acpi_state;
+
+ acpi_state = acpi_pm_device_sleep_state(&pdev->dev,
+ device_may_wakeup(&pdev->dev), NULL);
+ if (acpi_state < 0)
+ return PCI_POWER_ERROR;
+
+ switch (acpi_state) {
+ case ACPI_STATE_D0:
+ return PCI_D0;
+ case ACPI_STATE_D1:
+ return PCI_D1;
+ case ACPI_STATE_D2:
+ return PCI_D2;
+ case ACPI_STATE_D3:
+ return PCI_D3hot;
+ }
+ return PCI_POWER_ERROR;
}
static int acpi_pci_set_power_state(struct pci_dev *dev, pci_power_t state)
{
acpi_handle handle = DEVICE_ACPI_HANDLE(&dev->dev);
+ acpi_handle tmp;
static int state_conv[] = {
[0] = 0,
[1] = 1,
@@ -266,6 +283,9 @@ static int acpi_pci_set_power_state(struct pci_dev *dev, pci_power_t state)
if (!handle)
return -ENODEV;
+ /* If the ACPI device has _EJ0, ignore the device */
+ if (ACPI_SUCCESS(acpi_get_handle(handle, "_EJ0", &tmp)))
+ return 0;
return acpi_bus_set_power(handle, acpi_state);
}
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index c95485398687..fba319d6fcc8 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)
return 0;
}
-int (*platform_pci_choose_state)(struct pci_dev *dev, pm_message_t state);
+pci_power_t (*platform_pci_choose_state)(struct pci_dev *dev, pm_message_t state);
/**
* 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);
pci_power_t pci_choose_state(struct pci_dev *dev, pm_message_t state)
{
- int ret;
+ pci_power_t ret;
if (!pci_find_capability(dev, PCI_CAP_ID_PM))
return PCI_D0;
if (platform_pci_choose_state) {
ret = platform_pci_choose_state(dev, state);
- if (ret >= 0)
- state.event = ret;
+ if (ret != PCI_POWER_ERROR)
+ return ret;
}
switch (state.event) {
diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h
index 7b696cd66dc5..c6e132d7c0f7 100644
--- a/drivers/pci/pci.h
+++ b/drivers/pci/pci.h
@@ -12,7 +12,7 @@ extern int pci_bus_alloc_resource(struct pci_bus *bus, struct resource *res,
resource_size_t, resource_size_t),
void *alignf_data);
/* Firmware callbacks */
-extern int (*platform_pci_choose_state)(struct pci_dev *dev, pm_message_t state);
+extern pci_power_t (*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);
extern int pci_user_read_config_byte(struct pci_dev *dev, int where, u8 *val);