aboutsummaryrefslogtreecommitdiffstats
path: root/include/acpi
diff options
context:
space:
mode:
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>2012-11-27 07:42:42 -0500
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2012-11-27 07:42:42 -0500
commit45c36462aef0cccadb7755ea4edc78d13334a2be (patch)
treed707b2863494452585941d3818347005f34c636e /include/acpi
parentc4e050376c69bb9d67895842665264df2a2004d9 (diff)
parentb88ce2a41562d1a9554f209e0f31a32d9f473794 (diff)
Merge branch 'acpi-dev-pm' into acpi-enumeration
Subsequent commits in this branch will depend on 'acpi-dev-pm' material.
Diffstat (limited to 'include/acpi')
-rw-r--r--include/acpi/acpi_bus.h72
1 files changed, 69 insertions, 3 deletions
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h
index d1659904f2a0..c4ed4c2389c7 100644
--- a/include/acpi/acpi_bus.h
+++ b/include/acpi/acpi_bus.h
@@ -201,6 +201,7 @@ struct acpi_device_power_flags {
201struct acpi_device_power_state { 201struct acpi_device_power_state {
202 struct { 202 struct {
203 u8 valid:1; 203 u8 valid:1;
204 u8 os_accessible:1;
204 u8 explicit_set:1; /* _PSx present? */ 205 u8 explicit_set:1; /* _PSx present? */
205 u8 reserved:6; 206 u8 reserved:6;
206 } flags; 207 } flags;
@@ -339,6 +340,7 @@ acpi_status acpi_bus_get_status_handle(acpi_handle handle,
339 unsigned long long *sta); 340 unsigned long long *sta);
340int acpi_bus_get_status(struct acpi_device *device); 341int acpi_bus_get_status(struct acpi_device *device);
341int acpi_bus_set_power(acpi_handle handle, int state); 342int acpi_bus_set_power(acpi_handle handle, int state);
343int acpi_device_set_power(struct acpi_device *device, int state);
342int acpi_bus_update_power(acpi_handle handle, int *state_p); 344int acpi_bus_update_power(acpi_handle handle, int *state_p);
343bool acpi_bus_power_manageable(acpi_handle handle); 345bool acpi_bus_power_manageable(acpi_handle handle);
344bool acpi_bus_can_wakeup(acpi_handle handle); 346bool acpi_bus_can_wakeup(acpi_handle handle);
@@ -416,30 +418,94 @@ int acpi_enable_wakeup_device_power(struct acpi_device *dev, int state);
416int acpi_disable_wakeup_device_power(struct acpi_device *dev); 418int acpi_disable_wakeup_device_power(struct acpi_device *dev);
417 419
418#ifdef CONFIG_PM 420#ifdef CONFIG_PM
421acpi_status acpi_add_pm_notifier(struct acpi_device *adev,
422 acpi_notify_handler handler, void *context);
423acpi_status acpi_remove_pm_notifier(struct acpi_device *adev,
424 acpi_notify_handler handler);
425int acpi_device_power_state(struct device *dev, struct acpi_device *adev,
426 u32 target_state, int d_max_in, int *d_min_p);
419int acpi_pm_device_sleep_state(struct device *, int *, int); 427int acpi_pm_device_sleep_state(struct device *, int *, int);
420#else 428#else
421static inline int acpi_pm_device_sleep_state(struct device *d, int *p, int m) 429static inline acpi_status acpi_add_pm_notifier(struct acpi_device *adev,
430 acpi_notify_handler handler,
431 void *context)
432{
433 return AE_SUPPORT;
434}
435static inline acpi_status acpi_remove_pm_notifier(struct acpi_device *adev,
436 acpi_notify_handler handler)
437{
438 return AE_SUPPORT;
439}
440static inline int __acpi_device_power_state(int m, int *p)
422{ 441{
423 if (p) 442 if (p)
424 *p = ACPI_STATE_D0; 443 *p = ACPI_STATE_D0;
425 return (m >= ACPI_STATE_D0 && m <= ACPI_STATE_D3) ? m : ACPI_STATE_D0; 444 return (m >= ACPI_STATE_D0 && m <= ACPI_STATE_D3) ? m : ACPI_STATE_D0;
426} 445}
446static inline int acpi_device_power_state(struct device *dev,
447 struct acpi_device *adev,
448 u32 target_state, int d_max_in,
449 int *d_min_p)
450{
451 return __acpi_device_power_state(d_max_in, d_min_p);
452}
453static inline int acpi_pm_device_sleep_state(struct device *d, int *p, int m)
454{
455 return __acpi_device_power_state(m, p);
456}
427#endif 457#endif
428 458
429#ifdef CONFIG_PM_SLEEP 459#ifdef CONFIG_PM_RUNTIME
460int __acpi_device_run_wake(struct acpi_device *, bool);
430int acpi_pm_device_run_wake(struct device *, bool); 461int acpi_pm_device_run_wake(struct device *, bool);
431int acpi_pm_device_sleep_wake(struct device *, bool);
432#else 462#else
463static inline int __acpi_device_run_wake(struct acpi_device *adev, bool en)
464{
465 return -ENODEV;
466}
433static inline int acpi_pm_device_run_wake(struct device *dev, bool enable) 467static inline int acpi_pm_device_run_wake(struct device *dev, bool enable)
434{ 468{
435 return -ENODEV; 469 return -ENODEV;
436} 470}
471#endif
472
473#ifdef CONFIG_PM_SLEEP
474int __acpi_device_sleep_wake(struct acpi_device *, u32, bool);
475int acpi_pm_device_sleep_wake(struct device *, bool);
476#else
477static inline int __acpi_device_sleep_wake(struct acpi_device *adev,
478 u32 target_state, bool enable)
479{
480 return -ENODEV;
481}
437static inline int acpi_pm_device_sleep_wake(struct device *dev, bool enable) 482static inline int acpi_pm_device_sleep_wake(struct device *dev, bool enable)
438{ 483{
439 return -ENODEV; 484 return -ENODEV;
440} 485}
441#endif 486#endif
442 487
488#ifdef CONFIG_ACPI_SLEEP
489u32 acpi_target_system_state(void);
490#else
491static inline u32 acpi_target_system_state(void) { return ACPI_STATE_S0; }
492#endif
493
494static inline bool acpi_device_power_manageable(struct acpi_device *adev)
495{
496 return adev->flags.power_manageable;
497}
498
499static inline bool acpi_device_can_wakeup(struct acpi_device *adev)
500{
501 return adev->wakeup.flags.valid;
502}
503
504static inline bool acpi_device_can_poweroff(struct acpi_device *adev)
505{
506 return adev->power.states[ACPI_STATE_D3_COLD].flags.os_accessible;
507}
508
443#else /* CONFIG_ACPI */ 509#else /* CONFIG_ACPI */
444 510
445static inline int register_acpi_bus_type(void *bus) { return 0; } 511static inline int register_acpi_bus_type(void *bus) { return 0; }