Skip to content

Commit

Permalink
drm/nouveau/fan: restore pwm value on resume when in manual/auto mode
Browse files Browse the repository at this point in the history
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: Martin Peres <martin.peres@labri.fr>
Tested-by: Martin Peres <martin.peres@labri.fr>
Tested-by: Dash Four <mr.dash.four@googlemail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
  • Loading branch information
Martin Peres authored and Ben Skeggs committed Sep 4, 2013
1 parent ffb8ea8 commit 4cc00ad
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
7 changes: 6 additions & 1 deletion drivers/gpu/drm/nouveau/core/subdev/therm/base.c
Original file line number Diff line number Diff line change
Expand Up @@ -267,8 +267,13 @@ _nouveau_therm_init(struct nouveau_object *object)
if (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);
}
priv->sensor.program_alarms(therm);
return 0;
}
Expand Down
3 changes: 3 additions & 0 deletions drivers/gpu/drm/nouveau/core/subdev/therm/fan.c
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,9 @@ nouveau_therm_fan_ctor(struct nouveau_therm *therm)

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 */
ret = gpio->find(gpio, 0, DCB_GPIO_FAN_SENSE, 0xff, &priv->fan->tach);
if (ret)
Expand Down

0 comments on commit 4cc00ad

Please sign in to comment.