public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH] Platform/RaspberryPi4: Correct thermal offset
@ 2020-09-09 23:11 Jeremy Linton
  2020-09-11 18:13 ` Pete Batard
  2020-10-22 13:45 ` Ard Biesheuvel
  0 siblings, 2 replies; 4+ messages in thread
From: Jeremy Linton @ 2020-09-09 23:11 UTC (permalink / raw)
  To: devel; +Cc: leif, pete, awarkentin, ard.biesheuvel, Jeremy Linton

The current mainline DT indicates that the thermal offset
on the rpi is 410040 rather than the 419949 being used.
This means our temp calculation is offset nearly 10C higher
when running in ACPI mode vs DT.

Signed-off-by: Jeremy Linton <jeremy.linton@arm.com>
---
 Platform/RaspberryPi/AcpiTables/Dsdt.asl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Platform/RaspberryPi/AcpiTables/Dsdt.asl b/Platform/RaspberryPi/AcpiTables/Dsdt.asl
index 2b9e8211cf..d116f965e1 100644
--- a/Platform/RaspberryPi/AcpiTables/Dsdt.asl
+++ b/Platform/RaspberryPi/AcpiTables/Dsdt.asl
@@ -269,7 +269,7 @@ DefinitionBlock ("Dsdt.aml", "DSDT", 5, "RPIFDN", "RPI", 2)
           Field (TEMS, DWordAcc, NoLock, Preserve) {
             TMPS, 32
           }
-          return (((419949 - ((TMPS & 0x3ff) * 487)) / 100) + 2732);
+          return (((410040 - ((TMPS & 0x3ff) * 487)) / 100) + 2732);
         }
         Method (_SCP, 3) { }               // receive cooling policy from OS
 
-- 
2.13.7


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] Platform/RaspberryPi4: Correct thermal offset
  2020-09-09 23:11 [PATCH] Platform/RaspberryPi4: Correct thermal offset Jeremy Linton
@ 2020-09-11 18:13 ` Pete Batard
  2020-09-11 19:48   ` Jeremy Linton
  2020-10-22 13:45 ` Ard Biesheuvel
  1 sibling, 1 reply; 4+ messages in thread
From: Pete Batard @ 2020-09-11 18:13 UTC (permalink / raw)
  To: Jeremy Linton, devel; +Cc: leif, awarkentin, ard.biesheuvel

It might be worth sourcing public documentation, if you have any, 
indicating where these numeric values ultimately come from (the offset 
for absolute zero is easy to figure out, but the rest, not so much).

Apart from that:

On 2020.09.10 00:11, Jeremy Linton wrote:
> The current mainline DT indicates that the thermal offset
> on the rpi is 410040 rather than the 419949 being used.
> This means our temp calculation is offset nearly 10C higher
> when running in ACPI mode vs DT.
> 
> Signed-off-by: Jeremy Linton <jeremy.linton@arm.com>
> ---
>   Platform/RaspberryPi/AcpiTables/Dsdt.asl | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/Platform/RaspberryPi/AcpiTables/Dsdt.asl b/Platform/RaspberryPi/AcpiTables/Dsdt.asl
> index 2b9e8211cf..d116f965e1 100644
> --- a/Platform/RaspberryPi/AcpiTables/Dsdt.asl
> +++ b/Platform/RaspberryPi/AcpiTables/Dsdt.asl
> @@ -269,7 +269,7 @@ DefinitionBlock ("Dsdt.aml", "DSDT", 5, "RPIFDN", "RPI", 2)
>             Field (TEMS, DWordAcc, NoLock, Preserve) {
> 
>               TMPS, 32
> 
>             }
> 
> -          return (((419949 - ((TMPS & 0x3ff) * 487)) / 100) + 2732);
> 
> +          return (((410040 - ((TMPS & 0x3ff) * 487)) / 100) + 2732);
> 
>           }
> 
>           Method (_SCP, 3) { }               // receive cooling policy from OS
> 
>   
> 

Reviewed-by: Pete Batard <pete@akeo.ie>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Platform/RaspberryPi4: Correct thermal offset
  2020-09-11 18:13 ` Pete Batard
@ 2020-09-11 19:48   ` Jeremy Linton
  0 siblings, 0 replies; 4+ messages in thread
From: Jeremy Linton @ 2020-09-11 19:48 UTC (permalink / raw)
  To: Pete Batard, devel; +Cc: leif, awarkentin, ard.biesheuvel

Hi,
On 9/11/20 1:13 PM, Pete Batard wrote:
> It might be worth sourcing public documentation, if you have any, 
> indicating where these numeric values ultimately come from (the offset 
> for absolute zero is easy to figure out, but the rest, not so much).

I'm only privy to things that can be found with a google search.

So at the moment I'm not aware of proper first party documentation on 
the thermal sensor.

So 
https://elixir.bootlin.com/linux/v5.9-rc4/source/arch/arm/boot/dts/bcm2711.dtsi#L413 
gives us the base+slope values (410040, 487). Given the linux the units 
are in 1/1000h C, the remainder of the calculation is to adjust to 1/10th K.

There is also 
https://www.raspberrypi.org/documentation/hardware/raspberrypi/frequency-management.md

There is also a bit of documentation around "temp_limit"

https://www.raspberrypi.org/documentation/configuration/config-txt/overclocking.md

Which names 80-85C as the region that the cores should be throttled and 
some other thermal recommendations.

Finally, various mentions of the AVS (beyond the official document 
naming the int, but not the base address despite it being in the DT) in 
commit messages/etc help to clarify things, but none are particularly 
helpful on their own.


> 
> Apart from that:
> 
> On 2020.09.10 00:11, Jeremy Linton wrote:
>> The current mainline DT indicates that the thermal offset
>> on the rpi is 410040 rather than the 419949 being used.
>> This means our temp calculation is offset nearly 10C higher
>> when running in ACPI mode vs DT.
>>
>> Signed-off-by: Jeremy Linton <jeremy.linton@arm.com>
>> ---
>>   Platform/RaspberryPi/AcpiTables/Dsdt.asl | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/Platform/RaspberryPi/AcpiTables/Dsdt.asl 
>> b/Platform/RaspberryPi/AcpiTables/Dsdt.asl
>> index 2b9e8211cf..d116f965e1 100644
>> --- a/Platform/RaspberryPi/AcpiTables/Dsdt.asl
>> +++ b/Platform/RaspberryPi/AcpiTables/Dsdt.asl
>> @@ -269,7 +269,7 @@ DefinitionBlock ("Dsdt.aml", "DSDT", 5, "RPIFDN", 
>> "RPI", 2)
>>             Field (TEMS, DWordAcc, NoLock, Preserve) {
>>
>>               TMPS, 32
>>
>>             }
>>
>> -          return (((419949 - ((TMPS & 0x3ff) * 487)) / 100) + 2732);
>>
>> +          return (((410040 - ((TMPS & 0x3ff) * 487)) / 100) + 2732);
>>
>>           }
>>
>>           Method (_SCP, 3) { }               // receive cooling policy 
>> from OS
>>
>>
> 
> Reviewed-by: Pete Batard <pete@akeo.ie>


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Platform/RaspberryPi4: Correct thermal offset
  2020-09-09 23:11 [PATCH] Platform/RaspberryPi4: Correct thermal offset Jeremy Linton
  2020-09-11 18:13 ` Pete Batard
@ 2020-10-22 13:45 ` Ard Biesheuvel
  1 sibling, 0 replies; 4+ messages in thread
From: Ard Biesheuvel @ 2020-10-22 13:45 UTC (permalink / raw)
  To: Jeremy Linton, devel; +Cc: leif, pete, awarkentin

On 9/10/20 1:11 AM, Jeremy Linton wrote:
> The current mainline DT indicates that the thermal offset
> on the rpi is 410040 rather than the 419949 being used.
> This means our temp calculation is offset nearly 10C higher
> when running in ACPI mode vs DT.
> 
> Signed-off-by: Jeremy Linton <jeremy.linton@arm.com>
> ---
>   Platform/RaspberryPi/AcpiTables/Dsdt.asl | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/Platform/RaspberryPi/AcpiTables/Dsdt.asl b/Platform/RaspberryPi/AcpiTables/Dsdt.asl
> index 2b9e8211cf..d116f965e1 100644
> --- a/Platform/RaspberryPi/AcpiTables/Dsdt.asl
> +++ b/Platform/RaspberryPi/AcpiTables/Dsdt.asl
> @@ -269,7 +269,7 @@ DefinitionBlock ("Dsdt.aml", "DSDT", 5, "RPIFDN", "RPI", 2)
>             Field (TEMS, DWordAcc, NoLock, Preserve) {
>               TMPS, 32
>             }
> -          return (((419949 - ((TMPS & 0x3ff) * 487)) / 100) + 2732);
> +          return (((410040 - ((TMPS & 0x3ff) * 487)) / 100) + 2732);
>           }
>           Method (_SCP, 3) { }               // receive cooling policy from OS
>   
> 

Reviewed-by: Ard Biesheuvel <ard.biesheuvel@arm.com>

Pushed as dc6a619f933f..78c884bbe7d3

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-10-22 13:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-09-09 23:11 [PATCH] Platform/RaspberryPi4: Correct thermal offset Jeremy Linton
2020-09-11 18:13 ` Pete Batard
2020-09-11 19:48   ` Jeremy Linton
2020-10-22 13:45 ` Ard Biesheuvel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox