pm-imx6q.c 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /*
  2. * Copyright 2011 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_set_cpu_jump(0, v7_cpu_resume);
  34. /* Zzz ... */
  35. cpu_suspend(0, imx6q_suspend_finish);
  36. imx_smp_prepare();
  37. imx_gpc_post_resume();
  38. imx6q_set_lpm(WAIT_CLOCKED);
  39. break;
  40. default:
  41. return -EINVAL;
  42. }
  43. return 0;
  44. }
  45. static const struct platform_suspend_ops imx6q_pm_ops = {
  46. .enter = imx6q_pm_enter,
  47. .valid = suspend_valid_only_mem,
  48. };
  49. void __init imx6q_pm_init(void)
  50. {
  51. suspend_set_ops(&imx6q_pm_ops);
  52. }