mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Svyatoslav Ryhel <clamor95@gmail.com>
To: Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	Thierry Reding <thierry.reding@kernel.org>,
	Jonathan Hunter <jonathanh@nvidia.com>,
	Svyatoslav Ryhel <clamor95@gmail.com>,
	Mikko Perttunen <mperttunen@nvidia.com>
Cc: devicetree@vger.kernel.org, linux-tegra@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH v1 09/18] ARM: tegra: tegratab: Add thermal configuration
Date: Sun, 22 Nov 2026 22:13:58 +0200	[thread overview]
Message-ID: <20261122201407.23742-10-clamor95@gmail.com> (raw)
In-Reply-To: <20261122201407.23742-1-clamor95@gmail.com>

Add thermal monitoring setup based on Palmas GP ADC sensors.

Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
---
 .../tegra114-nvidia-tegratab-common.dtsi      | 126 ++++++++++++++++++
 1 file changed, 126 insertions(+)

diff --git a/arch/arm/boot/dts/nvidia/tegra114-nvidia-tegratab-common.dtsi b/arch/arm/boot/dts/nvidia/tegra114-nvidia-tegratab-common.dtsi
index bb5788b2539cd..cbf9b45284033 100644
--- a/arch/arm/boot/dts/nvidia/tegra114-nvidia-tegratab-common.dtsi
+++ b/arch/arm/boot/dts/nvidia/tegra114-nvidia-tegratab-common.dtsi
@@ -1,6 +1,8 @@
 // SPDX-License-Identifier: GPL-2.0
 
 #include <dt-bindings/input/input.h>
+#include <dt-bindings/thermal/thermal.h>
+
 #include "tegra114.dtsi"
 
 / {
@@ -983,6 +985,9 @@ fuel-gauge@36 {
 			monitored-battery = <&battery>;
 			power-supplies = <&bq24193>;
 
+			io-channels = <&thermistor>;
+			io-channel-names = "temp";
+
 			maxim,alert-low-soc-level = <10>;
 			maxim,double-soc;
 
@@ -1011,6 +1016,21 @@ usb_otg_vbus: usb-otg-vbus {
 		};
 	};
 
+	i2c@7000c400 {
+		status = "okay";
+		clock-frequency = <100000>;
+
+		power-sensor@44 {
+			compatible = "ti,ina230";
+			reg = <0x44>;
+
+			shunt-resistor = <5000>;
+
+			vs-supply = <&vdd_3v3_sys>;
+			#io-channel-cells = <1>;
+		};
+	};
+
 	i2c@7000d000 {
 		status = "okay";
 		clock-frequency = <400000>;
@@ -1025,6 +1045,21 @@ palmas: pmic@58 {
 
 			ti,system-power-controller;
 
+			palmas_gpadc: adc {
+				compatible = "ti,palmas-gpadc";
+
+				interrupt-parent = <&palmas>;
+				interrupts = <18 IRQ_TYPE_NONE>,
+					     <16 IRQ_TYPE_NONE>,
+					     <17 IRQ_TYPE_NONE>;
+
+				ti,channel0-current-microamp = <5>;
+				ti,channel3-current-microamp = <400>;
+				ti,enable-extended-delay;
+
+				#io-channel-cells = <1>;
+			};
+
 			palmas_extcon: extcon {
 				compatible = "ti,palmas-usb-vid";
 
@@ -1546,4 +1581,95 @@ vdd_3v3_com: regulator-com {
 		enable-active-high;
 		vin-supply = <&vdd_3v3_sys>;
 	};
+
+	thermistor: thermal-sensor-thermistor {
+		compatible = "generic-adc-thermal";
+		#thermal-sensor-cells = <0>;
+
+		io-channels = <&palmas_gpadc 1>;
+		io-channel-names = "sensor-channel";
+		#io-channel-cells = <0>;
+
+		temperature-lookup-table = <
+			(-40000) 2726  (-35000) 2708  (-30000) 2683  (-25000) 2649
+			(-20000) 2605  (-15000) 2547  (-10000) 2475   (-5000) 2386
+			       0 2279      5000 2154     10000 2012     15000 1857
+			   20000 1691     25000 1521     30000 1351     35000 1187
+			   40000 1032     45000  889     50000  761     55000  648
+			   60000  549     65000  464     70000  392     75000  330
+			   80000  279     85000  235     90000  199     95000  168
+			  100000  143    105000  121    110000  103    115000   88
+			  120000   76    125000   65 >;
+	};
+
+	tdiode: thermal-sensor-tdiode {
+		compatible = "generic-adc-thermal";
+		#thermal-sensor-cells = <0>;
+
+		io-channels = <&palmas_gpadc 3>;
+		io-channel-names = "sensor-channel";
+		#io-channel-cells = <0>;
+
+		// TODO: add a table here -25C to 125C
+	};
+
+	thermal-zones {
+		thermistor-thermal {
+			polling-delay-passive = <1100>; /* milliseconds */
+			polling-delay = <15000>; /* milliseconds */
+
+			thermal-sensors = <&thermistor>;
+
+			trips {
+				thermistor_trip: thermistor-alert {
+					/* throttle at 55C until temperature drops to 53C */
+					temperature = <55000>;
+					hysteresis = <2000>;
+					type = "passive";
+				};
+
+				thermistor-crit {
+					/* shut down at 60C */
+					temperature = <60000>;
+					hysteresis = <2000>;
+					type = "critical";
+				};
+			};
+
+			cooling-maps {
+				map-thermistor {
+					trip = <&thermistor_trip>;
+					cooling-device = <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+							 <&cpu1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+							 <&cpu2 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+							 <&cpu3 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+				};
+			};
+		};
+
+		tdiode-thermal {
+			polling-delay-passive = <1100>; /* milliseconds */
+			polling-delay = <15000>; /* milliseconds */
+
+			thermal-sensors = <&tdiode>;
+
+			trips {
+				tdiode_trip: tdiode-alert {
+					temperature = <60000>;
+					hysteresis = <2000>;
+					type = "passive";
+				};
+			};
+
+			cooling-maps {
+				map-tdiode {
+					trip = <&tdiode_trip>;
+					cooling-device = <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+							 <&cpu1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+							 <&cpu2 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+							 <&cpu3 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+				};
+			};
+		};
+	};
 };
-- 
2.53.0


  parent reply	other threads:[~2026-11-22 20:14 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-22 20:13 [PATCH v1 00/18] [WIP] ARM: tegra: Update Tegra Note 7 configuration Svyatoslav Ryhel
2026-11-22 20:13 ` [PATCH v1 01/18] dt-bindings: ARM: tegra: Document Tegra Note 7 variants Svyatoslav Ryhel
2026-11-22 20:13 ` [PATCH v1 02/18] ARM: tegra: Diverge Tegra Note 7 device tree to support its common versions Svyatoslav Ryhel
2026-11-22 20:13 ` [PATCH v1 03/18] ARM: tegra: tegratab: Upgrade powerlines configuration Svyatoslav Ryhel
2026-11-22 20:13 ` [PATCH v1 04/18] ARM: tegra: tegratab: Add pinmux node Svyatoslav Ryhel
2026-11-22 20:13 ` [PATCH v1 05/18] ARM: tegra: tegratab: Bind VDE device Svyatoslav Ryhel
2026-11-22 20:13 ` [PATCH v1 06/18] ARM: tegra: tegratab: Configure USB and power supply Svyatoslav Ryhel
2026-11-22 20:13 ` [PATCH v1 07/18] ARM: tegra: tegratab: Configure MMC devices Svyatoslav Ryhel
2026-11-22 20:13 ` [PATCH v1 08/18] ARM: tegra: tegratab: Configure wireless devices Svyatoslav Ryhel
2026-11-22 20:13 ` Svyatoslav Ryhel [this message]
2026-11-22 20:13 ` [PATCH v1 10/18] ARM: tegra: tegratab: Configure HDMI Svyatoslav Ryhel
2026-11-22 20:14 ` [PATCH v1 11/18] ARM: tegra: tegratab: Add audio codec and sound card configuration Svyatoslav Ryhel
2026-11-22 20:14 ` [PATCH v1 12/18] ARM: tegra: tegratab: Add common sensor nodes Svyatoslav Ryhel
2026-11-22 20:14 ` [PATCH v1 13/18] ARM: tegra: tegratab: Add MC and EMC timing nodes Svyatoslav Ryhel
2026-11-22 20:14 ` [PATCH v1 14/18] ARM: tegra: tegratab: Add CPU DFLL clock node Svyatoslav Ryhel
2026-11-22 20:14 ` [PATCH v1 15/18] ARM: tegra: tegratab: Update GPIO keys and switches Svyatoslav Ryhel
2026-11-22 20:14 ` [PATCH v1 16/18] ARM: tegra: tegratab: Update aliases, chosen and memory nodes Svyatoslav Ryhel
2026-11-22 20:14 ` [PATCH v1 17/18] ARM: tegra: tegratab: Add video input configuration Svyatoslav Ryhel
2026-11-22 20:14 ` [PATCH v1 18/18] ARM: tegra: tegratab: Add panel rotation Svyatoslav Ryhel

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=20261122201407.23742-10-clamor95@gmail.com \
    --to=clamor95@gmail.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=jonathanh@nvidia.com \
    --cc=krzk+dt@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=mperttunen@nvidia.com \
    --cc=robh@kernel.org \
    --cc=thierry.reding@kernel.org \
    /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

all inboxes | Powered by JetHome®