cpuidle.c 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /*
  2. * CPUIdle support code for SH-Mobile ARM
  3. *
  4. * Copyright (C) 2011 Magnus Damm
  5. *
  6. * This file is subject to the terms and conditions of the GNU General Public
  7. * License. See the file "COPYING" in the main directory of this archive
  8. * for more details.
  9. */
  10. #include <linux/pm.h>
  11. #include <linux/cpuidle.h>
  12. #include <linux/suspend.h>
  13. #include <linux/module.h>
  14. #include <linux/err.h>
  15. #include <asm/cpuidle.h>
  16. #include <asm/io.h>
  17. static struct cpuidle_device shmobile_cpuidle_dev;
  18. static struct cpuidle_driver shmobile_cpuidle_default_driver = {
  19. .name = "shmobile_cpuidle",
  20. .owner = THIS_MODULE,
  21. .states[0] = ARM_CPUIDLE_WFI_STATE,
  22. .safe_state_index = 0, /* C1 */
  23. .state_count = 1,
  24. };
  25. static struct cpuidle_driver *cpuidle_drv = &shmobile_cpuidle_default_driver;
  26. void __init shmobile_cpuidle_set_driver(struct cpuidle_driver *drv)
  27. {
  28. cpuidle_drv = drv;
  29. }
  30. int __init shmobile_cpuidle_init(void)
  31. {
  32. struct cpuidle_device *dev = &shmobile_cpuidle_dev;
  33. cpuidle_register_driver(cpuidle_drv);
  34. dev->state_count = cpuidle_drv->state_count;
  35. cpuidle_register_device(dev);
  36. return 0;
  37. }