Received: by 2002:a05:7412:7c14:b0:fa:6e18:a558 with SMTP id ii20csp171106rdb; Sun, 21 Jan 2024 23:37:25 -0800 (PST) X-Google-Smtp-Source: AGHT+IE6/KS5LFCQ73Hfyxu6GXqPApxp0HPvDTFRJXcgYOhjunCbDP6gC0yf7ABnkPAAQZ8TZhjV X-Received: by 2002:a25:9c82:0:b0:dc2:30f6:16aa with SMTP id y2-20020a259c82000000b00dc230f616aamr1633971ybo.107.1705909044779; Sun, 21 Jan 2024 23:37:24 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705909044; cv=pass; d=google.com; s=arc-20160816; b=vIHmIB6YtHMp7E1AN2sa72h9Oay0bxW+sFmWuLtdyVcvoMtxbOFcux/lowzjmut38N hn8zWoWxQzmzOcJ/IC0WlN+gTW+kqhMIoFfPUor92+a58yY+CLCJ6jDYURBkQcLELKcx O8ilNMnX2ES0U999h5IHxUkKczFW7CD3BrBIhoD19z3tJbvfQWIH71RJD2UQotelMRRa eY185BbGvzvGdrkejprX3Lzr8Wo/y0NDHfDa24uXGfpdgLYQ2fgiQra9ebiJoaPLieqU aUu4ibS68XdvAVC3VZS9oo2A4BLi96Zbal2YqiY75LZZn9GHegrYXlj5r4grBpHV4/pv QCOg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=xc3sa+GYOy4rKNLUFJb6qU3rV63Dt/e4wYasMz8dvE0=; fh=0qzIQHsFTuRUos9ruKyeONPhdEXzQe/CJNvru6acm1I=; b=ZxZdQbtiA+dQq2cgcQ9tjyfSPz3isvS6xF3PoGJpQR6hsUTlbrswOKo4zzEjNt0teQ dc98R8jwLcnlvhbDqcFD+bPEdBNehLtjQMSkI4h5mXskSEW5/4AOrX64UoNEXG1ZZZJ2 XobxSRBxHZboC4SwFcoyRWT3B5ITE60BII4re5GqPdoUPOgnAQ1Gi3ooH+aUuYb6KAw6 wOq0fsPmsurLGwjiAOlGCOGdDHMRGJ3wou+3vx9wVk9As5qzzfJIE1WuHz71eryxzLEZ fpJRVMR+tl/u9+ydsIo23X+kVo95woDnc/WYtXIVrF8YtD1uv6TFAPK4qU9sOO1HZn+h skTQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=N1Ouufk7; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-32433-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-32433-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id e10-20020a0cb44a000000b0068193b87ffasi5137563qvf.281.2024.01.21.23.37.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 21 Jan 2024 23:37:24 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-32433-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=N1Ouufk7; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-32433-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-32433-linux.lists.archive=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 6560D1C21766 for ; Mon, 22 Jan 2024 07:37:24 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8823317C68; Mon, 22 Jan 2024 07:37:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="N1Ouufk7" Received: from mail-ed1-f54.google.com (mail-ed1-f54.google.com [209.85.208.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 C469417BD0; Mon, 22 Jan 2024 07:37:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.54 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705909026; cv=none; b=Mchn5LdudC6+VYfWQQO5vgJX/IMNnW6kJu0tq3pgnI4XhpZ0HcqnsDRzW0XbLoHl0dcQh3jjsst9+KWq1IC72Pv9gUC//ZN07zlIiENKlTy1g5/3FJhB8Nlgl0Bq3ZInUH1HOGPXQ2y/vgx+YOeoYxbujXIHEyHvB+TYQkL8Ueg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705909026; c=relaxed/simple; bh=JMdye7mRvqKxsy1H6cLivdufLFV//IdChHJEZlWlrzQ=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=iSYTF5hQj88jJHVkPt85Zngf8n2etDfKJhrnVKOFE67dcYkAvRHOMO1K/mZmFKRPEdzBlQumC1Z310a5CdG3aqcur1Ngr93UcA37FeO/1ohacUsDkZIyE2/fad5JgicKnAb0wSdxjIWCHAjBqNUhqzAUzHiHF0qmpI+Df1mwjUo= 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=N1Ouufk7; arc=none smtp.client-ip=209.85.208.54 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-ed1-f54.google.com with SMTP id 4fb4d7f45d1cf-55a349cf29cso3106213a12.0; Sun, 21 Jan 2024 23:37:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1705909023; x=1706513823; 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=xc3sa+GYOy4rKNLUFJb6qU3rV63Dt/e4wYasMz8dvE0=; b=N1Ouufk7qFscUt7AE3q3uT+BdzdrWKxdrQeS19bWP4PBvYgCGzqfRlgwsCqTpnaZ8T d/H3yv/aohrfBIXSzjQvhvKsCsr3UAQkuwoOMArjOTHuBOdzcUZIfMp5jxgC/hlIH21i xghI7YK92Gceje+cD2reRTiuu3b8DRPGqK8GHt1bo4ok9Zhzic7LLA2IJX7oEdSXYhxp bEMbVCBuYkFPw3up1UIrqcj17NKy6B/i6lL35fHga/ykHfUtjASppCbol0Vq9DEGpNf9 8igqCS3OWDvgwZy63Us2UTame2W9+g3UANRnm2NFhhZMO74WVT4eQJoSnmcphDsgVis3 7RvA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705909023; x=1706513823; 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=xc3sa+GYOy4rKNLUFJb6qU3rV63Dt/e4wYasMz8dvE0=; b=q/nyfQ1WGQlDEUy9zuANSZIWpI9VBDLN1N5XzgSYwPyRpCGqcDlT6gWQJpfn6nhomu st1Frc7MScoX0PsVSe7RFNxUhhTiyy5wun1HoCMLKSk5kCf147HxkJWUUpZ7YoDLOJpn G/UWMyeQlZHZ1b13UmYyDSFfea5x5pIDYJZZaCppJU+XzVmw10XTDqxlsYEfKx5qYn9n QZryUumuhjn+fQi2U0bTZpTiqvqppBCfQErbe3x0Hz5zTZD++XRG2C4VsxVs3ZFFT9wm jF4L8hro63i1VBf8lHNSG9hSmOzwU6Wl7VC76w/HVCKrwcqOPH3qFZeWr/+au9CVjb4W spqw== X-Gm-Message-State: AOJu0Yye33kRBuA85ovcxbEueFfhKLNteiquxRPNwDI+4NolGbdEi4GO WYKisWQqgnjnvWdgpPrtkLfDTaod5DFfxoz7wZ5CSSwSerSOoqy+2DKJFMTpiP6jZoBp7Qw0xkL W1qE9Rei2fF/9hdp/Vpe75jziB2k= X-Received: by 2002:a17:907:8e07:b0:a2f:b9bf:3955 with SMTP id th7-20020a1709078e0700b00a2fb9bf3955mr1595162ejc.21.1705909022608; Sun, 21 Jan 2024 23:37:02 -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: <81a5410c3dbedbd4fe9ce60ab236700c@manjaro.org> From: Alexey Charkov Date: Mon, 22 Jan 2024 11:36:50 +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 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: > >> > On Thu, Jan 18, 2024 at 10:48=E2=80=AFPM Dragan Simic wrote: > >> >> On 2024-01-08 14:41, Alexey Charkov wrote: > >> >> > On Sun, Jan 7, 2024 at 2:54=E2=80=AFAM Dragan Simic wrote: > >> >> >> On 2024-01-06 23:23, Alexey Charkov wrote: > >> >> >> > Include thermal zones information in device tree for rk3588 va= riants > >> >> >> > and enable the built-in thermal sensing ADC on RADXA Rock 5B > >> >> >> > > >> >> >> > Signed-off-by: Alexey Charkov > >> >> >> > --- > >> >> >> > + trips { > >> >> >> > + threshold: trip-point-0 { > >> >> >> > >> >> >> It should be better to name it cpu_alert0 instead, because that'= s what > >> >> >> other newer dtsi files already use. > >> >> > > >> >> > Reflecting on your comments here and below, I'm thinking that may= be it > >> >> > would be better to define only the critical trip point for the So= C > >> >> > overall, and then have alerts along with the respective cooling m= aps > >> >> > separately for A76-0,1, A76-2,3, A55-0,1,2,3? After all, given th= at we > >> >> > have more granular temperature measurement here than in previous = RK > >> >> > chipsets it might be better to only throttle the "offending" core= s, > >> >> > not the full package. > >> >> > > >> >> > What do you think? > >> >> > > >> >> > Downstream DT doesn't follow this approach though, so maybe there= 's > >> >> > something I'm missing here. > >> >> > >> >> I agree, it's better to fully utilize the higher measurement > >> >> granularity > >> >> made possible by having multiple temperature sensors available. > >> >> > >> >> I also agree that we should have only the critical trip defined for > >> >> the > >> >> package-level temperature sensor. Let's have the separate temperat= ure > >> >> measurements for the CPU (sub)clusters do the thermal throttling, a= nd > >> >> let's keep the package-level measurement for the critical shutdowns > >> >> only. IIRC, some MediaTek SoC dtsi already does exactly that. > >> >> > >> >> Of course, there are no reasons not to have the critical trips defi= ned > >> >> for the CPU (sub)clusters as well. > >> > > >> > I think I'll also add a board-specific active cooling mechanism on t= he > >> > package level in the next iteration, given that Rock 5B has a PWM fa= n > >> > defined as a cooling device. That will go in the separate patch that > >> > updates rk3588-rock-5b.dts (your feedback to v2 of this patch is als= o > >> > duly noted, thank you!) > >> > >> Great, thanks. Sure, making use of the Rock 5B's support for > >> attaching > >> a PWM-controlled cooling fan is the way to go. > >> > >> Just to reiterate a bit, any "active" trip points belong to the board > >> dts file(s), because having a cooling fan is a board-specific feature. > >> 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 devicetree > > 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 modulates > > 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 > 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 lighter (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 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. Best regards, Alexey