From: Aastha Pandey <[email protected]>

Unlike the CPU, the GPU does not throttle its speed automatically when
it reaches high temperatures.

Set up GPU cooling on Nord by throttling the Adreno 753 GPU when it
reaches 105°C. Label the passive trip points of the GPU thermal zones,
map them to the GPU as a cooling device, and add a passive polling
delay so the thermal framework can monitor the zones while throttling.

The thermal zones and the GPU node are both described in nord.dtsi, so
do it there. On the GearVM variant the GPU node stays disabled, no
cooling device gets registered for it, and the maps are simply left
unbound.

Signed-off-by: Aastha Pandey <[email protected]>
Signed-off-by: Akhil P Oommen <[email protected]>
---
 arch/arm64/boot/dts/qcom/nord.dtsi | 177 ++++++++++++++++++++++++++++++-------
 1 file changed, 145 insertions(+), 32 deletions(-)

diff --git a/arch/arm64/boot/dts/qcom/nord.dtsi 
b/arch/arm64/boot/dts/qcom/nord.dtsi
index 36a422db8ea6..3e29c43ca9ad 100644
--- a/arch/arm64/boot/dts/qcom/nord.dtsi
+++ b/arch/arm64/boot/dts/qcom/nord.dtsi
@@ -6,6 +6,7 @@
 #include <dt-bindings/firmware/qcom,scm.h>
 #include <dt-bindings/interrupt-controller/arm-gic.h>
 #include <dt-bindings/mailbox/qcom-ipcc.h>
+#include <dt-bindings/thermal/thermal.h>
 
 #include "nord-ipcc.h"
 
@@ -5122,12 +5123,12 @@ trip-point1 {
                };
 
                gpuss-0-thermal {
-                       polling-delay-passive = <0>;
+                       polling-delay-passive = <10>;
                        polling-delay = <0>;
                        thermal-sensors = <&tsens6 1>;
 
                        trips {
-                               trip-point0 {
+                               gpuss0_alert0: trip-point0 {
                                        temperature = <105000>;
                                        hysteresis = <10000>;
                                        type = "passive";
@@ -5139,15 +5140,22 @@ trip-point1 {
                                        type = "passive";
                                };
                        };
+
+                       cooling-maps {
+                               map0 {
+                                       trip = <&gpuss0_alert0>;
+                                       cooling-device = <&gpu_0 
THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+                               };
+                       };
                };
 
                gpuss-1-thermal {
-                       polling-delay-passive = <0>;
+                       polling-delay-passive = <10>;
                        polling-delay = <0>;
                        thermal-sensors = <&tsens6 2>;
 
                        trips {
-                               trip-point0 {
+                               gpuss1_alert0: trip-point0 {
                                        temperature = <105000>;
                                        hysteresis = <10000>;
                                        type = "passive";
@@ -5159,15 +5167,22 @@ trip-point1 {
                                        type = "passive";
                                };
                        };
+
+                       cooling-maps {
+                               map0 {
+                                       trip = <&gpuss1_alert0>;
+                                       cooling-device = <&gpu_0 
THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+                               };
+                       };
                };
 
                gpuss-2-thermal {
-                       polling-delay-passive = <0>;
+                       polling-delay-passive = <10>;
                        polling-delay = <0>;
                        thermal-sensors = <&tsens6 3>;
 
                        trips {
-                               trip-point0 {
+                               gpuss2_alert0: trip-point0 {
                                        temperature = <105000>;
                                        hysteresis = <10000>;
                                        type = "passive";
@@ -5179,15 +5194,22 @@ trip-point1 {
                                        type = "passive";
                                };
                        };
+
+                       cooling-maps {
+                               map0 {
+                                       trip = <&gpuss2_alert0>;
+                                       cooling-device = <&gpu_0 
THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+                               };
+                       };
                };
 
                gpu-0-0-0-thermal {
-                       polling-delay-passive = <0>;
+                       polling-delay-passive = <10>;
                        polling-delay = <0>;
                        thermal-sensors = <&tsens6 4>;
 
                        trips {
-                               trip-point0 {
+                               gpu_0_0_0_alert0: trip-point0 {
                                        temperature = <105000>;
                                        hysteresis = <10000>;
                                        type = "passive";
@@ -5199,6 +5221,13 @@ trip-point1 {
                                        type = "passive";
                                };
                        };
+
+                       cooling-maps {
+                               map0 {
+                                       trip = <&gpu_0_0_0_alert0>;
+                                       cooling-device = <&gpu_0 
THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+                               };
+                       };
                };
 
                gpuss-1-0-thermal {
@@ -5342,12 +5371,12 @@ trip-point1 {
                };
 
                gpuss-0-1-1-thermal {
-                       polling-delay-passive = <0>;
+                       polling-delay-passive = <10>;
                        polling-delay = <0>;
                        thermal-sensors = <&tsens6 12>;
 
                        trips {
-                               trip-point0 {
+                               gpuss_0_1_1_alert0: trip-point0 {
                                        temperature = <105000>;
                                        hysteresis = <10000>;
                                        type = "passive";
@@ -5359,15 +5388,22 @@ trip-point1 {
                                        type = "passive";
                                };
                        };
+
+                       cooling-maps {
+                               map0 {
+                                       trip = <&gpuss_0_1_1_alert0>;
+                                       cooling-device = <&gpu_0 
THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+                               };
+                       };
                };
 
                gpuss-1-1-1-thermal {
-                       polling-delay-passive = <0>;
+                       polling-delay-passive = <10>;
                        polling-delay = <0>;
                        thermal-sensors = <&tsens6 13>;
 
                        trips {
-                               trip-point0 {
+                               gpuss_1_1_1_alert0: trip-point0 {
                                        temperature = <105000>;
                                        hysteresis = <10000>;
                                        type = "passive";
@@ -5379,15 +5415,22 @@ trip-point1 {
                                        type = "passive";
                                };
                        };
+
+                       cooling-maps {
+                               map0 {
+                                       trip = <&gpuss_1_1_1_alert0>;
+                                       cooling-device = <&gpu_0 
THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+                               };
+                       };
                };
 
                gpuss-2-1-1-thermal {
-                       polling-delay-passive = <0>;
+                       polling-delay-passive = <10>;
                        polling-delay = <0>;
                        thermal-sensors = <&tsens6 14>;
 
                        trips {
-                               trip-point0 {
+                               gpuss_2_1_1_alert0: trip-point0 {
                                        temperature = <105000>;
                                        hysteresis = <10000>;
                                        type = "passive";
@@ -5399,15 +5442,22 @@ trip-point1 {
                                        type = "passive";
                                };
                        };
+
+                       cooling-maps {
+                               map0 {
+                                       trip = <&gpuss_2_1_1_alert0>;
+                                       cooling-device = <&gpu_0 
THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+                               };
+                       };
                };
 
                gpu-0-1-1-thermal {
-                       polling-delay-passive = <0>;
+                       polling-delay-passive = <10>;
                        polling-delay = <0>;
                        thermal-sensors = <&tsens6 15>;
 
                        trips {
-                               trip-point0 {
+                               gpu_0_1_1_alert0: trip-point0 {
                                        temperature = <105000>;
                                        hysteresis = <10000>;
                                        type = "passive";
@@ -5419,6 +5469,13 @@ trip-point1 {
                                        type = "passive";
                                };
                        };
+
+                       cooling-maps {
+                               map0 {
+                                       trip = <&gpu_0_1_1_alert0>;
+                                       cooling-device = <&gpu_0 
THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+                               };
+                       };
                };
 
                amux-7-thermal {
@@ -5442,12 +5499,12 @@ trip-point1 {
                };
 
                gpuss-0-1-0-thermal {
-                       polling-delay-passive = <0>;
+                       polling-delay-passive = <10>;
                        polling-delay = <0>;
                        thermal-sensors = <&tsens7 1>;
 
                        trips {
-                               trip-point0 {
+                               gpuss_0_1_0_alert0: trip-point0 {
                                        temperature = <105000>;
                                        hysteresis = <10000>;
                                        type = "passive";
@@ -5459,15 +5516,22 @@ trip-point1 {
                                        type = "passive";
                                };
                        };
+
+                       cooling-maps {
+                               map0 {
+                                       trip = <&gpuss_0_1_0_alert0>;
+                                       cooling-device = <&gpu_0 
THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+                               };
+                       };
                };
 
                gpuss-1-1-0-thermal {
-                       polling-delay-passive = <0>;
+                       polling-delay-passive = <10>;
                        polling-delay = <0>;
                        thermal-sensors = <&tsens7 2>;
 
                        trips {
-                               trip-point0 {
+                               gpuss_1_1_0_alert0: trip-point0 {
                                        temperature = <105000>;
                                        hysteresis = <10000>;
                                        type = "passive";
@@ -5479,15 +5543,22 @@ trip-point1 {
                                        type = "passive";
                                };
                        };
+
+                       cooling-maps {
+                               map0 {
+                                       trip = <&gpuss_1_1_0_alert0>;
+                                       cooling-device = <&gpu_0 
THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+                               };
+                       };
                };
 
                gpuss-2-1-0-thermal {
-                       polling-delay-passive = <0>;
+                       polling-delay-passive = <10>;
                        polling-delay = <0>;
                        thermal-sensors = <&tsens7 3>;
 
                        trips {
-                               trip-point0 {
+                               gpuss_2_1_0_alert0: trip-point0 {
                                        temperature = <105000>;
                                        hysteresis = <10000>;
                                        type = "passive";
@@ -5499,15 +5570,22 @@ trip-point1 {
                                        type = "passive";
                                };
                        };
+
+                       cooling-maps {
+                               map0 {
+                                       trip = <&gpuss_2_1_0_alert0>;
+                                       cooling-device = <&gpu_0 
THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+                               };
+                       };
                };
 
                gpu-0-1-0-thermal {
-                       polling-delay-passive = <0>;
+                       polling-delay-passive = <10>;
                        polling-delay = <0>;
                        thermal-sensors = <&tsens7 4>;
 
                        trips {
-                               trip-point0 {
+                               gpu_0_1_0_alert0: trip-point0 {
                                        temperature = <105000>;
                                        hysteresis = <10000>;
                                        type = "passive";
@@ -5519,6 +5597,13 @@ trip-point1 {
                                        type = "passive";
                                };
                        };
+
+                       cooling-maps {
+                               map0 {
+                                       trip = <&gpu_0_1_0_alert0>;
+                                       cooling-device = <&gpu_0 
THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+                               };
+                       };
                };
 
                gpuss-1-2-thermal {
@@ -5662,12 +5747,12 @@ trip-point1 {
                };
 
                gpuss-0-1-thermal {
-                       polling-delay-passive = <0>;
+                       polling-delay-passive = <10>;
                        polling-delay = <0>;
                        thermal-sensors = <&tsens7 12>;
 
                        trips {
-                               trip-point0 {
+                               gpuss_0_1_alert0: trip-point0 {
                                        temperature = <105000>;
                                        hysteresis = <10000>;
                                        type = "passive";
@@ -5679,15 +5764,22 @@ trip-point1 {
                                        type = "passive";
                                };
                        };
+
+                       cooling-maps {
+                               map0 {
+                                       trip = <&gpuss_0_1_alert0>;
+                                       cooling-device = <&gpu_0 
THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+                               };
+                       };
                };
 
                gpuss-1-0-1-thermal {
-                       polling-delay-passive = <0>;
+                       polling-delay-passive = <10>;
                        polling-delay = <0>;
                        thermal-sensors = <&tsens7 13>;
 
                        trips {
-                               trip-point0 {
+                               gpuss_1_0_1_alert0: trip-point0 {
                                        temperature = <105000>;
                                        hysteresis = <10000>;
                                        type = "passive";
@@ -5699,15 +5791,22 @@ trip-point1 {
                                        type = "passive";
                                };
                        };
+
+                       cooling-maps {
+                               map0 {
+                                       trip = <&gpuss_1_0_1_alert0>;
+                                       cooling-device = <&gpu_0 
THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+                               };
+                       };
                };
 
                gpuss-2-0-1-thermal {
-                       polling-delay-passive = <0>;
+                       polling-delay-passive = <10>;
                        polling-delay = <0>;
                        thermal-sensors = <&tsens7 14>;
 
                        trips {
-                               trip-point0 {
+                               gpuss_2_0_1_alert0: trip-point0 {
                                        temperature = <105000>;
                                        hysteresis = <10000>;
                                        type = "passive";
@@ -5719,15 +5818,22 @@ trip-point1 {
                                        type = "passive";
                                };
                        };
+
+                       cooling-maps {
+                               map0 {
+                                       trip = <&gpuss_2_0_1_alert0>;
+                                       cooling-device = <&gpu_0 
THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+                               };
+                       };
                };
 
                gpu-0-0-1-thermal {
-                       polling-delay-passive = <0>;
+                       polling-delay-passive = <10>;
                        polling-delay = <0>;
                        thermal-sensors = <&tsens7 15>;
 
                        trips {
-                               trip-point0 {
+                               gpu_0_0_1_alert0: trip-point0 {
                                        temperature = <105000>;
                                        hysteresis = <10000>;
                                        type = "passive";
@@ -5739,6 +5845,13 @@ trip-point1 {
                                        type = "passive";
                                };
                        };
+
+                       cooling-maps {
+                               map0 {
+                                       trip = <&gpu_0_0_1_alert0>;
+                                       cooling-device = <&gpu_0 
THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+                               };
+                       };
                };
        };
 };

-- 
2.55.0

Reply via email to