1 #ifndef __NVKM_THERM_H__ 2 #define __NVKM_THERM_H__ 3 #include <core/subdev.h> 4 5 enum nvkm_therm_fan_mode { 6 NVKM_THERM_CTRL_NONE = 0, 7 NVKM_THERM_CTRL_MANUAL = 1, 8 NVKM_THERM_CTRL_AUTO = 2, 9 }; 10 11 enum nvkm_therm_attr_type { 12 NVKM_THERM_ATTR_FAN_MIN_DUTY = 0, 13 NVKM_THERM_ATTR_FAN_MAX_DUTY = 1, 14 NVKM_THERM_ATTR_FAN_MODE = 2, 15 16 NVKM_THERM_ATTR_THRS_FAN_BOOST = 10, 17 NVKM_THERM_ATTR_THRS_FAN_BOOST_HYST = 11, 18 NVKM_THERM_ATTR_THRS_DOWN_CLK = 12, 19 NVKM_THERM_ATTR_THRS_DOWN_CLK_HYST = 13, 20 NVKM_THERM_ATTR_THRS_CRITICAL = 14, 21 NVKM_THERM_ATTR_THRS_CRITICAL_HYST = 15, 22 NVKM_THERM_ATTR_THRS_SHUTDOWN = 16, 23 NVKM_THERM_ATTR_THRS_SHUTDOWN_HYST = 17, 24 }; 25 26 struct nvkm_therm { 27 struct nvkm_subdev base; 28 29 int (*pwm_ctrl)(struct nvkm_therm *, int line, bool); 30 int (*pwm_get)(struct nvkm_therm *, int line, u32 *, u32 *); 31 int (*pwm_set)(struct nvkm_therm *, int line, u32, u32); 32 int (*pwm_clock)(struct nvkm_therm *, int line); 33 34 int (*fan_get)(struct nvkm_therm *); 35 int (*fan_set)(struct nvkm_therm *, int); 36 int (*fan_sense)(struct nvkm_therm *); 37 38 int (*temp_get)(struct nvkm_therm *); 39 40 int (*attr_get)(struct nvkm_therm *, enum nvkm_therm_attr_type); 41 int (*attr_set)(struct nvkm_therm *, enum nvkm_therm_attr_type, int); 42 }; 43 44 static inline struct nvkm_therm * 45 nvkm_therm(void *obj) 46 { 47 return (void *)nvkm_subdev(obj, NVDEV_SUBDEV_THERM); 48 } 49 50 #define nvkm_therm_create(p,e,o,d) \ 51 nvkm_therm_create_((p), (e), (o), sizeof(**d), (void **)d) 52 #define nvkm_therm_destroy(p) ({ \ 53 struct nvkm_therm *therm = (p); \ 54 _nvkm_therm_dtor(nv_object(therm)); \ 55 }) 56 #define nvkm_therm_init(p) ({ \ 57 struct nvkm_therm *therm = (p); \ 58 _nvkm_therm_init(nv_object(therm)); \ 59 }) 60 #define nvkm_therm_fini(p,s) ({ \ 61 struct nvkm_therm *therm = (p); \ 62 _nvkm_therm_init(nv_object(therm), (s)); \ 63 }) 64 65 int nvkm_therm_create_(struct nvkm_object *, struct nvkm_object *, 66 struct nvkm_oclass *, int, void **); 67 void _nvkm_therm_dtor(struct nvkm_object *); 68 int _nvkm_therm_init(struct nvkm_object *); 69 int _nvkm_therm_fini(struct nvkm_object *, bool); 70 71 int nvkm_therm_cstate(struct nvkm_therm *, int, int); 72 73 extern struct nvkm_oclass nv40_therm_oclass; 74 extern struct nvkm_oclass nv50_therm_oclass; 75 extern struct nvkm_oclass g84_therm_oclass; 76 extern struct nvkm_oclass gt215_therm_oclass; 77 extern struct nvkm_oclass gf110_therm_oclass; 78 extern struct nvkm_oclass gm107_therm_oclass; 79 #endif 80