Message ID | 20240109192608.5981-1-alchark@gmail.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-21308-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2411:b0:101:2151:f287 with SMTP id m17csp334854dyi; Tue, 9 Jan 2024 11:27:13 -0800 (PST) X-Google-Smtp-Source: AGHT+IGDdlPn//ZcTzXY4lQHezuBnL3L6tAA6tG6m+mcOnR80ZbiNJCyQQkV1zT3zN8Q6vWkeo86 X-Received: by 2002:a05:620a:1216:b0:783:21aa:8799 with SMTP id u22-20020a05620a121600b0078321aa8799mr3715323qkj.62.1704828433753; Tue, 09 Jan 2024 11:27:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704828433; cv=none; d=google.com; s=arc-20160816; b=yy3r2HP7RK9rR8PPYx2xbxnZ08Tes9DKpt/r6ZOsZu3gMR357vSa0KXHQYrx8/ab8U UOGDtLu8E8PDjuevKmXwXv3yYDdgdk9VY2GkOW06Xuy0IiczLt/lSozuT865qUmgn9m6 8DWnc9pAgTdMEaRr/+O0tqVPgz+YXIKNNLTAxxQjzkUkJ/9veusUQDzMNAR2ifhrnEan kbd/jVONjcVBeuaVxuCpUA5F1sXo6A4chzKTXoSjzJGdXrjQYKXmgopbyjhtnv3MgGz9 xfBcvmIWVHnY5SGSYQMSQPmANHzvtYo/l/I5KuS2hskVFkrnGJ6fD1ITluFCSLFdTSz1 QLDg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:to:from:dkim-signature; bh=umKNw6oY7W/GC+6PKYH46lfy8g9nHWoaPdVcGAt9mEE=; fh=2QeRp1p8CqkkSWqMaMgC0YerPwS+o9TXkXeH+X9ae/E=; b=DX979d0eE5nfIlKpy+XAgziEl6ecX6Gb+pvK1V8u5kbkID0zi0bCbaUhbb8fpptJO9 IJOEzdFWUKgTU4Jm5d5wiImC91miaiQiCr+p8GLOsfYywu9Fn72YrG2ly3kbZQKhQ6N/ wopDAo47eJyv7XZUsxc2z00nqOntfvfdnzBkAVPr+Je8uWjCjdjevkLI/LiFeZraIbM5 JGcHDmAHr7G1bLlZzqGGO4h5OME0A10rJHpeD9LC0aMJQxn7NhRkG7bkTTnelguhEK1T GJX7QwOlCMs38WZryL30HEfesCWOT6nULr7B+qZYqyDISRSlE26+9rxFbKq71cC0gdSz QHtg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=IW9EE9tK; spf=pass (google.com: domain of linux-kernel+bounces-21308-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-21308-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id de12-20020a05620a370c00b007830acce9a6si2963921qkb.378.2024.01.09.11.27.13 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Jan 2024 11:27:13 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-21308-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=IW9EE9tK; spf=pass (google.com: domain of linux-kernel+bounces-21308-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-21308-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 7D7B51C208E4 for <ouuuleilei@gmail.com>; Tue, 9 Jan 2024 19:27:13 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0F7D53D54F; Tue, 9 Jan 2024 19:26:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="IW9EE9tK" Received: from mail-wm1-f54.google.com (mail-wm1-f54.google.com [209.85.128.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 451C03D386; Tue, 9 Jan 2024 19:26:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-wm1-f54.google.com with SMTP id 5b1f17b1804b1-40e54f233abso1346965e9.0; Tue, 09 Jan 2024 11:26:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1704828397; x=1705433197; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=umKNw6oY7W/GC+6PKYH46lfy8g9nHWoaPdVcGAt9mEE=; b=IW9EE9tK7dJ5sgOwOYNn/PY4cTYpwgiVpD/GzOHyygXm58gMRrCE96yPz0tg5iH58r 0U61UbetVkhMvhFnxoAi6zZg7RxLzyrZFfnAjCXl5tcDkfHkMCYIkkrWzdLt4D1kdDP/ odBYzivK89nDCW+ufshIKTMxeRYe2U/MKZZEQ3x5SflUj1BqSHnTBD51neeHEu+CAQD2 mckk81MWK8ZjwzDigdpciPBLMSd4yKc2VtCxUWd27mSuKUDOW4QZqX8j0BF9gu4K+sIE GuDyGGWORqm7ddzFnBWXnjccapM94d0B9hUo7kGfLf/97gNbyBqdRS26ShK4oEnhStH5 qGng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704828397; x=1705433197; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=umKNw6oY7W/GC+6PKYH46lfy8g9nHWoaPdVcGAt9mEE=; b=ITMAFj3UhWMC0WM/hzA7eOkIM3Zdcz/LtjYxV6NEGE4PkeQzmx3Zeuwo92BtSoyBIy 2Zg1rNZX4tOV9sfy66VZgmdCxC6afg0hU3RijEeGnNjkn/9rTv2dDAts2Xmi6hC72mv2 U37mt/gVvyPeFMz0CXjrNmo9EUmf3Njk7CxdfnI9C/cxWd7hy+3v4a7H8h/Ale4Nadka yBDmZ/FS7G6NgHONeG1pjC8ym3Uo/PMvX6lmhQfdHhhsESFTYHZ+FDJZCjtrkdBUi/hW d49KeDrvpL0z0E/dLWmMPiuy0XzeRn8oMoR5uTy0z6rGMDltO6t/5rTG/tFZ8ngU4unw 2qJQ== X-Gm-Message-State: AOJu0YwRjYHLZDiZ+obJ5ckDD30b14WP160uAxUzr1Be6y9jcGRbii8P 72TsF5QkiddGH+YnOGA9fog= X-Received: by 2002:a7b:c4d1:0:b0:40e:4aed:ad27 with SMTP id g17-20020a7bc4d1000000b0040e4aedad27mr1281983wmk.144.1704828397241; Tue, 09 Jan 2024 11:26:37 -0800 (PST) Received: from latitude-fedora.lan ([2001:8f8:183b:50fb::d35]) by smtp.gmail.com with ESMTPSA id u7-20020a05600c138700b0040d62f97e3csm15672468wmf.10.2024.01.09.11.26.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Jan 2024 11:26:36 -0800 (PST) From: Alexey Charkov <alchark@gmail.com> To: Rob Herring <robh+dt@kernel.org>, Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>, Conor Dooley <conor+dt@kernel.org>, Heiko Stuebner <heiko@sntech.de>, Sebastian Reichel <sebastian.reichel@collabora.com>, Cristian Ciocaltea <cristian.ciocaltea@collabora.com>, Christopher Obbard <chris.obbard@collabora.com>, =?utf-8?b?VGFtw6FzIFN6xbFj?= =?utf-8?b?cw==?= <szucst@iit.uni-miskolc.hu>, Shreeya Patel <shreeya.patel@collabora.com>, Alexey Charkov <alchark@gmail.com>, Kever Yang <kever.yang@rock-chips.com>, Jagan Teki <jagan@edgeble.ai>, Chris Morgan <macromorgan@hotmail.com>, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v2] arm64: dts: rockchip: enable built-in thermal monitoring on rk3588 Date: Tue, 9 Jan 2024 23:19:47 +0400 Message-ID: <20240109192608.5981-1-alchark@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240106222357.23835-1-alchark@gmail.com> References: <20240106222357.23835-1-alchark@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1787381559435665692 X-GMAIL-MSGID: 1787642179588005299 |
Series |
[v2] arm64: dts: rockchip: enable built-in thermal monitoring on rk3588
|
|
Commit Message
Alexey Charkov
Jan. 9, 2024, 7:19 p.m. UTC
Include thermal zones information in device tree for rk3588 variants
and enable the built-in thermal sensing ADC on RADXA Rock 5B
Signed-off-by: Alexey Charkov <alchark@gmail.com>
---
Changes in v2:
- Dropped redundant comments
- Included all CPU cores in cooling maps
- Split cooling maps into more granular ones utilizing TSADC
channels 1-3 which measure temperature by separate CPU clusters
instead of channel 0 which measures the center of the SoC die
---
.../boot/dts/rockchip/rk3588-rock-5b.dts | 4 +
arch/arm64/boot/dts/rockchip/rk3588s.dtsi | 151 ++++++++++++++++++
2 files changed, 155 insertions(+)
Comments
On 2024-01-09 20:19, Alexey Charkov wrote: > Include thermal zones information in device tree for rk3588 variants > and enable the built-in thermal sensing ADC on RADXA Rock 5B > > Signed-off-by: Alexey Charkov <alchark@gmail.com> > --- > Changes in v2: > - Dropped redundant comments > - Included all CPU cores in cooling maps > - Split cooling maps into more granular ones utilizing TSADC > channels 1-3 which measure temperature by separate CPU clusters > instead of channel 0 which measures the center of the SoC die > --- > .../boot/dts/rockchip/rk3588-rock-5b.dts | 4 + > arch/arm64/boot/dts/rockchip/rk3588s.dtsi | 151 ++++++++++++++++++ > 2 files changed, 155 insertions(+) > > diff --git a/arch/arm64/boot/dts/rockchip/rk3588-rock-5b.dts > b/arch/arm64/boot/dts/rockchip/rk3588-rock-5b.dts > index a5a104131403..f9d540000de3 100644 > --- a/arch/arm64/boot/dts/rockchip/rk3588-rock-5b.dts > +++ b/arch/arm64/boot/dts/rockchip/rk3588-rock-5b.dts > @@ -772,3 +772,7 @@ &usb_host1_ehci { > &usb_host1_ohci { > status = "okay"; > }; > + > +&tsadc { > + status = "okay"; > +}; I keep forgetting to note that enabling it for the Rock 5B should be performed in a separate patch. > diff --git a/arch/arm64/boot/dts/rockchip/rk3588s.dtsi > b/arch/arm64/boot/dts/rockchip/rk3588s.dtsi > index 8aa0499f9b03..8d54998d0ecc 100644 > --- a/arch/arm64/boot/dts/rockchip/rk3588s.dtsi > +++ b/arch/arm64/boot/dts/rockchip/rk3588s.dtsi > @@ -10,6 +10,7 @@ > #include <dt-bindings/reset/rockchip,rk3588-cru.h> > #include <dt-bindings/phy/phy.h> > #include <dt-bindings/ata/ahci.h> > +#include <dt-bindings/thermal/thermal.h> > > / { > compatible = "rockchip,rk3588"; > @@ -2112,6 +2113,156 @@ tsadc: tsadc@fec00000 { > status = "disabled"; > }; > > + thermal_zones: thermal-zones { > + /* sensor near the center of the whole chip */ > + soc_thermal: soc-thermal { > + polling-delay-passive = <20>; > + polling-delay = <1000>; > + sustainable-power = <2100>; > + thermal-sensors = <&tsadc 0>; > + > + trips { > + soc_crit: soc-crit { > + temperature = <115000>; > + hysteresis = <2000>; > + type = "critical"; > + }; > + }; > + }; As already noted in my previous response, perhaps it whould be better to name it package_thermal instead. That way, it should be more self descriptive. > + /* sensor between A76 cores 0 and 1 */ > + bigcore0_thermal: bigcore0-thermal { > + polling-delay-passive = <20>; > + polling-delay = <1000>; > + thermal-sensors = <&tsadc 1>; > + > + trips { > + bigcore0_alert: bigcore0-alert { > + temperature = <85000>; > + hysteresis = <2000>; > + type = "passive"; > + }; > + bigcore0_crit: bigcore0-crit { > + temperature = <115000>; > + hysteresis = <2000>; > + type = "critical"; > + }; > + }; As already noted in my previous message, perhaps another trip, of the "hot" type, should be added here. > + cooling-maps { > + map0 { > + trip = <&bigcore0_alert>; > + cooling-device = > + <&cpu_b0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, > + <&cpu_b1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; > + contribution = <1024>; > + }; > + }; > + }; > + > + /* sensor between A76 cores 2 and 3 */ > + bigcore2_thermal: bigcore2-thermal { > + polling-delay-passive = <20>; > + polling-delay = <1000>; > + thermal-sensors = <&tsadc 2>; > + > + trips { > + bigcore2_alert: bigcore2-alert { > + temperature = <85000>; > + hysteresis = <2000>; > + type = "passive"; > + }; > + bigcore2_crit: bigcore2-crit { > + temperature = <115000>; > + hysteresis = <2000>; > + type = "critical"; > + }; > + }; The same suggestion about one more "hot" trip applies here as well. > + cooling-maps { > + map1 { > + trip = <&bigcore2_alert>; > + cooling-device = > + <&cpu_b2 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, > + <&cpu_b3 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; > + contribution = <1024>; > + }; > + }; > + }; > + > + /* sensor between the four A55 cores */ > + little_core_thermal: littlecore-thermal { > + polling-delay-passive = <20>; > + polling-delay = <1000>; > + thermal-sensors = <&tsadc 3>; > + > + trips { > + littlecore_alert: littlecore-alert { > + temperature = <85000>; > + hysteresis = <2000>; > + type = "passive"; > + }; > + littlecore_crit: littlecore-crit { > + temperature = <115000>; > + hysteresis = <2000>; > + type = "critical"; > + }; > + }; The same suggestion about one more "hot" trip applies here as well. > + cooling-maps { > + map2 { > + trip = <&littlecore_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>; > + contribution = <1024>; > + }; > + }; > + }; > + > + /* sensor near the PD_CENTER power domain */ > + center_thermal: center-thermal { > + polling-delay-passive = <20>; > + polling-delay = <1000>; > + thermal-sensors = <&tsadc 4>; > + > + trips { > + center_crit: center-crit { > + temperature = <115000>; > + hysteresis = <2000>; > + type = "critical"; > + }; > + }; > + }; > + > + gpu_thermal: gpu-thermal { > + polling-delay-passive = <20>; > + polling-delay = <1000>; > + thermal-sensors = <&tsadc 5>; > + > + trips { > + gpu_crit: gpu-crit { > + temperature = <115000>; > + hysteresis = <2000>; > + type = "critical"; > + }; > + }; > + }; > + > + npu_thermal: npu-thermal { > + polling-delay-passive = <20>; > + polling-delay = <1000>; > + thermal-sensors = <&tsadc 6>; > + > + trips { > + npu_crit: npu-crit { > + temperature = <115000>; > + hysteresis = <2000>; > + type = "critical"; > + }; > + }; > + }; > + }; > + > saradc: adc@fec10000 { > compatible = "rockchip,rk3588-saradc"; > reg = <0x0 0xfec10000 0x0 0x10000>;
Am Dienstag, 9. Januar 2024, 20:19:47 CET schrieb Alexey Charkov: > Include thermal zones information in device tree for rk3588 variants > and enable the built-in thermal sensing ADC on RADXA Rock 5B > > Signed-off-by: Alexey Charkov <alchark@gmail.com> > --- > Changes in v2: > - Dropped redundant comments > - Included all CPU cores in cooling maps > - Split cooling maps into more granular ones utilizing TSADC > channels 1-3 which measure temperature by separate CPU clusters > instead of channel 0 which measures the center of the SoC die all of what Dragan wrote and additionally, please don't post v2 patches as reply to earlier versions. It confuses tooling like "b4" when trying to retrieve patches. Thanks Heiko > --- > .../boot/dts/rockchip/rk3588-rock-5b.dts | 4 + > arch/arm64/boot/dts/rockchip/rk3588s.dtsi | 151 ++++++++++++++++++ > 2 files changed, 155 insertions(+) > > diff --git a/arch/arm64/boot/dts/rockchip/rk3588-rock-5b.dts b/arch/arm64/boot/dts/rockchip/rk3588-rock-5b.dts > index a5a104131403..f9d540000de3 100644 > --- a/arch/arm64/boot/dts/rockchip/rk3588-rock-5b.dts > +++ b/arch/arm64/boot/dts/rockchip/rk3588-rock-5b.dts > @@ -772,3 +772,7 @@ &usb_host1_ehci { > &usb_host1_ohci { > status = "okay"; > }; > + > +&tsadc { > + status = "okay"; > +}; > diff --git a/arch/arm64/boot/dts/rockchip/rk3588s.dtsi b/arch/arm64/boot/dts/rockchip/rk3588s.dtsi > index 8aa0499f9b03..8d54998d0ecc 100644 > --- a/arch/arm64/boot/dts/rockchip/rk3588s.dtsi > +++ b/arch/arm64/boot/dts/rockchip/rk3588s.dtsi > @@ -10,6 +10,7 @@ > #include <dt-bindings/reset/rockchip,rk3588-cru.h> > #include <dt-bindings/phy/phy.h> > #include <dt-bindings/ata/ahci.h> > +#include <dt-bindings/thermal/thermal.h> > > / { > compatible = "rockchip,rk3588"; > @@ -2112,6 +2113,156 @@ tsadc: tsadc@fec00000 { > status = "disabled"; > }; > > + thermal_zones: thermal-zones { > + /* sensor near the center of the whole chip */ > + soc_thermal: soc-thermal { > + polling-delay-passive = <20>; > + polling-delay = <1000>; > + sustainable-power = <2100>; > + thermal-sensors = <&tsadc 0>; > + > + trips { > + soc_crit: soc-crit { > + temperature = <115000>; > + hysteresis = <2000>; > + type = "critical"; > + }; > + }; > + }; > + > + /* sensor between A76 cores 0 and 1 */ > + bigcore0_thermal: bigcore0-thermal { > + polling-delay-passive = <20>; > + polling-delay = <1000>; > + thermal-sensors = <&tsadc 1>; > + > + trips { > + bigcore0_alert: bigcore0-alert { > + temperature = <85000>; > + hysteresis = <2000>; > + type = "passive"; > + }; > + bigcore0_crit: bigcore0-crit { > + temperature = <115000>; > + hysteresis = <2000>; > + type = "critical"; > + }; > + }; > + cooling-maps { > + map0 { > + trip = <&bigcore0_alert>; > + cooling-device = > + <&cpu_b0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, > + <&cpu_b1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; > + contribution = <1024>; > + }; > + }; > + }; > + > + /* sensor between A76 cores 2 and 3 */ > + bigcore2_thermal: bigcore2-thermal { > + polling-delay-passive = <20>; > + polling-delay = <1000>; > + thermal-sensors = <&tsadc 2>; > + > + trips { > + bigcore2_alert: bigcore2-alert { > + temperature = <85000>; > + hysteresis = <2000>; > + type = "passive"; > + }; > + bigcore2_crit: bigcore2-crit { > + temperature = <115000>; > + hysteresis = <2000>; > + type = "critical"; > + }; > + }; > + cooling-maps { > + map1 { > + trip = <&bigcore2_alert>; > + cooling-device = > + <&cpu_b2 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, > + <&cpu_b3 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; > + contribution = <1024>; > + }; > + }; > + }; > + > + /* sensor between the four A55 cores */ > + little_core_thermal: littlecore-thermal { > + polling-delay-passive = <20>; > + polling-delay = <1000>; > + thermal-sensors = <&tsadc 3>; > + > + trips { > + littlecore_alert: littlecore-alert { > + temperature = <85000>; > + hysteresis = <2000>; > + type = "passive"; > + }; > + littlecore_crit: littlecore-crit { > + temperature = <115000>; > + hysteresis = <2000>; > + type = "critical"; > + }; > + }; > + cooling-maps { > + map2 { > + trip = <&littlecore_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>; > + contribution = <1024>; > + }; > + }; > + }; > + > + /* sensor near the PD_CENTER power domain */ > + center_thermal: center-thermal { > + polling-delay-passive = <20>; > + polling-delay = <1000>; > + thermal-sensors = <&tsadc 4>; > + > + trips { > + center_crit: center-crit { > + temperature = <115000>; > + hysteresis = <2000>; > + type = "critical"; > + }; > + }; > + }; > + > + gpu_thermal: gpu-thermal { > + polling-delay-passive = <20>; > + polling-delay = <1000>; > + thermal-sensors = <&tsadc 5>; > + > + trips { > + gpu_crit: gpu-crit { > + temperature = <115000>; > + hysteresis = <2000>; > + type = "critical"; > + }; > + }; > + }; > + > + npu_thermal: npu-thermal { > + polling-delay-passive = <20>; > + polling-delay = <1000>; > + thermal-sensors = <&tsadc 6>; > + > + trips { > + npu_crit: npu-crit { > + temperature = <115000>; > + hysteresis = <2000>; > + type = "critical"; > + }; > + }; > + }; > + }; > + > saradc: adc@fec10000 { > compatible = "rockchip,rk3588-saradc"; > reg = <0x0 0xfec10000 0x0 0x10000>; >
On 09/01/2024 20:19, Alexey Charkov wrote: > Include thermal zones information in device tree for rk3588 variants > and enable the built-in thermal sensing ADC on RADXA Rock 5B > > Signed-off-by: Alexey Charkov <alchark@gmail.com> > --- > Changes in v2: > - Dropped redundant comments > - Included all CPU cores in cooling maps > - Split cooling maps into more granular ones utilizing TSADC > channels 1-3 which measure temperature by separate CPU clusters > instead of channel 0 which measures the center of the SoC die > --- > .../boot/dts/rockchip/rk3588-rock-5b.dts | 4 + > arch/arm64/boot/dts/rockchip/rk3588s.dtsi | 151 ++++++++++++++++++ > 2 files changed, 155 insertions(+) > > diff --git a/arch/arm64/boot/dts/rockchip/rk3588-rock-5b.dts b/arch/arm64/boot/dts/rockchip/rk3588-rock-5b.dts > index a5a104131403..f9d540000de3 100644 > --- a/arch/arm64/boot/dts/rockchip/rk3588-rock-5b.dts > +++ b/arch/arm64/boot/dts/rockchip/rk3588-rock-5b.dts > @@ -772,3 +772,7 @@ &usb_host1_ehci { > &usb_host1_ohci { > status = "okay"; > }; > + > +&tsadc { > + status = "okay"; > +}; > diff --git a/arch/arm64/boot/dts/rockchip/rk3588s.dtsi b/arch/arm64/boot/dts/rockchip/rk3588s.dtsi > index 8aa0499f9b03..8d54998d0ecc 100644 > --- a/arch/arm64/boot/dts/rockchip/rk3588s.dtsi > +++ b/arch/arm64/boot/dts/rockchip/rk3588s.dtsi > @@ -10,6 +10,7 @@ > #include <dt-bindings/reset/rockchip,rk3588-cru.h> > #include <dt-bindings/phy/phy.h> > #include <dt-bindings/ata/ahci.h> > +#include <dt-bindings/thermal/thermal.h> > > / { > compatible = "rockchip,rk3588"; > @@ -2112,6 +2113,156 @@ tsadc: tsadc@fec00000 { > status = "disabled"; > }; > > + thermal_zones: thermal-zones { > + /* sensor near the center of the whole chip */ > + soc_thermal: soc-thermal { > + polling-delay-passive = <20>; There is no mitigation set for this thermal zone. It is pointless to specify a passive polling. > + polling-delay = <1000>; The driver is interrupt driven. No need to poll. > + sustainable-power = <2100>; There is no mitigation with this thermal zone. Specifying a sustainable power does not make sense. > + thermal-sensors = <&tsadc 0>; > + > + trips { > + soc_crit: soc-crit { > + temperature = <115000>; > + hysteresis = <2000>; This trip point leads to a system shutdown / reboot. It is not necessary to specify a hysteresis. > + type = "critical"; > + }; > + }; > + }; > + > + /* sensor between A76 cores 0 and 1 */ > + bigcore0_thermal: bigcore0-thermal { > + polling-delay-passive = <20>; > + polling-delay = <1000>; The driver is interrupt driven. No need to poll. > + thermal-sensors = <&tsadc 1>; > + > + trips { > + bigcore0_alert: bigcore0-alert { > + temperature = <85000>; > + hysteresis = <2000>; > + type = "passive"; > + }; > + bigcore0_crit: bigcore0-crit { > + temperature = <115000>; > + hysteresis = <2000>; > + type = "critical"; > + }; > + }; > + cooling-maps { > + map0 { > + trip = <&bigcore0_alert>; > + cooling-device = > + <&cpu_b0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, > + <&cpu_b1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; > + contribution = <1024>; If you specify the contribution, that means it is expected to use the IPA governor. However, this one needs an extra trip point before 'alert' to begin collecting temperatures in order to initialize the PID loop of the IPA. > + }; > + }; > + }; > + > + /* sensor between A76 cores 2 and 3 */ > + bigcore2_thermal: bigcore2-thermal { > + polling-delay-passive = <20>; > + polling-delay = <1000>; The driver is interrupt driven. No need to poll. > + thermal-sensors = <&tsadc 2>; > + > + trips { > + bigcore2_alert: bigcore2-alert { > + temperature = <85000>; > + hysteresis = <2000>; > + type = "passive"; > + }; > + bigcore2_crit: bigcore2-crit { > + temperature = <115000>; > + hysteresis = <2000>; > + type = "critical"; > + }; > + }; > + cooling-maps { > + map1 { > + trip = <&bigcore2_alert>; > + cooling-device = > + <&cpu_b2 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, > + <&cpu_b3 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; > + contribution = <1024>; > + }; > + }; > + }; > + > + /* sensor between the four A55 cores */ > + little_core_thermal: littlecore-thermal { > + polling-delay-passive = <20>; > + polling-delay = <1000>; The driver is interrupt driven. No need to poll. > + thermal-sensors = <&tsadc 3>; > + > + trips { > + littlecore_alert: littlecore-alert { > + temperature = <85000>; > + hysteresis = <2000>; > + type = "passive"; > + }; > + littlecore_crit: littlecore-crit { > + temperature = <115000>; > + hysteresis = <2000>; > + type = "critical"; > + }; > + }; > + cooling-maps { > + map2 { > + trip = <&littlecore_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>; > + contribution = <1024>; > + }; > + }; > + }; > + > + /* sensor near the PD_CENTER power domain */ > + center_thermal: center-thermal { > + polling-delay-passive = <20>; > + polling-delay = <1000>; Same comment as above for "soc-thermal" > + thermal-sensors = <&tsadc 4>; > + > + trips { > + center_crit: center-crit { > + temperature = <115000>; > + hysteresis = <2000>; > + type = "critical"; > + }; > + }; > + }; > + > + gpu_thermal: gpu-thermal { > + polling-delay-passive = <20>; > + polling-delay = <1000>; Same comment as above for "soc-thermal" > + thermal-sensors = <&tsadc 5>; > + > + trips { > + gpu_crit: gpu-crit { > + temperature = <115000>; > + hysteresis = <2000>; > + type = "critical"; > + }; > + }; > + }; > + > + npu_thermal: npu-thermal { > + polling-delay-passive = <20>; > + polling-delay = <1000>; Same comment as above for "soc-thermal" > + thermal-sensors = <&tsadc 6>; > + > + trips { > + npu_crit: npu-crit { > + temperature = <115000>; > + hysteresis = <2000>; > + type = "critical"; > + }; > + }; > + }; > + }; > + > saradc: adc@fec10000 { > compatible = "rockchip,rk3588-saradc"; > reg = <0x0 0xfec10000 0x0 0x10000>;
On Fri, Jan 19, 2024 at 8:21 PM Daniel Lezcano <daniel.lezcano@linaro.org> wrote: Hello Daniel, Thanks a lot for your review and comments! Please see some reflections below. > On 09/01/2024 20:19, Alexey Charkov wrote: > > Include thermal zones information in device tree for rk3588 variants > > and enable the built-in thermal sensing ADC on RADXA Rock 5B > > > > Signed-off-by: Alexey Charkov <alchark@gmail.com> > > --- > > Changes in v2: > > - Dropped redundant comments > > - Included all CPU cores in cooling maps > > - Split cooling maps into more granular ones utilizing TSADC > > channels 1-3 which measure temperature by separate CPU clusters > > instead of channel 0 which measures the center of the SoC die > > --- > > .../boot/dts/rockchip/rk3588-rock-5b.dts | 4 + > > arch/arm64/boot/dts/rockchip/rk3588s.dtsi | 151 ++++++++++++++++++ > > 2 files changed, 155 insertions(+) > > > > diff --git a/arch/arm64/boot/dts/rockchip/rk3588-rock-5b.dts b/arch/arm64/boot/dts/rockchip/rk3588-rock-5b.dts > > index a5a104131403..f9d540000de3 100644 > > --- a/arch/arm64/boot/dts/rockchip/rk3588-rock-5b.dts > > +++ b/arch/arm64/boot/dts/rockchip/rk3588-rock-5b.dts > > @@ -772,3 +772,7 @@ &usb_host1_ehci { > > &usb_host1_ohci { > > status = "okay"; > > }; > > + > > +&tsadc { > > + status = "okay"; > > +}; > > diff --git a/arch/arm64/boot/dts/rockchip/rk3588s.dtsi b/arch/arm64/boot/dts/rockchip/rk3588s.dtsi > > index 8aa0499f9b03..8d54998d0ecc 100644 > > --- a/arch/arm64/boot/dts/rockchip/rk3588s.dtsi > > +++ b/arch/arm64/boot/dts/rockchip/rk3588s.dtsi > > @@ -10,6 +10,7 @@ > > #include <dt-bindings/reset/rockchip,rk3588-cru.h> > > #include <dt-bindings/phy/phy.h> > > #include <dt-bindings/ata/ahci.h> > > +#include <dt-bindings/thermal/thermal.h> > > > > / { > > compatible = "rockchip,rk3588"; > > @@ -2112,6 +2113,156 @@ tsadc: tsadc@fec00000 { > > status = "disabled"; > > }; > > > > + thermal_zones: thermal-zones { > > + /* sensor near the center of the whole chip */ > > + soc_thermal: soc-thermal { > > + polling-delay-passive = <20>; > > There is no mitigation set for this thermal zone. It is pointless to > specify a passive polling. Indeed, it makes sense to me. There seems to be a catch though in that the driver calls the generic thermal_of_zone_register during the initial probe, which expects both of those polling delays to be present in the device tree, otherwise it simply refuses to add the respective thermal zone, see drivers/thermal/thermal_of.c:502 > > + polling-delay = <1000>; > > The driver is interrupt driven. No need to poll. Same here as above > > + sustainable-power = <2100>; > > There is no mitigation with this thermal zone. Specifying a sustainable > power does not make sense. Thanks, will drop this in v3! > > + thermal-sensors = <&tsadc 0>; > > + > > + trips { > > + soc_crit: soc-crit { > > + temperature = <115000>; > > + hysteresis = <2000>; > > This trip point leads to a system shutdown / reboot. It is not necessary > to specify a hysteresis. Similar to the above, the generic thermal_of code refuses to add the trip point if it has no hysteresis property defined (regardless of the trip type), see drivers/thermal/thermal_of.c:109 > > + type = "critical"; > > + }; > > + }; > > + }; > > + > > + /* sensor between A76 cores 0 and 1 */ > > + bigcore0_thermal: bigcore0-thermal { > > + polling-delay-passive = <20>; > > + polling-delay = <1000>; > > The driver is interrupt driven. No need to poll. > > > + thermal-sensors = <&tsadc 1>; > > + > > + trips { > > + bigcore0_alert: bigcore0-alert { > > + temperature = <85000>; > > + hysteresis = <2000>; > > + type = "passive"; > > + }; > > + bigcore0_crit: bigcore0-crit { > > + temperature = <115000>; > > + hysteresis = <2000>; > > + type = "critical"; > > + }; > > + }; > > + cooling-maps { > > + map0 { > > + trip = <&bigcore0_alert>; > > + cooling-device = > > + <&cpu_b0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, > > + <&cpu_b1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; > > + contribution = <1024>; > > If you specify the contribution, that means it is expected to use the > IPA governor. However, this one needs an extra trip point before 'alert' > to begin collecting temperatures in order to initialize the PID loop of > the IPA. Thank you! Will add extra passive cooling trip points at 75C to all three CPU clusters. Best regards, Alexey
Hi Alexey, On 21/01/2024 20:57, Alexey Charkov wrote: > On Fri, Jan 19, 2024 at 8:21 PM Daniel Lezcano > <daniel.lezcano@linaro.org> wrote: > Hello Daniel, > > Thanks a lot for your review and comments! Please see some reflections below. > >> On 09/01/2024 20:19, Alexey Charkov wrote: >>> Include thermal zones information in device tree for rk3588 variants >>> and enable the built-in thermal sensing ADC on RADXA Rock 5B >>> >>> Signed-off-by: Alexey Charkov <alchark@gmail.com> >>> --- >>> Changes in v2: >>> - Dropped redundant comments >>> - Included all CPU cores in cooling maps >>> - Split cooling maps into more granular ones utilizing TSADC >>> channels 1-3 which measure temperature by separate CPU clusters >>> instead of channel 0 which measures the center of the SoC die >>> --- >>> .../boot/dts/rockchip/rk3588-rock-5b.dts | 4 + >>> arch/arm64/boot/dts/rockchip/rk3588s.dtsi | 151 ++++++++++++++++++ >>> 2 files changed, 155 insertions(+) >>> >>> diff --git a/arch/arm64/boot/dts/rockchip/rk3588-rock-5b.dts b/arch/arm64/boot/dts/rockchip/rk3588-rock-5b.dts >>> index a5a104131403..f9d540000de3 100644 >>> --- a/arch/arm64/boot/dts/rockchip/rk3588-rock-5b.dts >>> +++ b/arch/arm64/boot/dts/rockchip/rk3588-rock-5b.dts >>> @@ -772,3 +772,7 @@ &usb_host1_ehci { >>> &usb_host1_ohci { >>> status = "okay"; >>> }; >>> + >>> +&tsadc { >>> + status = "okay"; >>> +}; >>> diff --git a/arch/arm64/boot/dts/rockchip/rk3588s.dtsi b/arch/arm64/boot/dts/rockchip/rk3588s.dtsi >>> index 8aa0499f9b03..8d54998d0ecc 100644 >>> --- a/arch/arm64/boot/dts/rockchip/rk3588s.dtsi >>> +++ b/arch/arm64/boot/dts/rockchip/rk3588s.dtsi >>> @@ -10,6 +10,7 @@ >>> #include <dt-bindings/reset/rockchip,rk3588-cru.h> >>> #include <dt-bindings/phy/phy.h> >>> #include <dt-bindings/ata/ahci.h> >>> +#include <dt-bindings/thermal/thermal.h> >>> >>> / { >>> compatible = "rockchip,rk3588"; >>> @@ -2112,6 +2113,156 @@ tsadc: tsadc@fec00000 { >>> status = "disabled"; >>> }; >>> >>> + thermal_zones: thermal-zones { >>> + /* sensor near the center of the whole chip */ >>> + soc_thermal: soc-thermal { >>> + polling-delay-passive = <20>; >> >> There is no mitigation set for this thermal zone. It is pointless to >> specify a passive polling. > > Indeed, it makes sense to me. There seems to be a catch though in that > the driver calls the generic thermal_of_zone_register during the > initial probe, which expects both of those polling delays to be > present in the device tree, otherwise it simply refuses to add the > respective thermal zone, see drivers/thermal/thermal_of.c:502 Usually: polling-delay-passive = <0>; polling-delay = <0>; cf: git grep "polling-delay = <0>" arch/arm64/boot/dts >>> + polling-delay = <1000>; >> >> The driver is interrupt driven. No need to poll. > > Same here as above > >>> + sustainable-power = <2100>; >> >> There is no mitigation with this thermal zone. Specifying a sustainable >> power does not make sense. > > Thanks, will drop this in v3! > >>> + thermal-sensors = <&tsadc 0>; >>> + >>> + trips { >>> + soc_crit: soc-crit { >>> + temperature = <115000>; >>> + hysteresis = <2000>; >> >> This trip point leads to a system shutdown / reboot. It is not necessary >> to specify a hysteresis. > > Similar to the above, the generic thermal_of code refuses to add the > trip point if it has no hysteresis property defined (regardless of the > trip type), see drivers/thermal/thermal_of.c:109 hysteresis = <0>;
On Mon, Jan 22, 2024 at 4:04 AM Daniel Lezcano <daniel.lezcano@linaro.org> wrote: > > > Hi Alexey, > > > On 21/01/2024 20:57, Alexey Charkov wrote: > > On Fri, Jan 19, 2024 at 8:21 PM Daniel Lezcano > > <daniel.lezcano@linaro.org> wrote: > > Hello Daniel, > > > > Thanks a lot for your review and comments! Please see some reflections below. > > > >> On 09/01/2024 20:19, Alexey Charkov wrote: > >>> Include thermal zones information in device tree for rk3588 variants > >>> and enable the built-in thermal sensing ADC on RADXA Rock 5B > >>> > >>> Signed-off-by: Alexey Charkov <alchark@gmail.com> > >>> --- > >>> Changes in v2: > >>> - Dropped redundant comments > >>> - Included all CPU cores in cooling maps > >>> - Split cooling maps into more granular ones utilizing TSADC > >>> channels 1-3 which measure temperature by separate CPU clusters > >>> instead of channel 0 which measures the center of the SoC die > >>> --- > >>> .../boot/dts/rockchip/rk3588-rock-5b.dts | 4 + > >>> arch/arm64/boot/dts/rockchip/rk3588s.dtsi | 151 ++++++++++++++++++ > >>> 2 files changed, 155 insertions(+) > >>> > >>> diff --git a/arch/arm64/boot/dts/rockchip/rk3588-rock-5b.dts b/arch/arm64/boot/dts/rockchip/rk3588-rock-5b.dts > >>> index a5a104131403..f9d540000de3 100644 > >>> --- a/arch/arm64/boot/dts/rockchip/rk3588-rock-5b.dts > >>> +++ b/arch/arm64/boot/dts/rockchip/rk3588-rock-5b.dts > >>> @@ -772,3 +772,7 @@ &usb_host1_ehci { > >>> &usb_host1_ohci { > >>> status = "okay"; > >>> }; > >>> + > >>> +&tsadc { > >>> + status = "okay"; > >>> +}; > >>> diff --git a/arch/arm64/boot/dts/rockchip/rk3588s.dtsi b/arch/arm64/boot/dts/rockchip/rk3588s.dtsi > >>> index 8aa0499f9b03..8d54998d0ecc 100644 > >>> --- a/arch/arm64/boot/dts/rockchip/rk3588s.dtsi > >>> +++ b/arch/arm64/boot/dts/rockchip/rk3588s.dtsi > >>> @@ -10,6 +10,7 @@ > >>> #include <dt-bindings/reset/rockchip,rk3588-cru.h> > >>> #include <dt-bindings/phy/phy.h> > >>> #include <dt-bindings/ata/ahci.h> > >>> +#include <dt-bindings/thermal/thermal.h> > >>> > >>> / { > >>> compatible = "rockchip,rk3588"; > >>> @@ -2112,6 +2113,156 @@ tsadc: tsadc@fec00000 { > >>> status = "disabled"; > >>> }; > >>> > >>> + thermal_zones: thermal-zones { > >>> + /* sensor near the center of the whole chip */ > >>> + soc_thermal: soc-thermal { > >>> + polling-delay-passive = <20>; > >> > >> There is no mitigation set for this thermal zone. It is pointless to > >> specify a passive polling. > > > > Indeed, it makes sense to me. There seems to be a catch though in that > > the driver calls the generic thermal_of_zone_register during the > > initial probe, which expects both of those polling delays to be > > present in the device tree, otherwise it simply refuses to add the > > respective thermal zone, see drivers/thermal/thermal_of.c:502 > > Usually: > > polling-delay-passive = <0>; > polling-delay = <0>; > > cf: > > git grep "polling-delay = <0>" arch/arm64/boot/dts Indeed, thanks a lot for the pointer! Somehow it slipped my attention. Will test and amend accordingly. > >>> + polling-delay = <1000>; > >> > >> The driver is interrupt driven. No need to poll. > > > > Same here as above > > > >>> + sustainable-power = <2100>; > >> > >> There is no mitigation with this thermal zone. Specifying a sustainable > >> power does not make sense. > > > > Thanks, will drop this in v3! > > > >>> + thermal-sensors = <&tsadc 0>; > >>> + > >>> + trips { > >>> + soc_crit: soc-crit { > >>> + temperature = <115000>; > >>> + hysteresis = <2000>; > >> > >> This trip point leads to a system shutdown / reboot. It is not necessary > >> to specify a hysteresis. > > > > Similar to the above, the generic thermal_of code refuses to add the > > trip point if it has no hysteresis property defined (regardless of the > > trip type), see drivers/thermal/thermal_of.c:109 > > hysteresis = <0>; Makes sense, thank you! Will amend accordingly. Best regards, Alexey
On Mon, Jan 22, 2024 at 4:04 AM Daniel Lezcano <daniel.lezcano@linaro.org> wrote: > > > Hi Alexey, > > > On 21/01/2024 20:57, Alexey Charkov wrote: > > On Fri, Jan 19, 2024 at 8:21 PM Daniel Lezcano > > <daniel.lezcano@linaro.org> wrote: > > Hello Daniel, > > > > Thanks a lot for your review and comments! Please see some reflections below. > > > >> On 09/01/2024 20:19, Alexey Charkov wrote: > >>> Include thermal zones information in device tree for rk3588 variants > >>> and enable the built-in thermal sensing ADC on RADXA Rock 5B > >>> > >>> Signed-off-by: Alexey Charkov <alchark@gmail.com> > >>> --- > >>> Changes in v2: > >>> - Dropped redundant comments > >>> - Included all CPU cores in cooling maps > >>> - Split cooling maps into more granular ones utilizing TSADC > >>> channels 1-3 which measure temperature by separate CPU clusters > >>> instead of channel 0 which measures the center of the SoC die > >>> --- > >>> .../boot/dts/rockchip/rk3588-rock-5b.dts | 4 + > >>> arch/arm64/boot/dts/rockchip/rk3588s.dtsi | 151 ++++++++++++++++++ > >>> 2 files changed, 155 insertions(+) > >>> > >>> diff --git a/arch/arm64/boot/dts/rockchip/rk3588-rock-5b.dts b/arch/arm64/boot/dts/rockchip/rk3588-rock-5b.dts > >>> index a5a104131403..f9d540000de3 100644 > >>> --- a/arch/arm64/boot/dts/rockchip/rk3588-rock-5b.dts > >>> +++ b/arch/arm64/boot/dts/rockchip/rk3588-rock-5b.dts > >>> @@ -772,3 +772,7 @@ &usb_host1_ehci { > >>> &usb_host1_ohci { > >>> status = "okay"; > >>> }; > >>> + > >>> +&tsadc { > >>> + status = "okay"; > >>> +}; > >>> diff --git a/arch/arm64/boot/dts/rockchip/rk3588s.dtsi b/arch/arm64/boot/dts/rockchip/rk3588s.dtsi > >>> index 8aa0499f9b03..8d54998d0ecc 100644 > >>> --- a/arch/arm64/boot/dts/rockchip/rk3588s.dtsi > >>> +++ b/arch/arm64/boot/dts/rockchip/rk3588s.dtsi > >>> @@ -10,6 +10,7 @@ > >>> #include <dt-bindings/reset/rockchip,rk3588-cru.h> > >>> #include <dt-bindings/phy/phy.h> > >>> #include <dt-bindings/ata/ahci.h> > >>> +#include <dt-bindings/thermal/thermal.h> > >>> > >>> / { > >>> compatible = "rockchip,rk3588"; > >>> @@ -2112,6 +2113,156 @@ tsadc: tsadc@fec00000 { > >>> status = "disabled"; > >>> }; > >>> > >>> + thermal_zones: thermal-zones { > >>> + /* sensor near the center of the whole chip */ > >>> + soc_thermal: soc-thermal { > >>> + polling-delay-passive = <20>; > >> > >> There is no mitigation set for this thermal zone. It is pointless to > >> specify a passive polling. > > > > Indeed, it makes sense to me. There seems to be a catch though in that > > the driver calls the generic thermal_of_zone_register during the > > initial probe, which expects both of those polling delays to be > > present in the device tree, otherwise it simply refuses to add the > > respective thermal zone, see drivers/thermal/thermal_of.c:502 > > Usually: > > polling-delay-passive = <0>; > polling-delay = <0>; > > cf: > > git grep "polling-delay = <0>" arch/arm64/boot/dts For some reason when I have both polling-delay-passive and polling-delay set to 0, the active cooling map I have in my board DT (using a PWM controlled fan) behaves weirdly. I use the following fragment in my board DTS: +&package_thermal { + trips { + package_fan: package-fan { + temperature = <55000>; + hysteresis = <2000>; + type = "active"; + }; + }; + + cooling-maps { + map-fan { + trip = <&package_fan>; + cooling-device = <&fan THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; + }; + }; +}; If I add polling-delay = <1000>; at the top, the fan speeds up and down dynamically as the package temperature swings around 55C. If I remove that (having set polling-delay = <0>; in rk3588s.dtsi), the fan speeds up to the midpoint cooling state once the package temperature approaches 55C, and then it just stays there forever: it doesn't speed up above the midpoint even as the temperature climbs above 70C, nor does it spin down as it falls back to around 45C. Is that the expected behavior for when the polling is disabled? I haven't yet studied in detail if passive cooling kicks in correctly with polling disabled, but this behavior with active cooling left me quite confused - any pointers would be much appreciated. Thanks a lot, Alexey
On 23/01/2024 20:47, Alexey Charkov wrote: > On Mon, Jan 22, 2024 at 4:04 AM Daniel Lezcano > <daniel.lezcano@linaro.org> wrote: >> >> >> Hi Alexey, >> >> >> On 21/01/2024 20:57, Alexey Charkov wrote: >>> On Fri, Jan 19, 2024 at 8:21 PM Daniel Lezcano >>> <daniel.lezcano@linaro.org> wrote: >>> Hello Daniel, >>> >>> Thanks a lot for your review and comments! Please see some reflections below. >>> >>>> On 09/01/2024 20:19, Alexey Charkov wrote: >>>>> Include thermal zones information in device tree for rk3588 variants >>>>> and enable the built-in thermal sensing ADC on RADXA Rock 5B >>>>> >>>>> Signed-off-by: Alexey Charkov <alchark@gmail.com> >>>>> --- >>>>> Changes in v2: >>>>> - Dropped redundant comments >>>>> - Included all CPU cores in cooling maps >>>>> - Split cooling maps into more granular ones utilizing TSADC >>>>> channels 1-3 which measure temperature by separate CPU clusters >>>>> instead of channel 0 which measures the center of the SoC die >>>>> --- >>>>> .../boot/dts/rockchip/rk3588-rock-5b.dts | 4 + >>>>> arch/arm64/boot/dts/rockchip/rk3588s.dtsi | 151 ++++++++++++++++++ >>>>> 2 files changed, 155 insertions(+) >>>>> >>>>> diff --git a/arch/arm64/boot/dts/rockchip/rk3588-rock-5b.dts b/arch/arm64/boot/dts/rockchip/rk3588-rock-5b.dts >>>>> index a5a104131403..f9d540000de3 100644 >>>>> --- a/arch/arm64/boot/dts/rockchip/rk3588-rock-5b.dts >>>>> +++ b/arch/arm64/boot/dts/rockchip/rk3588-rock-5b.dts >>>>> @@ -772,3 +772,7 @@ &usb_host1_ehci { >>>>> &usb_host1_ohci { >>>>> status = "okay"; >>>>> }; >>>>> + >>>>> +&tsadc { >>>>> + status = "okay"; >>>>> +}; >>>>> diff --git a/arch/arm64/boot/dts/rockchip/rk3588s.dtsi b/arch/arm64/boot/dts/rockchip/rk3588s.dtsi >>>>> index 8aa0499f9b03..8d54998d0ecc 100644 >>>>> --- a/arch/arm64/boot/dts/rockchip/rk3588s.dtsi >>>>> +++ b/arch/arm64/boot/dts/rockchip/rk3588s.dtsi >>>>> @@ -10,6 +10,7 @@ >>>>> #include <dt-bindings/reset/rockchip,rk3588-cru.h> >>>>> #include <dt-bindings/phy/phy.h> >>>>> #include <dt-bindings/ata/ahci.h> >>>>> +#include <dt-bindings/thermal/thermal.h> >>>>> >>>>> / { >>>>> compatible = "rockchip,rk3588"; >>>>> @@ -2112,6 +2113,156 @@ tsadc: tsadc@fec00000 { >>>>> status = "disabled"; >>>>> }; >>>>> >>>>> + thermal_zones: thermal-zones { >>>>> + /* sensor near the center of the whole chip */ >>>>> + soc_thermal: soc-thermal { >>>>> + polling-delay-passive = <20>; >>>> >>>> There is no mitigation set for this thermal zone. It is pointless to >>>> specify a passive polling. >>> >>> Indeed, it makes sense to me. There seems to be a catch though in that >>> the driver calls the generic thermal_of_zone_register during the >>> initial probe, which expects both of those polling delays to be >>> present in the device tree, otherwise it simply refuses to add the >>> respective thermal zone, see drivers/thermal/thermal_of.c:502 >> >> Usually: >> >> polling-delay-passive = <0>; >> polling-delay = <0>; >> >> cf: >> >> git grep "polling-delay = <0>" arch/arm64/boot/dts > > For some reason when I have both polling-delay-passive and > polling-delay set to 0, the active cooling map I have in my board DT > (using a PWM controlled fan) behaves weirdly. > I use the following fragment in my board DTS: > > +&package_thermal { > + trips { > + package_fan: package-fan { > + temperature = <55000>; > + hysteresis = <2000>; > + type = "active"; > + }; > + }; > + > + cooling-maps { > + map-fan { > + trip = <&package_fan>; > + cooling-device = <&fan THERMAL_NO_LIMIT > THERMAL_NO_LIMIT>; > + }; > + }; > +}; > > If I add polling-delay = <1000>; at the top, the fan speeds up and > down dynamically as the package temperature swings around 55C. If I > remove that (having set polling-delay = <0>; in rk3588s.dtsi), the fan > speeds up to the midpoint cooling state once the package temperature > approaches 55C, and then it just stays there forever: it doesn't speed > up above the midpoint even as the temperature climbs above 70C, nor > does it spin down as it falls back to around 45C. > > Is that the expected behavior for when the polling is disabled? I don't know the rest of the DT this fragment was added to, but I'm not surprised there is misbehavior because the configuration is not correct in this case. If there is a thermal zone with an active trip and an associated cooling device like a fan, then: -> polling-delay = <a_value>; -> polling-delay-passive = <0>; If there is a thermal zone with a passive cooling device like cpufreq cooling device, then 2 cases: 1. The sensor supports interrupt when crossing the trip point -> polling-delay = <0>; -> polling-delay-passive = <a_value>; 2. The sensor does not support interrupt when crossing the trip point -> polling-delay = <a_value>; -> polling-delay-passive = <another_value>; Why? When the cooling device is a passive cooling device, then the mitigation happens with a higher temperature sampling rate in order to change the state of the cooling device hundred of times per second. On a fan, the cooling effect is too slow for that so we keep the polling for that. > I haven't yet studied in detail if passive cooling kicks in correctly > with polling disabled, but this behavior with active cooling left me > quite confused - any pointers would be much appreciated. > > Thanks a lot, > Alexey
diff --git a/arch/arm64/boot/dts/rockchip/rk3588-rock-5b.dts b/arch/arm64/boot/dts/rockchip/rk3588-rock-5b.dts index a5a104131403..f9d540000de3 100644 --- a/arch/arm64/boot/dts/rockchip/rk3588-rock-5b.dts +++ b/arch/arm64/boot/dts/rockchip/rk3588-rock-5b.dts @@ -772,3 +772,7 @@ &usb_host1_ehci { &usb_host1_ohci { status = "okay"; }; + +&tsadc { + status = "okay"; +}; diff --git a/arch/arm64/boot/dts/rockchip/rk3588s.dtsi b/arch/arm64/boot/dts/rockchip/rk3588s.dtsi index 8aa0499f9b03..8d54998d0ecc 100644 --- a/arch/arm64/boot/dts/rockchip/rk3588s.dtsi +++ b/arch/arm64/boot/dts/rockchip/rk3588s.dtsi @@ -10,6 +10,7 @@ #include <dt-bindings/reset/rockchip,rk3588-cru.h> #include <dt-bindings/phy/phy.h> #include <dt-bindings/ata/ahci.h> +#include <dt-bindings/thermal/thermal.h> / { compatible = "rockchip,rk3588"; @@ -2112,6 +2113,156 @@ tsadc: tsadc@fec00000 { status = "disabled"; }; + thermal_zones: thermal-zones { + /* sensor near the center of the whole chip */ + soc_thermal: soc-thermal { + polling-delay-passive = <20>; + polling-delay = <1000>; + sustainable-power = <2100>; + thermal-sensors = <&tsadc 0>; + + trips { + soc_crit: soc-crit { + temperature = <115000>; + hysteresis = <2000>; + type = "critical"; + }; + }; + }; + + /* sensor between A76 cores 0 and 1 */ + bigcore0_thermal: bigcore0-thermal { + polling-delay-passive = <20>; + polling-delay = <1000>; + thermal-sensors = <&tsadc 1>; + + trips { + bigcore0_alert: bigcore0-alert { + temperature = <85000>; + hysteresis = <2000>; + type = "passive"; + }; + bigcore0_crit: bigcore0-crit { + temperature = <115000>; + hysteresis = <2000>; + type = "critical"; + }; + }; + cooling-maps { + map0 { + trip = <&bigcore0_alert>; + cooling-device = + <&cpu_b0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, + <&cpu_b1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; + contribution = <1024>; + }; + }; + }; + + /* sensor between A76 cores 2 and 3 */ + bigcore2_thermal: bigcore2-thermal { + polling-delay-passive = <20>; + polling-delay = <1000>; + thermal-sensors = <&tsadc 2>; + + trips { + bigcore2_alert: bigcore2-alert { + temperature = <85000>; + hysteresis = <2000>; + type = "passive"; + }; + bigcore2_crit: bigcore2-crit { + temperature = <115000>; + hysteresis = <2000>; + type = "critical"; + }; + }; + cooling-maps { + map1 { + trip = <&bigcore2_alert>; + cooling-device = + <&cpu_b2 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, + <&cpu_b3 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; + contribution = <1024>; + }; + }; + }; + + /* sensor between the four A55 cores */ + little_core_thermal: littlecore-thermal { + polling-delay-passive = <20>; + polling-delay = <1000>; + thermal-sensors = <&tsadc 3>; + + trips { + littlecore_alert: littlecore-alert { + temperature = <85000>; + hysteresis = <2000>; + type = "passive"; + }; + littlecore_crit: littlecore-crit { + temperature = <115000>; + hysteresis = <2000>; + type = "critical"; + }; + }; + cooling-maps { + map2 { + trip = <&littlecore_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>; + contribution = <1024>; + }; + }; + }; + + /* sensor near the PD_CENTER power domain */ + center_thermal: center-thermal { + polling-delay-passive = <20>; + polling-delay = <1000>; + thermal-sensors = <&tsadc 4>; + + trips { + center_crit: center-crit { + temperature = <115000>; + hysteresis = <2000>; + type = "critical"; + }; + }; + }; + + gpu_thermal: gpu-thermal { + polling-delay-passive = <20>; + polling-delay = <1000>; + thermal-sensors = <&tsadc 5>; + + trips { + gpu_crit: gpu-crit { + temperature = <115000>; + hysteresis = <2000>; + type = "critical"; + }; + }; + }; + + npu_thermal: npu-thermal { + polling-delay-passive = <20>; + polling-delay = <1000>; + thermal-sensors = <&tsadc 6>; + + trips { + npu_crit: npu-crit { + temperature = <115000>; + hysteresis = <2000>; + type = "critical"; + }; + }; + }; + }; + saradc: adc@fec10000 { compatible = "rockchip,rk3588-saradc"; reg = <0x0 0xfec10000 0x0 0x10000>;