]> err.no Git - linux-2.6/commitdiff
ACPI, PNP: hook ACPI D-state to PNP suspend/resume
authorShaohua Li <shaohua.li@intel.com>
Fri, 20 Jul 2007 02:03:20 +0000 (10:03 +0800)
committerLen Brown <len.brown@intel.com>
Sun, 22 Jul 2007 08:18:20 +0000 (04:18 -0400)
applied after Rafel's 'PM: Update global suspend and hibernation operations framework' patch set

Signed-off-by: Shaohua Li <shaohua.li@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
drivers/pnp/driver.c
drivers/pnp/pnpacpi/core.c
include/linux/pnp.h

index e161423b4300d7f76c6f2b5a207362e2e4688ed1..1432806451cd03cf751d2f3e9c896582bd7571cd 100644 (file)
@@ -167,6 +167,8 @@ static int pnp_bus_suspend(struct device *dev, pm_message_t state)
                        return error;
        }
 
+       if (pnp_dev->protocol && pnp_dev->protocol->suspend)
+               pnp_dev->protocol->suspend(pnp_dev, state);
        return 0;
 }
 
@@ -179,6 +181,9 @@ static int pnp_bus_resume(struct device *dev)
        if (!pnp_drv)
                return 0;
 
+       if (pnp_dev->protocol && pnp_dev->protocol->resume)
+               pnp_dev->protocol->resume(pnp_dev);
+
        if (!(pnp_drv->flags & PNP_DRIVER_RES_DO_NOT_CHANGE)) {
                error = pnp_start_dev(pnp_dev);
                if (error)
index a00548799e98f8655fbb9efcdd53c10e0837f06c..c37a558ecd9606fb2a67284bd20f7bb4a7577874 100644 (file)
@@ -119,11 +119,25 @@ static int pnpacpi_disable_resources(struct pnp_dev *dev)
        return ACPI_FAILURE(status) ? -ENODEV : 0;
 }
 
+static int pnpacpi_suspend(struct pnp_dev *dev, pm_message_t state)
+{
+       return acpi_bus_set_power((acpi_handle)dev->data,
+               acpi_pm_device_sleep_state(&dev->dev,
+               device_may_wakeup(&dev->dev), NULL));
+}
+
+static int pnpacpi_resume(struct pnp_dev *dev)
+{
+       return acpi_bus_set_power((acpi_handle)dev->data, ACPI_STATE_D0);
+}
+
 static struct pnp_protocol pnpacpi_protocol = {
        .name   = "Plug and Play ACPI",
        .get    = pnpacpi_get_resources,
        .set    = pnpacpi_set_resources,
        .disable = pnpacpi_disable_resources,
+       .suspend = pnpacpi_suspend,
+       .resume = pnpacpi_resume,
 };
 
 static int __init pnpacpi_add_device(struct acpi_device *device)
index 2a1897e6f9372a08a81054bd3d67cb8a43fe59c0..66edb2293184d05cf5c8b800b81d336f9cfe38c3 100644 (file)
@@ -335,6 +335,10 @@ struct pnp_protocol {
        int (*set)(struct pnp_dev *dev, struct pnp_resource_table *res);
        int (*disable)(struct pnp_dev *dev);
 
+       /* protocol specific suspend/resume */
+       int (*suspend)(struct pnp_dev *dev, pm_message_t state);
+       int (*resume)(struct pnp_dev *dev);
+
        /* used by pnp layer only (look but don't touch) */
        unsigned char           number;         /* protocol number*/
        struct device           dev;            /* link to driver model */