pm.c 657 B

123456789101112131415161718192021222324252627282930313233
  1. // SPDX-License-Identifier: GPL-2.0
  2. #include <linux/init.h>
  3. #include <linux/suspend.h>
  4. #include <asm/suspend.h>
  5. #include "smc.h"
  6. static int tango_pm_powerdown(unsigned long arg)
  7. {
  8. tango_suspend(__pa_symbol(cpu_resume));
  9. return -EIO; /* tango_suspend has failed */
  10. }
  11. static int tango_pm_enter(suspend_state_t state)
  12. {
  13. if (state == PM_SUSPEND_MEM)
  14. return cpu_suspend(0, tango_pm_powerdown);
  15. return -EINVAL;
  16. }
  17. static const struct platform_suspend_ops tango_pm_ops = {
  18. .enter = tango_pm_enter,
  19. .valid = suspend_valid_only_mem,
  20. };
  21. static int __init tango_pm_init(void)
  22. {
  23. suspend_set_ops(&tango_pm_ops);
  24. return 0;
  25. }
  26. late_initcall(tango_pm_init);