pm.c 622 B

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