aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/acpi.h
diff options
context:
space:
mode:
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>2012-11-01 20:41:01 -0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2012-11-14 18:15:18 -0500
commite5cc8ef31267317f3e177415c84e3f3602e5bfc9 (patch)
tree2bfdef81387d47b80918d673f2aca74568187427 /include/linux/acpi.h
parenta6ae7594b1b157e0e7976ed105a7be27d69a5361 (diff)
ACPI / PM: Provide ACPI PM callback routines for subsystems
Some bus types don't support power management natively, but generally there may be device nodes in ACPI tables corresponding to the devices whose bus types they are (under ACPI 5 those bus types may be SPI, I2C and platform). If that is the case, standard ACPI power management may be applied to those devices, although currently the kernel has no means for that. For this reason, provide a set of routines that may be used as power management callbacks for such devices. This may be done in three different ways. (1) Device drivers handling the devices in question may run acpi_dev_pm_attach() in their .probe() routines, which (on success) will cause the devices to be added to the general ACPI PM domain and ACPI power management will be used for them going forward. Then, acpi_dev_pm_detach() may be used to remove the devices from the general ACPI PM domain if ACPI power management is not necessary for them any more. (2) The devices' subsystems may use acpi_subsys_runtime_suspend(), acpi_subsys_runtime_resume(), acpi_subsys_prepare(), acpi_subsys_suspend_late(), acpi_subsys_resume_early() as their power management callbacks in the same way as the general ACPI PM domain does that. (3) The devices' drivers may execute acpi_dev_suspend_late(), acpi_dev_resume_early(), acpi_dev_runtime_suspend(), acpi_dev_runtime_resume() from their power management callbacks as appropriate, if that's absolutely necessary, but it is not recommended to do that, because such drivers may not work without ACPI support as a result. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'include/linux/acpi.h')
-rw-r--r--include/linux/acpi.h34
1 files changed, 34 insertions, 0 deletions
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index 90be98981102..0676b6ac57fa 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -430,4 +430,38 @@ acpi_status acpi_os_prepare_sleep(u8 sleep_state,
430#define acpi_os_set_prepare_sleep(func, pm1a_ctrl, pm1b_ctrl) do { } while (0) 430#define acpi_os_set_prepare_sleep(func, pm1a_ctrl, pm1b_ctrl) do { } while (0)
431#endif 431#endif
432 432
433#if defined(CONFIG_ACPI) && defined(CONFIG_PM_RUNTIME)
434int acpi_dev_runtime_suspend(struct device *dev);
435int acpi_dev_runtime_resume(struct device *dev);
436int acpi_subsys_runtime_suspend(struct device *dev);
437int acpi_subsys_runtime_resume(struct device *dev);
438#else
439static inline int acpi_dev_runtime_suspend(struct device *dev) { return 0; }
440static inline int acpi_dev_runtime_resume(struct device *dev) { return 0; }
441static inline int acpi_subsys_runtime_suspend(struct device *dev) { return 0; }
442static inline int acpi_subsys_runtime_resume(struct device *dev) { return 0; }
443#endif
444
445#ifdef CONFIG_ACPI_SLEEP
446int acpi_dev_suspend_late(struct device *dev);
447int acpi_dev_resume_early(struct device *dev);
448int acpi_subsys_prepare(struct device *dev);
449int acpi_subsys_suspend_late(struct device *dev);
450int acpi_subsys_resume_early(struct device *dev);
451#else
452static inline int acpi_dev_suspend_late(struct device *dev) { return 0; }
453static inline int acpi_dev_resume_early(struct device *dev) { return 0; }
454static inline int acpi_subsys_prepare(struct device *dev) { return 0; }
455static inline int acpi_subsys_suspend_late(struct device *dev) { return 0; }
456static inline int acpi_subsys_resume_early(struct device *dev) { return 0; }
457#endif
458
459#if defined(CONFIG_ACPI) && defined(CONFIG_PM)
460int acpi_dev_pm_attach(struct device *dev);
461int acpi_dev_pm_detach(struct device *dev);
462#else
463static inline int acpi_dev_pm_attach(struct device *dev) { return -ENODEV; }
464static inline void acpi_dev_pm_detach(struct device *dev) {}
465#endif
466
433#endif /*_LINUX_ACPI_H*/ 467#endif /*_LINUX_ACPI_H*/