[PATCH v3 2/2] ARM: dts: qcom: msm8960: Add tsens

Rudraksha Gupta posted 2 patches 11 months, 2 weeks ago
There is a newer version of this series
[PATCH v3 2/2] ARM: dts: qcom: msm8960: Add tsens
Posted by Rudraksha Gupta 11 months, 2 weeks ago
Copy tsens node from apq8064 and adjust these values:
- thermal-zones
  - adjust thermal-sensors
  - delete coefficients
  - trips
    - copy temperature and hystersis from downstream
    - delete cpu_crit
- qfprom
  - adjust compatible
- gcc
  - add syscon to compatible
  - tsens
    - change qcom,sensors to 5

Signed-off-by: Rudraksha Gupta <guptarud@gmail.com>
---
 arch/arm/boot/dts/qcom/qcom-msm8960.dtsi | 59 +++++++++++++++++++++++++++++++-
 1 file changed, 58 insertions(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/qcom/qcom-msm8960.dtsi b/arch/arm/boot/dts/qcom/qcom-msm8960.dtsi
index 865fe7cc39511d7cb9ec5c4b12100404f77e2989..155d6aba61e390dabca6b72160543b5aa134b219 100644
--- a/arch/arm/boot/dts/qcom/qcom-msm8960.dtsi
+++ b/arch/arm/boot/dts/qcom/qcom-msm8960.dtsi
@@ -52,6 +52,36 @@ memory@80000000 {
 		reg = <0x80000000 0>;
 	};
 
+	thermal-zones {
+		cpu0-thermal {
+			polling-delay-passive = <250>;
+			polling-delay = <1000>;
+			thermal-sensors = <&tsens 0>;
+
+			trips {
+				cpu_alert0: trip0 {
+					temperature = <60000>;
+					hysteresis = <10000>;
+					type = "passive";
+				};
+			};
+		};
+
+		cpu1-thermal {
+			polling-delay-passive = <250>;
+			polling-delay = <1000>;
+			thermal-sensors = <&tsens 1>;
+
+			trips {
+				cpu_alert1: trip0 {
+					temperature = <60000>;
+					hysteresis = <10000>;
+					type = "passive";
+				};
+			};
+		};
+	};
+
 	cpu-pmu {
 		compatible = "qcom,krait-pmu";
 		interrupts = <GIC_PPI 10 0x304>;
@@ -115,6 +145,21 @@ timer@200a000 {
 			cpu-offset = <0x80000>;
 		};
 
+		qfprom: efuse@700000 {
+			compatible = "qcom,msm8960-qfprom", "qcom,qfprom";
+			reg = <0x00700000 0x1000>;
+			#address-cells = <1>;
+			#size-cells = <1>;
+
+			tsens_calib: calib@404 {
+				reg = <0x404 0x10>;
+			};
+
+			tsens_backup: backup-calib@414 {
+				reg = <0x414 0x10>;
+			};
+		};
+
 		msmgpio: pinctrl@800000 {
 			compatible = "qcom,msm8960-pinctrl";
 			gpio-controller;
@@ -127,7 +172,7 @@ msmgpio: pinctrl@800000 {
 		};
 
 		gcc: clock-controller@900000 {
-			compatible = "qcom,gcc-msm8960";
+			compatible = "qcom,gcc-msm8960", "syscon";
 			#clock-cells = <1>;
 			#reset-cells = <1>;
 			reg = <0x900000 0x4000>;
@@ -135,6 +180,18 @@ gcc: clock-controller@900000 {
 				 <&pxo_board>,
 				 <&lcc PLL4>;
 			clock-names = "cxo", "pxo", "pll4";
+
+			tsens: thermal-sensor {
+				compatible = "qcom,msm8960-tsens";
+
+				nvmem-cells = <&tsens_calib>, <&tsens_backup>;
+				nvmem-cell-names = "calib", "calib_backup";
+				interrupts = <GIC_SPI 178 IRQ_TYPE_LEVEL_HIGH>;
+				interrupt-names = "uplow";
+
+				#qcom,sensors = <5>;
+				#thermal-sensor-cells = <1>;
+			};
 		};
 
 		lcc: clock-controller@28000000 {

-- 
2.45.2
Re: [PATCH v3 2/2] ARM: dts: qcom: msm8960: Add tsens
Posted by Konrad Dybcio 11 months, 2 weeks ago
On 27.02.2025 4:50 AM, Rudraksha Gupta wrote:
> Copy tsens node from apq8064 and adjust these values:
> - thermal-zones
>   - adjust thermal-sensors
>   - delete coefficients
>   - trips
>     - copy temperature and hystersis from downstream
>     - delete cpu_crit

Oh you most certainly want a critical trip point so that your device
doesn't become an oven.. I can't unfortunately find anything that would
definitely state what the max temperature is, but I guess that you
wouldn't want this thing heating up above 95C anyways, so we can take
a conservative (likely undervalued) guess like that.

> - qfprom
>   - adjust compatible
> - gcc
>   - add syscon to compatible
>   - tsens
>     - change qcom,sensors to 5
> 
> Signed-off-by: Rudraksha Gupta <guptarud@gmail.com>
> ---

In your commit message, focus on what you're adding. The fact that you
copy it from somewhere else is secondary. Describe what (and why) you're
doing in this patch, and only briefly mention that it's based on another
piece.

Konrad
Re: [PATCH v3 2/2] ARM: dts: qcom: msm8960: Add tsens
Posted by Dmitry Baryshkov 11 months, 2 weeks ago
On Wed, Feb 26, 2025 at 07:50:42PM -0800, Rudraksha Gupta wrote:
> Copy tsens node from apq8064 and adjust these values:
> - thermal-zones
>   - adjust thermal-sensors
>   - delete coefficients
>   - trips
>     - copy temperature and hystersis from downstream
>     - delete cpu_crit
> - qfprom
>   - adjust compatible
> - gcc
>   - add syscon to compatible
>   - tsens
>     - change qcom,sensors to 5

I'd say, this is probably the most unusal commit message message that
I've seen.

Nevertheless,

Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>


> 
> Signed-off-by: Rudraksha Gupta <guptarud@gmail.com>
> ---
>  arch/arm/boot/dts/qcom/qcom-msm8960.dtsi | 59 +++++++++++++++++++++++++++++++-
>  1 file changed, 58 insertions(+), 1 deletion(-)
> 

-- 
With best wishes
Dmitry
Re: [PATCH v3 2/2] ARM: dts: qcom: msm8960: Add tsens
Posted by Rudraksha Gupta 11 months, 2 weeks ago
>
> I'd say, this is probably the most unusal commit message message that
> I've seen.
>
> Nevertheless,
>
> Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
>

I agree. Please clarify what you mean by "Which values?" in v2. I've
interpreted that comment as "list out the changes I made when copying
the relevant nodes from apq8064".

There will likely be more comments by others, so I'll change the
commit message to match how you would like me to word it. Thanks for
your comments thus far.