Received: by 2002:a05:7412:bbc7:b0:fc:a2b0:25d7 with SMTP id kh7csp401070rdb; Thu, 1 Feb 2024 11:43:30 -0800 (PST) X-Google-Smtp-Source: AGHT+IF2fxT6O9diH57hejy8wwtsH8dvp+borNfuof/M4DBXxRZBSLUa6HmIhfTUio7ROozbUhPr X-Received: by 2002:a05:622a:447:b0:42b:ebf7:d207 with SMTP id o7-20020a05622a044700b0042bebf7d207mr8795qtx.29.1706816610498; Thu, 01 Feb 2024 11:43:30 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706816610; cv=pass; d=google.com; s=arc-20160816; b=ivan3ZTXR71K+2YWy/isFLNhHXkhtQ66ZzOXbApE0O7nHqt5IFCnTmJamITN9JFHhw vJTXLWm+c6tciPj1eCdGWDPB0zqFCM0WYm8tXhKJTVmN3mw59TBOvKO5itrQfZ2iNu3P E4qHnfR1qbK0NvkmeiB0yqdnBjxW1oBLB9L4p56fV3tPUhhce6wC8LrApn9KWg5xskNO G43AiyGb1jzm05atw0PS3wQZ3Xbu9WVk9I+yuoXdWM3BGr8ajp+iYM/sVJcYdjqoMnYk 1X80tjyq5aX1bYF9/XsCkMsjaWDa0n1IW8tSULX56tL6Qj9oLyLmOcaiKTbfbVS1lPl/ +Bvw== 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=EIkfYfYNlHUj/GmY+K0UnE1/E7dWPOhlec1knrz/+V0=; fh=LSXvn1FAyqiE/YO86t8CbkA9k7Yo3Svc00+PSF5oEUA=; b=npOZr3bIhUBWvHhLl/i3UduuazdVJK+3ZaeJwIIj37fwMU2bOuCiZ/oWTOKALEGmrB jijargQIdGXb8CDFwDhLFYx32prcpzXhcxKuo58I4SrZ+xqjinyVGg3IGd7xHQ5Wj8GI 647ACCYCK3hvAqziK08iVsgbxuJjopWA79VQYgVFqrTpiuDmUnictCV8e1oUt4rrRtZx U5S5A/yvKqHBnJldwGuaX8t5Ze0nQAeOq8LgwKM/KPpYuU2KRK8Ocl6hadPIUE3DERF4 Jr1hh0u8vHk7dCjAShMDePvH2VEl+AJwFm2Wp1TEryt0n7K3cARx5laM0vq7HGlXWY/d ftuw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@manjaro.org header.s=2021 header.b=uiITuexw; 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-48782-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-48782-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=manjaro.org X-Forwarded-Encrypted: i=1; AJvYcCX2A4R/GMEpd7Ym2uby+FWOI064ixcfztXaTbD5gHWZ9bZ1HHUgoMyD5I0AqUoUJuC9SBequ5/dRAaNcQSmLe5GDkP9KYeE5f0dyjuHRw== Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id l10-20020a05622a050a00b0042bf84a9cdfsi180786qtx.329.2024.02.01.11.43.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Feb 2024 11:43:30 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-48782-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=uiITuexw; 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-48782-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-48782-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 35A961C24852 for ; Thu, 1 Feb 2024 19:43:30 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id AC9DD85645; Thu, 1 Feb 2024 19:43:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=manjaro.org header.i=@manjaro.org header.b="uiITuexw" 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 7EEEE8527B; Thu, 1 Feb 2024 19:43:04 +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=1706816586; cv=none; b=rjtsaSBfGSzVZfyjXl566Yi68kO9l1esppnZ1uUBe33OF4ltAaA/VN6CocbIk1oqi3BJZAbP4S4ivPU16sGK7X9P1lKsBc/NiPb4MI5/EBa4qDWeDn0ZHWmtAoXl4mQuswKzoVJkdj1g9kKNbCH3eVGGrU84uzK5f6NQ9JCS3dc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706816586; c=relaxed/simple; bh=TGE23cUVJFk/9oNDyoC9tSJakRNR/ZlcXlTk0BrkpuM=; h=MIME-Version:Date:From:To:Cc:Subject:In-Reply-To:References: Message-ID:Content-Type; b=lb3fKBdw8NpHbTGpwNi4I98vBkc23NfZM7hDdMmlECKfmBF5BoVOVgRXJEiucetb2Kx2bT9q5G2arcl1G99z7Vqq6/RJ9vKI4Oa+a5qohPk7y9JFqA7/l/ilqPYGSELz3dDvhHukKdTb+hha5l2WWY2MWhQgR8flRBX6bQtfa10= 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=uiITuexw; 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=1706816582; 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=EIkfYfYNlHUj/GmY+K0UnE1/E7dWPOhlec1knrz/+V0=; b=uiITuexw2PTc1caViD53geTm3aDuLHMYkVN78zTF0e31CvMexBMTvz8lWSZ6y4XQP5s0To 4FFe9YprSCiHuZqcGGZssUh1gO2JBtvBTz/UOZ2o4TbFkAPXBJMU8/nKYVq3fLBl00dmBq kshLaxY465bk+7hT0ZubYT6sKu9NQdZhuNAEp4OcZZn7jAf3+YrNJBO/GaFgCwHg9EGni0 y1bV4T4rSAmmBQyNK978Q1RxfuARQ87c/AWZWf1yZXv4pQr6TCPOZuWwFAG9MW7IvI9oOQ /+0a3ALbEjAOeBLj23lQORYHj6MAmj4Pb7ReT7qXQj8Zc6o2t73zuHuyj1kzVQ== Date: Thu, 01 Feb 2024 20:43:01 +0100 From: Dragan Simic To: Alexey Charkov Cc: wens@kernel.org, Rob Herring , Krzysztof Kozlowski , Conor Dooley , Heiko Stuebner , Daniel Lezcano , Viresh Kumar , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 2/4] arm64: dts: rockchip: enable temperature driven fan control on Rock 5B In-Reply-To: References: <20240130-rk-dts-additions-v2-0-c6222c4c78df@gmail.com> <20240130-rk-dts-additions-v2-2-c6222c4c78df@gmail.com> <5e3e12d65e4919372e7fb02d56202393@manjaro.org> Message-ID: X-Sender: dsimic@manjaro.org Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Authentication-Results: ORIGINATING; auth=pass smtp.auth=dsimic@manjaro.org smtp.mailfrom=dsimic@manjaro.org On 2024-02-01 20:31, Dragan Simic wrote: > On 2024-02-01 20:15, Alexey Charkov wrote: >> On Thu, Feb 1, 2024 at 9:34 PM Dragan Simic >> wrote: >>> On 2024-02-01 15:26, Chen-Yu Tsai wrote: >>> > On Wed, Jan 31, 2024 at 2:22 AM Alexey Charkov >>> > wrote: >>> >> >>> >> This enables thermal monitoring on Radxa Rock 5B and links the PWM >>> >> fan as an active cooling device managed automatically by the thermal >>> >> subsystem, with a target SoC temperature of 65C and a minimum-spin >>> >> interval from 55C to 65C to ensure airflow when the system gets warm >>> >> >>> >> Acked-by: Daniel Lezcano >>> >> Signed-off-by: Alexey Charkov >>> >> --- >>> >> arch/arm64/boot/dts/rockchip/rk3588-rock-5b.dts | 34 >>> >> ++++++++++++++++++++++++- >>> >> 1 file changed, 33 insertions(+), 1 deletion(-) >>> >> >>> >> diff --git a/arch/arm64/boot/dts/rockchip/rk3588-rock-5b.dts >>> >> b/arch/arm64/boot/dts/rockchip/rk3588-rock-5b.dts >>> >> index a0e303c3a1dc..b485edeef876 100644 >>> >> --- a/arch/arm64/boot/dts/rockchip/rk3588-rock-5b.dts >>> >> +++ b/arch/arm64/boot/dts/rockchip/rk3588-rock-5b.dts >>> >> @@ -52,7 +52,7 @@ led_rgb_b { >>> >> >>> >> fan: pwm-fan { >>> >> compatible = "pwm-fan"; >>> >> - cooling-levels = <0 95 145 195 255>; >>> >> + cooling-levels = <0 120 150 180 210 240 255>; >>> >> fan-supply = <&vcc5v0_sys>; >>> >> pwms = <&pwm1 0 50000 0>; >>> >> #cooling-cells = <2>; >>> >> @@ -173,6 +173,34 @@ &cpu_l3 { >>> >> cpu-supply = <&vdd_cpu_lit_s0>; >>> >> }; >>> >> >>> >> +&package_thermal { >>> >> + polling-delay = <1000>; >>> >> + >>> >> + trips { >>> >> + package_fan0: package-fan0 { >>> >> + temperature = <55000>; >>> >> + hysteresis = <2000>; >>> >> + type = "active"; >>> >> + }; >>> >> + package_fan1: package-fan1 { >>> >> + temperature = <65000>; >>> >> + hysteresis = <2000>; >>> >> + type = "active"; >>> >> + }; >>> >> + }; >>> >> + >>> >> + cooling-maps { >>> >> + map0 { >>> >> + trip = <&package_fan0>; >>> >> + cooling-device = <&fan THERMAL_NO_LIMIT 1>; >>> >> + }; >>> >> + map1 { >>> >> + trip = <&package_fan1>; >>> >> + cooling-device = <&fan 1 THERMAL_NO_LIMIT>; >>> >> + }; >>> >> + }; >>> >> +}; >>> >> + >>> >> &i2c0 { >>> >> pinctrl-names = "default"; >>> >> pinctrl-0 = <&i2c0m2_xfer>; >>> >> @@ -731,6 +759,10 @@ regulator-state-mem { >>> >> }; >>> >> }; >>> >> >>> >> +&tsadc { >>> >> + status = "okay"; >>> >> +}; >>> >> + >>> > >>> > Is there any reason this can't be enabled by default in the .dtsi file? >>> > The thermal sensor doesn't depend on anything external, so there should >>> > be no reason to push this down to the board level. >>> >>> Actually, there is a reason. Different boards can handle the >>> critical >>> overheating differently, by letting the CRU or the PMIC handle it. >>> This >>> was also the case for the RK3399. >>> >>> Please, have a look at the following DT properties, which are >>> consumed >>> by drivers/thermal/rockchip_thermal.c: >>> - "rockchip,hw-tshut-mode" >>> - "rockchip,hw-tshut-polarity" >>> >>> See also page 1,372 of the RK3588 TRM v1.0. >>> >>> This has also reminded me to check how is the Rock 5B actually wired, >>> just to make sure. We actually need to provide the two DT properties >>> listed above, at least to avoid emitting the warnings. >> >> Well the defaults are already provided in rk3588s.dtsi, so there won't >> be any warnings (see lines 2222-2223 in Linus' master version), and >> according to the vendor kernel those are also what Rock 5B uses. > > Yes, I noticed the same a couple of minutes after sending my last > message, but didn't want to make more noise about it. :) I would've > mentioned it in my next message, of course. Just checked the Rock 5B schematic and it expects the CRU to be used to perform the hardware reset in case of a thermal runaway, so the defaults in the RK3588s dtsi are fine. I had to double-check it. :) However, now I have some open questions related to interrupt-driven operation. I'll research it further and come back with an update. >> This made me think however: what if a board doesn't enable TSADC, but >> has OPPs in place for higher voltage and frequency states? There won't >> be any throttling (as there won't be any thermal monitoring) and there >> might not be a critical shutdown at all if it heats up - possibly even >> causing hardware damage. In this case it seems that having TSADC >> enabled by default would at least trigger passive cooling, hopefully >> avoiding the critical shutdown altogether and making those properties >> irrelevant in 99% cases. > > Those are very good questions. Thumbs up! > > The trouble is that the boards can use different wiring to handle the > thermal runaways, by expecting the PMIC to handle it or not. Thus, > it's IMHO better to simply leave that to be tested and enabled on a > board-by-board basis, whenever a new RK3588(s)-based board is added. > > Thus, the only right way at this point would be to merge the addition > of the OPPs and the enabling of the TSADC for all currently supported > RK3588(s)-based boards at once, instead of just for the Rock 5B. > > I can handle the required changes for the QuartzPro64 dts file. For > other supported RK3588(s)-based boards, if there are no people having > access to them and willing to perform the dts changes and the testing, > I'd be willing to go through the board schematics, to enable the > TSADC for them as well. Please, let me know are you fine with the above-described approach.