diff options
author | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2012-11-27 07:42:42 -0500 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2012-11-27 07:42:42 -0500 |
commit | 45c36462aef0cccadb7755ea4edc78d13334a2be (patch) | |
tree | d707b2863494452585941d3818347005f34c636e /include/acpi | |
parent | c4e050376c69bb9d67895842665264df2a2004d9 (diff) | |
parent | b88ce2a41562d1a9554f209e0f31a32d9f473794 (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.h | 72 |
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 { | |||
201 | struct acpi_device_power_state { | 201 | struct 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); |
340 | int acpi_bus_get_status(struct acpi_device *device); | 341 | int acpi_bus_get_status(struct acpi_device *device); |
341 | int acpi_bus_set_power(acpi_handle handle, int state); | 342 | int acpi_bus_set_power(acpi_handle handle, int state); |
343 | int acpi_device_set_power(struct acpi_device *device, int state); | ||
342 | int acpi_bus_update_power(acpi_handle handle, int *state_p); | 344 | int acpi_bus_update_power(acpi_handle handle, int *state_p); |
343 | bool acpi_bus_power_manageable(acpi_handle handle); | 345 | bool acpi_bus_power_manageable(acpi_handle handle); |
344 | bool acpi_bus_can_wakeup(acpi_handle handle); | 346 | bool acpi_bus_can_wakeup(acpi_handle handle); |
@@ -416,30 +418,94 @@ int acpi_enable_wakeup_device_power(struct acpi_device *dev, int state); | |||
416 | int acpi_disable_wakeup_device_power(struct acpi_device *dev); | 418 | int acpi_disable_wakeup_device_power(struct acpi_device *dev); |
417 | 419 | ||
418 | #ifdef CONFIG_PM | 420 | #ifdef CONFIG_PM |
421 | acpi_status acpi_add_pm_notifier(struct acpi_device *adev, | ||
422 | acpi_notify_handler handler, void *context); | ||
423 | acpi_status acpi_remove_pm_notifier(struct acpi_device *adev, | ||
424 | acpi_notify_handler handler); | ||
425 | int acpi_device_power_state(struct device *dev, struct acpi_device *adev, | ||
426 | u32 target_state, int d_max_in, int *d_min_p); | ||
419 | int acpi_pm_device_sleep_state(struct device *, int *, int); | 427 | int acpi_pm_device_sleep_state(struct device *, int *, int); |
420 | #else | 428 | #else |
421 | static inline int acpi_pm_device_sleep_state(struct device *d, int *p, int m) | 429 | static 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 | } | ||
435 | static inline acpi_status acpi_remove_pm_notifier(struct acpi_device *adev, | ||
436 | acpi_notify_handler handler) | ||
437 | { | ||
438 | return AE_SUPPORT; | ||
439 | } | ||
440 | static 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 | } |
446 | static 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 | } | ||
453 | static 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 |
460 | int __acpi_device_run_wake(struct acpi_device *, bool); | ||
430 | int acpi_pm_device_run_wake(struct device *, bool); | 461 | int acpi_pm_device_run_wake(struct device *, bool); |
431 | int acpi_pm_device_sleep_wake(struct device *, bool); | ||
432 | #else | 462 | #else |
463 | static inline int __acpi_device_run_wake(struct acpi_device *adev, bool en) | ||
464 | { | ||
465 | return -ENODEV; | ||
466 | } | ||
433 | static inline int acpi_pm_device_run_wake(struct device *dev, bool enable) | 467 | static 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 | ||
474 | int __acpi_device_sleep_wake(struct acpi_device *, u32, bool); | ||
475 | int acpi_pm_device_sleep_wake(struct device *, bool); | ||
476 | #else | ||
477 | static inline int __acpi_device_sleep_wake(struct acpi_device *adev, | ||
478 | u32 target_state, bool enable) | ||
479 | { | ||
480 | return -ENODEV; | ||
481 | } | ||
437 | static inline int acpi_pm_device_sleep_wake(struct device *dev, bool enable) | 482 | static 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 | ||
489 | u32 acpi_target_system_state(void); | ||
490 | #else | ||
491 | static inline u32 acpi_target_system_state(void) { return ACPI_STATE_S0; } | ||
492 | #endif | ||
493 | |||
494 | static inline bool acpi_device_power_manageable(struct acpi_device *adev) | ||
495 | { | ||
496 | return adev->flags.power_manageable; | ||
497 | } | ||
498 | |||
499 | static inline bool acpi_device_can_wakeup(struct acpi_device *adev) | ||
500 | { | ||
501 | return adev->wakeup.flags.valid; | ||
502 | } | ||
503 | |||
504 | static 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 | ||
445 | static inline int register_acpi_bus_type(void *bus) { return 0; } | 511 | static inline int register_acpi_bus_type(void *bus) { return 0; } |