suspend.c 897 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. // SPDX-License-Identifier: GPL-2.0
  2. /*
  3. * Suspend-to-RAM support code for SH-Mobile ARM
  4. *
  5. * Copyright (C) 2011 Magnus Damm
  6. */
  7. #include <linux/pm.h>
  8. #include <linux/suspend.h>
  9. #include <linux/module.h>
  10. #include <linux/err.h>
  11. #include <linux/cpu.h>
  12. #include <asm/io.h>
  13. #include <asm/system_misc.h>
  14. #include "common.h"
  15. static int shmobile_suspend_default_enter(suspend_state_t suspend_state)
  16. {
  17. cpu_do_idle();
  18. return 0;
  19. }
  20. static int shmobile_suspend_begin(suspend_state_t state)
  21. {
  22. cpu_idle_poll_ctrl(true);
  23. return 0;
  24. }
  25. static void shmobile_suspend_end(void)
  26. {
  27. cpu_idle_poll_ctrl(false);
  28. }
  29. struct platform_suspend_ops shmobile_suspend_ops = {
  30. .begin = shmobile_suspend_begin,
  31. .end = shmobile_suspend_end,
  32. .enter = shmobile_suspend_default_enter,
  33. .valid = suspend_valid_only_mem,
  34. };
  35. int __init shmobile_suspend_init(void)
  36. {
  37. suspend_set_ops(&shmobile_suspend_ops);
  38. return 0;
  39. }