[Nouveau] [RFC PATCH 14/29] therm: Trigger reclock in temperature daemon

Karol Herbst
2017-09-15T17:11:14Z

Depending on the temperature, cstates might become unreachable or the maped
voltage of a cstate changes. We want to adjust to that.

Signed-off-by: Karol Herbst <karolherbst at gmail.com>
Reviewed-by: Martin Peres <martin.peres at free.fr>
---
 drm/nouveau/nvkm/subdev/therm/base.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drm/nouveau/nvkm/subdev/therm/base.c
b/drm/nouveau/nvkm/subdev/therm/base.c
index 59f01fec..c90b9cfc 100644
--- a/drm/nouveau/nvkm/subdev/therm/base.c
+++ b/drm/nouveau/nvkm/subdev/therm/base.c
@@ -23,6 +23,8 @@
  */
 #include "priv.h"

+#include <subdev/clk.h>
+
 int
 nvkm_therm_temp_get(struct nvkm_therm *therm, int *val)
 {
@@ -168,9 +170,15 @@ nvkm_therm_alarm(struct nvkm_alarm *alarm)
 	int temp;
 	struct nvkm_therm *therm  	       container_of(alarm, struct nvkm_therm,
alarm);
+	struct nvkm_clk *clk = therm->subdev.device->clk;
+
 	if (nvkm_therm_temp_get(therm, &temp) >= 0)
 		therm->last_temp = temp;
+
 	nvkm_therm_update(therm, therm->last_temp, -1);
+
+	if (clk)
+		nvkm_clk_tstate(clk, therm->last_temp);
 }

 int
--
2.14.1