1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24#include "priv.h"
25
26static int
27gm107_fan_pwm_ctrl(struct nvkm_therm *therm, int line, bool enable)
28{
29
30 return 0;
31}
32
33static int
34gm107_fan_pwm_get(struct nvkm_therm *therm, int line, u32 *divs, u32 *duty)
35{
36 struct nvkm_device *device = therm->subdev.device;
37 *divs = nvkm_rd32(device, 0x10eb20) & 0x1fff;
38 *duty = nvkm_rd32(device, 0x10eb24) & 0x1fff;
39 return 0;
40}
41
42static int
43gm107_fan_pwm_set(struct nvkm_therm *therm, int line, u32 divs, u32 duty)
44{
45 struct nvkm_device *device = therm->subdev.device;
46 nvkm_mask(device, 0x10eb10, 0x1fff, divs);
47 nvkm_wr32(device, 0x10eb14, duty | 0x80000000);
48 return 0;
49}
50
51static int
52gm107_fan_pwm_clock(struct nvkm_therm *therm, int line)
53{
54 return therm->subdev.device->crystal * 1000;
55}
56
57static const struct nvkm_therm_func
58gm107_therm = {
59 .init = gf119_therm_init,
60 .fini = g84_therm_fini,
61 .pwm_ctrl = gm107_fan_pwm_ctrl,
62 .pwm_get = gm107_fan_pwm_get,
63 .pwm_set = gm107_fan_pwm_set,
64 .pwm_clock = gm107_fan_pwm_clock,
65 .temp_get = g84_temp_get,
66 .fan_sense = gt215_therm_fan_sense,
67 .program_alarms = nvkm_therm_program_alarms_polling,
68};
69
70int
71gm107_therm_new(struct nvkm_device *device, int index,
72 struct nvkm_therm **ptherm)
73{
74 return nvkm_therm_new_(&gm107_therm, device, index, ptherm);
75}
76