From patchwork Mon Aug 21 14:03:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Botka X-Patchwork-Id: 136405 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b82d:0:b0:3f2:4152:657d with SMTP id z13csp3075384vqi; Mon, 21 Aug 2023 08:17:10 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGK8rqmPmhFkcqF195d7ASY6K9spmuo7u9XAwyPnveDU+MLH5J/kcJkbJ1KwAKEQjTM9G5V X-Received: by 2002:a05:6a20:b924:b0:137:5d1c:d087 with SMTP id fe36-20020a056a20b92400b001375d1cd087mr6455575pzb.4.1692631030255; Mon, 21 Aug 2023 08:17:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692631030; cv=none; d=google.com; s=arc-20160816; b=ijGE668b72ckLUdtW2p057Tv8L4q9iyhJYsb0+vxag/8Qz+JZRzo1wws+rbJmFgzXj RwKMP/lC2IKJPbWcenTTkuqAGxiFCUpZp5OQrjlUT9CeMVOGd/X7l2ODd0EWvXsrZaQv zD1IZUXlO5nzJRWgTHrORbv5y+QH3dXBOsH+SiulFSHlXRTRFvHbk4v0nJND9zzc4dQ3 MpCPVcCLz830I+lpkM1t/gSkNdUFUTpmYg9k9K57nknyk/HKoGbtns4eK4usJBZCyXuG yPSoSJnK7+vUxPRQvPmxbwmKtn9cq8zG6SI8w5lAX1h5yNRAQmD4D+eL0CDsxNJoInzS q6Lw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from; bh=M+jNe5H9PdV2ZUN/RGgjOMOCfAA2EOEsvn2DKyRCVwg=; fh=IcpAG5JBYu2Lf/A8kMK1PfwmRCpIKOz6Xzq81yO/0g4=; b=q2iGtRjZVW/INEJaV3KuYbDnE5bGCR2QYP+Bhd8hCj3/FK/6RtgoDOr9qLXHglqxfM p+tww5Sn7ShT6sQA3LkK1+SVA1qtNS0ArI+cWWd9e49mH7zFC6TgP/hSi7kA8tcgRe68 +Jmw2vKbKIgF0UHfe6u0YtFkDbe6vahyrRsUgyE/cRYQhxngGG82rAsmYPK91O/UIduq c14ABnCdjxfy/ZTkK9KgIvlpzfae0cDzdnnCa74iI1nMo631IaQ3FtUDP0ed8Bg37/5K mYIIDL0TwruR2I2bid3VI2dXimylkjn/w27W8pvrSj1a2zzw7Tg9QgjIKsruJVEijz4v n2Dg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id lg4-20020a170902fb8400b001b5395382a0si7281476plb.212.2023.08.21.08.16.56; Mon, 21 Aug 2023 08:17:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235649AbjHUOEB (ORCPT + 99 others); Mon, 21 Aug 2023 10:04:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40460 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235635AbjHUOD4 (ORCPT ); Mon, 21 Aug 2023 10:03:56 -0400 Received: from relay06.th.seeweb.it (relay06.th.seeweb.it [IPv6:2001:4b7a:2000:18::167]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CE475E9; Mon, 21 Aug 2023 07:03:53 -0700 (PDT) Received: from [192.168.2.137] (bband-dyn221.178-41-211.t-com.sk [178.41.211.221]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by m-r2.th.seeweb.it (Postfix) with ESMTPSA id 510F53F324; Mon, 21 Aug 2023 16:03:51 +0200 (CEST) From: Martin Botka Date: Mon, 21 Aug 2023 16:03:48 +0200 Subject: [PATCH v2 3/3] arm64: dts: allwinner: h616: Add thermal sensor and thermal zones MIME-Version: 1.0 Message-Id: <20230821-ths-h616-v2-3-cda60d556798@somainline.org> References: <20230821-ths-h616-v2-0-cda60d556798@somainline.org> In-Reply-To: <20230821-ths-h616-v2-0-cda60d556798@somainline.org> To: Vasily Khoruzhick , Yangtao Li , "Rafael J. Wysocki" , Daniel Lezcano , Amit Kucheria , Zhang Rui , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland Cc: linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org, Andre Przywara , Alan Ma , Luke Harrison , Marijn Suijten , AngeloGioacchino Del Regno , Konrad Dybcio , Martin Botka , Martin Botka X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1692626628; l=3135; i=martin.botka@somainline.org; s=20230811; h=from:subject:message-id; bh=Y5wSSzIWuOFKSGGZMNJjnzIykv3kiku+VUt8NVG55u0=; b=7EqC6e2dCq8+IHUQbrSK/ZIw526FrhhLr0JeelOvsJp1ijiF9qXcOtLFt9HQJg6vhbKiJtIGw wVuertO4HyZDwx5j+3/wWqHiU6KJfvu92iSpV5FjkzUs1QKbOaIlE1C X-Developer-Key: i=martin.botka@somainline.org; a=ed25519; pk=aTCd3jmwU8GrJidWg3DSKLpdVMcpFzXzCSLXLR6NtWU= X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1774852274811084965 X-GMAIL-MSGID: 1774852274811084965 There are 4 thermal sensors: - CPU - GPU - VE - DRAM Add the thermal sensor configuration and thermal zones Signed-off-by: Martin Botka --- arch/arm64/boot/dts/allwinner/sun50i-h616.dtsi | 87 ++++++++++++++++++++++++++ 1 file changed, 87 insertions(+) diff --git a/arch/arm64/boot/dts/allwinner/sun50i-h616.dtsi b/arch/arm64/boot/dts/allwinner/sun50i-h616.dtsi index d549d277d972..063db9634e5f 100644 --- a/arch/arm64/boot/dts/allwinner/sun50i-h616.dtsi +++ b/arch/arm64/boot/dts/allwinner/sun50i-h616.dtsi @@ -9,6 +9,7 @@ #include #include #include +#include / { interrupt-parent = <&gic>; @@ -138,6 +139,10 @@ sid: efuse@3006000 { reg = <0x03006000 0x1000>; #address-cells = <1>; #size-cells = <1>; + + ths_calibration: thermal-sensor-calibration@14 { + reg = <0x14 0x8>; + }; }; watchdog: watchdog@30090a0 { @@ -511,6 +516,18 @@ mdio0: mdio { }; }; + ths: thermal-sensor@5070400 { + compatible = "allwinner,sun50i-h616-ths"; + reg = <0x05070400 0x400>; + interrupts = ; + clocks = <&ccu CLK_BUS_THS>; + clock-names = "bus"; + resets = <&ccu RST_BUS_THS>; + nvmem-cells = <&ths_calibration>; + nvmem-cell-names = "calibration"; + #thermal-sensor-cells = <1>; + }; + usbotg: usb@5100000 { compatible = "allwinner,sun50i-h616-musb", "allwinner,sun8i-h3-musb"; @@ -755,4 +772,74 @@ r_rsb: rsb@7083000 { #size-cells = <0>; }; }; + + thermal-zones { + cpu-thermal { + polling-delay-passive = <500>; + polling-delay = <1000>; + thermal-sensors = <&ths 2>; + sustainable-power = <1000>; + + trips { + cpu_threshold: cpu-trip-0 { + temperature = <60000>; + type = "passive"; + hysteresis = <0>; + }; + cpu_target: cpu-trip-1 { + temperature = <70000>; + type = "passive"; + hysteresis = <0>; + }; + cpu_critical: cpu-trip-2 { + temperature = <110000>; + type = "critical"; + hysteresis = <0>; + }; + }; + }; + + gpu-thermal { + polling-delay-passive = <500>; + polling-delay = <1000>; + thermal-sensors = <&ths 0>; + sustainable-power = <1100>; + + trips { + gpu_temp_critical: gpu-trip-0 { + temperature = <110000>; + type = "critical"; + hysteresis = <0>; + }; + }; + }; + + ve-thermal { + polling-delay-passive = <0>; + polling-delay = <0>; + thermal-sensors = <&ths 1>; + + trips { + ve_temp_critical: ve-trip-0 { + temperature = <110000>; + type = "critical"; + hysteresis = <0>; + }; + }; + }; + + ddr-thermal { + polling-delay-passive = <0>; + polling-delay = <0>; + thermal-sensors = <&ths 3>; + + trips { + ddr_temp_critical: ddr-trip-0 { + temperature = <110000>; + type = "critical"; + hysteresis = <0>; + }; + }; + }; + }; };