cpuidle.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef __ASM_ARM_CPUIDLE_H
  3. #define __ASM_ARM_CPUIDLE_H
  4. #include <asm/proc-fns.h>
  5. #ifdef CONFIG_CPU_IDLE
  6. extern int arm_cpuidle_simple_enter(struct cpuidle_device *dev,
  7. struct cpuidle_driver *drv, int index);
  8. #else
  9. static inline int arm_cpuidle_simple_enter(struct cpuidle_device *dev,
  10. struct cpuidle_driver *drv, int index) { return -ENODEV; }
  11. #endif
  12. /* Common ARM WFI state */
  13. #define ARM_CPUIDLE_WFI_STATE_PWR(p) {\
  14. .enter = arm_cpuidle_simple_enter,\
  15. .exit_latency = 1,\
  16. .target_residency = 1,\
  17. .power_usage = p,\
  18. .name = "WFI",\
  19. .desc = "ARM WFI",\
  20. }
  21. /*
  22. * in case power_specified == 1, give a default WFI power value needed
  23. * by some governors
  24. */
  25. #define ARM_CPUIDLE_WFI_STATE ARM_CPUIDLE_WFI_STATE_PWR(UINT_MAX)
  26. struct device_node;
  27. struct cpuidle_ops {
  28. int (*suspend)(unsigned long arg);
  29. int (*init)(struct device_node *, int cpu);
  30. };
  31. struct of_cpuidle_method {
  32. const char *method;
  33. const struct cpuidle_ops *ops;
  34. };
  35. #define CPUIDLE_METHOD_OF_DECLARE(name, _method, _ops) \
  36. static const struct of_cpuidle_method __cpuidle_method_of_table_##name \
  37. __used __section(__cpuidle_method_of_table) \
  38. = { .method = _method, .ops = _ops }
  39. extern int arm_cpuidle_suspend(int index);
  40. extern int arm_cpuidle_init(int cpu);
  41. #endif