diff mbox series

[v2,12/12] arm64: dts: qcom: sc8280xp-x13s: Add thermal zone support

Message ID 20221029051449.30678-13-manivannan.sadhasivam@linaro.org
State Superseded
Headers show
Series sc8280xp-pmic updates and X13s thermal zone support | expand

Commit Message

Manivannan Sadhasivam Oct. 29, 2022, 5:14 a.m. UTC
Add thermal zone support by making use of the thermistor SYS_THERM6.
Based on experiments, this thermistor seems to reflect the actual
surface temperature of the laptop.

For the cooling device, all BIG CPU cores are throttle down to keep the
temperature at a sane level.

Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
---
 .../qcom/sc8280xp-lenovo-thinkpad-x13s.dts    | 46 +++++++++++++++++++
 1 file changed, 46 insertions(+)

Comments

Konrad Dybcio Oct. 29, 2022, 2:29 p.m. UTC | #1
On 29.10.2022 07:14, Manivannan Sadhasivam wrote:
> Add thermal zone support by making use of the thermistor SYS_THERM6.
> Based on experiments, this thermistor seems to reflect the actual
> surface temperature of the laptop.
> 
> For the cooling device, all BIG CPU cores are throttle down to keep the
s/throttle/throttled

Is it okay to let the 4xA78C run at full throttle in thermal emergencies though?
> temperature at a sane level.
> 
> Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
> ---
>  .../qcom/sc8280xp-lenovo-thinkpad-x13s.dts    | 46 +++++++++++++++++++
>  1 file changed, 46 insertions(+)
> 
> diff --git a/arch/arm64/boot/dts/qcom/sc8280xp-lenovo-thinkpad-x13s.dts b/arch/arm64/boot/dts/qcom/sc8280xp-lenovo-thinkpad-x13s.dts
> index ca77c19c6d0d..96e2fa72f782 100644
> --- a/arch/arm64/boot/dts/qcom/sc8280xp-lenovo-thinkpad-x13s.dts
> +++ b/arch/arm64/boot/dts/qcom/sc8280xp-lenovo-thinkpad-x13s.dts
> @@ -29,6 +29,52 @@ backlight {
>  		pinctrl-0 = <&edp_bl_en>, <&edp_bl_pwm>;
>  	};
>  
> +	thermal-zones {
> +		skin-temp-thermal {
> +			polling-delay-passive = <250>;
> +			polling-delay = <0>;
> +			thermal-sensors = <&pmk8280_adc_tm 5>;
> +
> +			trips {
> +				skin_temp_alert0: trip-point0 {
> +					temperature = <55000>;
> +					hysteresis = <1000>;
> +					type = "passive";
> +				};
> +
> +				skin_temp_alert1: trip-point1 {
> +					temperature = <58000>;
> +					hysteresis = <1000>;
> +					type = "passive";
> +				};
> +
> +				skin-temp-crit {
> +					temperature = <73000>;
Ouch, I didn't know we were serving burnt fingers at the cafeteria today :D

Or maybe this just looks scary.. The laptop looks plastic, so maybe it won't cause instant
burns?

Konrad
> +					hysteresis = <1000>;
> +					type = "critical";
> +				};
> +			};
> +
> +			cooling-maps {
> +				map0 {
> +					trip = <&skin_temp_alert0>;
> +					cooling-device = <&CPU4 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
> +							 <&CPU5 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
> +							 <&CPU6 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
> +							 <&CPU7 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
> +				};
> +
> +				map1 {
> +					trip = <&skin_temp_alert1>;
> +					cooling-device = <&CPU4 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
> +							 <&CPU5 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
> +							 <&CPU6 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
> +							 <&CPU7 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
> +				};
> +			};
> +		};
> +	};
> +
>  	vreg_edp_bl: regulator-edp-bl {
>  		compatible = "regulator-fixed";
>
Manivannan Sadhasivam Nov. 3, 2022, 5:50 a.m. UTC | #2
On Sat, Oct 29, 2022 at 04:29:05PM +0200, Konrad Dybcio wrote:
> 
> 
> On 29.10.2022 07:14, Manivannan Sadhasivam wrote:
> > Add thermal zone support by making use of the thermistor SYS_THERM6.
> > Based on experiments, this thermistor seems to reflect the actual
> > surface temperature of the laptop.
> > 
> > For the cooling device, all BIG CPU cores are throttle down to keep the
> s/throttle/throttled
> 
> Is it okay to let the 4xA78C run at full throttle in thermal emergencies though?

I don't get it. Can you elaborate?

> > temperature at a sane level.
> > 
> > Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
> > ---
> >  .../qcom/sc8280xp-lenovo-thinkpad-x13s.dts    | 46 +++++++++++++++++++
> >  1 file changed, 46 insertions(+)
> > 
> > diff --git a/arch/arm64/boot/dts/qcom/sc8280xp-lenovo-thinkpad-x13s.dts b/arch/arm64/boot/dts/qcom/sc8280xp-lenovo-thinkpad-x13s.dts
> > index ca77c19c6d0d..96e2fa72f782 100644
> > --- a/arch/arm64/boot/dts/qcom/sc8280xp-lenovo-thinkpad-x13s.dts
> > +++ b/arch/arm64/boot/dts/qcom/sc8280xp-lenovo-thinkpad-x13s.dts
> > @@ -29,6 +29,52 @@ backlight {
> >  		pinctrl-0 = <&edp_bl_en>, <&edp_bl_pwm>;
> >  	};
> >  
> > +	thermal-zones {
> > +		skin-temp-thermal {
> > +			polling-delay-passive = <250>;
> > +			polling-delay = <0>;
> > +			thermal-sensors = <&pmk8280_adc_tm 5>;
> > +
> > +			trips {
> > +				skin_temp_alert0: trip-point0 {
> > +					temperature = <55000>;
> > +					hysteresis = <1000>;
> > +					type = "passive";
> > +				};
> > +
> > +				skin_temp_alert1: trip-point1 {
> > +					temperature = <58000>;
> > +					hysteresis = <1000>;
> > +					type = "passive";
> > +				};
> > +
> > +				skin-temp-crit {
> > +					temperature = <73000>;
> Ouch, I didn't know we were serving burnt fingers at the cafeteria today :D
> 
> Or maybe this just looks scary.. The laptop looks plastic, so maybe it won't cause instant
> burns?
> 

73c is what the reasonable number I came up with after some experiments. At
this point the temperature won't burn your finger but crossing this surely
would (that's what happening without this series).

Thanks,
Mani

> Konrad
> > +					hysteresis = <1000>;
> > +					type = "critical";
> > +				};
> > +			};
> > +
> > +			cooling-maps {
> > +				map0 {
> > +					trip = <&skin_temp_alert0>;
> > +					cooling-device = <&CPU4 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
> > +							 <&CPU5 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
> > +							 <&CPU6 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
> > +							 <&CPU7 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
> > +				};
> > +
> > +				map1 {
> > +					trip = <&skin_temp_alert1>;
> > +					cooling-device = <&CPU4 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
> > +							 <&CPU5 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
> > +							 <&CPU6 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
> > +							 <&CPU7 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
> > +				};
> > +			};
> > +		};
> > +	};
> > +
> >  	vreg_edp_bl: regulator-edp-bl {
> >  		compatible = "regulator-fixed";
> >
Konrad Dybcio Nov. 3, 2022, 10:02 a.m. UTC | #3
On 03/11/2022 06:50, Manivannan Sadhasivam wrote:
> On Sat, Oct 29, 2022 at 04:29:05PM +0200, Konrad Dybcio wrote:
>>
>> On 29.10.2022 07:14, Manivannan Sadhasivam wrote:
>>> Add thermal zone support by making use of the thermistor SYS_THERM6.
>>> Based on experiments, this thermistor seems to reflect the actual
>>> surface temperature of the laptop.
>>>
>>> For the cooling device, all BIG CPU cores are throttle down to keep the
>> s/throttle/throttled
>>
>> Is it okay to let the 4xA78C run at full throttle in thermal emergencies though?
> I don't get it. Can you elaborate?

8280xp has 4xA78C and 4xX1C. You only added the latter ones to the 
cooling map.


>
>>> temperature at a sane level.
>>>
>>> Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
>>> ---
>>>   .../qcom/sc8280xp-lenovo-thinkpad-x13s.dts    | 46 +++++++++++++++++++
>>>   1 file changed, 46 insertions(+)
>>>
>>> diff --git a/arch/arm64/boot/dts/qcom/sc8280xp-lenovo-thinkpad-x13s.dts b/arch/arm64/boot/dts/qcom/sc8280xp-lenovo-thinkpad-x13s.dts
>>> index ca77c19c6d0d..96e2fa72f782 100644
>>> --- a/arch/arm64/boot/dts/qcom/sc8280xp-lenovo-thinkpad-x13s.dts
>>> +++ b/arch/arm64/boot/dts/qcom/sc8280xp-lenovo-thinkpad-x13s.dts
>>> @@ -29,6 +29,52 @@ backlight {
>>>   		pinctrl-0 = <&edp_bl_en>, <&edp_bl_pwm>;
>>>   	};
>>>   
>>> +	thermal-zones {
>>> +		skin-temp-thermal {
>>> +			polling-delay-passive = <250>;
>>> +			polling-delay = <0>;
>>> +			thermal-sensors = <&pmk8280_adc_tm 5>;
>>> +
>>> +			trips {
>>> +				skin_temp_alert0: trip-point0 {
>>> +					temperature = <55000>;
>>> +					hysteresis = <1000>;
>>> +					type = "passive";
>>> +				};
>>> +
>>> +				skin_temp_alert1: trip-point1 {
>>> +					temperature = <58000>;
>>> +					hysteresis = <1000>;
>>> +					type = "passive";
>>> +				};
>>> +
>>> +				skin-temp-crit {
>>> +					temperature = <73000>;
>> Ouch, I didn't know we were serving burnt fingers at the cafeteria today :D
>>
>> Or maybe this just looks scary.. The laptop looks plastic, so maybe it won't cause instant
>> burns?
>>
> 73c is what the reasonable number I came up with after some experiments. At
> this point the temperature won't burn your finger but crossing this surely
> would (that's what happening without this series).

Ok, then I suppose it's fine. Thanks!


Konrad

>
> Thanks,
> Mani
>
>> Konrad
>>> +					hysteresis = <1000>;
>>> +					type = "critical";
>>> +				};
>>> +			};
>>> +
>>> +			cooling-maps {
>>> +				map0 {
>>> +					trip = <&skin_temp_alert0>;
>>> +					cooling-device = <&CPU4 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
>>> +							 <&CPU5 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
>>> +							 <&CPU6 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
>>> +							 <&CPU7 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
>>> +				};
>>> +
>>> +				map1 {
>>> +					trip = <&skin_temp_alert1>;
>>> +					cooling-device = <&CPU4 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
>>> +							 <&CPU5 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
>>> +							 <&CPU6 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
>>> +							 <&CPU7 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
>>> +				};
>>> +			};
>>> +		};
>>> +	};
>>> +
>>>   	vreg_edp_bl: regulator-edp-bl {
>>>   		compatible = "regulator-fixed";
>>>
Manivannan Sadhasivam Nov. 3, 2022, 12:12 p.m. UTC | #4
On Thu, Nov 03, 2022 at 11:02:30AM +0100, Konrad Dybcio wrote:
> 
> On 03/11/2022 06:50, Manivannan Sadhasivam wrote:
> > On Sat, Oct 29, 2022 at 04:29:05PM +0200, Konrad Dybcio wrote:
> > > 
> > > On 29.10.2022 07:14, Manivannan Sadhasivam wrote:
> > > > Add thermal zone support by making use of the thermistor SYS_THERM6.
> > > > Based on experiments, this thermistor seems to reflect the actual
> > > > surface temperature of the laptop.
> > > > 
> > > > For the cooling device, all BIG CPU cores are throttle down to keep the
> > > s/throttle/throttled
> > > 
> > > Is it okay to let the 4xA78C run at full throttle in thermal emergencies though?
> > I don't get it. Can you elaborate?
> 
> 8280xp has 4xA78C and 4xX1C. You only added the latter ones to the cooling
> map.
> 

Right, that's because the first 4 cores doesn't contribute to thermal much and
thottling them doesn't yield any thermal gain.

Thanks,
Mani

> 
> > 
> > > > temperature at a sane level.
> > > > 
> > > > Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
> > > > ---
> > > >   .../qcom/sc8280xp-lenovo-thinkpad-x13s.dts    | 46 +++++++++++++++++++
> > > >   1 file changed, 46 insertions(+)
> > > > 
> > > > diff --git a/arch/arm64/boot/dts/qcom/sc8280xp-lenovo-thinkpad-x13s.dts b/arch/arm64/boot/dts/qcom/sc8280xp-lenovo-thinkpad-x13s.dts
> > > > index ca77c19c6d0d..96e2fa72f782 100644
> > > > --- a/arch/arm64/boot/dts/qcom/sc8280xp-lenovo-thinkpad-x13s.dts
> > > > +++ b/arch/arm64/boot/dts/qcom/sc8280xp-lenovo-thinkpad-x13s.dts
> > > > @@ -29,6 +29,52 @@ backlight {
> > > >   		pinctrl-0 = <&edp_bl_en>, <&edp_bl_pwm>;
> > > >   	};
> > > > +	thermal-zones {
> > > > +		skin-temp-thermal {
> > > > +			polling-delay-passive = <250>;
> > > > +			polling-delay = <0>;
> > > > +			thermal-sensors = <&pmk8280_adc_tm 5>;
> > > > +
> > > > +			trips {
> > > > +				skin_temp_alert0: trip-point0 {
> > > > +					temperature = <55000>;
> > > > +					hysteresis = <1000>;
> > > > +					type = "passive";
> > > > +				};
> > > > +
> > > > +				skin_temp_alert1: trip-point1 {
> > > > +					temperature = <58000>;
> > > > +					hysteresis = <1000>;
> > > > +					type = "passive";
> > > > +				};
> > > > +
> > > > +				skin-temp-crit {
> > > > +					temperature = <73000>;
> > > Ouch, I didn't know we were serving burnt fingers at the cafeteria today :D
> > > 
> > > Or maybe this just looks scary.. The laptop looks plastic, so maybe it won't cause instant
> > > burns?
> > > 
> > 73c is what the reasonable number I came up with after some experiments. At
> > this point the temperature won't burn your finger but crossing this surely
> > would (that's what happening without this series).
> 
> Ok, then I suppose it's fine. Thanks!
> 
> 
> Konrad
> 
> > 
> > Thanks,
> > Mani
> > 
> > > Konrad
> > > > +					hysteresis = <1000>;
> > > > +					type = "critical";
> > > > +				};
> > > > +			};
> > > > +
> > > > +			cooling-maps {
> > > > +				map0 {
> > > > +					trip = <&skin_temp_alert0>;
> > > > +					cooling-device = <&CPU4 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
> > > > +							 <&CPU5 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
> > > > +							 <&CPU6 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
> > > > +							 <&CPU7 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
> > > > +				};
> > > > +
> > > > +				map1 {
> > > > +					trip = <&skin_temp_alert1>;
> > > > +					cooling-device = <&CPU4 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
> > > > +							 <&CPU5 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
> > > > +							 <&CPU6 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
> > > > +							 <&CPU7 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
> > > > +				};
> > > > +			};
> > > > +		};
> > > > +	};
> > > > +
> > > >   	vreg_edp_bl: regulator-edp-bl {
> > > >   		compatible = "regulator-fixed";
diff mbox series

Patch

diff --git a/arch/arm64/boot/dts/qcom/sc8280xp-lenovo-thinkpad-x13s.dts b/arch/arm64/boot/dts/qcom/sc8280xp-lenovo-thinkpad-x13s.dts
index ca77c19c6d0d..96e2fa72f782 100644
--- a/arch/arm64/boot/dts/qcom/sc8280xp-lenovo-thinkpad-x13s.dts
+++ b/arch/arm64/boot/dts/qcom/sc8280xp-lenovo-thinkpad-x13s.dts
@@ -29,6 +29,52 @@  backlight {
 		pinctrl-0 = <&edp_bl_en>, <&edp_bl_pwm>;
 	};
 
+	thermal-zones {
+		skin-temp-thermal {
+			polling-delay-passive = <250>;
+			polling-delay = <0>;
+			thermal-sensors = <&pmk8280_adc_tm 5>;
+
+			trips {
+				skin_temp_alert0: trip-point0 {
+					temperature = <55000>;
+					hysteresis = <1000>;
+					type = "passive";
+				};
+
+				skin_temp_alert1: trip-point1 {
+					temperature = <58000>;
+					hysteresis = <1000>;
+					type = "passive";
+				};
+
+				skin-temp-crit {
+					temperature = <73000>;
+					hysteresis = <1000>;
+					type = "critical";
+				};
+			};
+
+			cooling-maps {
+				map0 {
+					trip = <&skin_temp_alert0>;
+					cooling-device = <&CPU4 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+							 <&CPU5 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+							 <&CPU6 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+							 <&CPU7 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+				};
+
+				map1 {
+					trip = <&skin_temp_alert1>;
+					cooling-device = <&CPU4 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+							 <&CPU5 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+							 <&CPU6 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+							 <&CPU7 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+				};
+			};
+		};
+	};
+
 	vreg_edp_bl: regulator-edp-bl {
 		compatible = "regulator-fixed";