cpu_cooling.h 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. /*
  2. * linux/include/linux/cpu_cooling.h
  3. *
  4. * Copyright (C) 2012 Samsung Electronics Co., Ltd(http://www.samsung.com)
  5. * Copyright (C) 2012 Amit Daniel <amit.kachhap@linaro.org>
  6. *
  7. * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation; version 2 of the License.
  11. *
  12. * This program is distributed in the hope that it will be useful, but
  13. * WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. * General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License along
  18. * with this program; if not, write to the Free Software Foundation, Inc.,
  19. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  20. *
  21. * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  22. */
  23. #ifndef __CPU_COOLING_H__
  24. #define __CPU_COOLING_H__
  25. #include <linux/of.h>
  26. #include <linux/thermal.h>
  27. #include <linux/cpumask.h>
  28. struct cpufreq_policy;
  29. typedef int (*get_static_t)(cpumask_t *cpumask, int interval,
  30. unsigned long voltage, u32 *power);
  31. #ifdef CONFIG_CPU_THERMAL
  32. /**
  33. * cpufreq_cooling_register - function to create cpufreq cooling device.
  34. * @policy: cpufreq policy.
  35. */
  36. struct thermal_cooling_device *
  37. cpufreq_cooling_register(struct cpufreq_policy *policy);
  38. /**
  39. * cpufreq_cooling_unregister - function to remove cpufreq cooling device.
  40. * @cdev: thermal cooling device pointer.
  41. */
  42. void cpufreq_cooling_unregister(struct thermal_cooling_device *cdev);
  43. #else /* !CONFIG_CPU_THERMAL */
  44. static inline struct thermal_cooling_device *
  45. cpufreq_cooling_register(struct cpufreq_policy *policy)
  46. {
  47. return ERR_PTR(-ENOSYS);
  48. }
  49. static inline
  50. void cpufreq_cooling_unregister(struct thermal_cooling_device *cdev)
  51. {
  52. return;
  53. }
  54. #endif /* CONFIG_CPU_THERMAL */
  55. #if defined(CONFIG_THERMAL_OF) && defined(CONFIG_CPU_THERMAL)
  56. /**
  57. * of_cpufreq_cooling_register - create cpufreq cooling device based on DT.
  58. * @policy: cpufreq policy.
  59. */
  60. struct thermal_cooling_device *
  61. of_cpufreq_cooling_register(struct cpufreq_policy *policy);
  62. #else
  63. static inline struct thermal_cooling_device *
  64. of_cpufreq_cooling_register(struct cpufreq_policy *policy)
  65. {
  66. return NULL;
  67. }
  68. #endif /* defined(CONFIG_THERMAL_OF) && defined(CONFIG_CPU_THERMAL) */
  69. #endif /* __CPU_COOLING_H__ */