From patchwork Sun Sep 8 21:08:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiko Stuebner X-Patchwork-Id: 13795642 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B6D71E6FE49 for ; Sun, 8 Sep 2024 21:11:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=uN6w3gE8U0RovROAz/uUVTZ5DMnfuYOXHl8lNyEF+vc=; b=jmLiMl7egyMrri QySlAA0EvIOjeJU84eX21uU0G14SDWcuPwwSf3t10Z3fSqsWKtFdrQ2pIQFUx/pGcUbGqjOSvXdgg U0XSA1ywsD7DycorHd+eqfME5cepW/jwGH79AhiNIMPqIYgybQgH2o3EG75E+nUsJBKrTYYiAEo9U yMUVZ36vqIkufGCzT1pITn9xknqNZzJ2ef10O5E0255WyCfu+dyXQYzW2y+WezSCHGsRgxmZKwRjs 047TfI3KpArpcCavqOC5LMI14dxnaECSYUSeU1rzqJ1FTJWn2M1uRlTbJI8Rd4UH0qEgwga7el+kq dJ9auLYt8zuxp1aZy8+A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1snPBR-0000000HTIP-1UYj; Sun, 08 Sep 2024 21:10:57 +0000 Received: from gloria.sntech.de ([185.11.138.130]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1snPAM-0000000HSyj-2nnL; Sun, 08 Sep 2024 21:09:52 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sntech.de; s=gloria202408; h=Content-Transfer-Encoding:MIME-Version:References: In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=OX2mDGoNhn5NuPQsdotMoW4uOBKIyWHrefRAShTe53U=; b=EHmovt9L5GSUnYJk/xNyBWIedS wdT+ucqi3dQ2luJXasSnEyx3QM31LaMA2TSxa/4MYL2wBGfI8lWT7OT7GIgcIyq/7BNEMH7D1TUKh k+DzQApAwZ78N/qVvaCJIC4Mftexr1DwxURibPlkouCtfcjG7QHtCMwdmQsvbY9N+pKAHijiFcpjt ANzToNevsP6+GrYZr6tpH4gcknEa3AndSDKfpp3/KO2BcEw+tF3c3IfD8LWTwt9xH4QQOetPwZ7RK Vk8fmT8slGn5Jm2r4tfDbsyh1WF1PnaB07iCH8ioYUlat4NK/bOe4jJVlv9IO8EJVSJxRAxqMNnEZ C8uModkg==; Received: from i5e8616cc.versanet.de ([94.134.22.204] helo=phil.lan) by gloria.sntech.de with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1snPA7-0003s9-3H; Sun, 08 Sep 2024 23:09:35 +0200 From: Heiko Stuebner To: lee@kernel.org, jikos@kernel.org, jic23@kernel.org Cc: robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, jdelvare@suse.com, linux@roeck-us.net, srinivas.pandruvada@linux.intel.com, bentiss@kernel.org, dmitry.torokhov@gmail.com, pavel@ucw.cz, ukleinek@debian.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hwmon@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-input@vger.kernel.org, linux-iio@vger.kernel.org, linux-leds@vger.kernel.org, Heiko Stuebner Subject: [PATCH v8 8/9] arm64: dts: rockchip: hook up the MCU on the QNAP TS433 Date: Sun, 8 Sep 2024 23:08:02 +0200 Message-ID: <20240908210803.3339919-9-heiko@sntech.de> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240908210803.3339919-1-heiko@sntech.de> References: <20240908210803.3339919-1-heiko@sntech.de> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240908_140950_712032_999C7E92 X-CRM114-Status: GOOD ( 15.18 ) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+linux-rockchip=archiver.kernel.org@lists.infradead.org The MCU is an important part of the device functionality. It provides functionality like fan-control, more leds, etc and even more important without it, the NAS-device cannot even fully turned off. Hook up the serial device to its uart and hook into the thermal management to control the fan according to the cpu temperature. While the MCU also provides a temperature sensor for the case, this one is just polled and does not provide functionality for handling trip points in hardware, so a lot of polling would be involved. As the cpu is only cooled passively in these devices, it's temperature rising will indicate the temperature level of the system just earlier. Signed-off-by: Heiko Stuebner --- .../boot/dts/rockchip/rk3568-qnap-ts433.dts | 57 +++++++++++++++++++ 1 file changed, 57 insertions(+) diff --git a/arch/arm64/boot/dts/rockchip/rk3568-qnap-ts433.dts b/arch/arm64/boot/dts/rockchip/rk3568-qnap-ts433.dts index e601d9271ba8..4bc5f5691d45 100644 --- a/arch/arm64/boot/dts/rockchip/rk3568-qnap-ts433.dts +++ b/arch/arm64/boot/dts/rockchip/rk3568-qnap-ts433.dts @@ -483,6 +483,54 @@ rgmii_phy0: ethernet-phy@0 { }; }; +/* + * The MCU can provide system temperature too, but only by polling and of + * course also cannot set trip points. So attach to the cpu thermal-zone + * instead to control the fan. + */ +&cpu_thermal { + trips { + case_fan0: case-fan0 { + hysteresis = <2000>; + temperature = <35000>; + type = "active"; + }; + + case_fan1: case-fan1 { + hysteresis = <2000>; + temperature = <45000>; + type = "active"; + }; + + case_fan2: case-fan2 { + hysteresis = <2000>; + temperature = <65000>; + type = "active"; + }; + }; + + cooling-maps { + /* + * Always provide some air movement, due to small case + * full of harddrives. + */ + map1 { + cooling-device = <&fan THERMAL_NO_LIMIT 1>; + trip = <&case_fan0>; + }; + + map2 { + cooling-device = <&fan 2 3>; + trip = <&case_fan1>; + }; + + map3 { + cooling-device = <&fan 4 THERMAL_NO_LIMIT>; + trip = <&case_fan2>; + }; + }; +}; + &pcie30phy { data-lanes = <1 2>; status = "okay"; @@ -582,6 +630,15 @@ &tsadc { */ &uart0 { status = "okay"; + + mcu { + compatible = "qnap,ts433-mcu"; + + fan: fan-0 { + #cooling-cells = <2>; + cooling-levels = <0 64 89 128 166 204 221 238>; + }; + }; }; /*