Skip to contentSkip to conversation

thermal: tegra: soctherm bugfixes

PATCH In review Nicolas Chauvet 4 participants 12 messages Sep 27, 2020 – Nov 20, 2020

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

v2 cover thermal: tegra: soctherm bugfixes

When using tegra_soctherm driver on jetson-tk1, the following messages can be seen:
from kernel: tegra_soctherm 700e2000.thermal-sensor:
throttle-cfg: heavy: no throt prop or invalid prop
soctherm: trip temperature -2147483647 forced to -127000
thermtrip: will shut down when cpu reaches 101000 mC
soctherm: trip temperature -2147483647 forced to -127000
thermtrip: will shut down when gpu reaches 101000 mC
soctherm: trip temperature -2147483647 forced to -127000
thermtrip: will shut down when pll reaches 103000 mC
throttrip: pll: missing hot temperature
soctherm: trip temperature -2147483647 forced to -127000
thermtrip: will shut down when mem reaches 101000 mC
throttrip: mem: missing hot temperature
IRQ index 1 not found

This serie fixes two errors and two warnings that are reported in dmesg It was compiled and tested at runtime on jetson-tk1 only.

v2:
* Add missing tegra210 device-tree properties
* Add the appropriate prefix for tegra soctherm
* Use SoCs condition over of_compatible

Nicolas Chauvet (6):
ARM: tegra: Add missing gpu-throt-level to tegra124 soctherm
ARM: tegra: Add missing hot temperatures to tegra124 thermal-zones
arm64: tegra: Add missing hot temperatures to tegra132 thermal-zones
arm64: tegra: Add missing gpu-throt-level to tegra210 soctherm
arm64: tegra: Add missing hot temperatures to tegra210 thermal-zones
thermal: tegra: Avoid setting edp_irq when not relevant

 arch/arm/boot/dts/tegra124.dtsi           | 11 +++++++
 arch/arm64/boot/dts/nvidia/tegra132.dtsi  | 10 ++++++
 arch/arm64/boot/dts/nvidia/tegra210.dtsi  | 13 ++++++++
 drivers/thermal/tegra/soctherm.c          | 38 +++++++++++++----------
 drivers/thermal/tegra/soctherm.h          |  1 +
 drivers/thermal/tegra/tegra124-soctherm.c |  1 +
 drivers/thermal/tegra/tegra132-soctherm.c |  1 +
 drivers/thermal/tegra/tegra210-soctherm.c |  1 +
 8 files changed, 60 insertions(+), 16 deletions(-)
Signature · 1 line
2.25.4
#1 lore raw

PATCH v2 1/6 ARM: tegra: Add missing gpu-throt-level to tegra124 soctherm

On jetson-tk1 the following message can be seen:
tegra_soctherm 700e2000.thermal-sensor: throttle-cfg: heavy: no throt prop or invalid prop

This patch will fix the invalid prop issue according to the binding.

---
 arch/arm/boot/dts/tegra124.dtsi | 1 +
 1 file changed, 1 insertion(+)
arch/arm/boot/dts/tegra124.dtsi +1 -0
index 64f488ba1e72..a0fa5821a232 100644
@@ -910,6 +910,7 @@ throttle-cfgs {
 			throttle_heavy: heavy {
 				nvidia,priority = <100>;
 				nvidia,cpu-throt-percent = <85>;
+				nvidia,gpu-throt-level = <TEGRA_SOCTHERM_THROT_LEVEL_HIGH>;
 
 				#cooling-cells = <2>;
 			};
Signature · 1 line
2.25.4
#2 lore raw

PATCH v2 2/6 ARM: tegra: Add missing hot temperatures to tegra124 thermal-zones

In reply to Nicolas Chauvet

According to dmesg, thermal-zones for mem and cpu are missing hot temperatures properties.

throttrip: pll: missing hot temperature
...
throttrip: mem: missing hot temperature
...

Adding them will clear the messages.

---
 arch/arm/boot/dts/tegra124.dtsi | 10 ++++++++++
 1 file changed, 10 insertions(+)
arch/arm/boot/dts/tegra124.dtsi +10 -0
index a0fa5821a232..c71d597ace01 100644
@@ -1248,6 +1248,11 @@ mem-shutdown-trip {
 					hysteresis = <0>;
 					type = "critical";
 				};
+				mem-throttle-trip {
+					temperature = <99000>;
+					hysteresis = <1000>;
+					type = "hot";
+				};
 			};
 
 			cooling-maps {
@@ -1299,6 +1304,11 @@ pllx-shutdown-trip {
 					hysteresis = <0>;
 					type = "critical";
 				};
+				pllx-throttle-trip {
+					temperature = <99000>;
+					hysteresis = <1000>;
+					type = "hot";
+				};
 			};
 
 			cooling-maps {
Signature · 1 line
2.25.4
#3 lore raw

PATCH v2 3/6 arm64: tegra: Add missing hot temperatures to tegra132 thermal-zones

In reply to Nicolas Chauvet

According to dmesg, thermal-zones for mem and cpu are missing hot temperatures properties.

throttrip: pll: missing hot temperature
...
throttrip: mem: missing hot temperature
...

Adding them will clear the messages.

---
 arch/arm64/boot/dts/nvidia/tegra132.dtsi | 10 ++++++++++
 1 file changed, 10 insertions(+)
arch/arm64/boot/dts/nvidia/tegra132.dtsi +10 -0
index e40281510c0c..cd913e59ba26 100644
@@ -925,6 +925,11 @@ mem_shutdown_trip {
 					hysteresis = <1000>;
 					type = "critical";
 				};
+				mem_throttle_trip {
+					temperature = <99000>;
+					hysteresis = <1000>;
+					type = "hot";
+				};
 			};
 
 			cooling-maps {
@@ -975,6 +980,11 @@ pllx_shutdown_trip {
 					hysteresis = <1000>;
 					type = "critical";
 				};
+				pllx_throttle_trip {
+					temperature = <99000>;
+					hysteresis = <1000>;
+					type = "hot";
+				};
 			};
 
 			cooling-maps {
Signature · 1 line
2.25.4
#4 lore raw

PATCH v2 4/6 arm64: tegra: Add missing gpu-throt-level to tegra210 soctherm

In reply to Nicolas Chauvet

On jetson-tx1 the following message can be seen:
tegra_soctherm 700e2000.thermal-sensor: throttle-cfg: heavy: no throt prop or invalid prop

This patch will fix the invalid prop issue according to the binding.

---
 arch/arm64/boot/dts/nvidia/tegra210.dtsi | 1 +
 1 file changed, 1 insertion(+)
arch/arm64/boot/dts/nvidia/tegra210.dtsi +1 -0
index 8cca2166a446..c518292ee3f5 100644
@@ -1582,6 +1582,7 @@ throttle-cfgs {
 			throttle_heavy: heavy {
 				nvidia,priority = <100>;
 				nvidia,cpu-throt-percent = <85>;
+				nvidia,gpu-throt-level = <TEGRA_SOCTHERM_THROT_LEVEL_HIGH>;
 
 				#cooling-cells = <2>;
 			};
Signature · 1 line
2.25.4
#5 lore raw

PATCH v2 5/6 arm64: tegra: Add missing hot temperatures to tegra210 thermal-zones

In reply to Nicolas Chauvet

According to dmesg, thermal-zones for mem and cpu are missing hot temperatures properties.

throttrip: pll: missing hot temperature
...
throttrip: mem: missing hot temperature
...

Adding them will clear the messages.

---
 arch/arm64/boot/dts/nvidia/tegra210.dtsi | 12 ++++++++++++
 1 file changed, 12 insertions(+)
arch/arm64/boot/dts/nvidia/tegra210.dtsi +12 -0
index c518292ee3f5..9e8ddec52651 100644
@@ -1639,6 +1639,12 @@ dram_throttle: mem-throttle-trip {
 					type = "active";
 				};
 
+				mem-hot-trip {
+					temperature = <100000>;
+					hysteresis = <1000>;
+					type = "hot";
+				};
+
 				mem-shutdown-trip {
 					temperature = <103000>;
 					hysteresis = <0>;
@@ -1701,6 +1707,12 @@ pllx-shutdown-trip {
 					hysteresis = <0>;
 					type = "critical";
 				};
+
+				pllx-throttle-trip {
+					temperature = <100000>;
+					hysteresis = <1000>;
+					type = "hot";
+				};
 			};
 
 			cooling-maps {
Signature · 1 line
2.25.4
#6 lore raw

PATCH v2 6/6 thermal: tegra: Avoid setting edp_irq when not relevant

In reply to Nicolas Chauvet

According to the binding, the edp_irq is not available on tegra124/132

This commit moves the initialization of tegra->edp_irq after the introduced has_edp_irq condition. This will have the following effects:
- soctherm_interrupts_init will not return prematurely with unfinished
thermal_irq initialization on tegra124 and tegra132
- edp_irq initialization will be done only when relevant

As a result, this will clear the following error on jetson-tk1 :
kernel: tegra_soctherm 700e2000.thermal-sensor: IRQ index 1 not found

v2:
* Use .has_edp_irq boolean instead of of_compatible
* Switch subject prefix to use thermal instead of ARM

Fixes 4a04beb1bf2e (thermal: tegra: add support for EDP IRQ)
---
 drivers/thermal/tegra/soctherm.c          | 38 +++++++++++++----------
 drivers/thermal/tegra/soctherm.h          |  1 +
 drivers/thermal/tegra/tegra124-soctherm.c |  1 +
 drivers/thermal/tegra/tegra132-soctherm.c |  1 +
 drivers/thermal/tegra/tegra210-soctherm.c |  1 +
 5 files changed, 26 insertions(+), 16 deletions(-)
drivers/thermal/tegra/soctherm.c +22 -16
index 66e0639da4bf..0c79e033e7ea 100644
@@ -2025,12 +2025,6 @@ static int soctherm_interrupts_init(struct platform_device *pdev,
 		return 0;
 	}
 
-	tegra->edp_irq = platform_get_irq(pdev, 1);
-	if (tegra->edp_irq < 0) {
-		dev_dbg(&pdev->dev, "get 'edp_irq' failed.\n");
-		return 0;
-	}
-
 	ret = devm_request_threaded_irq(&pdev->dev,
 					tegra->thermal_irq,
 					soctherm_thermal_isr,
@@ -2043,16 +2037,28 @@ static int soctherm_interrupts_init(struct platform_device *pdev,
 		return ret;
 	}
 
-	ret = devm_request_threaded_irq(&pdev->dev,
-					tegra->edp_irq,
-					soctherm_edp_isr,
-					soctherm_edp_isr_thread,
-					IRQF_ONESHOT,
-					"soctherm_edp",
-					tegra);
-	if (ret < 0) {
-		dev_err(&pdev->dev, "request_irq 'edp_irq' failed.\n");
-		return ret;
+	/* Initialize edp_irq when available */
+	if (tegra->soc->has_edp_irq) {
+		/* get IRQ */
+
+		tegra->edp_irq = platform_get_irq(pdev, 1);
+		if (tegra->edp_irq < 0) {
+			dev_dbg(&pdev->dev, "get 'edp_irq' failed.\n");
+			return 0;
+		}
+
+		/* request IRQ */
+		ret = devm_request_threaded_irq(&pdev->dev,
+						tegra->edp_irq,
+						soctherm_edp_isr,
+						soctherm_edp_isr_thread,
+						IRQF_ONESHOT,
+						"soctherm_edp",
+						tegra);
+		if (ret < 0) {
+			dev_err(&pdev->dev, "request_irq 'edp_irq' failed.\n");
+			return ret;
+		}
 	}
 
 	return 0;
drivers/thermal/tegra/soctherm.h +1 -0
index 70501e73d586..b93cfdd06e5d 100644
@@ -128,6 +128,7 @@ struct tegra_soctherm_soc {
 	const int thresh_grain;
 	const unsigned int bptt;
 	const bool use_ccroc;
+	const bool has_edp_irq;
 	struct tsensor_group_thermtrips *thermtrips;
 };
 
drivers/thermal/tegra/tegra124-soctherm.c +1 -0
index 20ad27f4d1a1..c8c8231f6cdd 100644
@@ -216,4 +216,5 @@ const struct tegra_soctherm_soc tegra124_soctherm = {
 	.thresh_grain = TEGRA124_THRESH_GRAIN,
 	.bptt = TEGRA124_BPTT,
 	.use_ccroc = false,
+	.has_edp_irq = false,
 };
drivers/thermal/tegra/tegra132-soctherm.c +1 -0
index b76308fdad9e..1bc9481de5fc 100644
@@ -216,4 +216,5 @@ const struct tegra_soctherm_soc tegra132_soctherm = {
 	.thresh_grain = TEGRA132_THRESH_GRAIN,
 	.bptt = TEGRA132_BPTT,
 	.use_ccroc = true,
+	.has_edp_irq = false,
 };
drivers/thermal/tegra/tegra210-soctherm.c +1 -0
index d0ff793f18c5..2b09c8a811d0 100644
@@ -224,5 +224,6 @@ const struct tegra_soctherm_soc tegra210_soctherm = {
 	.thresh_grain = TEGRA210_THRESH_GRAIN,
 	.bptt = TEGRA210_BPTT,
 	.use_ccroc = false,
+	.has_edp_irq = true,
 	.thermtrips = tegra210_tsensor_thermtrips,
 };
Signature · 1 line
2.25.4
maintainer
#7 lore raw

Re: [PATCH v2 6/6] thermal: tegra: Avoid setting edp_irq when not relevant

Quoted 1 line · Nicolas Chauvet

According to the binding, the edp_irq is not available on tegra124/132

It appears that the binding doc is not update to date or missing the relevant information. Looking at the Tegra124 TRM I see that there is a SOCTHERM EDP IRQ (51) and so maybe the correct fix is to add this.

Cheers
Jon

Signature · 1 line
nvpublic
#8 lore raw
In reply to Nicolas Chauvet
Quoted 45 lines · Nicolas Chauvet

When using tegra_soctherm driver on jetson-tk1, the following messages can be seen:
from kernel: tegra_soctherm 700e2000.thermal-sensor:
throttle-cfg: heavy: no throt prop or invalid prop
soctherm: trip temperature -2147483647 forced to -127000
thermtrip: will shut down when cpu reaches 101000 mC
soctherm: trip temperature -2147483647 forced to -127000
thermtrip: will shut down when gpu reaches 101000 mC
soctherm: trip temperature -2147483647 forced to -127000
thermtrip: will shut down when pll reaches 103000 mC
throttrip: pll: missing hot temperature
soctherm: trip temperature -2147483647 forced to -127000
thermtrip: will shut down when mem reaches 101000 mC
throttrip: mem: missing hot temperature
IRQ index 1 not found

This serie fixes two errors and two warnings that are reported in dmesg It was compiled and tested at runtime on jetson-tk1 only.

v2:
* Add missing tegra210 device-tree properties
* Add the appropriate prefix for tegra soctherm
* Use SoCs condition over of_compatible

Nicolas Chauvet (6):
ARM: tegra: Add missing gpu-throt-level to tegra124 soctherm
ARM: tegra: Add missing hot temperatures to tegra124 thermal-zones
arm64: tegra: Add missing hot temperatures to tegra132 thermal-zones
arm64: tegra: Add missing gpu-throt-level to tegra210 soctherm
arm64: tegra: Add missing hot temperatures to tegra210 thermal-zones
thermal: tegra: Avoid setting edp_irq when not relevant

 arch/arm/boot/dts/tegra124.dtsi           | 11 +++++++
 arch/arm64/boot/dts/nvidia/tegra132.dtsi  | 10 ++++++
 arch/arm64/boot/dts/nvidia/tegra210.dtsi  | 13 ++++++++
 drivers/thermal/tegra/soctherm.c          | 38 +++++++++++++----------
 drivers/thermal/tegra/soctherm.h          |  1 +
 drivers/thermal/tegra/tegra124-soctherm.c |  1 +
 drivers/thermal/tegra/tegra132-soctherm.c |  1 +
 drivers/thermal/tegra/tegra210-soctherm.c |  1 +
 8 files changed, 60 insertions(+), 16 deletions(-)
Quoted 2 lines

--
2.25.4

Hello,
This series is still pending review.

Thierry, do you expect some reviewers from the linux-pm (Zhang, Daniel ?) To me it seems like tegra specific changes, so maybe a Nvidia reviewer is awaited ?

Thanks.

#9 lore raw
Quoted 49 lines · Nicolas Chauvet
Quoted 45 lines · Nicolas Chauvet

When using tegra_soctherm driver on jetson-tk1, the following messages can be seen:
from kernel: tegra_soctherm 700e2000.thermal-sensor:
throttle-cfg: heavy: no throt prop or invalid prop
soctherm: trip temperature -2147483647 forced to -127000
thermtrip: will shut down when cpu reaches 101000 mC
soctherm: trip temperature -2147483647 forced to -127000
thermtrip: will shut down when gpu reaches 101000 mC
soctherm: trip temperature -2147483647 forced to -127000
thermtrip: will shut down when pll reaches 103000 mC
throttrip: pll: missing hot temperature
soctherm: trip temperature -2147483647 forced to -127000
thermtrip: will shut down when mem reaches 101000 mC
throttrip: mem: missing hot temperature
IRQ index 1 not found

This serie fixes two errors and two warnings that are reported in dmesg It was compiled and tested at runtime on jetson-tk1 only.

v2:
* Add missing tegra210 device-tree properties
* Add the appropriate prefix for tegra soctherm
* Use SoCs condition over of_compatible

Nicolas Chauvet (6):
ARM: tegra: Add missing gpu-throt-level to tegra124 soctherm
ARM: tegra: Add missing hot temperatures to tegra124 thermal-zones
arm64: tegra: Add missing hot temperatures to tegra132 thermal-zones
arm64: tegra: Add missing gpu-throt-level to tegra210 soctherm
arm64: tegra: Add missing hot temperatures to tegra210 thermal-zones
thermal: tegra: Avoid setting edp_irq when not relevant

 arch/arm/boot/dts/tegra124.dtsi           | 11 +++++++
 arch/arm64/boot/dts/nvidia/tegra132.dtsi  | 10 ++++++
 arch/arm64/boot/dts/nvidia/tegra210.dtsi  | 13 ++++++++
 drivers/thermal/tegra/soctherm.c          | 38 +++++++++++++----------
 drivers/thermal/tegra/soctherm.h          |  1 +
 drivers/thermal/tegra/tegra124-soctherm.c |  1 +
 drivers/thermal/tegra/tegra132-soctherm.c |  1 +
 drivers/thermal/tegra/tegra210-soctherm.c |  1 +
 8 files changed, 60 insertions(+), 16 deletions(-)
Quoted 2 lines

--
2.25.4

Quoted 6 lines

Hello,
This series is still pending review.

Thierry, do you expect some reviewers from the linux-pm (Zhang, Daniel ?) To me it seems like tegra specific changes, so maybe a Nvidia reviewer is awaited ?

I can apply the patch 6/6, other patches must go through arm-soc tree.

Thierry can you give your blessing ?

Thanks

-- Daniel

Signature · 5 lines
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog
#10 lore raw
Quoted 53 lines · Daniel Lezcano
Quoted 52 lines · Nicolas Chauvet
Quoted 45 lines · Nicolas Chauvet

When using tegra_soctherm driver on jetson-tk1, the following messages can be seen:
from kernel: tegra_soctherm 700e2000.thermal-sensor:
throttle-cfg: heavy: no throt prop or invalid prop
soctherm: trip temperature -2147483647 forced to -127000
thermtrip: will shut down when cpu reaches 101000 mC
soctherm: trip temperature -2147483647 forced to -127000
thermtrip: will shut down when gpu reaches 101000 mC
soctherm: trip temperature -2147483647 forced to -127000
thermtrip: will shut down when pll reaches 103000 mC
throttrip: pll: missing hot temperature
soctherm: trip temperature -2147483647 forced to -127000
thermtrip: will shut down when mem reaches 101000 mC
throttrip: mem: missing hot temperature
IRQ index 1 not found

This serie fixes two errors and two warnings that are reported in dmesg It was compiled and tested at runtime on jetson-tk1 only.

v2:
* Add missing tegra210 device-tree properties
* Add the appropriate prefix for tegra soctherm
* Use SoCs condition over of_compatible

Nicolas Chauvet (6):
ARM: tegra: Add missing gpu-throt-level to tegra124 soctherm
ARM: tegra: Add missing hot temperatures to tegra124 thermal-zones
arm64: tegra: Add missing hot temperatures to tegra132 thermal-zones
arm64: tegra: Add missing gpu-throt-level to tegra210 soctherm
arm64: tegra: Add missing hot temperatures to tegra210 thermal-zones
thermal: tegra: Avoid setting edp_irq when not relevant

 arch/arm/boot/dts/tegra124.dtsi           | 11 +++++++
 arch/arm64/boot/dts/nvidia/tegra132.dtsi  | 10 ++++++
 arch/arm64/boot/dts/nvidia/tegra210.dtsi  | 13 ++++++++
 drivers/thermal/tegra/soctherm.c          | 38 +++++++++++++----------
 drivers/thermal/tegra/soctherm.h          |  1 +
 drivers/thermal/tegra/tegra124-soctherm.c |  1 +
 drivers/thermal/tegra/tegra132-soctherm.c |  1 +
 drivers/thermal/tegra/tegra210-soctherm.c |  1 +
 8 files changed, 60 insertions(+), 16 deletions(-)
Quoted 2 lines

--
2.25.4

Hello,
This series is still pending review.

Quoted 7 lines
Quoted 3 lines

Thierry, do you expect some reviewers from the linux-pm (Zhang, Daniel ?) To me it seems like tegra specific changes, so maybe a Nvidia reviewer is awaited ?

I can apply the patch 6/6, other patches must go through arm-soc tree.

Thierry can you give your blessing ?

As Jon mentioned, making support for that EDP IRQ doesn't seem to be the right thing. If this IRQ does exist on Tegra124/Tegra132, then a more correct patch would be to add that to the device tree. I vaguely recall writing a patch to do that, a while back when I was trying to get rid of a couple of dt_binding_check warnings/errors, so I'll dig around for that.

I think for now we should probably ignore the driver patch. I'll get back to you if we determine that EDP IRQ is not present on those SoCs, in which case the driver patch would be correct.

Thierry

#11 lore raw
In reply to Nicolas Chauvet
Quoted 26 lines · Nicolas Chauvet

When using tegra_soctherm driver on jetson-tk1, the following messages can be seen:
from kernel: tegra_soctherm 700e2000.thermal-sensor:
throttle-cfg: heavy: no throt prop or invalid prop
soctherm: trip temperature -2147483647 forced to -127000
thermtrip: will shut down when cpu reaches 101000 mC
soctherm: trip temperature -2147483647 forced to -127000
thermtrip: will shut down when gpu reaches 101000 mC
soctherm: trip temperature -2147483647 forced to -127000
thermtrip: will shut down when pll reaches 103000 mC
throttrip: pll: missing hot temperature
soctherm: trip temperature -2147483647 forced to -127000
thermtrip: will shut down when mem reaches 101000 mC
throttrip: mem: missing hot temperature
IRQ index 1 not found

This serie fixes two errors and two warnings that are reported in dmesg It was compiled and tested at runtime on jetson-tk1 only.

v2:
* Add missing tegra210 device-tree properties
* Add the appropriate prefix for tegra soctherm
* Use SoCs condition over of_compatible

Quoted 6 lines

Nicolas Chauvet (6):
ARM: tegra: Add missing gpu-throt-level to tegra124 soctherm
ARM: tegra: Add missing hot temperatures to tegra124 thermal-zones
arm64: tegra: Add missing hot temperatures to tegra132 thermal-zones
arm64: tegra: Add missing gpu-throt-level to tegra210 soctherm
arm64: tegra: Add missing hot temperatures to tegra210 thermal-zones

I've applied all these...

Quoted 1 line

thermal: tegra: Avoid setting edp_irq when not relevant

and sent out a couple of patches that should make this obsolete since the EDP IRQ does exist on Tegra124/Tegra132 according to the TRM.

Thierry