Commit fc30e68e authored by Shaohua Li's avatar Shaohua Li Committed by Len Brown

ACPI, PNP: hook ACPI D-state to PNP suspend/resume

applied after Rafel's 'PM: Update global suspend and hibernation operations framework' patch set
Signed-off-by: default avatarShaohua Li <shaohua.li@intel.com>
Signed-off-by: default avatarLen Brown <len.brown@intel.com>
parent fd4aff1a
...@@ -167,6 +167,8 @@ static int pnp_bus_suspend(struct device *dev, pm_message_t state) ...@@ -167,6 +167,8 @@ static int pnp_bus_suspend(struct device *dev, pm_message_t state)
return error; return error;
} }
if (pnp_dev->protocol && pnp_dev->protocol->suspend)
pnp_dev->protocol->suspend(pnp_dev, state);
return 0; return 0;
} }
...@@ -179,6 +181,9 @@ static int pnp_bus_resume(struct device *dev) ...@@ -179,6 +181,9 @@ static int pnp_bus_resume(struct device *dev)
if (!pnp_drv) if (!pnp_drv)
return 0; 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)) { if (!(pnp_drv->flags & PNP_DRIVER_RES_DO_NOT_CHANGE)) {
error = pnp_start_dev(pnp_dev); error = pnp_start_dev(pnp_dev);
if (error) if (error)
......
...@@ -119,11 +119,25 @@ static int pnpacpi_disable_resources(struct pnp_dev *dev) ...@@ -119,11 +119,25 @@ static int pnpacpi_disable_resources(struct pnp_dev *dev)
return ACPI_FAILURE(status) ? -ENODEV : 0; 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 = { static struct pnp_protocol pnpacpi_protocol = {
.name = "Plug and Play ACPI", .name = "Plug and Play ACPI",
.get = pnpacpi_get_resources, .get = pnpacpi_get_resources,
.set = pnpacpi_set_resources, .set = pnpacpi_set_resources,
.disable = pnpacpi_disable_resources, .disable = pnpacpi_disable_resources,
.suspend = pnpacpi_suspend,
.resume = pnpacpi_resume,
}; };
static int __init pnpacpi_add_device(struct acpi_device *device) static int __init pnpacpi_add_device(struct acpi_device *device)
......
...@@ -335,6 +335,10 @@ struct pnp_protocol { ...@@ -335,6 +335,10 @@ struct pnp_protocol {
int (*set)(struct pnp_dev *dev, struct pnp_resource_table *res); int (*set)(struct pnp_dev *dev, struct pnp_resource_table *res);
int (*disable)(struct pnp_dev *dev); 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) */ /* used by pnp layer only (look but don't touch) */
unsigned char number; /* protocol number*/ unsigned char number; /* protocol number*/
struct device dev; /* link to driver model */ struct device dev; /* link to driver model */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment