thermal_netlink.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  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. #else
  50. static inline int thermal_netlink_init(void)
  51. {
  52. return 0;
  53. }
  54. static inline int thermal_notify_tz_create(const struct thermal_zone_device *tz)
  55. {
  56. return 0;
  57. }
  58. static inline int thermal_genl_register_notifier(struct notifier_block *nb)
  59. {
  60. return 0;
  61. }
  62. static inline int thermal_genl_unregister_notifier(struct notifier_block *nb)
  63. {
  64. return 0;
  65. }
  66. static inline int thermal_notify_tz_delete(const struct thermal_zone_device *tz)
  67. {
  68. return 0;
  69. }
  70. static inline int thermal_notify_tz_enable(const struct thermal_zone_device *tz)
  71. {
  72. return 0;
  73. }
  74. static inline int thermal_notify_tz_disable(const struct thermal_zone_device *tz)
  75. {
  76. return 0;
  77. }
  78. static inline int thermal_notify_tz_trip_down(const struct thermal_zone_device *tz,
  79. const struct thermal_trip *trip)
  80. {
  81. return 0;
  82. }
  83. static inline int thermal_notify_tz_trip_up(const struct thermal_zone_device *tz,
  84. const struct thermal_trip *trip)
  85. {
  86. return 0;
  87. }
  88. static inline int thermal_notify_tz_trip_change(const struct thermal_zone_device *tz,
  89. const struct thermal_trip *trip)
  90. {
  91. return 0;
  92. }
  93. static inline int thermal_notify_cdev_state_update(const struct thermal_cooling_device *cdev,
  94. int state)
  95. {
  96. return 0;
  97. }
  98. static inline int thermal_notify_cdev_add(const struct thermal_cooling_device *cdev)
  99. {
  100. return 0;
  101. }
  102. static inline int thermal_notify_cdev_delete(const struct thermal_cooling_device *cdev)
  103. {
  104. return 0;
  105. }
  106. static inline int thermal_notify_tz_gov_change(const struct thermal_zone_device *tz,
  107. const char *name)
  108. {
  109. return 0;
  110. }
  111. static inline int thermal_genl_sampling_temp(int id, int temp)
  112. {
  113. return 0;
  114. }
  115. static inline int thermal_genl_cpu_capability_event(int count, struct thermal_genl_cpu_caps *caps)
  116. {
  117. return 0;
  118. }
  119. static inline void __init thermal_netlink_exit(void) {}
  120. #endif /* CONFIG_THERMAL_NETLINK */