From: "Jernej Škrabec" <jernej.skrabec@gmail.com>
To: Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
Paul Walmsley <paul.walmsley@sifive.com>,
Palmer Dabbelt <palmer@dabbelt.com>,
Albert Ou <aou@eecs.berkeley.edu>, Chen-Yu Tsai <wens@csie.org>,
Samuel Holland <samuel@sholland.org>,
Alex Studer <alex@studer.dev>
Cc: devicetree@vger.kernel.org, linux-riscv@lists.infradead.org,
linux-arm-kernel@lists.infradead.org,
linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org,
Alex Studer <alex@studer.dev>
Subject: Re: [PATCH] riscv: dts: allwinner: d1: Add CPU thermal sensor and zone
Date: Tue, 18 Feb 2025 18:23:52 +0100 [thread overview]
Message-ID: <4628970.LvFx2qVVIh@jernej-laptop> (raw)
In-Reply-To: <20250218020629.1476126-1-alex@studer.dev>
Dne torek, 18. februar 2025 ob 03:06:29 Srednjeevropski standardni čas je Alex Studer napisal(a):
> The sun20i THS (built in CPU thermal sensor) is supported in code, but
> was never added to the device tree. So, add it to the device tree,
> along with a thermal zone for the CPU.
>
> Signed-off-by: Alex Studer <alex@studer.dev>
> ---
> arch/riscv/boot/dts/allwinner/sun20i-d1s.dtsi | 31 +++++++++++++++++++
> .../boot/dts/allwinner/sunxi-d1s-t113.dtsi | 16 ++++++++++
> 2 files changed, 47 insertions(+)
>
> diff --git a/arch/riscv/boot/dts/allwinner/sun20i-d1s.dtsi b/arch/riscv/boot/dts/allwinner/sun20i-d1s.dtsi
> index 6367112e6..bdde82aa8 100644
> --- a/arch/riscv/boot/dts/allwinner/sun20i-d1s.dtsi
> +++ b/arch/riscv/boot/dts/allwinner/sun20i-d1s.dtsi
> @@ -3,6 +3,8 @@
>
> #define SOC_PERIPHERAL_IRQ(nr) (nr + 16)
>
> +#include <dt-bindings/thermal/thermal.h>
Put above line on top (before SOC_PERIPHERAL_IRQ()).
> +
> #include "sunxi-d1s-t113.dtsi"
>
> / {
> @@ -115,4 +117,33 @@ pmu {
> <0x00000000 0x0000000e 0xffffffff 0xffffffff 0x00010000>,
> <0x00000000 0x0000000f 0xffffffff 0xffffffff 0x00020000>;
> };
> +
> + thermal-zones {
> + cpu-thermal {
> + polling-delay-passive = <0>;
> + polling-delay = <0>;
> + thermal-sensors = <&ths>;
> +
> + cooling-maps {
> + map0 {
> + trip = <&cpu_alert>;
> + cooling-device = <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
> + };
> + };
> +
> + trips {
> + cpu_alert: cpu-alert {
> + temperature = <85000>;
> + hysteresis = <2000>;
> + type = "passive";
> + };
> +
> + cpu-crit {
> + temperature = <100000>;
> + hysteresis = <0>;
> + type = "critical";
> + };
Where do those limits come from?
> + };
> + };
> + };
> };
> diff --git a/arch/riscv/boot/dts/allwinner/sunxi-d1s-t113.dtsi b/arch/riscv/boot/dts/allwinner/sunxi-d1s-t113.dtsi
> index e4175adb0..fcfcaf06c 100644
> --- a/arch/riscv/boot/dts/allwinner/sunxi-d1s-t113.dtsi
> +++ b/arch/riscv/boot/dts/allwinner/sunxi-d1s-t113.dtsi
> @@ -426,6 +426,10 @@ sid: efuse@3006000 {
> reg = <0x3006000 0x1000>;
> #address-cells = <1>;
> #size-cells = <1>;
> +
> + ths_calibration: thermal-sensor-calibration@14 {
> + reg = <0x14 0x8>;
> + };
> };
>
> crypto: crypto@3040000 {
> @@ -934,5 +938,17 @@ rtc: rtc@7090000 {
> clock-names = "bus", "hosc", "ahb";
> #clock-cells = <1>;
> };
> +
> + ths: thermal-sensor@2009400 {
> + compatible = "allwinner,sun20i-d1-ths";
> + reg = <0x2009400 0x100>;
Size should be 0x400.
Best regards,
Jernej
> + interrupts = <SOC_PERIPHERAL_IRQ(58) IRQ_TYPE_LEVEL_HIGH>;
> + clocks = <&ccu CLK_BUS_THS>;
> + clock-names = "bus";
> + resets = <&ccu RST_BUS_THS>;
> + nvmem-cells = <&ths_calibration>;
> + nvmem-cell-names = "calibration";
> + #thermal-sensor-cells = <0>;
> + };
> };
> };
>
next prev parent reply other threads:[~2025-02-18 17:30 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-18 2:06 [PATCH] riscv: dts: allwinner: d1: Add CPU thermal sensor and zone Alex Studer
2025-02-18 17:23 ` Jernej Škrabec [this message]
2025-02-19 3:02 ` Alex Studer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4628970.LvFx2qVVIh@jernej-laptop \
--to=jernej.skrabec@gmail.com \
--cc=alex@studer.dev \
--cc=aou@eecs.berkeley.edu \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=krzk+dt@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=linux-sunxi@lists.linux.dev \
--cc=palmer@dabbelt.com \
--cc=paul.walmsley@sifive.com \
--cc=robh@kernel.org \
--cc=samuel@sholland.org \
--cc=wens@csie.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox