Skip to contentSkip to conversation

drm/nouveau/therm: turn on a fan only when crossing threshold in positive direction

PATCH In review Marcin Slusarz 2 participants 2 messages Feb 3, 2013 – Feb 4, 2013 1 message not in the archive

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/3 drm/nouveau/therm: turn on a fan only when crossing threshold in positive direction

+ the same for shutdown threshold - seems impossible, but shutdown can fail.

---
 drivers/gpu/drm/nouveau/core/subdev/therm/temp.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
drivers/gpu/drm/nouveau/core/subdev/therm/temp.c +7 -4
index bf9b3ce..8f27b44 100644
@@ -105,7 +105,7 @@ void nouveau_therm_sensor_event(struct nouveau_therm *therm,
 		return;
 
 	if (dir == NOUVEAU_THERM_THRS_FALLING)
-		nv_info(therm, "temperature (%u C) went bellow the '%s' threshold\n",
+		nv_info(therm, "temperature (%u C) went below the '%s' threshold\n",
 			temperature, thresolds[thrs]);
 	else
 		nv_info(therm, "temperature (%u C) hit the '%s' threshold\n",
@@ -114,8 +114,10 @@ void nouveau_therm_sensor_event(struct nouveau_therm *therm,
 	active = (dir == NOUVEAU_THERM_THRS_RISING);
 	switch (thrs) {
 	case NOUVEAU_THERM_THRS_FANBOOST:
-		nouveau_therm_fan_set(therm, true, 100);
-		nouveau_therm_mode(therm, NOUVEAU_THERM_CTRL_AUTO);
+		if (active) {
+			nouveau_therm_fan_set(therm, true, 100);
+			nouveau_therm_mode(therm, NOUVEAU_THERM_CTRL_AUTO);
+		}
 		break;
 	case NOUVEAU_THERM_THRS_DOWNCLOCK:
 		if (priv->emergency.downclock)
@@ -126,7 +128,8 @@ void nouveau_therm_sensor_event(struct nouveau_therm *therm,
 			priv->emergency.pause(therm, active);
 		break;
 	case NOUVEAU_THERM_THRS_SHUTDOWN:
-		orderly_poweroff(true);
+		if (active)
+			orderly_poweroff(true);
 		break;
 	case NOUVEAU_THERM_THRS_NR:
 		break;
Signature · 1 line
1.8.1

A message that is not in the archive (sent off-list or not yet received): 1359922077-3347-1-git-send-email-marcin.slusarz-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org

#2 lore raw
Quoted 3 lines · Marcin Slusarz

+ the same for shutdown threshold - seems impossible, but shutdown can fail.

Looks good. Please add my signed-off-by

Quoted 40 lines
---
  drivers/gpu/drm/nouveau/core/subdev/therm/temp.c | 11 +++++++----
  1 file changed, 7 insertions(+), 4 deletions(-)
drivers/gpu/drm/nouveau/core/subdev/therm/temp.c +7 -4
index bf9b3ce..8f27b44 100644
@@ -105,7 +105,7 @@ void nouveau_therm_sensor_event(struct nouveau_therm *therm,
  		return;
 
  	if (dir == NOUVEAU_THERM_THRS_FALLING)
-		nv_info(therm, "temperature (%u C) went bellow the '%s' threshold\n",
+		nv_info(therm, "temperature (%u C) went below the '%s' threshold\n",
  			temperature, thresolds[thrs]);
  	else
  		nv_info(therm, "temperature (%u C) hit the '%s' threshold\n",
@@ -114,8 +114,10 @@ void nouveau_therm_sensor_event(struct nouveau_therm *therm,
  	active = (dir == NOUVEAU_THERM_THRS_RISING);
  	switch (thrs) {
  	case NOUVEAU_THERM_THRS_FANBOOST:
-		nouveau_therm_fan_set(therm, true, 100);
-		nouveau_therm_mode(therm, NOUVEAU_THERM_CTRL_AUTO);
+		if (active) {
+			nouveau_therm_fan_set(therm, true, 100);
+			nouveau_therm_mode(therm, NOUVEAU_THERM_CTRL_AUTO);
+		}
  		break;
  	case NOUVEAU_THERM_THRS_DOWNCLOCK:
  		if (priv->emergency.downclock)
@@ -126,7 +128,8 @@ void nouveau_therm_sensor_event(struct nouveau_therm *therm,
  			priv->emergency.pause(therm, active);
  		break;
  	case NOUVEAU_THERM_THRS_SHUTDOWN:
-		orderly_poweroff(true);
+		if (active)
+			orderly_poweroff(true);
  		break;
  	case NOUVEAU_THERM_THRS_NR:
  		break;