therm.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef __NVBIOS_THERM_H__
  3. #define __NVBIOS_THERM_H__
  4. struct nvbios_therm_threshold {
  5. u8 temp;
  6. u8 hysteresis;
  7. };
  8. struct nvbios_therm_sensor {
  9. /* diode */
  10. s16 slope_mult;
  11. s16 slope_div;
  12. s16 offset_num;
  13. s16 offset_den;
  14. s8 offset_constant;
  15. /* thresholds */
  16. struct nvbios_therm_threshold thrs_fan_boost;
  17. struct nvbios_therm_threshold thrs_down_clock;
  18. struct nvbios_therm_threshold thrs_critical;
  19. struct nvbios_therm_threshold thrs_shutdown;
  20. };
  21. enum nvbios_therm_fan_type {
  22. NVBIOS_THERM_FAN_UNK = 0,
  23. NVBIOS_THERM_FAN_TOGGLE = 1,
  24. NVBIOS_THERM_FAN_PWM = 2,
  25. };
  26. /* no vbios have more than 6 */
  27. #define NVKM_TEMP_FAN_TRIP_MAX 10
  28. struct nvbios_therm_trip_point {
  29. int fan_duty;
  30. int temp;
  31. int hysteresis;
  32. };
  33. enum nvbios_therm_fan_mode {
  34. NVBIOS_THERM_FAN_TRIP = 0,
  35. NVBIOS_THERM_FAN_LINEAR = 1,
  36. NVBIOS_THERM_FAN_OTHER = 2,
  37. };
  38. struct nvbios_therm_fan {
  39. enum nvbios_therm_fan_type type;
  40. u32 pwm_freq;
  41. u8 min_duty;
  42. u8 max_duty;
  43. u16 bump_period;
  44. u16 slow_down_period;
  45. enum nvbios_therm_fan_mode fan_mode;
  46. struct nvbios_therm_trip_point trip[NVKM_TEMP_FAN_TRIP_MAX];
  47. u8 nr_fan_trip;
  48. u8 linear_min_temp;
  49. u8 linear_max_temp;
  50. };
  51. enum nvbios_therm_domain {
  52. NVBIOS_THERM_DOMAIN_CORE,
  53. NVBIOS_THERM_DOMAIN_AMBIENT,
  54. };
  55. int
  56. nvbios_therm_sensor_parse(struct nvkm_bios *, enum nvbios_therm_domain,
  57. struct nvbios_therm_sensor *);
  58. int
  59. nvbios_therm_fan_parse(struct nvkm_bios *, struct nvbios_therm_fan *);
  60. #endif