1 #ifndef __NVKM_THERM_H__
2 #define __NVKM_THERM_H__
3 #include <core/subdev.h>
5 #include <subdev/bios.h>
6 #include <subdev/bios/therm.h>
7 #include <subdev/timer.h>
9 enum nvkm_therm_thrs_direction {
10 NVKM_THERM_THRS_FALLING = 0,
11 NVKM_THERM_THRS_RISING = 1
14 enum nvkm_therm_thrs_state {
15 NVKM_THERM_THRS_LOWER = 0,
16 NVKM_THERM_THRS_HIGHER = 1
19 enum nvkm_therm_thrs {
20 NVKM_THERM_THRS_FANBOOST = 0,
21 NVKM_THERM_THRS_DOWNCLOCK = 1,
22 NVKM_THERM_THRS_CRITICAL = 2,
23 NVKM_THERM_THRS_SHUTDOWN = 3,
27 enum nvkm_therm_fan_mode {
28 NVKM_THERM_CTRL_NONE = 0,
29 NVKM_THERM_CTRL_MANUAL = 1,
30 NVKM_THERM_CTRL_AUTO = 2,
33 enum nvkm_therm_attr_type {
34 NVKM_THERM_ATTR_FAN_MIN_DUTY = 0,
35 NVKM_THERM_ATTR_FAN_MAX_DUTY = 1,
36 NVKM_THERM_ATTR_FAN_MODE = 2,
38 NVKM_THERM_ATTR_THRS_FAN_BOOST = 10,
39 NVKM_THERM_ATTR_THRS_FAN_BOOST_HYST = 11,
40 NVKM_THERM_ATTR_THRS_DOWN_CLK = 12,
41 NVKM_THERM_ATTR_THRS_DOWN_CLK_HYST = 13,
42 NVKM_THERM_ATTR_THRS_CRITICAL = 14,
43 NVKM_THERM_ATTR_THRS_CRITICAL_HYST = 15,
44 NVKM_THERM_ATTR_THRS_SHUTDOWN = 16,
45 NVKM_THERM_ATTR_THRS_SHUTDOWN_HYST = 17,
49 const struct nvkm_therm_func *func;
50 struct nvkm_subdev subdev;
52 /* automatic thermal management */
53 struct nvkm_alarm alarm;
55 struct nvbios_therm_trip_point *last_trip;
61 struct nvbios_therm_sensor bios_sensor;
68 spinlock_t alarm_program_lock;
69 struct nvkm_alarm therm_poll_alarm;
70 enum nvkm_therm_thrs_state alarm_state[NVKM_THERM_THRS_NR];
73 /* what should be done if the card overheats */
75 void (*downclock)(struct nvkm_therm *, bool active);
76 void (*pause)(struct nvkm_therm *, bool active);
80 struct i2c_client *ic;
82 int (*fan_get)(struct nvkm_therm *);
83 int (*fan_set)(struct nvkm_therm *, int);
85 int (*attr_get)(struct nvkm_therm *, enum nvkm_therm_attr_type);
86 int (*attr_set)(struct nvkm_therm *, enum nvkm_therm_attr_type, int);
89 int nvkm_therm_temp_get(struct nvkm_therm *);
90 int nvkm_therm_fan_sense(struct nvkm_therm *);
91 int nvkm_therm_cstate(struct nvkm_therm *, int, int);
93 int nv40_therm_new(struct nvkm_device *, int, struct nvkm_therm **);
94 int nv50_therm_new(struct nvkm_device *, int, struct nvkm_therm **);
95 int g84_therm_new(struct nvkm_device *, int, struct nvkm_therm **);
96 int gt215_therm_new(struct nvkm_device *, int, struct nvkm_therm **);
97 int gf119_therm_new(struct nvkm_device *, int, struct nvkm_therm **);
98 int gm107_therm_new(struct nvkm_device *, int, struct nvkm_therm **);