thermal_netlink.h 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /*
  3. * Copyright (C) Linaro Ltd 2020
  4. * Author: Daniel Lezcano <daniel.lezcano@linaro.org>
  5. */
  6. struct thermal_genl_cpu_caps {
  7. int cpu;
  8. int performance;
  9. int efficiency;
  10. };
  11. enum thermal_genl_multicast_groups {
  12. THERMAL_GENL_SAMPLING_GROUP = 0,
  13. THERMAL_GENL_EVENT_GROUP = 1,
  14. THERMAL_GENL_MAX_GROUP = THERMAL_GENL_EVENT_GROUP,
  15. };
  16. #define THERMAL_NOTIFY_BIND 0
  17. #define THERMAL_NOTIFY_UNBIND 1
  18. struct thermal_genl_notify {
  19. int mcgrp;
  20. };
  21. struct thermal_zone_device;
  22. struct thermal_trip;
  23. struct thermal_cooling_device;
  24. /* Netlink notification function */
  25. #ifdef CONFIG_THERMAL_NETLINK
  26. int __init thermal_netlink_init(void);
  27. void __init thermal_netlink_exit(void);
  28. int thermal_genl_register_notifier(struct notifier_block *nb);
  29. int thermal_genl_unregister_notifier(struct notifier_block *nb);
  30. int thermal_notify_tz_create(const struct thermal_zone_device *tz);
  31. int thermal_notify_tz_delete(const struct thermal_zone_device *tz);
  32. int thermal_notify_tz_enable(const struct thermal_zone_device *tz);
  33. int thermal_notify_tz_disable(const struct thermal_zone_device *tz);
  34. int thermal_notify_tz_trip_down(const struct thermal_zone_device *tz,
  35. const struct thermal_trip *trip);
  36. int thermal_notify_tz_trip_up(const struct thermal_zone_device *tz,
  37. const struct thermal_trip *trip);
  38. int thermal_notify_tz_trip_change(const struct thermal_zone_device *tz,
  39. const struct thermal_trip *trip);
  40. int thermal_notify_cdev_state_update(const struct thermal_cooling_device *cdev,
  41. int state);
  42. int thermal_notify_cdev_add(const struct thermal_cooling_device *cdev);
  43. int thermal_notify_cdev_delete(const struct thermal_cooling_device *cdev);
  44. int thermal_notify_tz_gov_change(const struct thermal_zone_device *tz,
  45. const char *name);
  46. int thermal_genl_sampling_temp(int id, int temp);
  47. int thermal_genl_cpu_capability_event(int count,
  48. struct thermal_genl_cpu_caps *caps);
  49. int thermal_notify_threshold_add(const struct thermal_zone_device *tz,
  50. int temperature, int direction);
  51. int thermal_notify_threshold_delete(const struct thermal_zone_device *tz,
  52. int temperature, int direction);
  53. int thermal_notify_threshold_flush(const struct thermal_zone_device *tz);
  54. int thermal_notify_threshold_down(const struct thermal_zone_device *tz);
  55. int thermal_notify_threshold_up(const struct thermal_zone_device *tz);
  56. #else
  57. static inline int thermal_netlink_init(void)
  58. {
  59. return 0;
  60. }
  61. static inline int thermal_notify_tz_create(const struct thermal_zone_device *tz)
  62. {
  63. return 0;
  64. }
  65. static inline int thermal_genl_register_notifier(struct notifier_block *nb)
  66. {
  67. return 0;
  68. }
  69. static inline int thermal_genl_unregister_notifier(struct notifier_block *nb)
  70. {
  71. return 0;
  72. }
  73. static inline int thermal_notify_tz_delete(const struct thermal_zone_device *tz)
  74. {
  75. return 0;
  76. }
  77. static inline int thermal_notify_tz_enable(const struct thermal_zone_device *tz)
  78. {
  79. return 0;
  80. }
  81. static inline int thermal_notify_tz_disable(const struct thermal_zone_device *tz)
  82. {
  83. return 0;
  84. }
  85. static inline int thermal_notify_tz_trip_down(const struct thermal_zone_device *tz,
  86. const struct thermal_trip *trip)
  87. {
  88. return 0;
  89. }
  90. static inline int thermal_notify_tz_trip_up(const struct thermal_zone_device *tz,
  91. const struct thermal_trip *trip)
  92. {
  93. return 0;
  94. }
  95. static inline int thermal_notify_tz_trip_change(const struct thermal_zone_device *tz,
  96. const struct thermal_trip *trip)
  97. {
  98. return 0;
  99. }
  100. static inline int thermal_notify_cdev_state_update(const struct thermal_cooling_device *cdev,
  101. int state)
  102. {
  103. return 0;
  104. }
  105. static inline int thermal_notify_cdev_add(const struct thermal_cooling_device *cdev)
  106. {
  107. return 0;
  108. }
  109. static inline int thermal_notify_cdev_delete(const struct thermal_cooling_device *cdev)
  110. {
  111. return 0;
  112. }
  113. static inline int thermal_notify_tz_gov_change(const struct thermal_zone_device *tz,
  114. const char *name)
  115. {
  116. return 0;
  117. }
  118. static inline int thermal_genl_sampling_temp(int id, int temp)
  119. {
  120. return 0;
  121. }
  122. static inline int thermal_genl_cpu_capability_event(int count, struct thermal_genl_cpu_caps *caps)
  123. {
  124. return 0;
  125. }
  126. static inline int thermal_notify_threshold_add(const struct thermal_zone_device *tz,
  127. int temperature, int direction)
  128. {
  129. return 0;
  130. }
  131. static inline int thermal_notify_threshold_delete(const struct thermal_zone_device *tz,
  132. int temperature, int direction)
  133. {
  134. return 0;
  135. }
  136. static inline int thermal_notify_threshold_flush(const struct thermal_zone_device *tz)
  137. {
  138. return 0;
  139. }
  140. static inline int thermal_notify_threshold_down(const struct thermal_zone_device *tz)
  141. {
  142. return 0;
  143. }
  144. static inline int thermal_notify_threshold_up(const struct thermal_zone_device *tz)
  145. {
  146. return 0;
  147. }
  148. static inline void __init thermal_netlink_exit(void) {}
  149. #endif /* CONFIG_THERMAL_NETLINK */