aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci/pci-acpi.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/pci/pci-acpi.c')
-rw-r--r--drivers/pci/pci-acpi.c19
1 files changed, 19 insertions, 0 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)
253 return -ENODEV; 253 return -ENODEV;
254} 254}
255 255
256static int acpi_pci_set_power_state(struct pci_dev *dev, pci_power_t state)
257{
258 acpi_handle handle = DEVICE_ACPI_HANDLE(&dev->dev);
259 static int state_conv[] = {
260 [0] = 0,
261 [1] = 1,
262 [2] = 2,
263 [3] = 3,
264 [4] = 3
265 };
266 int acpi_state = state_conv[(int __force) state];
267
268 if (!handle)
269 return -ENODEV;
270 return acpi_bus_set_power(handle, acpi_state);
271}
272
273
256/* ACPI bus type */ 274/* ACPI bus type */
257static int pci_acpi_find_device(struct device *dev, acpi_handle *handle) 275static int pci_acpi_find_device(struct device *dev, acpi_handle *handle)
258{ 276{
@@ -300,6 +318,7 @@ static int __init pci_acpi_init(void)
300 if (ret) 318 if (ret)
301 return 0; 319 return 0;
302 platform_pci_choose_state = acpi_pci_choose_state; 320 platform_pci_choose_state = acpi_pci_choose_state;
321 platform_pci_set_power_state = acpi_pci_set_power_state;
303 return 0; 322 return 0;
304} 323}
305arch_initcall(pci_acpi_init); 324arch_initcall(pci_acpi_init);