cpuidle.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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. #define __cpuidle_method_section __used __section("__cpuidle_method_of_table")
  9. #else
  10. static inline int arm_cpuidle_simple_enter(struct cpuidle_device *dev,
  11. struct cpuidle_driver *drv, int index) { return -ENODEV; }
  12. #define __cpuidle_method_section __maybe_unused /* drop silently */
  13. #endif
  14. /* Common ARM WFI state */
  15. #define ARM_CPUIDLE_WFI_STATE_PWR(p) {\
  16. .enter = arm_cpuidle_simple_enter,\
  17. .exit_latency = 1,\
  18. .target_residency = 1,\
  19. .power_usage = p,\
  20. .name = "WFI",\
  21. .desc = "ARM WFI",\
  22. }
  23. /*
  24. * in case power_specified == 1, give a default WFI power value needed
  25. * by some governors
  26. */
  27. #define ARM_CPUIDLE_WFI_STATE ARM_CPUIDLE_WFI_STATE_PWR(UINT_MAX)
  28. struct device_node;
  29. struct cpuidle_ops {
  30. int (*suspend)(unsigned long arg);
  31. int (*init)(struct device_node *, int cpu);
  32. };
  33. struct of_cpuidle_method {
  34. const char *method;
  35. const struct cpuidle_ops *ops;
  36. };
  37. #define CPUIDLE_METHOD_OF_DECLARE(name, _method, _ops) \
  38. static const struct of_cpuidle_method __cpuidle_method_of_table_##name \
  39. __cpuidle_method_section = { .method = _method, .ops = _ops }
  40. extern int arm_cpuidle_suspend(int index);
  41. extern int arm_cpuidle_init(int cpu);
  42. struct arm_cpuidle_irq_context { };
  43. #define arm_cpuidle_save_irq_context(c) (void)c
  44. #define arm_cpuidle_restore_irq_context(c) (void)c
  45. #endif