pm-imx6q.c 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /*
  2. * Copyright 2011-2013 Freescale Semiconductor, Inc.
  3. * Copyright 2011 Linaro Ltd.
  4. *
  5. * The code contained herein is licensed under the GNU General Public
  6. * License. You may obtain a copy of the GNU General Public License
  7. * Version 2 or later at the following locations:
  8. *
  9. * http://www.opensource.org/licenses/gpl-license.html
  10. * http://www.gnu.org/copyleft/gpl.html
  11. */
  12. #include <linux/init.h>
  13. #include <linux/io.h>
  14. #include <linux/of.h>
  15. #include <linux/suspend.h>
  16. #include <asm/cacheflush.h>
  17. #include <asm/proc-fns.h>
  18. #include <asm/suspend.h>
  19. #include <asm/hardware/cache-l2x0.h>
  20. #include "common.h"
  21. #include "hardware.h"
  22. static int imx6q_suspend_finish(unsigned long val)
  23. {
  24. cpu_do_idle();
  25. return 0;
  26. }
  27. static int imx6q_pm_enter(suspend_state_t state)
  28. {
  29. switch (state) {
  30. case PM_SUSPEND_MEM:
  31. imx6q_set_lpm(STOP_POWER_OFF);
  32. imx_gpc_pre_suspend();
  33. imx_anatop_pre_suspend();
  34. imx_set_cpu_jump(0, v7_cpu_resume);
  35. /* Zzz ... */
  36. cpu_suspend(0, imx6q_suspend_finish);
  37. imx_smp_prepare();
  38. imx_anatop_post_resume();
  39. imx_gpc_post_resume();
  40. imx6q_set_lpm(WAIT_CLOCKED);
  41. break;
  42. default:
  43. return -EINVAL;
  44. }
  45. return 0;
  46. }
  47. static const struct platform_suspend_ops imx6q_pm_ops = {
  48. .enter = imx6q_pm_enter,
  49. .valid = suspend_valid_only_mem,
  50. };
  51. void __init imx6q_pm_init(void)
  52. {
  53. suspend_set_ops(&imx6q_pm_ops);
  54. }