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