cpu_cooling.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * linux/include/linux/cpu_cooling.h
  4. *
  5. * Copyright (C) 2012 Samsung Electronics Co., Ltd(http://www.samsung.com)
  6. * Copyright (C) 2012 Amit Daniel <[email protected]>
  7. *
  8. * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  9. *
  10. * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  11. */
  12. #ifndef __CPU_COOLING_H__
  13. #define __CPU_COOLING_H__
  14. #include <linux/of.h>
  15. #include <linux/thermal.h>
  16. #include <linux/cpumask.h>
  17. struct cpufreq_policy;
  18. #ifdef CONFIG_CPU_FREQ_THERMAL
  19. /**
  20. * cpufreq_cooling_register - function to create cpufreq cooling device.
  21. * @policy: cpufreq policy.
  22. */
  23. struct thermal_cooling_device *
  24. cpufreq_cooling_register(struct cpufreq_policy *policy);
  25. /**
  26. * cpufreq_cooling_unregister - function to remove cpufreq cooling device.
  27. * @cdev: thermal cooling device pointer.
  28. */
  29. void cpufreq_cooling_unregister(struct thermal_cooling_device *cdev);
  30. /**
  31. * of_cpufreq_cooling_register - create cpufreq cooling device based on DT.
  32. * @policy: cpufreq policy.
  33. */
  34. struct thermal_cooling_device *
  35. of_cpufreq_cooling_register(struct cpufreq_policy *policy);
  36. #else /* !CONFIG_CPU_FREQ_THERMAL */
  37. static inline struct thermal_cooling_device *
  38. cpufreq_cooling_register(struct cpufreq_policy *policy)
  39. {
  40. return ERR_PTR(-ENOSYS);
  41. }
  42. static inline
  43. void cpufreq_cooling_unregister(struct thermal_cooling_device *cdev)
  44. {
  45. return;
  46. }
  47. static inline struct thermal_cooling_device *
  48. of_cpufreq_cooling_register(struct cpufreq_policy *policy)
  49. {
  50. return NULL;
  51. }
  52. #endif /* CONFIG_CPU_FREQ_THERMAL */
  53. struct cpuidle_driver;
  54. #ifdef CONFIG_CPU_IDLE_THERMAL
  55. void cpuidle_cooling_register(struct cpuidle_driver *drv);
  56. #else /* CONFIG_CPU_IDLE_THERMAL */
  57. static inline void cpuidle_cooling_register(struct cpuidle_driver *drv)
  58. {
  59. }
  60. #endif /* CONFIG_CPU_IDLE_THERMAL */
  61. #endif /* __CPU_COOLING_H__ */