Received: by 2002:ab2:3141:0:b0:1ed:23cc:44d1 with SMTP id i1csp823552lqg; Sat, 2 Mar 2024 03:25:58 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVcRMGtNejvgpl3Ycezh2XGF2eRCjEmebsiJVOB9ycAglrqmblmurOfLzJRTXm/9ES541/UDGnFCFjoIQz8m/es4rmY43HGL8npW1Gmbw== X-Google-Smtp-Source: AGHT+IFktnQ8CiRPL9OztJU7aXOW2RisEIiG5h1rsUUlXVOrj0Zb+oSL5TaeoJTmyq+WTLvOp4Le X-Received: by 2002:a6b:7f02:0:b0:7c8:3b68:f33a with SMTP id l2-20020a6b7f02000000b007c83b68f33amr715752ioq.19.1709378758723; Sat, 02 Mar 2024 03:25:58 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709378758; cv=pass; d=google.com; s=arc-20160816; b=tfoQVcGg9UqKHakho88Zh9thARsum34H2q2Vd7OnxBRJrykyRuI62qUlOg6ihtew0+ OFMLjjPwaT8oCQeqL6yF7p37HGjc14J6vfwS11odzbkUCB/UDXYQLEZw0SarqcvnCI82 kqR/U5s6pbftxT5vz/iaT4qd6UnrXkPte0tOwzBZxgGCMQTPPII7RWSyqSmDZofp+FHq QwA+xFW58vwfIrG9bvjWAxqOe8IlI+612XT5s/45h5o9I/PDRl5L65Le+8EremfrKT9c hDnmMTusEOcig/F2/7Kp16vPddKpHWMZEnzD7u8Gip/WN8EEYrGhaAsXMm6ncKamL3As I2nA== ARC-Message-Signature: i=2; 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:cc:to:from; bh=uX+bvcbp4b9AvwvoyltcM+HzexDijRu0hyphKqOXzcs=; fh=7D+xEDGF5sypQ9H/pFJGzNB90Q0nhaIOiquqdHC6/XE=; b=TF54i5XEXFp1u44OhcoBi7lFwIJCcavRjdkJyiY8+5l2Q8d866ia0YaU1bTR8/+glq 43wVNdtasnLABNHteyAAR7h7Nhqdnx5+INMW4IJnULI6B0R8CCeurXsZJGz6wVDGBu+Q g9wwkgBJU8TvrMXYPkbOyqyo7wMGCyzilD90s+eh961aiGtc8vYvIRTqfIbxib3iBek5 8JRmjh1u3b19Z1J0asBeGYXer9RnWDF8TO3wi9URgkN74ttY+PZox+unL+46iCYyu+VP EaM7TCIc/4u+6DSYNLRd45mnulC0opaFanDlxmt/a9tvGRusmac+rZIb2qI9dqI0qHfk fmaw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=sntech.de dmarc=pass fromdomain=sntech.de); spf=pass (google.com: domain of linux-kernel+bounces-89428-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-89428-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=sntech.de Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id k184-20020a6324c1000000b005dc87643cd1si5369113pgk.138.2024.03.02.03.25.58 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 02 Mar 2024 03:25:58 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-89428-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=sntech.de dmarc=pass fromdomain=sntech.de); spf=pass (google.com: domain of linux-kernel+bounces-89428-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-89428-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=sntech.de 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 5EC2D2849A7 for ; Sat, 2 Mar 2024 11:25:58 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 769541754F; Sat, 2 Mar 2024 11:25:50 +0000 (UTC) Received: from gloria.sntech.de (gloria.sntech.de [185.11.138.130]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BB0AB79C8; Sat, 2 Mar 2024 11:25:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.11.138.130 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709378749; cv=none; b=ZI4kgepFtQA0Kukq5BOztKcKJxCngasqlDOMpbJgn9C7DtoARR0cKicdWqlvlrchZ+/HoLCuCxtNqxrZ1d++69btvWdnrX+EAgykPhp6mO9Oi0XuMpFkDTaBF6JYqJxgPNzY5lajle1c9dDMPgJy86Vi711Cg8EKhFhv8O//RRk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709378749; c=relaxed/simple; bh=sMqS1fumc/mbQ7Gx2OwAlS8gdIKqwndhQBFUGCp6lfw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=k8DlZr9FV12bli4+hSGHkFxo3lqZ41ac/nmgPHOHgak1cw2VvqJXiJ02Rj/6hDzLiOBPwb1e7SRuPdbqzyB8NhLBYmQOUPvOhxFTc9x0uFJQRe9WCI8jjGN0WxiLyxoBtX/QWXAg9I/ugqF+gcGqFvHb+oVdyizffnwZQKEE+7Q= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=sntech.de; spf=pass smtp.mailfrom=sntech.de; arc=none smtp.client-ip=185.11.138.130 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=sntech.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sntech.de Received: from [194.95.143.137] (helo=phil.localnet) by gloria.sntech.de with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rgNUb-0004tX-MU; Sat, 02 Mar 2024 12:25:25 +0100 From: Heiko Stuebner To: Rob Herring , Krzysztof Kozlowski , Conor Dooley , Alexey Charkov Cc: Daniel Lezcano , Dragan Simic , Viresh Kumar , Chen-Yu Tsai , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org, Alexey Charkov Subject: Re: [PATCH v3 1/5] arm64: dts: rockchip: enable built-in thermal monitoring on RK3588 Date: Sat, 02 Mar 2024 12:25:24 +0100 Message-ID: <6279836.31r3eYUQgx@phil> In-Reply-To: <20240229-rk-dts-additions-v3-1-6afe8473a631@gmail.com> References: <20240229-rk-dts-additions-v3-0-6afe8473a631@gmail.com> <20240229-rk-dts-additions-v3-1-6afe8473a631@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Am Donnerstag, 29. Februar 2024, 20:26:32 CET schrieb Alexey Charkov: > Include thermal zones information in device tree for RK3588 variants. > > This also enables the TSADC controller unconditionally on all boards > to ensure that thermal protections are in place via throttling and > emergency reset, once OPPs are added to enable CPU DVFS. > > The default settings (using CRU as the emergency reset mechanism) > should work on all boards regardless of their wiring, as CRU resets > do not depend on any external components. Boards that have the TSHUT > signal wired to the reset line of the PMIC may opt to switch to GPIO > tshut mode instead (rockchip,hw-tshut-mode = <1>;) > > It seems though that downstream kernels don't use that, even for > those boards where the wiring allows for GPIO based tshut, such as > Radxa Rock 5B [1], [2], [3] > > [1] https://github.com/radxa/kernel/blob/stable-5.10-rock5/arch/arm64/boot/dts/rockchip/rk3588-rock-5b.dts#L540 > [2] https://github.com/radxa/kernel/blob/stable-5.10-rock5/arch/arm64/boot/dts/rockchip/rk3588s.dtsi#L5433 > [3] https://dl.radxa.com/rock5/5b/docs/hw/radxa_rock_5b_v1423_sch.pdf page 11 (TSADC_SHUT_H) > > Signed-off-by: Alexey Charkov > --- > arch/arm64/boot/dts/rockchip/rk3588s.dtsi | 176 +++++++++++++++++++++++++++++- > 1 file changed, 175 insertions(+), 1 deletion(-) > > diff --git a/arch/arm64/boot/dts/rockchip/rk3588s.dtsi b/arch/arm64/boot/dts/rockchip/rk3588s.dtsi > index 36b1b7acfe6a..9bf197358642 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"; > @@ -2225,7 +2226,180 @@ tsadc: tsadc@fec00000 { > pinctrl-1 = <&tsadc_shut>; > pinctrl-names = "gpio", "otpout"; > #thermal-sensor-cells = <1>; > - status = "disabled"; > + status = "okay"; > + }; so I've skimmed over the general discussion, though don't have a hard opinion in either direction yet. Still there are some low-hanging fruit: - having the thermal-zones addition in a separate patch would allow to merge the obvious stuff, while this discussion is still ongoing - status=okay in a soc dtsi is wrong, because okay is the default status so if anything the status property should be removed In general I'm not that much of a fan of things just working implicitly. So somehow, when someone submits a board devicetree, I expect them to having ensured stuff is enabled somewhat ok. So even seeing a simple &tsadc { status = "okay" }; suggests that they have at least noticed the existence of thermal stuff. At least that is where my thought-process is at the moment ;-) Heiko > + thermal_zones: thermal-zones { > + /* sensor near the center of the SoC */ > + package_thermal: package-thermal { > + polling-delay-passive = <0>; > + polling-delay = <0>; > + thermal-sensors = <&tsadc 0>; > + > + trips { > + package_crit: package-crit { > + temperature = <115000>; > + hysteresis = <0>; > + type = "critical"; > + }; > + }; > + }; > + > + /* sensor between A76 cores 0 and 1 */ > + bigcore0_thermal: bigcore0-thermal { > + polling-delay-passive = <100>; > + polling-delay = <0>; > + thermal-sensors = <&tsadc 1>; > + > + trips { > + /* threshold to start collecting temperature > + * statistics e.g. with the IPA governor > + */ > + bigcore0_alert0: bigcore0-alert0 { > + temperature = <75000>; > + hysteresis = <2000>; > + type = "passive"; > + }; > + /* actual control temperature */ > + bigcore0_alert1: bigcore0-alert1 { > + temperature = <85000>; > + hysteresis = <2000>; > + type = "passive"; > + }; > + bigcore0_crit: bigcore0-crit { > + temperature = <115000>; > + hysteresis = <0>; > + type = "critical"; > + }; > + }; > + cooling-maps { > + map0 { > + trip = <&bigcore0_alert1>; > + cooling-device = > + <&cpu_b0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, > + <&cpu_b1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; > + }; > + }; > + }; > + > + /* sensor between A76 cores 2 and 3 */ > + bigcore2_thermal: bigcore2-thermal { > + polling-delay-passive = <100>; > + polling-delay = <0>; > + thermal-sensors = <&tsadc 2>; > + > + trips { > + /* threshold to start collecting temperature > + * statistics e.g. with the IPA governor > + */ > + bigcore2_alert0: bigcore2-alert0 { > + temperature = <75000>; > + hysteresis = <2000>; > + type = "passive"; > + }; > + /* actual control temperature */ > + bigcore2_alert1: bigcore2-alert1 { > + temperature = <85000>; > + hysteresis = <2000>; > + type = "passive"; > + }; > + bigcore2_crit: bigcore2-crit { > + temperature = <115000>; > + hysteresis = <0>; > + type = "critical"; > + }; > + }; > + cooling-maps { > + map0 { > + trip = <&bigcore2_alert1>; > + cooling-device = > + <&cpu_b2 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, > + <&cpu_b3 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; > + }; > + }; > + }; > + > + /* sensor between the four A55 cores */ > + little_core_thermal: littlecore-thermal { > + polling-delay-passive = <100>; > + polling-delay = <0>; > + thermal-sensors = <&tsadc 3>; > + > + trips { > + /* threshold to start collecting temperature > + * statistics e.g. with the IPA governor > + */ > + littlecore_alert0: littlecore-alert0 { > + temperature = <75000>; > + hysteresis = <2000>; > + type = "passive"; > + }; > + /* actual control temperature */ > + littlecore_alert1: littlecore-alert1 { > + temperature = <85000>; > + hysteresis = <2000>; > + type = "passive"; > + }; > + littlecore_crit: littlecore-crit { > + temperature = <115000>; > + hysteresis = <0>; > + type = "critical"; > + }; > + }; > + cooling-maps { > + map0 { > + trip = <&littlecore_alert1>; > + 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>; > + }; > + }; > + }; > + > + /* sensor near the PD_CENTER power domain */ > + center_thermal: center-thermal { > + polling-delay-passive = <0>; > + polling-delay = <0>; > + thermal-sensors = <&tsadc 4>; > + > + trips { > + center_crit: center-crit { > + temperature = <115000>; > + hysteresis = <0>; > + type = "critical"; > + }; > + }; > + }; > + > + gpu_thermal: gpu-thermal { > + polling-delay-passive = <0>; > + polling-delay = <0>; > + thermal-sensors = <&tsadc 5>; > + > + trips { > + gpu_crit: gpu-crit { > + temperature = <115000>; > + hysteresis = <0>; > + type = "critical"; > + }; > + }; > + }; > + > + npu_thermal: npu-thermal { > + polling-delay-passive = <0>; > + polling-delay = <0>; > + thermal-sensors = <&tsadc 6>; > + > + trips { > + npu_crit: npu-crit { > + temperature = <115000>; > + hysteresis = <0>; > + type = "critical"; > + }; > + }; > + }; > }; > > saradc: adc@fec10000 { > >