Received: by 2002:a05:7412:7c14:b0:fa:6e18:a558 with SMTP id ii20csp352874rdb; Mon, 22 Jan 2024 06:21:35 -0800 (PST) X-Google-Smtp-Source: AGHT+IFSuH91UdTGbczWrJqGpk2XZdgke4EttP75i2ECU2JhN8vG3BcRoT1yPMiFT4fPff+hj/ci X-Received: by 2002:ac8:4e4a:0:b0:42a:2aa:c88c with SMTP id e10-20020ac84e4a000000b0042a02aac88cmr5981488qtw.75.1705933295065; Mon, 22 Jan 2024 06:21:35 -0800 (PST) Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id w2-20020a05622a190200b0042997fb63a8si5780755qtc.286.2024.01.22.06.21.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 06:21:35 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-33147-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=neutral (body hash did not verify) header.i=@gmail.com header.s=20230601 header.b="EiY9/ZK9"; arc=fail (body hash mismatch); spf=pass (google.com: domain of linux-kernel+bounces-33147-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-33147-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (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 9A6691C22493 for ; Mon, 22 Jan 2024 14:21:34 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E7B963D554; Mon, 22 Jan 2024 14:21:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="EiY9/ZK9" Received: from mail-lf1-f50.google.com (mail-lf1-f50.google.com [209.85.167.50]) (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 369AC1DDC3; Mon, 22 Jan 2024 14:21:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.50 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705933271; cv=none; b=MVyxelBoaNEbLrPuRp+wn5ysmdBq85LwocymsVRW+dAnf2rWbdXVATT7csjusCVIMB06S4ZHfQZEAA/fXo+XXfdGGAEl8ZnrltOt8Kx454yZ8qD151Ea7brJTk/HRlS5jH5kaEbox2fRsjX3z7QWfI5Vi1Ii3sPzqcX/HAFa8fc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705933271; c=relaxed/simple; bh=/OiSOf1dxe7/x3O4pUMFGEf8cbKO4q48qz9aptH7mPE=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=nltlOwttoOqLMZU/B85YAj/04xfV5rmIlKm2pXfr9Iw/FNr9Wn5DWWNG7512pr0eTtQOg6Q74Nh9piJJaowFBdwKklG3IIGCFTXvVQ5mmX9OAsXxok+kjFK0Sj4sYhhZzP5BmFzuR661J9Bg+clFkCFmRx1Y0GVDqm8cOWOSVwo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=EiY9/ZK9; arc=none smtp.client-ip=209.85.167.50 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-lf1-f50.google.com with SMTP id 2adb3069b0e04-50eaa8b447bso3357774e87.1; Mon, 22 Jan 2024 06:21:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1705933267; x=1706538067; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=5zB3kOyhIcCOt/Jppp5iQur4STVOrQ4FRP/kqR1IvMQ=; b=EiY9/ZK91f8FOveruA1BW+LvSQMtCcQd/Ch7yRLlngznQ4rhJSXTWphplNetw+13mc DYsGBF0rIp2oMwZy1yGKyEoDxob4q245KESzg9Bqkfsaw+BYMWcRccP3ivwB2Zv8VrOD e/F8ZYXQZA8kwL3EriQ8RVJRcM73GXjJ5l+aVTtAedVffdUqcEiWJF4nXtMHDsIU9fEA 8vpJGwhK/W5TFvSCYzyUgVoahC1lpQYHaFelYVlPxuw3OEp4raegYHRSayvZZKp5eyYP CBK2LF0+OjlwZTnAHZG84sc7gEhm1gqaIDVkBhgV/OgCzc2hbgwXvSK6j0/XDk3WB96v yEUQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705933267; x=1706538067; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=5zB3kOyhIcCOt/Jppp5iQur4STVOrQ4FRP/kqR1IvMQ=; b=dDhEkXEzUVeodEh/c+9uU8+3kAYna9wP+ply+tiarYHX8UWmwh+8WU8iQIPtRByCec vucLFpKXD2vnS8z8pmgyguw02tCL7x1Kj0JYcEHQzLeXRsF4ANWcEt7a8iMfD/mEV4+Z D/1zpjmAd9eFnUtGoizU70QT/fgiJ26pzI1hxfrMrokAYMWgz9bpjW4FQnlFSu9dra77 rONbYsM2BiVJRBgh9aQnTdan85I2LGVCDWgVPXw9gh8A+Z1v20XmYvVEd8J2QfL48lDW DGfmg/RSLo2CjM7uF3Ean3gCGpi3NnfTfd65ga2GNGw/Qsih7b5hU+EJzntLw/R+yt08 /yow== X-Gm-Message-State: AOJu0YyyU+RiZ3Xj5MWSveKHLHlY9dB/yXFuTdxyiGUHJQfwBwVkArM7 iFUjHOUW44zmGcT+RGoRKN9Uv5Eqw+nfjg1BnoEgCE6EqwCDbw3prQBMjPYeen1XAHrxjmdBteq 5LkTHsHgjeDnGYfM57jsI5oi8/xdUDQK7uWVfOg== X-Received: by 2002:a05:6512:b01:b0:50e:e3e5:40f8 with SMTP id w1-20020a0565120b0100b0050ee3e540f8mr820239lfu.1.1705933266840; Mon, 22 Jan 2024 06:21:06 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240106222357.23835-1-alchark@gmail.com> <81a5410c3dbedbd4fe9ce60ab236700c@manjaro.org> In-Reply-To: From: Alexey Charkov Date: Mon, 22 Jan 2024 18:20:54 +0400 Message-ID: Subject: Re: [PATCH] arm64: dts: rockchip: enable built-in thermal monitoring on rk3588 To: Dragan Simic Cc: Rob Herring , Krzysztof Kozlowski , Conor Dooley , Heiko Stuebner , Sebastian Reichel , Cristian Ciocaltea , Christopher Obbard , =?UTF-8?B?VGFtw6FzIFN6xbFjcw==?= , Shreeya Patel , Kever Yang , Chris Morgan , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Mon, Jan 22, 2024 at 11:57=E2=80=AFAM Dragan Simic = wrote: > > On 2024-01-22 08:36, Alexey Charkov wrote: > > On Mon, Jan 22, 2024 at 10:22=E2=80=AFAM Dragan Simic > > wrote: > >> On 2024-01-22 07:03, Alexey Charkov wrote: > >> > On Mon, Jan 22, 2024 at 8:55=E2=80=AFAM Dragan Simic wrote: > >> >> On 2024-01-21 19:56, Alexey Charkov wrote: > >> >> > I think I'll also add a board-specific active cooling mechanism o= n the > >> >> > package level in the next iteration, given that Rock 5B has a PWM= fan > >> >> > defined as a cooling device. That will go in the separate patch t= hat > >> >> > updates rk3588-rock-5b.dts (your feedback to v2 of this patch is = also > >> >> > duly noted, thank you!) > >> >> > >> >> Great, thanks. Sure, making use of the Rock 5B's support for attac= hing > >> >> a PWM-controlled cooling fan is the way to go. > >> >> > >> >> Just to reiterate a bit, any "active" trip points belong to the boa= rd > >> >> dts file(s), because having a cooling fan is a board-specific featu= re. > >> >> As a note, you may also want to have a look at the RockPro64 dts(i) > >> >> files, for example; the RockPro64 also comes with a cooling fan > >> >> connector and the associated PWM fan control logic. > >> > > >> > Thanks for the pointer! There is also a helpful doc within devicetre= e > >> > bindings descriptions, although it sits under hwmon which was a bit > >> > confusing to me. I've already tested it locally (by adding to the > >> > board dts), and it spins up and down quite nicely, and even modulate= s > >> > the fan speed swiftly when the load changes - yay! > >> > >> Nice! Also, isn't it like magic? :) To me, turning LEDs on/off and > >> controlling fans acts as some kind of a "bridge" between the virtual > >> and the real world. :) > > > > Oh yes! I also keep admiring how one can add just a couple of lines of > > text here and there that's not even real code, and the whole kernel > > machinery starts crunching numbers, analyzing temperatures, running > > PID loops, etc etc so that I could enjoy the satisfying whistle of a > > small fan when I type `make -j8` :-D > > Yes, it's very satisfying, :) and it also demonstrates the true power > of the device trees as hardware definitions. Just a few more lines and > the cooling works! :) > > >> As a suggestion, it would be good to test with a couple of different > >> fans, to make sure that the PWM values work well for more that one fan > >> model. The Rock 5B requires a 5 V fan, if I'm not mistaken? > > > > It is 5V, yes. I only have one fan to try though, and I simply relied > > on the PWM values that are already defined in the upstream > > rk3588-rock-5b.dts. They don't look ideal for my particular fan, > > because the lowest non-zero cooling state currently uses a PWM value > > of 95, which doesn't always make it spin up. But in the end it doesn't > > seem to matter that much, because that tiny fan needs to spin at full > > 255 whenever all eight cores are loaded (and even then it can only > > balance the temperature at around 60.5=D0=A1), and when the load is lig= hter > > (such as during various ./configure runs) it just switches off > > completely as the temperature goes down to 46C even with the fan not > > spinning. > > I see, 5 V fans unfortunately aren't very common. I'm not sure why > Radxa opted for 5 V there; maybe the goal was to use Raspberry Pi 5 V > fans, but using those tiny fans doesn't make much sense, IMHO. > > I think you can freely adjust the PWM values a bit to make your fan > start reliably at the lowest state, regardless of how rarely that state > will be used. See, if your fan doesn't spin up reliably with the > current > lowest state, chances for other fan models not to spin up are quite > high. > IOW, it's better to play safe there, if you agree. > > What kind of heatsink are you using with your Rock 5B? Ah yes, and > what's the actual model of the fan you're using? I use Radxa's 4012 heatsink-fan assembly that comes as an add-on option when buying the board itself from Allnet. I guess I'll include slightly adjusted PWM values in the rk3588-rock-5b.dts patch to better represent my fan's "preferred" range (in my experience a PWM value of around 120 is the reliable lower end - it would continue spinning below that point but won't always start without being pushed manually) > > I don't currently use the GPU/NPU/VPU though - maybe those would > > produce more moderate load which could benefit from spinning the fan > > at medium speeds. > > Perhaps, but it will need to be tested at some point. Have you tried > loading only one or two CPU cores? I do see the full range of PWM values being used, including intermediate ones. It doesn't go zero to hero :) My point was more about the default fan not being super mighty vs. the full package thermal output, which will likely mean that intermediate values are rarely used. But I'll double check with more varied loads to make sure it behaves in a sensible way (especially given that I'll be testing purely interrupt-driven operation per Daniel's guidance in the other sub-thread). Best regards, Alexey