pm.c 1002 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. // SPDX-License-Identifier: GPL-2.0-only
  2. /*
  3. * Copyright 2011 Calxeda, Inc.
  4. */
  5. #include <linux/cpu_pm.h>
  6. #include <linux/init.h>
  7. #include <linux/psci.h>
  8. #include <linux/suspend.h>
  9. #include <asm/suspend.h>
  10. #include <uapi/linux/psci.h>
  11. #define HIGHBANK_SUSPEND_PARAM \
  12. ((0 << PSCI_0_2_POWER_STATE_ID_SHIFT) | \
  13. (1 << PSCI_0_2_POWER_STATE_AFFL_SHIFT) | \
  14. (PSCI_POWER_STATE_TYPE_POWER_DOWN << PSCI_0_2_POWER_STATE_TYPE_SHIFT))
  15. static int highbank_suspend_finish(unsigned long val)
  16. {
  17. return psci_ops.cpu_suspend(HIGHBANK_SUSPEND_PARAM, __pa(cpu_resume));
  18. }
  19. static int highbank_pm_enter(suspend_state_t state)
  20. {
  21. cpu_pm_enter();
  22. cpu_cluster_pm_enter();
  23. cpu_suspend(0, highbank_suspend_finish);
  24. cpu_cluster_pm_exit();
  25. cpu_pm_exit();
  26. return 0;
  27. }
  28. static const struct platform_suspend_ops highbank_pm_ops = {
  29. .enter = highbank_pm_enter,
  30. .valid = suspend_valid_only_mem,
  31. };
  32. void __init highbank_pm_init(void)
  33. {
  34. if (!psci_ops.cpu_suspend)
  35. return;
  36. suspend_set_ops(&highbank_pm_ops);
  37. }