suspend.c 1.0 KB

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