Commit 4cc00ad1 authored by Martin Peres's avatar Martin Peres Committed by Ben Skeggs

drm/nouveau/fan: restore pwm value on resume when in manual/auto mode

If the fan was in manual or auto mode, we should restore the fan speed
that was previously set when resuming.

The initial pwm value is saved when loading the module.
Signed-off-by: default avatarMartin Peres <martin.peres@labri.fr>
Tested-by: default avatarMartin Peres <martin.peres@labri.fr>
Tested-by: default avatarDash Four <mr.dash.four@googlemail.com>
Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
parent ffb8ea8a
...@@ -267,8 +267,13 @@ _nouveau_therm_init(struct nouveau_object *object) ...@@ -267,8 +267,13 @@ _nouveau_therm_init(struct nouveau_object *object)
if (ret) if (ret)
return ret; return ret;
if (priv->suspend >= 0) if (priv->suspend >= 0) {
/* restore the pwm value only when on manual or auto mode */
if (priv->suspend > 0)
nouveau_therm_fan_set(therm, true, priv->fan->percent);
nouveau_therm_fan_mode(therm, priv->suspend); nouveau_therm_fan_mode(therm, priv->suspend);
}
priv->sensor.program_alarms(therm); priv->sensor.program_alarms(therm);
return 0; return 0;
} }
......
...@@ -234,6 +234,9 @@ nouveau_therm_fan_ctor(struct nouveau_therm *therm) ...@@ -234,6 +234,9 @@ nouveau_therm_fan_ctor(struct nouveau_therm *therm)
nv_info(therm, "FAN control: %s\n", priv->fan->type); nv_info(therm, "FAN control: %s\n", priv->fan->type);
/* read the current speed, it is useful when resuming */
priv->fan->percent = nouveau_therm_fan_get(therm);
/* attempt to detect a tachometer connection */ /* attempt to detect a tachometer connection */
ret = gpio->find(gpio, 0, DCB_GPIO_FAN_SENSE, 0xff, &priv->fan->tach); ret = gpio->find(gpio, 0, DCB_GPIO_FAN_SENSE, 0xff, &priv->fan->tach);
if (ret) if (ret)
......
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