aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/acpi/sleep.c16
-rw-r--r--include/acpi/acpi_bus.h12
2 files changed, 18 insertions, 10 deletions
diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c
index 4754ff6e70e6..e807f4196f89 100644
--- a/drivers/acpi/sleep.c
+++ b/drivers/acpi/sleep.c
@@ -27,6 +27,8 @@
27 27
28u8 sleep_states[ACPI_S_STATE_COUNT]; 28u8 sleep_states[ACPI_S_STATE_COUNT];
29 29
30static u32 acpi_target_sleep_state = ACPI_STATE_S0;
31
30static void acpi_sleep_tts_switch(u32 acpi_state) 32static void acpi_sleep_tts_switch(u32 acpi_state)
31{ 33{
32 union acpi_object in_arg = { ACPI_TYPE_INTEGER }; 34 union acpi_object in_arg = { ACPI_TYPE_INTEGER };
@@ -79,8 +81,6 @@ static int acpi_sleep_prepare(u32 acpi_state)
79} 81}
80 82
81#ifdef CONFIG_ACPI_SLEEP 83#ifdef CONFIG_ACPI_SLEEP
82static u32 acpi_target_sleep_state = ACPI_STATE_S0;
83
84/* 84/*
85 * The ACPI specification wants us to save NVS memory regions during hibernation 85 * The ACPI specification wants us to save NVS memory regions during hibernation
86 * and to restore them during the subsequent resume. Windows does that also for 86 * and to restore them during the subsequent resume. Windows does that also for
@@ -562,7 +562,7 @@ int acpi_suspend(u32 acpi_state)
562 return -EINVAL; 562 return -EINVAL;
563} 563}
564 564
565#ifdef CONFIG_PM_SLEEP 565#ifdef CONFIG_PM_OPS
566/** 566/**
567 * acpi_pm_device_sleep_state - return preferred power state of ACPI device 567 * acpi_pm_device_sleep_state - return preferred power state of ACPI device
568 * in the system sleep state given by %acpi_target_sleep_state 568 * in the system sleep state given by %acpi_target_sleep_state
@@ -624,7 +624,7 @@ int acpi_pm_device_sleep_state(struct device *dev, int *d_min_p)
624 * can wake the system. _S0W may be valid, too. 624 * can wake the system. _S0W may be valid, too.
625 */ 625 */
626 if (acpi_target_sleep_state == ACPI_STATE_S0 || 626 if (acpi_target_sleep_state == ACPI_STATE_S0 ||
627 (device_may_wakeup(dev) && adev->wakeup.state.enabled && 627 (device_may_wakeup(dev) &&
628 adev->wakeup.sleep_state <= acpi_target_sleep_state)) { 628 adev->wakeup.sleep_state <= acpi_target_sleep_state)) {
629 acpi_status status; 629 acpi_status status;
630 630
@@ -632,7 +632,9 @@ int acpi_pm_device_sleep_state(struct device *dev, int *d_min_p)
632 status = acpi_evaluate_integer(handle, acpi_method, NULL, 632 status = acpi_evaluate_integer(handle, acpi_method, NULL,
633 &d_max); 633 &d_max);
634 if (ACPI_FAILURE(status)) { 634 if (ACPI_FAILURE(status)) {
635 d_max = d_min; 635 if (acpi_target_sleep_state != ACPI_STATE_S0 ||
636 status != AE_NOT_FOUND)
637 d_max = d_min;
636 } else if (d_max < d_min) { 638 } else if (d_max < d_min) {
637 /* Warn the user of the broken DSDT */ 639 /* Warn the user of the broken DSDT */
638 printk(KERN_WARNING "ACPI: Wrong value from %s\n", 640 printk(KERN_WARNING "ACPI: Wrong value from %s\n",
@@ -646,7 +648,9 @@ int acpi_pm_device_sleep_state(struct device *dev, int *d_min_p)
646 *d_min_p = d_min; 648 *d_min_p = d_min;
647 return d_max; 649 return d_max;
648} 650}
651#endif /* CONFIG_PM_OPS */
649 652
653#ifdef CONFIG_PM_SLEEP
650/** 654/**
651 * acpi_pm_device_sleep_wake - enable or disable the system wake-up 655 * acpi_pm_device_sleep_wake - enable or disable the system wake-up
652 * capability of given device 656 * capability of given device
@@ -677,7 +681,7 @@ int acpi_pm_device_sleep_wake(struct device *dev, bool enable)
677 681
678 return error; 682 return error;
679} 683}
680#endif 684#endif /* CONFIG_PM_SLEEP */
681 685
682static void acpi_power_off_prepare(void) 686static void acpi_power_off_prepare(void)
683{ 687{
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h
index a47bb908ddcd..359ef11725a6 100644
--- a/include/acpi/acpi_bus.h
+++ b/include/acpi/acpi_bus.h
@@ -389,21 +389,25 @@ struct acpi_pci_root *acpi_pci_find_root(acpi_handle handle);
389int acpi_enable_wakeup_device_power(struct acpi_device *dev, int state); 389int acpi_enable_wakeup_device_power(struct acpi_device *dev, int state);
390int acpi_disable_wakeup_device_power(struct acpi_device *dev); 390int acpi_disable_wakeup_device_power(struct acpi_device *dev);
391 391
392#ifdef CONFIG_PM_SLEEP 392#ifdef CONFIG_PM_OPS
393int acpi_pm_device_sleep_state(struct device *, int *); 393int acpi_pm_device_sleep_state(struct device *, int *);
394int acpi_pm_device_sleep_wake(struct device *, bool); 394#else
395#else /* !CONFIG_PM_SLEEP */
396static inline int acpi_pm_device_sleep_state(struct device *d, int *p) 395static inline int acpi_pm_device_sleep_state(struct device *d, int *p)
397{ 396{
398 if (p) 397 if (p)
399 *p = ACPI_STATE_D0; 398 *p = ACPI_STATE_D0;
400 return ACPI_STATE_D3; 399 return ACPI_STATE_D3;
401} 400}
401#endif
402
403#ifdef CONFIG_PM_SLEEP
404int acpi_pm_device_sleep_wake(struct device *, bool);
405#else
402static inline int acpi_pm_device_sleep_wake(struct device *dev, bool enable) 406static inline int acpi_pm_device_sleep_wake(struct device *dev, bool enable)
403{ 407{
404 return -ENODEV; 408 return -ENODEV;
405} 409}
406#endif /* !CONFIG_PM_SLEEP */ 410#endif
407 411
408#endif /* CONFIG_ACPI */ 412#endif /* CONFIG_ACPI */
409 413