Commit 800efb4c authored by Martin Peres's avatar Martin Peres Committed by Ben Skeggs

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: default avatarMartin Peres <martin.peres@free.fr>
Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
parent 7722e1b0
...@@ -64,10 +64,9 @@ nvkm_therm_update_trip(struct nvkm_therm *therm) ...@@ -64,10 +64,9 @@ nvkm_therm_update_trip(struct nvkm_therm *therm)
} }
static int static int
nvkm_therm_update_linear(struct nvkm_therm *therm) nvkm_therm_compute_linear_duty(struct nvkm_therm *therm, u8 linear_min_temp,
u8 linear_max_temp)
{ {
u8 linear_min_temp = therm->fan->bios.linear_min_temp;
u8 linear_max_temp = therm->fan->bios.linear_max_temp;
u8 temp = therm->func->temp_get(therm); u8 temp = therm->func->temp_get(therm);
u16 duty; u16 duty;
...@@ -85,6 +84,21 @@ nvkm_therm_update_linear(struct nvkm_therm *therm) ...@@ -85,6 +84,21 @@ nvkm_therm_update_linear(struct nvkm_therm *therm)
return duty; return duty;
} }
static int
nvkm_therm_update_linear(struct nvkm_therm *therm)
{
u8 min = therm->fan->bios.linear_min_temp;
u8 max = therm->fan->bios.linear_max_temp;
return nvkm_therm_compute_linear_duty(therm, min, max);
}
static int
nvkm_therm_update_linear_fallback(struct nvkm_therm *therm)
{
u8 max = therm->bios_sensor.thrs_fan_boost.temp;
return nvkm_therm_compute_linear_duty(therm, 30, max);
}
static void static void
nvkm_therm_update(struct nvkm_therm *therm, int mode) nvkm_therm_update(struct nvkm_therm *therm, int mode)
{ {
...@@ -119,6 +133,8 @@ nvkm_therm_update(struct nvkm_therm *therm, int mode) ...@@ -119,6 +133,8 @@ nvkm_therm_update(struct nvkm_therm *therm, int mode)
case NVBIOS_THERM_FAN_OTHER: case NVBIOS_THERM_FAN_OTHER:
if (therm->cstate) if (therm->cstate)
duty = therm->cstate; duty = therm->cstate;
else
duty = nvkm_therm_update_linear_fallback(therm);
poll = false; poll = false;
break; break;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment