cpuidle-imx6sl.c 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /*
  2. * Copyright (C) 2014 Freescale Semiconductor, Inc.
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License version 2 as
  6. * published by the Free Software Foundation.
  7. */
  8. #include <linux/cpuidle.h>
  9. #include <linux/module.h>
  10. #include <asm/cpuidle.h>
  11. #include "common.h"
  12. #include "cpuidle.h"
  13. static int imx6sl_enter_wait(struct cpuidle_device *dev,
  14. struct cpuidle_driver *drv, int index)
  15. {
  16. imx6_set_lpm(WAIT_UNCLOCKED);
  17. /*
  18. * Software workaround for ERR005311, see function
  19. * description for details.
  20. */
  21. imx6sl_set_wait_clk(true);
  22. cpu_do_idle();
  23. imx6sl_set_wait_clk(false);
  24. imx6_set_lpm(WAIT_CLOCKED);
  25. return index;
  26. }
  27. static struct cpuidle_driver imx6sl_cpuidle_driver = {
  28. .name = "imx6sl_cpuidle",
  29. .owner = THIS_MODULE,
  30. .states = {
  31. /* WFI */
  32. ARM_CPUIDLE_WFI_STATE,
  33. /* WAIT */
  34. {
  35. .exit_latency = 50,
  36. .target_residency = 75,
  37. .flags = CPUIDLE_FLAG_TIMER_STOP,
  38. .enter = imx6sl_enter_wait,
  39. .name = "WAIT",
  40. .desc = "Clock off",
  41. },
  42. },
  43. .state_count = 2,
  44. .safe_state_index = 0,
  45. };
  46. int __init imx6sl_cpuidle_init(void)
  47. {
  48. return cpuidle_register(&imx6sl_cpuidle_driver, NULL);
  49. }