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 9 struct nvbios_therm_sensor { 10 /* diode */ 11 s16 slope_mult; 12 s16 slope_div; 13 s16 offset_num; 14 s16 offset_den; 15 s8 offset_constant; 16 17 /* thresholds */ 18 struct nvbios_therm_threshold thrs_fan_boost; 19 struct nvbios_therm_threshold thrs_down_clock; 20 struct nvbios_therm_threshold thrs_critical; 21 struct nvbios_therm_threshold thrs_shutdown; 22 }; 23 24 enum nvbios_therm_fan_type { 25 NVBIOS_THERM_FAN_UNK = 0, 26 NVBIOS_THERM_FAN_TOGGLE = 1, 27 NVBIOS_THERM_FAN_PWM = 2, 28 }; 29 30 /* no vbios have more than 6 */ 31 #define NVKM_TEMP_FAN_TRIP_MAX 10 32 struct nvbios_therm_trip_point { 33 int fan_duty; 34 int temp; 35 int hysteresis; 36 }; 37 38 enum nvbios_therm_fan_mode { 39 NVBIOS_THERM_FAN_TRIP = 0, 40 NVBIOS_THERM_FAN_LINEAR = 1, 41 NVBIOS_THERM_FAN_OTHER = 2, 42 }; 43 44 struct nvbios_therm_fan { 45 enum nvbios_therm_fan_type type; 46 47 u32 pwm_freq; 48 49 u8 min_duty; 50 u8 max_duty; 51 52 u16 bump_period; 53 u16 slow_down_period; 54 55 enum nvbios_therm_fan_mode fan_mode; 56 struct nvbios_therm_trip_point trip[NVKM_TEMP_FAN_TRIP_MAX]; 57 u8 nr_fan_trip; 58 u8 linear_min_temp; 59 u8 linear_max_temp; 60 }; 61 62 enum nvbios_therm_domain { 63 NVBIOS_THERM_DOMAIN_CORE, 64 NVBIOS_THERM_DOMAIN_AMBIENT, 65 }; 66 67 int 68 nvbios_therm_sensor_parse(struct nvkm_bios *, enum nvbios_therm_domain, 69 struct nvbios_therm_sensor *); 70 71 int 72 nvbios_therm_fan_parse(struct nvkm_bios *, struct nvbios_therm_fan *); 73 #endif 74