summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Peres <martin.peres@labri.fr>2013-08-11 22:48:49 -0400
committerBen Skeggs <bskeggs@redhat.com>2013-08-21 11:34:46 +1000
commit7af9a560a7e51ce46489f1eac8f4975d7d9e3626 (patch)
tree0e5fd0320b4e3a9e0d5fb5be3601cd0d13b6dded
parent3be1c37ac6f140402fec121546acd691d5ad119f (diff)
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: 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>
-rw-r--r--nvkm/subdev/therm/base.c7
-rw-r--r--nvkm/subdev/therm/fan.c3
2 files changed, 9 insertions, 1 deletions
diff --git a/nvkm/subdev/therm/base.c b/nvkm/subdev/therm/base.c
index 3e9d941d..2ada3d71 100644
--- a/nvkm/subdev/therm/base.c
+++ b/nvkm/subdev/therm/base.c
@@ -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;
}
diff --git a/nvkm/subdev/therm/fan.c b/nvkm/subdev/therm/fan.c
index c728380d..4d8450fc 100644
--- a/nvkm/subdev/therm/fan.c
+++ b/nvkm/subdev/therm/fan.c
@@ -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)