From patchwork Mon Jan 22 20:34:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Link Mauve X-Patchwork-Id: 13526265 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id AE46FC46CD2 for ; Mon, 22 Jan 2024 21:20:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=daBkiY0TN8OTdEoXxYcnjI/qYuf1hnJr4cMY5qZ5RZk=; b=i5KMRtfx8jvFpL wGaqBE0eRaywbrxtkAvd0tVgqgATgI/q7kKvMcRkVxmFx8TX69mRwAZE5Agmfy7ZSCgrBuGYleunG BQYcWVh2mmt5ArJ/FtzCM9f4gyL3RrDtXYkRbbV8NqBQLV9gqIT0eq98UOqNb/NkALQmCM7BzOZpA WOaFZ/98RJZbgji74/vStgBq1E1gfsW5om4ojhkTq1yz0UfjWOCcvFQnxtdTgaJjFFsgAdZ8vKNes rxIBgs70Y9MK1b+CYOLL3RDT13V5IoUod60m3vca2FUtUF1cR4h+sq88wRFwRTs6utpbDSlHPXIMY zsjjnDaJXVbgtYK1nkTg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rS1iS-00E9tw-2b; Mon, 22 Jan 2024 21:20:24 +0000 Received: from luna.linkmauve.fr ([82.65.109.163]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rS1iP-00E9ri-32 for linux-rockchip@lists.infradead.org; Mon, 22 Jan 2024 21:20:23 +0000 Received: by luna.linkmauve.fr (Postfix, from userid 1000) id 371E5DDADC3; Mon, 22 Jan 2024 21:35:15 +0100 (CET) From: Emmanuel Gil Peyrot To: Rob Herring , Krzysztof Kozlowski , Conor Dooley , Heiko Stuebner , Sebastian Reichel , Cristian Ciocaltea , =?utf-8?b?VGFtw6Fz?= =?utf-8?b?IFN6xbFjcw==?= , Christopher Obbard , Shreeya Patel , John Clark , Dragan Simic , Chris Morgan , Emmanuel Gil Peyrot , Andy Yan , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org, Nicolas Frattaroli Subject: [PATCH 1/2] arm64: dts: rockchip: Add the rk3588 thermal zones Date: Mon, 22 Jan 2024 21:34:57 +0100 Message-ID: <20240122203502.3311520-2-linkmauve@linkmauve.fr> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240122203502.3311520-1-linkmauve@linkmauve.fr> References: <20240122203502.3311520-1-linkmauve@linkmauve.fr> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240122_132022_254330_4685EE8E X-CRM114-Status: GOOD ( 18.18 ) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+linux-rockchip=archiver.kernel.org@lists.infradead.org The driver got added back in 45d7b3867a5cabb97fc31f16122cda8540c3a30c, but the dts never got updated, so here it is! I’ve added it to the rk3588s because that’s where most of the definitions are, but I’ve only tested on a rk3588 so maybe there are subtle changes. The rk3588 TRM also documents slightly different values (in part 1 section 14.5.3) than the driver, but I’ve left the values alone since I have no way to determine which one is (more) correct. Only the CPU is properly mapped, as neither the GPU nor the NPU have been added to the dts for now, I’ve left some TODOs there. All of the thermal zones report almost the same value on my rock-5b board, I’m not sure if this is due to a programming error or if this is to be expected. For instance, after running for a while, all of the zones report 44384 m℃, despite having used neither the GPU nor the NPU. Additionally, the alert and crit temperatures have been arbitrarily chosen based on other dts files, not based on any knowledge of the thermal behaviours of this specific SoC. Signed-off-by: Emmanuel Gil Peyrot --- arch/arm64/boot/dts/rockchip/rk3588s.dtsi | 181 ++++++++++++++++++++++ 1 file changed, 181 insertions(+) diff --git a/arch/arm64/boot/dts/rockchip/rk3588s.dtsi b/arch/arm64/boot/dts/rockchip/rk3588s.dtsi index 36b1b7acfe6a..c7a2078960b7 100644 --- a/arch/arm64/boot/dts/rockchip/rk3588s.dtsi +++ b/arch/arm64/boot/dts/rockchip/rk3588s.dtsi @@ -10,6 +10,7 @@ #include #include #include +#include / { compatible = "rockchip,rk3588"; @@ -436,6 +437,186 @@ scmi_shmem: sram@0 { }; }; + thermal_zones: thermal-zones { + soc-thermal { + polling-delay-passive = <250>; /* milliseconds */ + polling-delay = <1000>; /* milliseconds */ + thermal-sensors = <&tsadc 0>; + + trips { + soc_alert: trip-alert { + temperature = <80000>; + hysteresis = <2000>; + type = "passive"; + }; + soc_crit: trip-crit { + temperature = <100000>; + hysteresis = <2000>; + type = "critical"; + }; + }; + cooling-maps { + map0 { + trip = <&soc_alert>; + cooling-device = <&cpu_b0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, + <&cpu_b1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, + <&cpu_b2 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, + <&cpu_b3 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, + <&cpu_l0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, + <&cpu_l1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, + <&cpu_l2 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, + <&cpu_l3 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; + }; + }; + }; + + cluster1-thermal { + polling-delay-passive = <250>; /* milliseconds */ + polling-delay = <1000>; /* milliseconds */ + thermal-sensors = <&tsadc 1>; + + trips { + cluster1_alert: trip-alert { + temperature = <80000>; + hysteresis = <2000>; + type = "passive"; + }; + cluster1_crit: trip-crit { + temperature = <100000>; + hysteresis = <2000>; + type = "critical"; + }; + }; + cooling-maps { + map0 { + trip = <&cluster1_alert>; + cooling-device = <&cpu_b0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, + <&cpu_b1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; + }; + }; + }; + + cluster2-thermal { + polling-delay-passive = <250>; /* milliseconds */ + polling-delay = <1000>; /* milliseconds */ + thermal-sensors = <&tsadc 2>; + + trips { + cluster2_alert: trip-alert { + temperature = <80000>; + hysteresis = <2000>; + type = "passive"; + }; + cluster2_crit: trip-crit { + temperature = <100000>; + hysteresis = <2000>; + type = "critical"; + }; + }; + cooling-maps { + map0 { + trip = <&cluster2_alert>; + cooling-device = <&cpu_b2 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, + <&cpu_b3 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; + }; + }; + }; + + cluster0-thermal { + polling-delay-passive = <250>; /* milliseconds */ + polling-delay = <1000>; /* milliseconds */ + thermal-sensors = <&tsadc 3>; + + trips { + cluster0_alert: trip-alert { + temperature = <80000>; + hysteresis = <2000>; + type = "passive"; + }; + cluster0_crit: trip-crit { + temperature = <100000>; + hysteresis = <2000>; + type = "critical"; + }; + }; + cooling-maps { + map0 { + trip = <&cluster0_alert>; + cooling-device = <&cpu_l0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, + <&cpu_l1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, + <&cpu_l2 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, + <&cpu_l3 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; + }; + }; + }; + + center-thermal { + polling-delay-passive = <250>; /* milliseconds */ + polling-delay = <1000>; /* milliseconds */ + thermal-sensors = <&tsadc 4>; + + trips { + center_alert: trip-alert { + temperature = <80000>; + hysteresis = <2000>; + type = "passive"; + }; + center_crit: trip-crit { + temperature = <100000>; + hysteresis = <2000>; + type = "critical"; + }; + }; + cooling-maps { + /* TODO: what exactly is "center"? */ + }; + }; + + gpu-thermal { + polling-delay-passive = <250>; /* milliseconds */ + polling-delay = <1000>; /* milliseconds */ + thermal-sensors = <&tsadc 5>; + + trips { + gpu_alert: trip-alert { + temperature = <80000>; + hysteresis = <2000>; + type = "passive"; + }; + gpu_crit: trip-crit { + temperature = <100000>; + hysteresis = <2000>; + type = "critical"; + }; + }; + cooling-maps { + /* TODO: Add the GPU here once it is supported. */ + }; + }; + + npu-thermal { + polling-delay-passive = <250>; /* milliseconds */ + polling-delay = <1000>; /* milliseconds */ + thermal-sensors = <&tsadc 6>; + + trips { + npu_alert: trip-alert { + temperature = <80000>; + hysteresis = <2000>; + type = "passive"; + }; + npu_crit: trip-crit { + temperature = <100000>; + hysteresis = <2000>; + type = "critical"; + }; + }; + cooling-maps { + /* TODO: Add the NPU here once it is supported. */ + }; + }; + }; + usb_host0_ehci: usb@fc800000 { compatible = "rockchip,rk3588-ehci", "generic-ehci"; reg = <0x0 0xfc800000 0x0 0x40000>;