thermal.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /*
  2. * Copyright (c) 2014 Qualcomm Atheros, Inc.
  3. *
  4. * Permission to use, copy, modify, and/or distribute this software for any
  5. * purpose with or without fee is hereby granted, provided that the above
  6. * copyright notice and this permission notice appear in all copies.
  7. *
  8. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  9. * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  10. * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
  11. * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  12. * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  13. * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  14. * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  15. */
  16. #ifndef _THERMAL_
  17. #define _THERMAL_
  18. #define ATH10K_QUIET_PERIOD_DEFAULT 100
  19. #define ATH10K_QUIET_PERIOD_MIN 25
  20. #define ATH10K_QUIET_START_OFFSET 10
  21. #define ATH10K_HWMON_NAME_LEN 15
  22. #define ATH10K_THERMAL_SYNC_TIMEOUT_HZ (5*HZ)
  23. #define ATH10K_THERMAL_THROTTLE_MAX 100
  24. struct ath10k_thermal {
  25. struct thermal_cooling_device *cdev;
  26. struct completion wmi_sync;
  27. /* protected by conf_mutex */
  28. u32 throttle_state;
  29. u32 quiet_period;
  30. /* temperature value in Celcius degree
  31. * protected by data_lock
  32. */
  33. int temperature;
  34. };
  35. #ifdef CONFIG_THERMAL
  36. int ath10k_thermal_register(struct ath10k *ar);
  37. void ath10k_thermal_unregister(struct ath10k *ar);
  38. void ath10k_thermal_event_temperature(struct ath10k *ar, int temperature);
  39. void ath10k_thermal_set_throttling(struct ath10k *ar);
  40. #else
  41. static inline int ath10k_thermal_register(struct ath10k *ar)
  42. {
  43. return 0;
  44. }
  45. static inline void ath10k_thermal_unregister(struct ath10k *ar)
  46. {
  47. }
  48. static inline void ath10k_thermal_event_temperature(struct ath10k *ar,
  49. int temperature)
  50. {
  51. }
  52. static inline void ath10k_thermal_set_throttling(struct ath10k *ar)
  53. {
  54. }
  55. #endif
  56. #endif /* _THERMAL_ */