]> git.karo-electronics.de Git - karo-tx-linux.git/blob - drivers/gpu/drm/nouveau/core/include/subdev/therm.h
drm/nouveau/therm: fix various style issues, make more consistent
[karo-tx-linux.git] / drivers / gpu / drm / nouveau / core / include / subdev / therm.h
1 #ifndef __NOUVEAU_THERM_H__
2 #define __NOUVEAU_THERM_H__
3
4 #include <core/device.h>
5 #include <core/subdev.h>
6
7 enum nouveau_therm_fan_mode {
8         FAN_CONTROL_NONE = 0,
9         FAN_CONTROL_MANUAL = 1,
10         FAN_CONTROL_NR,
11 };
12
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,
17
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,
26 };
27
28 struct nouveau_therm {
29         struct nouveau_subdev base;
30
31         int (*fan_get)(struct nouveau_therm *);
32         int (*fan_set)(struct nouveau_therm *, int);
33         int (*fan_sense)(struct nouveau_therm *);
34
35         int (*temp_get)(struct nouveau_therm *);
36
37         int (*attr_get)(struct nouveau_therm *, enum nouveau_therm_attr_type);
38         int (*attr_set)(struct nouveau_therm *,
39                         enum nouveau_therm_attr_type, int);
40 };
41
42 static inline struct nouveau_therm *
43 nouveau_therm(void *obj)
44 {
45         return (void *)nv_device(obj)->subdev[NVDEV_SUBDEV_THERM];
46 }
47
48 #define nouveau_therm_create(p,e,o,d)                                          \
49         nouveau_therm_create_((p), (e), (o), sizeof(**d), (void **)d)
50 #define nouveau_therm_destroy(p)                                               \
51         nouveau_subdev_destroy(&(p)->base)
52 #define nouveau_therm_init(p) ({                                               \
53         struct nouveau_therm *therm = (p);                                     \
54         _nouveau_therm_init(nv_object(therm));                                 \
55 })
56 #define nouveau_therm_fini(p,s) ({                                             \
57         struct nouveau_therm *therm = (p);                                     \
58         _nouveau_therm_init(nv_object(therm), (s));                            \
59 })
60
61 int nouveau_therm_create_(struct nouveau_object *, struct nouveau_object *,
62                           struct nouveau_oclass *, int, void **);
63
64 #define _nouveau_therm_dtor _nouveau_subdev_dtor
65 int _nouveau_therm_init(struct nouveau_object *);
66 int _nouveau_therm_fini(struct nouveau_object *, bool);
67
68 extern struct nouveau_oclass nv40_therm_oclass;
69 extern struct nouveau_oclass nv50_therm_oclass;
70 extern struct nouveau_oclass nvd0_therm_oclass;
71
72 #endif