All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/nouveau/fan: handle the cases where we are outside of the linear zone
@ 2012-12-20  0:32 martin.peres-GANU6spQydw
  0 siblings, 0 replies; only message in thread
From: martin.peres-GANU6spQydw @ 2012-12-20  0:32 UTC (permalink / raw)
  To: nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW; +Cc: Martin Peres

From: Martin Peres <martin.peres@labri.fr>

This fixes a bug where, when temperature is outside of the linear range, fan
pwm would be outside of the allowed range ([0, 100]) and could get negative in
some cases.

It seems like a regression that happened when we re-worked the fan management
logic before merging.

Tested-by: Ozan Çağlayan <ozancag@gmail.com>
Signed-off-by: Martin Peres <martin.peres@labri.fr>
---
 drivers/gpu/drm/nouveau/core/subdev/therm/base.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/gpu/drm/nouveau/core/subdev/therm/base.c b/drivers/gpu/drm/nouveau/core/subdev/therm/base.c
index b35b4a2..25b7f6a 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/therm/base.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/therm/base.c
@@ -71,6 +71,13 @@ nouveau_therm_update_linear(struct nouveau_therm *therm)
 	u8  temp = therm->temp_get(therm);
 	u16 duty;
 
+	/* handle the non-linear part first */
+	if (temp < linear_min_temp)
+		return priv->fan->bios.min_duty;
+	else if (temp > linear_max_temp)
+		return priv->fan->bios.max_duty;
+
+	/* we are in the linear zone */
 	duty  = (temp - linear_min_temp);
 	duty *= (priv->fan->bios.max_duty - priv->fan->bios.min_duty);
 	duty /= (linear_max_temp - linear_min_temp);
-- 
1.8.0.2

_______________________________________________
Nouveau mailing list
Nouveau@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/nouveau

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2012-12-20  0:32 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-12-20  0:32 [PATCH] drm/nouveau/fan: handle the cases where we are outside of the linear zone martin.peres-GANU6spQydw

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.