diff options
author | Shaohua Li <shaohua.li@intel.com> | 2007-07-19 22:03:20 -0400 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2007-07-22 04:18:20 -0400 |
commit | fc30e68e88baf463683bde43347756889ba2ffae (patch) | |
tree | 3da69f1c11c10e0ad3c3663989575a5a03ef61c1 | |
parent | fd4aff1a28eecbd729b409bf7d3eff5948f20414 (diff) |
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: Shaohua Li <shaohua.li@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
-rw-r--r-- | drivers/pnp/driver.c | 5 | ||||
-rw-r--r-- | drivers/pnp/pnpacpi/core.c | 14 | ||||
-rw-r--r-- | include/linux/pnp.h | 4 |
3 files changed, 23 insertions, 0 deletions
diff --git a/drivers/pnp/driver.c b/drivers/pnp/driver.c index e161423b4300..1432806451cd 100644 --- a/drivers/pnp/driver.c +++ b/drivers/pnp/driver.c | |||
@@ -167,6 +167,8 @@ static int pnp_bus_suspend(struct device *dev, pm_message_t state) | |||
167 | return error; | 167 | return error; |
168 | } | 168 | } |
169 | 169 | ||
170 | if (pnp_dev->protocol && pnp_dev->protocol->suspend) | ||
171 | pnp_dev->protocol->suspend(pnp_dev, state); | ||
170 | return 0; | 172 | return 0; |
171 | } | 173 | } |
172 | 174 | ||
@@ -179,6 +181,9 @@ static int pnp_bus_resume(struct device *dev) | |||
179 | if (!pnp_drv) | 181 | if (!pnp_drv) |
180 | return 0; | 182 | return 0; |
181 | 183 | ||
184 | if (pnp_dev->protocol && pnp_dev->protocol->resume) | ||
185 | pnp_dev->protocol->resume(pnp_dev); | ||
186 | |||
182 | if (!(pnp_drv->flags & PNP_DRIVER_RES_DO_NOT_CHANGE)) { | 187 | if (!(pnp_drv->flags & PNP_DRIVER_RES_DO_NOT_CHANGE)) { |
183 | error = pnp_start_dev(pnp_dev); | 188 | error = pnp_start_dev(pnp_dev); |
184 | if (error) | 189 | if (error) |
diff --git a/drivers/pnp/pnpacpi/core.c b/drivers/pnp/pnpacpi/core.c index a00548799e98..c37a558ecd96 100644 --- a/drivers/pnp/pnpacpi/core.c +++ b/drivers/pnp/pnpacpi/core.c | |||
@@ -119,11 +119,25 @@ static int pnpacpi_disable_resources(struct pnp_dev *dev) | |||
119 | return ACPI_FAILURE(status) ? -ENODEV : 0; | 119 | return ACPI_FAILURE(status) ? -ENODEV : 0; |
120 | } | 120 | } |
121 | 121 | ||
122 | static int pnpacpi_suspend(struct pnp_dev *dev, pm_message_t state) | ||
123 | { | ||
124 | return acpi_bus_set_power((acpi_handle)dev->data, | ||
125 | acpi_pm_device_sleep_state(&dev->dev, | ||
126 | device_may_wakeup(&dev->dev), NULL)); | ||
127 | } | ||
128 | |||
129 | static int pnpacpi_resume(struct pnp_dev *dev) | ||
130 | { | ||
131 | return acpi_bus_set_power((acpi_handle)dev->data, ACPI_STATE_D0); | ||
132 | } | ||
133 | |||
122 | static struct pnp_protocol pnpacpi_protocol = { | 134 | static struct pnp_protocol pnpacpi_protocol = { |
123 | .name = "Plug and Play ACPI", | 135 | .name = "Plug and Play ACPI", |
124 | .get = pnpacpi_get_resources, | 136 | .get = pnpacpi_get_resources, |
125 | .set = pnpacpi_set_resources, | 137 | .set = pnpacpi_set_resources, |
126 | .disable = pnpacpi_disable_resources, | 138 | .disable = pnpacpi_disable_resources, |
139 | .suspend = pnpacpi_suspend, | ||
140 | .resume = pnpacpi_resume, | ||
127 | }; | 141 | }; |
128 | 142 | ||
129 | static int __init pnpacpi_add_device(struct acpi_device *device) | 143 | static int __init pnpacpi_add_device(struct acpi_device *device) |
diff --git a/include/linux/pnp.h b/include/linux/pnp.h index 2a1897e6f937..66edb2293184 100644 --- a/include/linux/pnp.h +++ b/include/linux/pnp.h | |||
@@ -335,6 +335,10 @@ struct pnp_protocol { | |||
335 | int (*set)(struct pnp_dev *dev, struct pnp_resource_table *res); | 335 | int (*set)(struct pnp_dev *dev, struct pnp_resource_table *res); |
336 | int (*disable)(struct pnp_dev *dev); | 336 | int (*disable)(struct pnp_dev *dev); |
337 | 337 | ||
338 | /* protocol specific suspend/resume */ | ||
339 | int (*suspend)(struct pnp_dev *dev, pm_message_t state); | ||
340 | int (*resume)(struct pnp_dev *dev); | ||
341 | |||
338 | /* used by pnp layer only (look but don't touch) */ | 342 | /* used by pnp layer only (look but don't touch) */ |
339 | unsigned char number; /* protocol number*/ | 343 | unsigned char number; /* protocol number*/ |
340 | struct device dev; /* link to driver model */ | 344 | struct device dev; /* link to driver model */ |