diff options
author | Martin Peres <martin.peres@free.fr> | 2016-09-28 20:41:35 -0400 |
---|---|---|
committer | Ben Skeggs <bskeggs@redhat.com> | 2017-02-17 02:38:17 -0500 |
commit | 800efb4c2857ec543fdc33585bbcb1fd5ef28337 (patch) | |
tree | aa5da9c49ec0cbeda3d79a9dd2a3a03d39975e37 | |
parent | 7722e1b0b6accab2ca11da0e9c708459fff65fb4 (diff) |
drm/nouveau/drm/therm/fan: add a fallback if no fan control is specified in the vbios
This seems to be absolutely necessary for a lot of NV40.
Reported-by: gsgf on IRC/freenode
Signed-off-by: Martin Peres <martin.peres@free.fr>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
-rw-r--r-- | drivers/gpu/drm/nouveau/nvkm/subdev/therm/base.c | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/therm/base.c b/drivers/gpu/drm/nouveau/nvkm/subdev/therm/base.c index 8894fee30cbc..df949fa7d05d 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/therm/base.c +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/therm/base.c | |||
@@ -64,10 +64,9 @@ nvkm_therm_update_trip(struct nvkm_therm *therm) | |||
64 | } | 64 | } |
65 | 65 | ||
66 | static int | 66 | static int |
67 | nvkm_therm_update_linear(struct nvkm_therm *therm) | 67 | nvkm_therm_compute_linear_duty(struct nvkm_therm *therm, u8 linear_min_temp, |
68 | u8 linear_max_temp) | ||
68 | { | 69 | { |
69 | u8 linear_min_temp = therm->fan->bios.linear_min_temp; | ||
70 | u8 linear_max_temp = therm->fan->bios.linear_max_temp; | ||
71 | u8 temp = therm->func->temp_get(therm); | 70 | u8 temp = therm->func->temp_get(therm); |
72 | u16 duty; | 71 | u16 duty; |
73 | 72 | ||
@@ -85,6 +84,21 @@ nvkm_therm_update_linear(struct nvkm_therm *therm) | |||
85 | return duty; | 84 | return duty; |
86 | } | 85 | } |
87 | 86 | ||
87 | static int | ||
88 | nvkm_therm_update_linear(struct nvkm_therm *therm) | ||
89 | { | ||
90 | u8 min = therm->fan->bios.linear_min_temp; | ||
91 | u8 max = therm->fan->bios.linear_max_temp; | ||
92 | return nvkm_therm_compute_linear_duty(therm, min, max); | ||
93 | } | ||
94 | |||
95 | static int | ||
96 | nvkm_therm_update_linear_fallback(struct nvkm_therm *therm) | ||
97 | { | ||
98 | u8 max = therm->bios_sensor.thrs_fan_boost.temp; | ||
99 | return nvkm_therm_compute_linear_duty(therm, 30, max); | ||
100 | } | ||
101 | |||
88 | static void | 102 | static void |
89 | nvkm_therm_update(struct nvkm_therm *therm, int mode) | 103 | nvkm_therm_update(struct nvkm_therm *therm, int mode) |
90 | { | 104 | { |
@@ -119,6 +133,8 @@ nvkm_therm_update(struct nvkm_therm *therm, int mode) | |||
119 | case NVBIOS_THERM_FAN_OTHER: | 133 | case NVBIOS_THERM_FAN_OTHER: |
120 | if (therm->cstate) | 134 | if (therm->cstate) |
121 | duty = therm->cstate; | 135 | duty = therm->cstate; |
136 | else | ||
137 | duty = nvkm_therm_update_linear_fallback(therm); | ||
122 | poll = false; | 138 | poll = false; |
123 | break; | 139 | break; |
124 | } | 140 | } |