Re: [PATCH v2 00/13] qcom: dts: thermal cleanups

From: Amit Kucheria
Date: Thu Apr 25 2019 - 02:31:42 EST


Marc, can you please test these 3 patches on top of my original series?

Andy, patches 1 and 2 fix problems that already exist upstream. They
were not introduced by my series.
Patch 3 fixes an issue with my series where the name of the thermal
zone was too long. You can choose to fold it into the patch titled
"arm64: dts: msm8998: thermal: Add temperature sensors near major
peripherals" or add it as a new patch with a Fixes tag.

On Wed, Apr 24, 2019 at 8:00 PM Marc Gonzalez <marc.w.gonzalez@xxxxxxx> wrote:
>
> On 23/04/2019 15:10, Marc Gonzalez wrote:
>
> > Sure. I can give you a Tested-by once everything works on the MEDIABOX I have.
> >
> > You mention the 4 thermal_zone*/temp failures.
> >
> > What about the cluster0-mhm-thermal and cluster1-mhm-thermal failures?
>
> I have synced up with today's linux-next.

Thanks for the report. Can you add the attached couple of patches and retest?

> # dmesg | grep thermal
> Failed to build cluster0-mhm-thermal zone -22
> Failed to build cluster1-mhm-thermal zone -22

This one turned out to be a silly one, The name of the thermal zone is
restricted to under 20 characters. Fixed that with patch 3.

> # for F in $(find /sys/class/thermal/thermal_zone?/ /sys/class/thermal/thermal_zone??/ -type f); do echo $F; cat $F; done
> /sys/class/thermal/thermal_zone0/uevent
> /sys/class/thermal/thermal_zone0/trip_point_0_hyst
> 2000
> /sys/class/thermal/thermal_zone0/mode
> enabled
> /sys/class/thermal/thermal_zone0/power/runtime_active_time
> 0
> /sys/class/thermal/thermal_zone0/power/runtime_status
> unsupported

<snip>

> /sys/class/thermal/thermal_zone8/type
> gpu-thermal-bottom
> /sys/class/thermal/thermal_zone8/offset
> 0
> /sys/class/thermal/thermal_zone8/slope
> 1
> /sys/class/thermal/thermal_zone8/trip_point_0_type
> hot
> /sys/class/thermal/thermal_zone8/k_po
> 0
> /sys/class/thermal/thermal_zone8/integral_cutoff
> 0
> /sys/class/thermal/thermal_zone8/k_i
> 0
> /sys/class/thermal/thermal_zone8/k_pu
> 0
> /sys/class/thermal/thermal_zone8/temp
> cat: read error: Invalid argument

Patch 2 should fix this and thermal_zone9 below.

> /sys/class/thermal/thermal_zone8/trip_point_0_temp
> 90000
> /sys/class/thermal/thermal_zone9/uevent
> /sys/class/thermal/thermal_zone9/trip_point_0_hyst
> 2000
> /sys/class/thermal/thermal_zone9/passive
> 0
> /sys/class/thermal/thermal_zone9/mode
> disabled
> /sys/class/thermal/thermal_zone9/power/runtime_active_time
> 0
> /sys/class/thermal/thermal_zone9/power/runtime_status
> unsupported
> /sys/class/thermal/thermal_zone9/power/autosuspend_delay_ms
> cat: read error: Input/output error
> /sys/class/thermal/thermal_zone9/power/runtime_suspended_time
> 0
> /sys/class/thermal/thermal_zone9/power/control
> auto
> /sys/class/thermal/thermal_zone9/available_policies
> step_wise
> /sys/class/thermal/thermal_zone9/policy
> step_wise
> /sys/class/thermal/thermal_zone9/k_d
> 0
> /sys/class/thermal/thermal_zone9/sustainable_power
> 0
> /sys/class/thermal/thermal_zone9/type
> gpu-thermal-top
> /sys/class/thermal/thermal_zone9/offset
> 0
> /sys/class/thermal/thermal_zone9/slope

<snip>

> /sys/class/thermal/thermal_zone18/available_policies
> step_wise
> /sys/class/thermal/thermal_zone18/policy
> step_wise
> /sys/class/thermal/thermal_zone18/k_d
> 0
> /sys/class/thermal/thermal_zone18/sustainable_power
> 0
> /sys/class/thermal/thermal_zone18/type
> battery-thermal

This look wrong. TSENS shouldn't have board-specific thermal zones.

<snip>

> /sys/class/thermal/thermal_zone19/k_d
> 0
> /sys/class/thermal/thermal_zone19/sustainable_power
> 0
> /sys/class/thermal/thermal_zone19/type
> skin-thermal

And this too. See patch 1 to fix this existing issue (not introduced
by my series).
From 94698e19b6329e98404ff9b9cc0c90a3062fa5e5 Mon Sep 17 00:00:00 2001
Message-Id: <94698e19b6329e98404ff9b9cc0c90a3062fa5e5.1556169637.git.amit.kucheria@xxxxxxxxxx>
From: Amit Kucheria <amit.kucheria@xxxxxxxxxx>
Date: Thu, 25 Apr 2019 01:22:50 +0530
Subject: [PATCH 1/2] arm64: dts: msm8998-mtp: thermal: Remove skin and battery
thermal zones

The msm8998-mtp doesn't have TSENS-based sensors wired up for skin and
battery thermal zones. TSENS sensors should be common across all boards
using the SoC and shouldn't be board-specific as these entries.

They also show the following error when trying to read the temperature

cat: read error: Invalid argument

Remove these board-specific erroneous thermal zones.

Fixes: 4449b6f248d9 ("arm64: dts: qcom: msm8998: Add tsens and thermal-zones")
Signed-off-by: Amit Kucheria <amit.kucheria@xxxxxxxxxx>
---
arch/arm64/boot/dts/qcom/msm8998-mtp.dtsi | 38 -----------------------
1 file changed, 38 deletions(-)

diff --git a/arch/arm64/boot/dts/qcom/msm8998-mtp.dtsi b/arch/arm64/boot/dts/qcom/msm8998-mtp.dtsi
index f0901067b043..60bdf7485f0e 100644
--- a/arch/arm64/boot/dts/qcom/msm8998-mtp.dtsi
+++ b/arch/arm64/boot/dts/qcom/msm8998-mtp.dtsi
@@ -15,44 +15,6 @@
stdout-path = "serial0:115200n8";
};

- thermal-zones {
- battery-thermal {
- polling-delay-passive = <250>;
- polling-delay = <1000>;
-
- thermal-sensors = <&tsens0 0>;
-
- trips {
- battery_crit: trip0 {
- temperature = <60000>;
- hysteresis = <2000>;
- type = "critical";
- };
- };
- };
-
- skin-thermal {
- polling-delay-passive = <250>;
- polling-delay = <1000>;
-
- thermal-sensors = <&tsens1 5>;
-
- trips {
- skin_alert: trip0 {
- temperature = <44000>;
- hysteresis = <2000>;
- type = "passive";
- };
-
- skip_crit: trip1 {
- temperature = <70000>;
- hysteresis = <2000>;
- type = "critical";
- };
- };
- };
- };
-
vph_pwr: vph-pwr-regulator {
compatible = "regulator-fixed";
regulator-name = "vph_pwr";
--
2.17.1

From eda7da2d0098d6617671e67658226e3c5fb07045 Mon Sep 17 00:00:00 2001
Message-Id: <eda7da2d0098d6617671e67658226e3c5fb07045.1556169637.git.amit.kucheria@xxxxxxxxxx>
In-Reply-To: <94698e19b6329e98404ff9b9cc0c90a3062fa5e5.1556169637.git.amit.kucheria@xxxxxxxxxx>
References: <94698e19b6329e98404ff9b9cc0c90a3062fa5e5.1556169637.git.amit.kucheria@xxxxxxxxxx>
From: Amit Kucheria <amit.kucheria@xxxxxxxxxx>
Date: Thu, 25 Apr 2019 01:52:44 +0530
Subject: [PATCH 2/2] arm64: dts: msm8998: thermal: Fix number of supported
sensors

msm8998 has 22 sensors connected in total, 14 on the 1st controller, 8
on the 2nd controller. Increase the number to allow sensors with ID 12
and 13 to be registered.

Signed-off-by: Amit Kucheria <amit.kucheria@xxxxxxxxxx>
---
arch/arm64/boot/dts/qcom/msm8998.dtsi | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm64/boot/dts/qcom/msm8998.dtsi b/arch/arm64/boot/dts/qcom/msm8998.dtsi
index 998017d4d847..062a93a12198 100644
--- a/arch/arm64/boot/dts/qcom/msm8998.dtsi
+++ b/arch/arm64/boot/dts/qcom/msm8998.dtsi
@@ -745,7 +745,7 @@
reg = <0x10ab000 0x1000>, /* TM */
<0x10aa000 0x1000>; /* SROT */

- #qcom,sensors = <12>;
+ #qcom,sensors = <14>;
#thermal-sensor-cells = <1>;
};

--
2.17.1

From 43ee011006562bac3091fbbe563df883460e98a6 Mon Sep 17 00:00:00 2001
Message-Id: <43ee011006562bac3091fbbe563df883460e98a6.1556173507.git.amit.kucheria@xxxxxxxxxx>
In-Reply-To: <94698e19b6329e98404ff9b9cc0c90a3062fa5e5.1556173507.git.amit.kucheria@xxxxxxxxxx>
References: <94698e19b6329e98404ff9b9cc0c90a3062fa5e5.1556173507.git.amit.kucheria@xxxxxxxxxx>
From: Amit Kucheria <amit.kucheria@xxxxxxxxxx>
Date: Thu, 25 Apr 2019 11:53:27 +0530
Subject: [PATCH 3/3] arm64: dts: msm8998: thermal: Restrict thermal zone name
length to under 20

The thermal core restricts names of thermal zones to under 20
characters. Fix the names for a couple of msm8998 thermal zones.

Signed-off-by: Amit Kucheria <amit.kucheria@xxxxxxxxxx>
---
arch/arm64/boot/dts/qcom/msm8998.dtsi | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm64/boot/dts/qcom/msm8998.dtsi b/arch/arm64/boot/dts/qcom/msm8998.dtsi
index 062a93a12198..01757829d5f3 100644
--- a/arch/arm64/boot/dts/qcom/msm8998.dtsi
+++ b/arch/arm64/boot/dts/qcom/msm8998.dtsi
@@ -536,7 +536,7 @@
};
};

- cluster0-mhm-thermal {
+ clust0-mhm-thermal {
polling-delay-passive = <250>;
polling-delay = <1000>;

@@ -551,7 +551,7 @@
};
};

- cluster1-mhm-thermal {
+ clust1-mhm-thermal {
polling-delay-passive = <250>;
polling-delay = <1000>;

--
2.17.1