From: Dipa Ramesh Mantre <[email protected]>

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

Set up CDSP cooling by throttling the cdsp, when it reaches 95°C.

Add polling-delay-passive so the governor periodically evaluates
the zone during passive cooling and steps up cooling levels when
temperature stabilizes below the next trip.

Signed-off-by: Dipa Ramesh Mantre <[email protected]>
Reviewed-by: Dmitry Baryshkov <[email protected]>
Signed-off-by: Gaurav Kohli <[email protected]>
---
 arch/arm64/boot/dts/qcom/hamoa-iot-evk.dts | 32 +++++++++++++++
 arch/arm64/boot/dts/qcom/hamoa.dtsi        | 63 ++++++++++++++++++++++++++++++
 2 files changed, 95 insertions(+)

diff --git a/arch/arm64/boot/dts/qcom/hamoa-iot-evk.dts 
b/arch/arm64/boot/dts/qcom/hamoa-iot-evk.dts
index 9fa86bb6438e..a146be1cb5fb 100644
--- a/arch/arm64/boot/dts/qcom/hamoa-iot-evk.dts
+++ b/arch/arm64/boot/dts/qcom/hamoa-iot-evk.dts
@@ -1684,4 +1684,36 @@ trip-point0 {
                        };
                };
        };
+
+       nsp0-thermal {
+               trips {
+                       trip-point1 {
+                               temperature = <105000>;
+                       };
+               };
+       };
+
+       nsp1-thermal {
+               trips {
+                       trip-point1 {
+                               temperature = <105000>;
+                       };
+               };
+       };
+
+       nsp2-thermal {
+               trips {
+                       trip-point1 {
+                               temperature = <105000>;
+                       };
+               };
+       };
+
+       nsp3-thermal {
+               trips {
+                       trip-point1 {
+                               temperature = <105000>;
+                       };
+               };
+       };
 };
diff --git a/arch/arm64/boot/dts/qcom/hamoa.dtsi 
b/arch/arm64/boot/dts/qcom/hamoa.dtsi
index 09527dcf9576..ba453c8ca80d 100644
--- a/arch/arm64/boot/dts/qcom/hamoa.dtsi
+++ b/arch/arm64/boot/dts/qcom/hamoa.dtsi
@@ -23,6 +23,7 @@
 #include <dt-bindings/soc/qcom,gpr.h>
 #include <dt-bindings/soc/qcom,rpmh-rsc.h>
 #include <dt-bindings/sound/qcom,q6dsp-lpass-ports.h>
+#include <dt-bindings/thermal/qcom,pas.h>
 #include <dt-bindings/thermal/thermal.h>
 
 / {
@@ -8971,6 +8972,8 @@ remoteproc_cdsp: remoteproc@32300000 {
 
                        status = "disabled";
 
+                       #cooling-cells = <3>;
+
                        glink-edge {
                                interrupts-extended = <&ipcc IPCC_CLIENT_CDSP
                                                             
IPCC_MPROC_SIGNAL_GLINK_QMP
@@ -9558,6 +9561,7 @@ aoss0-critical {
                };
 
                thermal_nsp0: nsp0-thermal {
+                       polling-delay-passive = <200>;
                        thermal-sensors = <&tsens3 1>;
 
                        trips {
@@ -9567,15 +9571,30 @@ trip-point0 {
                                        type = "hot";
                                };
 
+                               nsp0_alert0: trip-point1 {
+                                       temperature = <95000>;
+                                       hysteresis = <5000>;
+                                       type = "passive";
+                               };
+
                                nsp0-critical {
                                        temperature = <115000>;
                                        hysteresis = <1000>;
                                        type = "critical";
                                };
                        };
+
+                       cooling-maps {
+                               map0 {
+                                       trip = <&nsp0_alert0>;
+                                       cooling-device = <&remoteproc_cdsp 
QCOM_TMD_CDSP_SW
+                                                        THERMAL_NO_LIMIT 
THERMAL_NO_LIMIT>;
+                               };
+                       };
                };
 
                thermal_nsp1: nsp1-thermal {
+                       polling-delay-passive = <200>;
                        thermal-sensors = <&tsens3 2>;
 
                        trips {
@@ -9585,15 +9604,30 @@ trip-point0 {
                                        type = "hot";
                                };
 
+                               nsp1_alert0: trip-point1 {
+                                       temperature = <95000>;
+                                       hysteresis = <5000>;
+                                       type = "passive";
+                               };
+
                                nsp1-critical {
                                        temperature = <115000>;
                                        hysteresis = <1000>;
                                        type = "critical";
                                };
                        };
+
+                       cooling-maps {
+                               map0 {
+                                       trip = <&nsp1_alert0>;
+                                       cooling-device = <&remoteproc_cdsp 
QCOM_TMD_CDSP_SW
+                                                        THERMAL_NO_LIMIT 
THERMAL_NO_LIMIT>;
+                               };
+                       };
                };
 
                thermal_nsp2: nsp2-thermal {
+                       polling-delay-passive = <200>;
                        thermal-sensors = <&tsens3 3>;
 
                        trips {
@@ -9603,15 +9637,30 @@ trip-point0 {
                                        type = "hot";
                                };
 
+                               nsp2_alert0: trip-point1 {
+                                       temperature = <95000>;
+                                       hysteresis = <5000>;
+                                       type = "passive";
+                               };
+
                                nsp2-critical {
                                        temperature = <115000>;
                                        hysteresis = <1000>;
                                        type = "critical";
                                };
                        };
+
+                       cooling-maps {
+                               map0 {
+                                       trip = <&nsp2_alert0>;
+                                       cooling-device = <&remoteproc_cdsp 
QCOM_TMD_CDSP_SW
+                                                        THERMAL_NO_LIMIT 
THERMAL_NO_LIMIT>;
+                               };
+                       };
                };
 
                thermal_nsp3: nsp3-thermal {
+                       polling-delay-passive = <200>;
                        thermal-sensors = <&tsens3 4>;
 
                        trips {
@@ -9621,12 +9670,26 @@ trip-point0 {
                                        type = "hot";
                                };
 
+                               nsp3_alert0: trip-point1 {
+                                       temperature = <95000>;
+                                       hysteresis = <5000>;
+                                       type = "passive";
+                               };
+
                                nsp3-critical {
                                        temperature = <115000>;
                                        hysteresis = <1000>;
                                        type = "critical";
                                };
                        };
+
+                       cooling-maps {
+                               map0 {
+                                       trip = <&nsp3_alert0>;
+                                       cooling-device = <&remoteproc_cdsp 
QCOM_TMD_CDSP_SW
+                                                        THERMAL_NO_LIMIT 
THERMAL_NO_LIMIT>;
+                               };
+                       };
                };
 
                thermal_gpuss_0: gpuss-0-thermal {

-- 
2.34.1


Reply via email to