Received: by 2002:a05:7412:ba23:b0:fa:4c10:6cad with SMTP id jp35csp559235rdb; Thu, 18 Jan 2024 11:20:46 -0800 (PST) X-Google-Smtp-Source: AGHT+IEs+NmGkeX+iYrOcUmxo6vo5If63UNhffWWrKcaq0/Q37+RJltUfQ1y08984tvoOJKjbXg3 X-Received: by 2002:a0c:8b81:0:b0:680:64c0:469f with SMTP id r1-20020a0c8b81000000b0068064c0469fmr956011qva.94.1705605646072; Thu, 18 Jan 2024 11:20:46 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705605646; cv=pass; d=google.com; s=arc-20160816; b=xiyqwUZisL1lqEaD2pqgH616sZtaqA8rJ7EdJS6zk6aeJ297qnJ6h5YACv3hCZFwOE k+oPu+qE8yG3PypVUYsg0eBIv0BFpflOJrhfI0I4VggJJU9yo93K2jGkK8frZNqqkTYr LLvIsKmjdQKSIoVZHbHHX4WyeTBEpaCzoUr56WcyT9chmT4BiUGho/jiOrlddAMwfj5/ biC7Y5Qn/tbZGNx1BTLJkET68kEkw1d4vCZnHr4PIjwsKFXXNHtzqfBEOFmnrx99ceX8 zKPa1rkeEQuzsT9bBsprbSOtGVOaSMi2ymoX0bFgc3QxgaMR2Giuc5cK9Ti0p4yJgtHv RbOg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:message-id:references:in-reply-to:subject :cc:to:from:date:dkim-signature:mime-version:list-unsubscribe :list-subscribe:list-id:precedence; bh=gbaiGyjUuFBv/B6T7BobR3rYeP5lnHdOhbgwwWsDHPQ=; fh=Rjurc/DXt/Cv7d/8O4qWF7T81LBVDThRZqRon4U5m6w=; b=QCBum1taUcFyA92n1Ip0OVInmPc5HgiMwrZcXJQ01PFoWUWrGYe6M9uWoYLaZqzEVe k2QgmXnWewzGEbzXBCDCfjx8iIxUbomZZ3TKUlrTd570zQbcQElYy+ic3L68UtqZl9h8 1BFMTwobGUx6cdY1V/OwZffdCznuZW2TrjqPl+vJMlY5JyVCXIHuSI2tK2tobITdKQU7 uIsm7r9ll6b0X/keERjo3YcznX21cFN3E2EeWTN+IvRqJG3Ahn3DikxYuV9l2JFC3Tk8 F1azLSzseKAw5O6021ds7Dsg/2vZ6ks70vimAIFd8YS+lx/ycKK/KcMrrq5a66sNO/rY un3Q== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@manjaro.org header.s=2021 header.b=MlLRzmYX; arc=pass (i=1 spf=pass spfdomain=manjaro.org dkim=pass dkdomain=manjaro.org dmarc=pass fromdomain=manjaro.org); spf=pass (google.com: domain of linux-kernel+bounces-30504-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-30504-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=manjaro.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id k9-20020a0cabc9000000b0067f73c62cdcsi7082166qvb.227.2024.01.18.11.20.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Jan 2024 11:20:46 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-30504-linux.lists.archive=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=@manjaro.org header.s=2021 header.b=MlLRzmYX; arc=pass (i=1 spf=pass spfdomain=manjaro.org dkim=pass dkdomain=manjaro.org dmarc=pass fromdomain=manjaro.org); spf=pass (google.com: domain of linux-kernel+bounces-30504-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-30504-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=manjaro.org 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 C0D481C2365A for ; Thu, 18 Jan 2024 19:20:45 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 99EFD2E410; Thu, 18 Jan 2024 19:20:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=manjaro.org header.i=@manjaro.org header.b="MlLRzmYX" Received: from mail.manjaro.org (mail.manjaro.org [116.203.91.91]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 372842E401; Thu, 18 Jan 2024 19:20:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=116.203.91.91 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705605633; cv=none; b=mXSGgUOgo65qFfwvSfF8NUJSZlyHOun3zjKMmluVsyGQMQEqUn/2VTl6eQ3oIwBvZmKXDczjr78M3+uZPKHQqESc/IRIvSyXsGT2lOpF//LS91/MXfPg4WsUMAkYnKhMVAR5wz+VMSLa7Gna/YLsZ6Nnt/NcWK2aFrkG/CcRO5c= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705605633; c=relaxed/simple; bh=XFtCyJ15nJ3Ukf1vlMXMF+lDjLtMrWQZPiaWK6IfrgY=; h=MIME-Version:Date:From:To:Cc:Subject:In-Reply-To:References: Message-ID:Content-Type; b=kqITra5ZQ6GkMFlsQggxLCzJQK/3W0hZ2JqImfqwEu+273LZpKQ2YxYYBhikybVbYOzt3dl74D2lxF8qGsKR+VF4qQcArWna3TE0vUW2mCGy2lfaf4SzaJUTYGHm2hTL550TMX5JrfehXJm/9kNO19+3UYwyP/m4/CkWrGBGgdU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=manjaro.org; spf=pass smtp.mailfrom=manjaro.org; dkim=pass (2048-bit key) header.d=manjaro.org header.i=@manjaro.org header.b=MlLRzmYX; arc=none smtp.client-ip=116.203.91.91 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=manjaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=manjaro.org Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=manjaro.org; s=2021; t=1705605628; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=gbaiGyjUuFBv/B6T7BobR3rYeP5lnHdOhbgwwWsDHPQ=; b=MlLRzmYXJVZsDtFuEV0oioMp21CqTzeOtr/1cvAC8nwzaJo3PJBFGxKJP6V9D1X+Q6aH5C VPzeD+6Mq7jDIfDwMFNtVaM3YgMAZ0VtKD6Qt+HCbeeSNDtJm7nhxTHWtQEQAzXFkkKQz0 sTyAYS6j8Mdo9oqK71Lq577F1ddUvJARIIziRqEewiFWbO0JOusMWdjYuL9U/gJt8Mjpt5 UjDTL8FSyfFTeOAHOebs2rOlKSvOOW+pUqjbsx58e2gFyvv4OpQaenWdVCKIu4BBWu0Xic fYs5xvr9jblTMMK1i2HePVXKr1N7s96dKCE+u5hjCBcXqlR8+OknFHipiCO//g== Date: Thu, 18 Jan 2024 20:20:28 +0100 From: Dragan Simic To: Alexey Charkov Cc: Rob Herring , Krzysztof Kozlowski , Conor Dooley , Heiko Stuebner , Sebastian Reichel , Cristian Ciocaltea , Christopher Obbard , =?UTF-8?Q?Tam=C3=A1s_Sz=C5=B1cs?= , Shreeya Patel , Kever Yang , Jagan Teki , Chris Morgan , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] arm64: dts: rockchip: enable built-in thermal monitoring on rk3588 In-Reply-To: <20240109192608.5981-1-alchark@gmail.com> References: <20240106222357.23835-1-alchark@gmail.com> <20240109192608.5981-1-alchark@gmail.com> Message-ID: <121f6c6f65efcca3ad6dbe5264563561@manjaro.org> X-Sender: dsimic@manjaro.org Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Authentication-Results: ORIGINATING; auth=pass smtp.auth=dsimic@manjaro.org smtp.mailfrom=dsimic@manjaro.org 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 > --- > 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 > #include > #include > +#include > > / { > 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>;