suspend.c 1008 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /*
  2. * Suspend-to-RAM support code for SH-Mobile ARM
  3. *
  4. * Copyright (C) 2011 Magnus Damm
  5. *
  6. * This file is subject to the terms and conditions of the GNU General Public
  7. * License. See the file "COPYING" in the main directory of this archive
  8. * for more details.
  9. */
  10. #include <linux/pm.h>
  11. #include <linux/suspend.h>
  12. #include <linux/module.h>
  13. #include <linux/err.h>
  14. #include <asm/system.h>
  15. #include <asm/io.h>
  16. static int shmobile_suspend_default_enter(suspend_state_t suspend_state)
  17. {
  18. cpu_do_idle();
  19. return 0;
  20. }
  21. static int shmobile_suspend_begin(suspend_state_t state)
  22. {
  23. disable_hlt();
  24. return 0;
  25. }
  26. static void shmobile_suspend_end(void)
  27. {
  28. enable_hlt();
  29. }
  30. struct platform_suspend_ops shmobile_suspend_ops = {
  31. .begin = shmobile_suspend_begin,
  32. .end = shmobile_suspend_end,
  33. .enter = shmobile_suspend_default_enter,
  34. .valid = suspend_valid_only_mem,
  35. };
  36. static int __init shmobile_suspend_init(void)
  37. {
  38. suspend_set_ops(&shmobile_suspend_ops);
  39. return 0;
  40. }
  41. late_initcall(shmobile_suspend_init);