Merge branch 'suspend' into test
authorLen Brown <len.brown@intel.com>
Thu, 23 Oct 2008 03:28:46 +0000 (23:28 -0400)
committerLen Brown <len.brown@intel.com>
Thu, 23 Oct 2008 03:28:46 +0000 (23:28 -0400)
1  2 
drivers/acpi/sleep/main.c

index 4c21480b58207c0132af414bb3c361204c3e0806,2a312702225f95dcf2401e803adfefe0c9a4c13f..cc344d4252c94d4da031480a4f8ee88448b75458
  #include "sleep.h"
  
  u8 sleep_states[ACPI_S_STATE_COUNT];
 +static u32 acpi_target_sleep_state = ACPI_STATE_S0;
  
+ static void acpi_sleep_tts_switch(u32 acpi_state)
+ {
+       union acpi_object in_arg = { ACPI_TYPE_INTEGER };
+       struct acpi_object_list arg_list = { 1, &in_arg };
+       acpi_status status = AE_OK;
+       in_arg.integer.value = acpi_state;
+       status = acpi_evaluate_object(NULL, "\\_TTS", &arg_list, NULL);
+       if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) {
+               /*
+                * OS can't evaluate the _TTS object correctly. Some warning
+                * message will be printed. But it won't break anything.
+                */
+               printk(KERN_NOTICE "Failure in evaluating _TTS object\n");
+       }
+ }
+ static int tts_notify_reboot(struct notifier_block *this,
+                       unsigned long code, void *x)
+ {
+       acpi_sleep_tts_switch(ACPI_STATE_S5);
+       return NOTIFY_DONE;
+ }
+ static struct notifier_block tts_notifier = {
+       .notifier_call  = tts_notify_reboot,
+       .next           = NULL,
+       .priority       = 0,
+ };
  static int acpi_sleep_prepare(u32 acpi_state)
  {
  #ifdef CONFIG_ACPI_SLEEP
@@@ -130,8 -162,9 +161,9 @@@ static void acpi_pm_end(void
         * failing transition to a sleep state.
         */
        acpi_target_sleep_state = ACPI_STATE_S0;
+       acpi_sleep_tts_switch(acpi_target_sleep_state);
  }
 -#endif /* CONFIG_PM_SLEEP */
 +#endif /* CONFIG_ACPI_SLEEP */
  
  #ifdef CONFIG_SUSPEND
  extern void do_suspend_lowlevel(void);