linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dmitry Osipenko <digetx@gmail.com>
To: Thierry Reding <thierry.reding@gmail.com>,
	Jonathan Hunter <jonathanh@nvidia.com>,
	Agneli <poczt@protonmail.ch>, Paul Fertser <fercerpav@gmail.com>,
	Svyatoslav Ryhel <clamor95@gmail.com>
Cc: linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH v1 06/10] ARM: tegra: paz00: Add CPU thermal zone
Date: Mon, 10 May 2021 23:25:56 +0300	[thread overview]
Message-ID: <20210510202600.12156-7-digetx@gmail.com> (raw)
In-Reply-To: <20210510202600.12156-1-digetx@gmail.com>

Add thermal zone with a passive cooling trip for CPU. Attach it to the
LM90 sensor which monitors CPU temperature. Now CPU frequencies will be
throttled once trip point is reached, preventing critical overheat.

Tested-by: Agneli <poczt@protonmail.ch>
Tested-by: Paul Fertser <fercerpav@gmail.com>
Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
---
 arch/arm/boot/dts/tegra20-paz00.dts | 42 +++++++++++++++++++++++++++--
 1 file changed, 40 insertions(+), 2 deletions(-)

diff --git a/arch/arm/boot/dts/tegra20-paz00.dts b/arch/arm/boot/dts/tegra20-paz00.dts
index 63d62418d4b8..3180bff90756 100644
--- a/arch/arm/boot/dts/tegra20-paz00.dts
+++ b/arch/arm/boot/dts/tegra20-paz00.dts
@@ -2,6 +2,8 @@
 /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"
@@ -498,9 +500,10 @@ ldo_rtc {
 			};
 		};
 
-		adt7461@4c {
+		adt7461: temperature-sensor@4c {
 			compatible = "adi,adt7461";
 			reg = <0x4c>;
+			#thermal-sensor-cells = <1>;
 		};
 	};
 
@@ -655,11 +658,46 @@ cpus {
 		cpu0: cpu@0 {
 			cpu-supply = <&cpu_vdd_reg>;
 			operating-points-v2 = <&cpu0_opp_table>;
+			#cooling-cells = <2>;
 		};
 
-		cpu@1 {
+		cpu1: cpu@1 {
 			cpu-supply = <&cpu_vdd_reg>;
 			operating-points-v2 = <&cpu0_opp_table>;
+			#cooling-cells = <2>;
+		};
+	};
+
+	thermal-zones {
+		cpu-thermal {
+			polling-delay-passive = <500>; /* milliseconds */
+			polling-delay = <1500>; /* milliseconds */
+
+			thermal-sensors = <&adt7461 1>;
+
+			trips {
+				trip0: cpu-alert0 {
+					/* start throttling at 80C */
+					temperature = <80000>;
+					hysteresis = <200>;
+					type = "passive";
+				};
+
+				trip1: cpu-crit {
+					/* shut down at 85C */
+					temperature = <85000>;
+					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>;
+				};
+			};
 		};
 	};
 };
-- 
2.30.2


  parent reply	other threads:[~2021-05-10 20:28 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-10 20:25 [PATCH v1 00/10] NVIDIA Tegra ARM32 device-tree improvements for 5.14 Dmitry Osipenko
2021-05-10 20:25 ` [PATCH v1 01/10] ARM: tegra: acer-a500: Improve microphone detection Dmitry Osipenko
2021-05-10 20:25 ` [PATCH v1 02/10] ARM: tegra: acer-a500: Specify proper voltage for WiFi SDIO bus Dmitry Osipenko
2021-05-10 20:25 ` [PATCH v1 03/10] ARM: tegra: acer-a500: Bump thermal trips by 10C Dmitry Osipenko
2021-05-14 21:16   ` Michał Mirosław
2021-05-14 22:17     ` Dmitry Osipenko
2021-06-11  9:52     ` Daniel Lezcano
2021-06-12 10:40       ` Dmitry Osipenko
2021-06-12 14:24         ` Daniel Lezcano
2021-06-13  0:25           ` Dmitry Osipenko
2021-06-13 18:19             ` Daniel Lezcano
2021-06-15 12:53               ` Dmitry Osipenko
2021-06-15 13:05                 ` Daniel Lezcano
2021-06-15 13:26                   ` Dmitry Osipenko
2021-05-10 20:25 ` [PATCH v1 04/10] ARM: tegra: Add reg property to Tegra20 EMC table device-tree nodes Dmitry Osipenko
2021-05-31  9:14   ` Thierry Reding
2021-05-31 20:45     ` Dmitry Osipenko
2021-06-01 11:25       ` Thierry Reding
2021-06-01 17:44         ` Dmitry Osipenko
2021-06-01 17:54         ` Dmitry Osipenko
2021-05-10 20:25 ` [PATCH v1 05/10] ARM: tegra: wm8903: Fix polarity of headphones-detection GPIO in device-trees Dmitry Osipenko
2021-05-10 20:25 ` Dmitry Osipenko [this message]
2021-05-10 20:25 ` [PATCH v1 07/10] ARM: tegra: nexus7: Add i2c-thermtrip node Dmitry Osipenko
2021-05-10 20:25 ` [PATCH v1 08/10] ARM: tegra: nexus7: Improve thermal zones Dmitry Osipenko
2021-05-10 20:25 ` [PATCH v1 09/10] ARM: tegra: nexus7: Remove monitored-battery property Dmitry Osipenko
2021-05-10 20:26 ` [PATCH v1 10/10] ARM: tegra: nexus7: Correct 3v3 regulator GPIO of PM269 variant Dmitry Osipenko
2021-05-31  8:58 ` [PATCH v1 00/10] NVIDIA Tegra ARM32 device-tree improvements for 5.14 Thierry Reding

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210510202600.12156-7-digetx@gmail.com \
    --to=digetx@gmail.com \
    --cc=clamor95@gmail.com \
    --cc=fercerpav@gmail.com \
    --cc=jonathanh@nvidia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=poczt@protonmail.ch \
    --cc=thierry.reding@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).