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

Set up CDSP cooling by throttling the cdsp when it reaches 100°C and
for modem when it reaches to 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.

Since the remoteproc_mpss node doesn't exist on non modem boards, the
cooling-maps that reference it cause DT compilation errors. To fix that
remove inherited mdmss cooling-map nodes.

Signed-off-by: Gaurav Kohli <[email protected]>
---
 arch/arm64/boot/dts/qcom/kodiak.dtsi               | 125 +++++++++++++++++++++
 .../boot/dts/qcom/qcs6490-radxa-dragon-q6a.dts     |   8 ++
 .../dts/qcom/qcs6490-thundercomm-minipc-g1iot.dts  |   8 ++
 .../boot/dts/qcom/qcs6490-thundercomm-rubikpi3.dts |   8 ++
 .../boot/dts/qcom/qcs6490-vicharak-axon-mini.dts   |   8 ++
 .../boot/dts/qcom/sc7280-herobrine-lte-sku.dtsi    |  10 ++
 .../boot/dts/qcom/sc7280-herobrine-wifi-sku.dtsi   |   9 ++
 7 files changed, 176 insertions(+)

diff --git a/arch/arm64/boot/dts/qcom/kodiak.dtsi 
b/arch/arm64/boot/dts/qcom/kodiak.dtsi
index 7e73348fe0d0..53dcc5ebacd3 100644
--- a/arch/arm64/boot/dts/qcom/kodiak.dtsi
+++ b/arch/arm64/boot/dts/qcom/kodiak.dtsi
@@ -30,6 +30,7 @@
 #include <dt-bindings/sound/qcom,lpass.h>
 #include <dt-bindings/sound/qcom,q6afe.h>
 #include <dt-bindings/sound/qcom,q6asm.h>
+#include <dt-bindings/thermal/qcom,pas.h>
 #include <dt-bindings/thermal/thermal.h>
 
 / {
@@ -3431,6 +3432,8 @@ remoteproc_mpss: remoteproc@4080000 {
                        qcom,smem-states = <&modem_smp2p_out 0>;
                        qcom,smem-state-names = "stop";
 
+                       #cooling-cells = <3>;
+
                        status = "disabled";
 
                        glink-edge {
@@ -4803,6 +4806,8 @@ remoteproc_cdsp: remoteproc@a300000 {
                        qcom,smem-states = <&cdsp_smp2p_out 0>;
                        qcom,smem-state-names = "stop";
 
+                       #cooling-cells = <3>;
+
                        status = "disabled";
 
                        glink-edge {
@@ -7732,6 +7737,8 @@ map0 {
                };
 
                nspss0-thermal {
+                       polling-delay-passive = <200>;
+
                        thermal-sensors = <&tsens1 3>;
 
                        trips {
@@ -7741,15 +7748,31 @@ nspss0_alert0: trip-point0 {
                                        type = "hot";
                                };
 
+                               nspss0_alert1: trip-point1 {
+                                       temperature = <100000>;
+                                       hysteresis = <5000>;
+                                       type = "passive";
+                               };
+
                                nspss0_crit: nspss0-crit {
                                        temperature = <110000>;
                                        hysteresis = <0>;
                                        type = "critical";
                                };
                        };
+
+                       cooling-maps {
+                               map0 {
+                                       trip = <&nspss0_alert1>;
+                                       cooling-device = <&remoteproc_cdsp 
QCOM_TMD_CDSP_SW
+                                                        THERMAL_NO_LIMIT 
THERMAL_NO_LIMIT>;
+                               };
+                       };
                };
 
                nspss1-thermal {
+                       polling-delay-passive = <200>;
+
                        thermal-sensors = <&tsens1 4>;
 
                        trips {
@@ -7759,12 +7782,26 @@ nspss1_alert0: trip-point0 {
                                        type = "hot";
                                };
 
+                               nspss1_alert1: trip-point1 {
+                                       temperature = <100000>;
+                                       hysteresis = <5000>;
+                                       type = "passive";
+                               };
+
                                nspss1_crit: nspss1-crit {
                                        temperature = <110000>;
                                        hysteresis = <0>;
                                        type = "critical";
                                };
                        };
+
+                       cooling-maps {
+                               map0 {
+                                       trip = <&nspss1_alert1>;
+                                       cooling-device = <&remoteproc_cdsp 
QCOM_TMD_CDSP_SW
+                                                        THERMAL_NO_LIMIT 
THERMAL_NO_LIMIT>;
+                               };
+                       };
                };
 
                video-thermal {
@@ -7804,6 +7841,8 @@ ddr_crit: ddr-crit {
                };
 
                mdmss0-thermal {
+                       polling-delay-passive = <200>;
+
                        thermal-sensors = <&tsens1 7>;
 
                        trips {
@@ -7813,15 +7852,37 @@ mdmss0_alert0: trip-point0 {
                                        type = "hot";
                                };
 
+                               mdmss0_alert1: trip-point1 {
+                                       temperature = <95000>;
+                                       hysteresis = <2000>;
+                                       type = "passive";
+                               };
+
                                mdmss0_crit: mdmss0-crit {
                                        temperature = <110000>;
                                        hysteresis = <0>;
                                        type = "critical";
                                };
                        };
+
+                       cooling-maps {
+                               mdmss0_pa_cooling_map: map0 {
+                                       trip = <&mdmss0_alert1>;
+                                       cooling-device = <&remoteproc_mpss 
QCOM_TMD_PA
+                                                        THERMAL_NO_LIMIT 
THERMAL_NO_LIMIT>;
+                               };
+
+                               mdmss0_modem_cooling_map: map1 {
+                                       trip = <&mdmss0_alert1>;
+                                       cooling-device = <&remoteproc_mpss 
QCOM_TMD_MODEM
+                                                        THERMAL_NO_LIMIT 
THERMAL_NO_LIMIT>;
+                               };
+                       };
                };
 
                mdmss1-thermal {
+                       polling-delay-passive = <200>;
+
                        thermal-sensors = <&tsens1 8>;
 
                        trips {
@@ -7831,15 +7892,37 @@ mdmss1_alert0: trip-point0 {
                                        type = "hot";
                                };
 
+                               mdmss1_alert1: trip-point1 {
+                                       temperature = <95000>;
+                                       hysteresis = <2000>;
+                                       type = "passive";
+                               };
+
                                mdmss1_crit: mdmss1-crit {
                                        temperature = <110000>;
                                        hysteresis = <0>;
                                        type = "critical";
                                };
                        };
+
+                       cooling-maps {
+                               mdmss1_pa_cooling_map: map0 {
+                                       trip = <&mdmss1_alert1>;
+                                       cooling-device = <&remoteproc_mpss 
QCOM_TMD_PA
+                                                        THERMAL_NO_LIMIT 
THERMAL_NO_LIMIT>;
+                               };
+
+                               mdmss1_modem_cooling_map: map1 {
+                                       trip = <&mdmss1_alert1>;
+                                       cooling-device = <&remoteproc_mpss 
QCOM_TMD_MODEM
+                                                        THERMAL_NO_LIMIT 
THERMAL_NO_LIMIT>;
+                               };
+                       };
                };
 
                mdmss2-thermal {
+                       polling-delay-passive = <200>;
+
                        thermal-sensors = <&tsens1 9>;
 
                        trips {
@@ -7849,15 +7932,37 @@ mdmss2_alert0: trip-point0 {
                                        type = "hot";
                                };
 
+                               mdmss2_alert1: trip-point1 {
+                                       temperature = <95000>;
+                                       hysteresis = <2000>;
+                                       type = "passive";
+                               };
+
                                mdmss2_crit: mdmss2-crit {
                                        temperature = <110000>;
                                        hysteresis = <0>;
                                        type = "critical";
                                };
                        };
+
+                       cooling-maps {
+                               mdmss2_pa_cooling_map: map0 {
+                                       trip = <&mdmss2_alert1>;
+                                       cooling-device = <&remoteproc_mpss 
QCOM_TMD_PA
+                                                        THERMAL_NO_LIMIT 
THERMAL_NO_LIMIT>;
+                               };
+
+                               mdmss2_modem_cooling_map: map1 {
+                                       trip = <&mdmss2_alert1>;
+                                       cooling-device = <&remoteproc_mpss 
QCOM_TMD_MODEM
+                                                        THERMAL_NO_LIMIT 
THERMAL_NO_LIMIT>;
+                               };
+                       };
                };
 
                mdmss3-thermal {
+                       polling-delay-passive = <200>;
+
                        thermal-sensors = <&tsens1 10>;
 
                        trips {
@@ -7867,12 +7972,32 @@ mdmss3_alert0: trip-point0 {
                                        type = "hot";
                                };
 
+                               mdmss3_alert1: trip-point1 {
+                                       temperature = <95000>;
+                                       hysteresis = <2000>;
+                                       type = "passive";
+                               };
+
                                mdmss3_crit: mdmss3-crit {
                                        temperature = <110000>;
                                        hysteresis = <0>;
                                        type = "critical";
                                };
                        };
+
+                       cooling-maps {
+                               mdmss3_pa_cooling_map: map0 {
+                                       trip = <&mdmss3_alert1>;
+                                       cooling-device = <&remoteproc_mpss 
QCOM_TMD_PA
+                                                        THERMAL_NO_LIMIT 
THERMAL_NO_LIMIT>;
+                               };
+
+                               mdmss3_modem_cooling_map: map1 {
+                                       trip = <&mdmss3_alert1>;
+                                       cooling-device = <&remoteproc_mpss 
QCOM_TMD_MODEM
+                                                        THERMAL_NO_LIMIT 
THERMAL_NO_LIMIT>;
+                               };
+                       };
                };
 
                camera0-thermal {
diff --git a/arch/arm64/boot/dts/qcom/qcs6490-radxa-dragon-q6a.dts 
b/arch/arm64/boot/dts/qcom/qcs6490-radxa-dragon-q6a.dts
index 82ebd88f9aba..e3ddf47ce421 100644
--- a/arch/arm64/boot/dts/qcom/qcs6490-radxa-dragon-q6a.dts
+++ b/arch/arm64/boot/dts/qcom/qcs6490-radxa-dragon-q6a.dts
@@ -24,6 +24,14 @@
 /delete-node/ &adsp_mem;
 /delete-node/ &cdsp_mem;
 /delete-node/ &ipa_fw_mem;
+/delete-node/ &mdmss0_pa_cooling_map;
+/delete-node/ &mdmss0_modem_cooling_map;
+/delete-node/ &mdmss1_pa_cooling_map;
+/delete-node/ &mdmss1_modem_cooling_map;
+/delete-node/ &mdmss2_pa_cooling_map;
+/delete-node/ &mdmss2_modem_cooling_map;
+/delete-node/ &mdmss3_pa_cooling_map;
+/delete-node/ &mdmss3_modem_cooling_map;
 /delete-node/ &mpss_mem;
 /delete-node/ &remoteproc_mpss;
 /delete-node/ &remoteproc_wpss;
diff --git a/arch/arm64/boot/dts/qcom/qcs6490-thundercomm-minipc-g1iot.dts 
b/arch/arm64/boot/dts/qcom/qcs6490-thundercomm-minipc-g1iot.dts
index c8eed8ba93f5..8ce0cf23deee 100644
--- a/arch/arm64/boot/dts/qcom/qcs6490-thundercomm-minipc-g1iot.dts
+++ b/arch/arm64/boot/dts/qcom/qcs6490-thundercomm-minipc-g1iot.dts
@@ -22,6 +22,14 @@
 /delete-node/ &cdsp_mem;
 /delete-node/ &ipa_fw_mem;
 /delete-node/ &mpss_mem;
+/delete-node/ &mdmss0_pa_cooling_map;
+/delete-node/ &mdmss0_modem_cooling_map;
+/delete-node/ &mdmss1_pa_cooling_map;
+/delete-node/ &mdmss1_modem_cooling_map;
+/delete-node/ &mdmss2_pa_cooling_map;
+/delete-node/ &mdmss2_modem_cooling_map;
+/delete-node/ &mdmss3_pa_cooling_map;
+/delete-node/ &mdmss3_modem_cooling_map;
 /delete-node/ &remoteproc_mpss;
 /delete-node/ &remoteproc_wpss;
 /delete-node/ &rmtfs_mem;
diff --git a/arch/arm64/boot/dts/qcom/qcs6490-thundercomm-rubikpi3.dts 
b/arch/arm64/boot/dts/qcom/qcs6490-thundercomm-rubikpi3.dts
index d8a9a7e47bdc..abee1af19c23 100644
--- a/arch/arm64/boot/dts/qcom/qcs6490-thundercomm-rubikpi3.dts
+++ b/arch/arm64/boot/dts/qcom/qcs6490-thundercomm-rubikpi3.dts
@@ -23,6 +23,14 @@
 /delete-node/ &adsp_mem;
 /delete-node/ &cdsp_mem;
 /delete-node/ &ipa_fw_mem;
+/delete-node/ &mdmss0_pa_cooling_map;
+/delete-node/ &mdmss0_modem_cooling_map;
+/delete-node/ &mdmss1_pa_cooling_map;
+/delete-node/ &mdmss1_modem_cooling_map;
+/delete-node/ &mdmss2_pa_cooling_map;
+/delete-node/ &mdmss2_modem_cooling_map;
+/delete-node/ &mdmss3_pa_cooling_map;
+/delete-node/ &mdmss3_modem_cooling_map;
 /delete-node/ &mpss_mem;
 /delete-node/ &remoteproc_mpss;
 /delete-node/ &remoteproc_wpss;
diff --git a/arch/arm64/boot/dts/qcom/qcs6490-vicharak-axon-mini.dts 
b/arch/arm64/boot/dts/qcom/qcs6490-vicharak-axon-mini.dts
index 4f2e0109f49b..d3f558596ca2 100644
--- a/arch/arm64/boot/dts/qcom/qcs6490-vicharak-axon-mini.dts
+++ b/arch/arm64/boot/dts/qcom/qcs6490-vicharak-axon-mini.dts
@@ -25,6 +25,14 @@
 /delete-node/ &cdsp_mem;
 /delete-node/ &ipa_fw_mem;
 /delete-node/ &mpss_mem;
+/delete-node/ &mdmss0_pa_cooling_map;
+/delete-node/ &mdmss0_modem_cooling_map;
+/delete-node/ &mdmss1_pa_cooling_map;
+/delete-node/ &mdmss1_modem_cooling_map;
+/delete-node/ &mdmss2_pa_cooling_map;
+/delete-node/ &mdmss2_modem_cooling_map;
+/delete-node/ &mdmss3_pa_cooling_map;
+/delete-node/ &mdmss3_modem_cooling_map;
 /delete-node/ &remoteproc_mpss;
 /delete-node/ &remoteproc_wpss;
 /delete-node/ &rmtfs_mem;
diff --git a/arch/arm64/boot/dts/qcom/sc7280-herobrine-lte-sku.dtsi 
b/arch/arm64/boot/dts/qcom/sc7280-herobrine-lte-sku.dtsi
index ac89724ee099..891941906a46 100644
--- a/arch/arm64/boot/dts/qcom/sc7280-herobrine-lte-sku.dtsi
+++ b/arch/arm64/boot/dts/qcom/sc7280-herobrine-lte-sku.dtsi
@@ -28,8 +28,18 @@ &ipa {
        status = "okay";
 };
 
+/delete-node/ &mdmss0_pa_cooling_map;
+/delete-node/ &mdmss0_modem_cooling_map;
+/delete-node/ &mdmss1_pa_cooling_map;
+/delete-node/ &mdmss1_modem_cooling_map;
+/delete-node/ &mdmss2_pa_cooling_map;
+/delete-node/ &mdmss2_modem_cooling_map;
+/delete-node/ &mdmss3_pa_cooling_map;
+/delete-node/ &mdmss3_modem_cooling_map;
+
 &remoteproc_mpss {
        compatible = "qcom,sc7280-mss-pil";
+       /delete-property/ #cooling-cells;
        reg = <0 0x04080000 0 0x10000>, <0 0x04180000 0 0x48>;
        reg-names = "qdsp6", "rmb";
 
diff --git a/arch/arm64/boot/dts/qcom/sc7280-herobrine-wifi-sku.dtsi 
b/arch/arm64/boot/dts/qcom/sc7280-herobrine-wifi-sku.dtsi
index 3ebc915f0dc2..296c72672ec5 100644
--- a/arch/arm64/boot/dts/qcom/sc7280-herobrine-wifi-sku.dtsi
+++ b/arch/arm64/boot/dts/qcom/sc7280-herobrine-wifi-sku.dtsi
@@ -7,6 +7,15 @@
 
 /* WIFI SKUs save 256M by not having modem/mba/rmtfs memory regions defined. */
 
+/delete-node/ &mdmss0_pa_cooling_map;
+/delete-node/ &mdmss0_modem_cooling_map;
+/delete-node/ &mdmss1_pa_cooling_map;
+/delete-node/ &mdmss1_modem_cooling_map;
+/delete-node/ &mdmss2_pa_cooling_map;
+/delete-node/ &mdmss2_modem_cooling_map;
+/delete-node/ &mdmss3_pa_cooling_map;
+/delete-node/ &mdmss3_modem_cooling_map;
+
 /delete-node/ &mpss_mem;
 /delete-node/ &remoteproc_mpss;
 /delete-node/ &rmtfs_mem;

-- 
2.34.1


Reply via email to