arm64: dts: qcom: sc8280xp: Introduce additional tsens instances

Message ID 20240118-sc8280xp-tsens2_3-v1-1-e86bce14f6bf@quicinc.com
State New
Headers
Series arm64: dts: qcom: sc8280xp: Introduce additional tsens instances |

Commit Message

Bjorn Andersson Jan. 18, 2024, 11 p.m. UTC
  The SC8280XP contains two additional tsens instances, providing among
other things thermal measurements for the GPU.

Add these and a GPU thermal-zone.

Signed-off-by: Bjorn Andersson <quic_bjorande@quicinc.com>
---
 arch/arm64/boot/dts/qcom/sc8280xp.dtsi | 37 ++++++++++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)


---
base-commit: 943b9f0ab2cfbaea148dd6ac279957eb08b96904
change-id: 20240118-sc8280xp-tsens2_3-a5fd9a48d655

Best regards,
  

Comments

Konrad Dybcio Jan. 18, 2024, 11:31 p.m. UTC | #1
On 1/19/24 00:00, Bjorn Andersson wrote:
> The SC8280XP contains two additional tsens instances, providing among
> other things thermal measurements for the GPU.
> 
> Add these and a GPU thermal-zone.
> 
> Signed-off-by: Bjorn Andersson <quic_bjorande@quicinc.com>
> ---
>   arch/arm64/boot/dts/qcom/sc8280xp.dtsi | 37 ++++++++++++++++++++++++++++++++++
>   1 file changed, 37 insertions(+)
> 
> diff --git a/arch/arm64/boot/dts/qcom/sc8280xp.dtsi b/arch/arm64/boot/dts/qcom/sc8280xp.dtsi
> index febf28356ff8..68b5ac0339a0 100644
> --- a/arch/arm64/boot/dts/qcom/sc8280xp.dtsi
> +++ b/arch/arm64/boot/dts/qcom/sc8280xp.dtsi
> @@ -4033,6 +4033,28 @@ tsens1: thermal-sensor@c265000 {
>   			#thermal-sensor-cells = <1>;
>   		};
>   
> +		tsens2: thermal-sensor@c251000 {
> +			compatible = "qcom,sc8280xp-tsens", "qcom,tsens-v2";
> +			reg = <0 0x0c251000 0 0x1ff>, /* TM */
> +			      <0 0x0c224000 0 0x8>; /* SROT */

I've previously called for removing these comments that we've been
copypasting around for years and years, and I'm gonna stand by that :P

[...]

>   
> +		gpu-thermal {
> +			polling-delay-passive = <250>;
> +			polling-delay = <1000>;

Hm, did tsens only gain support of non-polled reporting with 8450?

If not, we should definitely update all the relevant SoCs.

Konrad
  
Bjorn Andersson Jan. 19, 2024, 7 p.m. UTC | #2
On Fri, Jan 19, 2024 at 12:31:06AM +0100, Konrad Dybcio wrote:
> 
> 
> On 1/19/24 00:00, Bjorn Andersson wrote:
> > The SC8280XP contains two additional tsens instances, providing among
> > other things thermal measurements for the GPU.
> > 
> > Add these and a GPU thermal-zone.
> > 
> > Signed-off-by: Bjorn Andersson <quic_bjorande@quicinc.com>
> > ---
> >   arch/arm64/boot/dts/qcom/sc8280xp.dtsi | 37 ++++++++++++++++++++++++++++++++++
> >   1 file changed, 37 insertions(+)
> > 
> > diff --git a/arch/arm64/boot/dts/qcom/sc8280xp.dtsi b/arch/arm64/boot/dts/qcom/sc8280xp.dtsi
> > index febf28356ff8..68b5ac0339a0 100644
> > --- a/arch/arm64/boot/dts/qcom/sc8280xp.dtsi
> > +++ b/arch/arm64/boot/dts/qcom/sc8280xp.dtsi
> > @@ -4033,6 +4033,28 @@ tsens1: thermal-sensor@c265000 {
> >   			#thermal-sensor-cells = <1>;
> >   		};
> > +		tsens2: thermal-sensor@c251000 {
> > +			compatible = "qcom,sc8280xp-tsens", "qcom,tsens-v2";
> > +			reg = <0 0x0c251000 0 0x1ff>, /* TM */
> > +			      <0 0x0c224000 0 0x8>; /* SROT */
> 
> I've previously called for removing these comments that we've been
> copypasting around for years and years, and I'm gonna stand by that :P
> 

I'm not against that idea, but are you requesting that I update the
patch, removing the comments as well. Or that I send another patch
removing all of them?

> [...]
> 
> > +		gpu-thermal {
> > +			polling-delay-passive = <250>;
> > +			polling-delay = <1000>;
> 
> Hm, did tsens only gain support of non-polled reporting with 8450?
> 
> If not, we should definitely update all the relevant SoCs.
> 

Are you referring to the fact that 8450 seems to set most*
polling-delays to 0, which are "valid" delays but would cause
thermal_zone_device_set_polling() to just cancel the timeout every time?

We should be able to do that on all platforms with working interrupts,
no?

[*] Some of the zones has a passive timeout of 10?


That said, as above. Would you like me to fix that now?

Regards,
Bjorn
  
Konrad Dybcio Jan. 20, 2024, 1:34 p.m. UTC | #3
On 19.01.2024 20:00, Bjorn Andersson wrote:
> On Fri, Jan 19, 2024 at 12:31:06AM +0100, Konrad Dybcio wrote:
>>
>>
>> On 1/19/24 00:00, Bjorn Andersson wrote:
>>> The SC8280XP contains two additional tsens instances, providing among
>>> other things thermal measurements for the GPU.
>>>
>>> Add these and a GPU thermal-zone.
>>>
>>> Signed-off-by: Bjorn Andersson <quic_bjorande@quicinc.com>
>>> ---
>>>   arch/arm64/boot/dts/qcom/sc8280xp.dtsi | 37 ++++++++++++++++++++++++++++++++++
>>>   1 file changed, 37 insertions(+)
>>>
>>> diff --git a/arch/arm64/boot/dts/qcom/sc8280xp.dtsi b/arch/arm64/boot/dts/qcom/sc8280xp.dtsi
>>> index febf28356ff8..68b5ac0339a0 100644
>>> --- a/arch/arm64/boot/dts/qcom/sc8280xp.dtsi
>>> +++ b/arch/arm64/boot/dts/qcom/sc8280xp.dtsi
>>> @@ -4033,6 +4033,28 @@ tsens1: thermal-sensor@c265000 {
>>>   			#thermal-sensor-cells = <1>;
>>>   		};
>>> +		tsens2: thermal-sensor@c251000 {
>>> +			compatible = "qcom,sc8280xp-tsens", "qcom,tsens-v2";
>>> +			reg = <0 0x0c251000 0 0x1ff>, /* TM */
>>> +			      <0 0x0c224000 0 0x8>; /* SROT */
>>
>> I've previously called for removing these comments that we've been
>> copypasting around for years and years, and I'm gonna stand by that :P
>>
> 
> I'm not against that idea, but are you requesting that I update the
> patch, removing the comments as well. Or that I send another patch
> removing all of them?

Sending a patch that you immediately fix up is a little besides
the point. But the latter would also be nice, if you could.

> 
>> [...]
>>
>>> +		gpu-thermal {
>>> +			polling-delay-passive = <250>;
>>> +			polling-delay = <1000>;
>>
>> Hm, did tsens only gain support of non-polled reporting with 8450?
>>
>> If not, we should definitely update all the relevant SoCs.
>>
> 
> Are you referring to the fact that 8450 seems to set most*
> polling-delays to 0, which are "valid" delays but would cause
> thermal_zone_device_set_polling() to just cancel the timeout every time?
> 
> We should be able to do that on all platforms with working interrupts,
> no?

That's why I'm asking!

> 
> [*] Some of the zones has a passive timeout of 10?
> 
> 
> That said, as above. Would you like me to fix that now?

Yes, please!

Konrad
  
Johan Hovold Jan. 26, 2024, 10 a.m. UTC | #4
On Fri, Jan 19, 2024 at 12:31:06AM +0100, Konrad Dybcio wrote:
> On 1/19/24 00:00, Bjorn Andersson wrote:

> > +		gpu-thermal {
> > +			polling-delay-passive = <250>;
> > +			polling-delay = <1000>;
> 
> Hm, did tsens only gain support of non-polled reporting with 8450?
> 
> If not, we should definitely update all the relevant SoCs.

Did you determine whether the interrupts work as expected?

We don't want to be polling here unless we have to (i.e. polling-delay
should be 0 as per the binding).

Johan
  
Konrad Dybcio Jan. 26, 2024, 10:48 a.m. UTC | #5
On 1/26/24 11:00, Johan Hovold wrote:
> On Fri, Jan 19, 2024 at 12:31:06AM +0100, Konrad Dybcio wrote:
>> On 1/19/24 00:00, Bjorn Andersson wrote:
> 
>>> +		gpu-thermal {
>>> +			polling-delay-passive = <250>;
>>> +			polling-delay = <1000>;
>>
>> Hm, did tsens only gain support of non-polled reporting with 8450?
>>
>> If not, we should definitely update all the relevant SoCs.
> 
> Did you determine whether the interrupts work as expected?

Yes, they seem to!

> 
> We don't want to be polling here unless we have to (i.e. polling-delay
> should be 0 as per the binding).

Even better:

https://lore.kernel.org/lkml/20240125-topic-thermal-v1-0-3c9d4dced138@linaro.org/

Believe me, I'm not omitting you from Cc on purpose.. I usually
realize I forgot right after pressing enter on "do you really
wanna send"..

Konrad
  
Johan Hovold Jan. 26, 2024, 12:09 p.m. UTC | #6
On Fri, Jan 26, 2024 at 11:48:03AM +0100, Konrad Dybcio wrote:
> On 1/26/24 11:00, Johan Hovold wrote:
> > On Fri, Jan 19, 2024 at 12:31:06AM +0100, Konrad Dybcio wrote:
> >> On 1/19/24 00:00, Bjorn Andersson wrote:
> > 
> >>> +		gpu-thermal {
> >>> +			polling-delay-passive = <250>;
> >>> +			polling-delay = <1000>;
> >>
> >> Hm, did tsens only gain support of non-polled reporting with 8450?
> >>
> >> If not, we should definitely update all the relevant SoCs.
> > 
> > Did you determine whether the interrupts work as expected?
> 
> Yes, they seem to!

Excellent.

> > We don't want to be polling here unless we have to (i.e. polling-delay
> > should be 0 as per the binding).
> 
> Even better:
> 
> https://lore.kernel.org/lkml/20240125-topic-thermal-v1-0-3c9d4dced138@linaro.org/

I'm not sure that's better, but either way we want to set
'polling-delay' to zero here as we don't want to have to wait for that
binding and driver update to hit mainline in 6.9-rc1 before merging this
patch.
 
> Believe me, I'm not omitting you from Cc on purpose.. I usually
> realize I forgot right after pressing enter on "do you really
> wanna send"..

Heh. No worries.

Johan
  

Patch

diff --git a/arch/arm64/boot/dts/qcom/sc8280xp.dtsi b/arch/arm64/boot/dts/qcom/sc8280xp.dtsi
index febf28356ff8..68b5ac0339a0 100644
--- a/arch/arm64/boot/dts/qcom/sc8280xp.dtsi
+++ b/arch/arm64/boot/dts/qcom/sc8280xp.dtsi
@@ -4033,6 +4033,28 @@  tsens1: thermal-sensor@c265000 {
 			#thermal-sensor-cells = <1>;
 		};
 
+		tsens2: thermal-sensor@c251000 {
+			compatible = "qcom,sc8280xp-tsens", "qcom,tsens-v2";
+			reg = <0 0x0c251000 0 0x1ff>, /* TM */
+			      <0 0x0c224000 0 0x8>; /* SROT */
+			#qcom,sensors = <11>;
+			interrupts-extended = <&pdc 122 IRQ_TYPE_LEVEL_HIGH>,
+					      <&pdc 124 IRQ_TYPE_LEVEL_HIGH>;
+			interrupt-names = "uplow", "critical";
+			#thermal-sensor-cells = <1>;
+		};
+
+		tsens3: thermal-sensor@c252000 {
+			compatible = "qcom,sc8280xp-tsens", "qcom,tsens-v2";
+			reg = <0 0x0c252000 0 0x1ff>, /* TM */
+			      <0 0x0c225000 0 0x8>; /* SROT */
+			#qcom,sensors = <5>;
+			interrupts-extended = <&pdc 123 IRQ_TYPE_LEVEL_HIGH>,
+					      <&pdc 125 IRQ_TYPE_LEVEL_HIGH>;
+			interrupt-names = "uplow", "critical";
+			#thermal-sensor-cells = <1>;
+		};
+
 		aoss_qmp: power-management@c300000 {
 			compatible = "qcom,sc8280xp-aoss-qmp", "qcom,aoss-qmp";
 			reg = <0 0x0c300000 0 0x400>;
@@ -5212,6 +5234,21 @@  cpu-crit {
 			};
 		};
 
+		gpu-thermal {
+			polling-delay-passive = <250>;
+			polling-delay = <1000>;
+
+			thermal-sensors = <&tsens2 2>;
+
+			trips {
+				cpu-crit {
+					temperature = <110000>;
+					hysteresis = <1000>;
+					type = "critical";
+				};
+			};
+		};
+
 		mem-thermal {
 			polling-delay-passive = <250>;
 			polling-delay = <1000>;