thermal.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /* SPDX-License-Identifier: BSD-3-Clause-Clear */
  2. /*
  3. * Copyright (c) 2020 The Linux Foundation. All rights reserved.
  4. */
  5. #ifndef _ATH11K_THERMAL_
  6. #define _ATH11K_THERMAL_
  7. #define ATH11K_THERMAL_TEMP_LOW_MARK -100
  8. #define ATH11K_THERMAL_TEMP_HIGH_MARK 150
  9. #define ATH11K_THERMAL_THROTTLE_MAX 100
  10. #define ATH11K_THERMAL_DEFAULT_DUTY_CYCLE 100
  11. #define ATH11K_HWMON_NAME_LEN 15
  12. #define ATH11K_THERMAL_SYNC_TIMEOUT_HZ (5 * HZ)
  13. struct ath11k_thermal {
  14. struct thermal_cooling_device *cdev;
  15. struct completion wmi_sync;
  16. /* protected by conf_mutex */
  17. u32 throttle_state;
  18. /* temperature value in Celsius degree
  19. * protected by data_lock
  20. */
  21. int temperature;
  22. };
  23. #if IS_REACHABLE(CONFIG_THERMAL)
  24. int ath11k_thermal_register(struct ath11k_base *sc);
  25. void ath11k_thermal_unregister(struct ath11k_base *sc);
  26. int ath11k_thermal_set_throttling(struct ath11k *ar, u32 throttle_state);
  27. void ath11k_thermal_event_temperature(struct ath11k *ar, int temperature);
  28. #else
  29. static inline int ath11k_thermal_register(struct ath11k_base *sc)
  30. {
  31. return 0;
  32. }
  33. static inline void ath11k_thermal_unregister(struct ath11k_base *sc)
  34. {
  35. }
  36. static inline int ath11k_thermal_set_throttling(struct ath11k *ar, u32 throttle_state)
  37. {
  38. return 0;
  39. }
  40. static inline void ath11k_thermal_event_temperature(struct ath11k *ar,
  41. int temperature)
  42. {
  43. }
  44. #endif
  45. #endif /* _ATH11K_THERMAL_ */