--- a/drivers/gpu/drm/nouveau/core/subdev/therm/priv.h +++ b/drivers/gpu/drm/nouveau/core/subdev/therm/priv.h @@ -77,6 +77,7 @@ struct nouveau_therm_priv { struct nouveau_therm_trip_point *last_trip; int mode; int suspend; + int suspend_fan_percent; /* bios */ struct nvbios_therm_sensor bios_sensor; --- a/drivers/gpu/drm/nouveau/core/subdev/therm/base.c +++ b/drivers/gpu/drm/nouveau/core/subdev/therm/base.c @@ -267,8 +267,13 @@ _nouveau_therm_init(struct nouveau_objec if (ret) return ret; - if (priv->suspend >= 0) - nouveau_therm_fan_mode(therm, priv->mode); + if (priv->suspend >= 0) { + nouveau_therm_fan_mode(therm, priv->suspend); + if (priv->suspend == NOUVEAU_THERM_CTRL_MANUAL && + priv->suspend_fan_percent > 0) + nouveau_therm_fan_user_set(therm, + priv->suspend_fan_percent); + } priv->sensor.program_alarms(therm); return 0; } @@ -281,6 +286,9 @@ _nouveau_therm_fini(struct nouveau_objec if (suspend) { priv->suspend = priv->mode; + if (priv->suspend == NOUVEAU_THERM_CTRL_MANUAL) + priv->suspend_fan_percent = + nouveau_therm_fan_user_get(therm); priv->mode = NOUVEAU_THERM_CTRL_NONE; } @@ -311,7 +319,8 @@ nouveau_therm_create_(struct nouveau_obj priv->base.fan_sense = nouveau_therm_fan_sense; priv->base.attr_get = nouveau_therm_attr_get; priv->base.attr_set = nouveau_therm_attr_set; - priv->mode = priv->suspend = -1; /* undefined */ + priv->mode = priv->suspend = + priv->suspend_fan_percent = -1; /* undefined */ return 0; }