ARM: tegra: ventana: Support CPU thermal throttling
authorDmitry Osipenko <digetx@gmail.com>
Tue, 2 Mar 2021 12:09:51 +0000 (15:09 +0300)
committerThierry Reding <treding@nvidia.com>
Wed, 24 Mar 2021 15:06:28 +0000 (16:06 +0100)
Enable CPU thermal throttling on Tegra20 Ventana board.

Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
arch/arm/boot/dts/tegra20-ventana.dts

index 02b94ed..99a356c 100644 (file)
@@ -2,6 +2,7 @@
 /dts-v1/;
 
 #include <dt-bindings/input/input.h>
+#include <dt-bindings/thermal/thermal.h>
 #include "tegra20.dtsi"
 #include "tegra20-cpu-opp.dtsi"
 #include "tegra20-cpu-opp-microvolt.dtsi"
                        };
                };
 
-               temperature-sensor@4c {
+               nct1008: temperature-sensor@4c {
                        compatible = "onnn,nct1008";
                        reg = <0x4c>;
+                       #thermal-sensor-cells = <1>;
                };
        };
 
                cpu0: cpu@0 {
                        cpu-supply = <&vdd_cpu>;
                        operating-points-v2 = <&cpu0_opp_table>;
+                       #cooling-cells = <2>;
                };
 
-               cpu@1 {
+               cpu1: cpu@1 {
                        cpu-supply = <&vdd_cpu>;
                        operating-points-v2 = <&cpu0_opp_table>;
+                       #cooling-cells = <2>;
                };
        };
 
                         <&tegra_car TEGRA20_CLK_CDEV1>;
                clock-names = "pll_a", "pll_a_out0", "mclk";
        };
+
+       thermal-zones {
+               cpu-thermal {
+                       polling-delay-passive = <1000>; /* milliseconds */
+                       polling-delay = <5000>; /* milliseconds */
+
+                       thermal-sensors = <&nct1008 1>;
+
+                       trips {
+                               trip0: cpu-alert0 {
+                                       /* start throttling at 50C */
+                                       temperature = <50000>;
+                                       hysteresis = <200>;
+                                       type = "passive";
+                               };
+
+                               trip1: cpu-crit {
+                                       /* shut down at 60C */
+                                       temperature = <60000>;
+                                       hysteresis = <2000>;
+                                       type = "critical";
+                               };
+                       };
+
+                       cooling-maps {
+                               map0 {
+                                       trip = <&trip0>;
+                                       cooling-device = <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+                                                        <&cpu1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+                               };
+                       };
+               };
+       };
 };