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