1 #ifndef __NOUVEAU_THERM_H__
2 #define __NOUVEAU_THERM_H__
4 #include <core/device.h>
5 #include <core/subdev.h>
7 enum nouveau_therm_fan_mode
{
8 NOUVEAU_THERM_CTRL_NONE
= 0,
9 NOUVEAU_THERM_CTRL_MANUAL
= 1,
10 NOUVEAU_THERM_CTRL_AUTO
= 2,
13 enum nouveau_therm_attr_type
{
14 NOUVEAU_THERM_ATTR_FAN_MIN_DUTY
= 0,
15 NOUVEAU_THERM_ATTR_FAN_MAX_DUTY
= 1,
16 NOUVEAU_THERM_ATTR_FAN_MODE
= 2,
18 NOUVEAU_THERM_ATTR_THRS_FAN_BOOST
= 10,
19 NOUVEAU_THERM_ATTR_THRS_FAN_BOOST_HYST
= 11,
20 NOUVEAU_THERM_ATTR_THRS_DOWN_CLK
= 12,
21 NOUVEAU_THERM_ATTR_THRS_DOWN_CLK_HYST
= 13,
22 NOUVEAU_THERM_ATTR_THRS_CRITICAL
= 14,
23 NOUVEAU_THERM_ATTR_THRS_CRITICAL_HYST
= 15,
24 NOUVEAU_THERM_ATTR_THRS_SHUTDOWN
= 16,
25 NOUVEAU_THERM_ATTR_THRS_SHUTDOWN_HYST
= 17,
28 struct nouveau_therm
{
29 struct nouveau_subdev base
;
31 int (*pwm_ctrl
)(struct nouveau_therm
*, int line
, bool);
32 int (*pwm_get
)(struct nouveau_therm
*, int line
, u32
*, u32
*);
33 int (*pwm_set
)(struct nouveau_therm
*, int line
, u32
, u32
);
34 int (*pwm_clock
)(struct nouveau_therm
*, int line
);
36 int (*fan_get
)(struct nouveau_therm
*);
37 int (*fan_set
)(struct nouveau_therm
*, int);
38 int (*fan_sense
)(struct nouveau_therm
*);
40 int (*temp_get
)(struct nouveau_therm
*);
42 int (*attr_get
)(struct nouveau_therm
*, enum nouveau_therm_attr_type
);
43 int (*attr_set
)(struct nouveau_therm
*,
44 enum nouveau_therm_attr_type
, int);
47 static inline struct nouveau_therm
*
48 nouveau_therm(void *obj
)
50 return (void *)nv_device(obj
)->subdev
[NVDEV_SUBDEV_THERM
];
53 #define nouveau_therm_create(p,e,o,d) \
54 nouveau_therm_create_((p), (e), (o), sizeof(**d), (void **)d)
55 #define nouveau_therm_destroy(p) ({ \
56 struct nouveau_therm *therm = (p); \
57 _nouveau_therm_dtor(nv_object(therm)); \
59 #define nouveau_therm_init(p) ({ \
60 struct nouveau_therm *therm = (p); \
61 _nouveau_therm_init(nv_object(therm)); \
63 #define nouveau_therm_fini(p,s) ({ \
64 struct nouveau_therm *therm = (p); \
65 _nouveau_therm_init(nv_object(therm), (s)); \
68 int nouveau_therm_create_(struct nouveau_object
*, struct nouveau_object
*,
69 struct nouveau_oclass
*, int, void **);
70 void _nouveau_therm_dtor(struct nouveau_object
*);
71 int _nouveau_therm_init(struct nouveau_object
*);
72 int _nouveau_therm_fini(struct nouveau_object
*, bool);
74 int nouveau_therm_cstate(struct nouveau_therm
*, int, int);
76 extern struct nouveau_oclass nv40_therm_oclass
;
77 extern struct nouveau_oclass nv50_therm_oclass
;
78 extern struct nouveau_oclass nv84_therm_oclass
;
79 extern struct nouveau_oclass nva3_therm_oclass
;
80 extern struct nouveau_oclass nvd0_therm_oclass
;