pm.c 1021 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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. #include "core.h"
  12. #define HIGHBANK_SUSPEND_PARAM \
  13. ((0 << PSCI_0_2_POWER_STATE_ID_SHIFT) | \
  14. (1 << PSCI_0_2_POWER_STATE_AFFL_SHIFT) | \
  15. (PSCI_POWER_STATE_TYPE_POWER_DOWN << PSCI_0_2_POWER_STATE_TYPE_SHIFT))
  16. static int highbank_suspend_finish(unsigned long val)
  17. {
  18. return psci_ops.cpu_suspend(HIGHBANK_SUSPEND_PARAM, __pa(cpu_resume));
  19. }
  20. static int highbank_pm_enter(suspend_state_t state)
  21. {
  22. cpu_pm_enter();
  23. cpu_cluster_pm_enter();
  24. cpu_suspend(0, highbank_suspend_finish);
  25. cpu_cluster_pm_exit();
  26. cpu_pm_exit();
  27. return 0;
  28. }
  29. static const struct platform_suspend_ops highbank_pm_ops = {
  30. .enter = highbank_pm_enter,
  31. .valid = suspend_valid_only_mem,
  32. };
  33. void __init highbank_pm_init(void)
  34. {
  35. if (!psci_ops.cpu_suspend)
  36. return;
  37. suspend_set_ops(&highbank_pm_ops);
  38. }