Commit | Line | Data |
---|---|---|
bc79202f BS |
1 | #ifndef __NVTHERM_PRIV_H__ |
2 | #define __NVTHERM_PRIV_H__ | |
3 | ||
aa1b9b48 MP |
4 | /* |
5 | * Copyright 2012 The Nouveau community | |
6 | * | |
7 | * Permission is hereby granted, free of charge, to any person obtaining a | |
8 | * copy of this software and associated documentation files (the "Software"), | |
9 | * to deal in the Software without restriction, including without limitation | |
10 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, | |
11 | * and/or sell copies of the Software, and to permit persons to whom the | |
12 | * Software is furnished to do so, subject to the following conditions: | |
13 | * | |
14 | * The above copyright notice and this permission notice shall be included in | |
15 | * all copies or substantial portions of the Software. | |
16 | * | |
17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |
18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | |
20 | * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR | |
21 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, | |
22 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | |
23 | * OTHER DEALINGS IN THE SOFTWARE. | |
24 | * | |
25 | * Authors: Martin Peres | |
26 | */ | |
27 | ||
28 | #include <subdev/therm.h> | |
29 | ||
30 | #include <subdev/bios/extdev.h> | |
d639b4f5 | 31 | #include <subdev/bios/gpio.h> |
aa1b9b48 MP |
32 | #include <subdev/bios/perf.h> |
33 | #include <subdev/bios/therm.h> | |
0cbf83bb | 34 | #include <subdev/timer.h> |
aa1b9b48 | 35 | |
9c3bd3a5 | 36 | struct nouveau_fan { |
fa37e8dd | 37 | struct nouveau_therm *parent; |
9c3bd3a5 BS |
38 | const char *type; |
39 | enum nouveau_therm_fan_mode mode; | |
9c3bd3a5 BS |
40 | |
41 | struct nvbios_therm_fan bios; | |
42 | struct nvbios_perf_fan perf; | |
43 | ||
fa37e8dd MP |
44 | struct nouveau_alarm alarm; |
45 | spinlock_t lock; | |
46 | int percent; | |
47 | ||
9c3bd3a5 BS |
48 | int (*get)(struct nouveau_therm *therm); |
49 | int (*set)(struct nouveau_therm *therm, int percent); | |
50 | ||
51 | struct dcb_gpio_func tach; | |
52 | }; | |
53 | ||
aa1b9b48 MP |
54 | struct nouveau_therm_priv { |
55 | struct nouveau_therm base; | |
56 | ||
57 | /* bios */ | |
58 | struct nvbios_therm_sensor bios_sensor; | |
aa1b9b48 MP |
59 | |
60 | /* fan priv */ | |
9c3bd3a5 | 61 | struct nouveau_fan *fan; |
aa1b9b48 MP |
62 | |
63 | /* ic */ | |
64 | struct i2c_client *ic; | |
65 | }; | |
66 | ||
aa1b9b48 MP |
67 | int nouveau_therm_attr_get(struct nouveau_therm *therm, |
68 | enum nouveau_therm_attr_type type); | |
69 | int nouveau_therm_attr_set(struct nouveau_therm *therm, | |
70 | enum nouveau_therm_attr_type type, int value); | |
71 | ||
72 | void nouveau_therm_ic_ctor(struct nouveau_therm *therm); | |
73 | ||
74 | int nouveau_therm_sensor_ctor(struct nouveau_therm *therm); | |
75 | ||
76 | int nouveau_therm_fan_ctor(struct nouveau_therm *therm); | |
77 | int nouveau_therm_fan_get(struct nouveau_therm *therm); | |
fa37e8dd | 78 | int nouveau_therm_fan_set(struct nouveau_therm *therm, bool now, int percent); |
2f951a5d MP |
79 | int nouveau_therm_fan_user_get(struct nouveau_therm *therm); |
80 | int nouveau_therm_fan_user_set(struct nouveau_therm *therm, int percent); | |
81 | int nouveau_therm_fan_set_mode(struct nouveau_therm *therm, | |
82 | enum nouveau_therm_fan_mode mode); | |
83 | ||
aa1b9b48 | 84 | int nouveau_therm_fan_sense(struct nouveau_therm *therm); |
bc79202f | 85 | |
9c3bd3a5 BS |
86 | int nouveau_therm_preinit(struct nouveau_therm *); |
87 | ||
88 | int nv50_fan_pwm_ctrl(struct nouveau_therm *, int, bool); | |
d639b4f5 BS |
89 | int nv50_fan_pwm_get(struct nouveau_therm *, int, u32 *, u32 *); |
90 | int nv50_fan_pwm_set(struct nouveau_therm *, int, u32, u32); | |
91 | int nv50_fan_pwm_clock(struct nouveau_therm *); | |
bc79202f BS |
92 | int nv50_temp_get(struct nouveau_therm *therm); |
93 | ||
9cbcd337 BS |
94 | int nva3_therm_fan_sense(struct nouveau_therm *); |
95 | ||
9c3bd3a5 | 96 | int nouveau_fanpwm_create(struct nouveau_therm *, struct dcb_gpio_func *); |
0cbf83bb | 97 | int nouveau_fantog_create(struct nouveau_therm *, struct dcb_gpio_func *); |
9c3bd3a5 BS |
98 | int nouveau_fannil_create(struct nouveau_therm *); |
99 | ||
bc79202f | 100 | #endif |