suspend.c 1016 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 <linux/cpu.h>
  15. #include <asm/io.h>
  16. #include <asm/system_misc.h>
  17. static int shmobile_suspend_default_enter(suspend_state_t suspend_state)
  18. {
  19. cpu_do_idle();
  20. return 0;
  21. }
  22. static int shmobile_suspend_begin(suspend_state_t state)
  23. {
  24. cpu_idle_poll_ctrl(true);
  25. return 0;
  26. }
  27. static void shmobile_suspend_end(void)
  28. {
  29. cpu_idle_poll_ctrl(false);
  30. }
  31. struct platform_suspend_ops shmobile_suspend_ops = {
  32. .begin = shmobile_suspend_begin,
  33. .end = shmobile_suspend_end,
  34. .enter = shmobile_suspend_default_enter,
  35. .valid = suspend_valid_only_mem,
  36. };
  37. int __init shmobile_suspend_init(void)
  38. {
  39. suspend_set_ops(&shmobile_suspend_ops);
  40. return 0;
  41. }