From patchwork Fri Feb 17 23:56:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Enrico Mioso X-Patchwork-Id: 1744486 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.openwrt.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=dsNxwp4p; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=HDwEiRKN; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PJTMV1SwRz1yYg for ; Sat, 18 Feb 2023 11:00:06 +1100 (AEDT) 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=VzF/je9yuXi03r54mdRkqgfI6DIE9/1ZilQ+7ChqmSk=; b=dsNxwp4pg1Jtok 0Uxuman1jBo2KkVUAnuFfe3/d2GUVxSaKZIW+bDgnYh1kcUY0mb3RUwiuA+sj/7C5DlbEZrqOARhb p0vB0zqy00a8+FJnr+dWDcqEnfdeH/cUWB8I69prVpgK2uqLfqanJZ7fv/3uLPOAGQMfDYGajGm2s A3DryENO+Pua+jIulAN5wYMZ2x5qcOl89iV1j4DxWpRCQcWnkKMIzdTs5Q4AxGhZDyehRx6r7MuJT BpIuQPHTUAveV0G0t2XHB9IB3rSl17XKPvlTOCG6XXnkaqJ/d89NaKzytlqWWPXwk+cCgaXoSL7g4 92JuGnA295/Pdxwoa88g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pTAbs-00Fzcc-Ux; Fri, 17 Feb 2023 23:57:49 +0000 Received: from mail-wr1-x429.google.com ([2a00:1450:4864:20::429]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pTAbR-00Fza1-Iw for openwrt-devel@lists.openwrt.org; Fri, 17 Feb 2023 23:57:24 +0000 Received: by mail-wr1-x429.google.com with SMTP id r11so2638489wru.1 for ; Fri, 17 Feb 2023 15:57:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=uSBw8AWRw8rqqhSwgkKx9CgEVqeWBbmYykqNrOKMFNI=; b=HDwEiRKNzeRUpkGiRAytc9Ionxmxi79MMRem8XrWPUbMuhrXDuqPSsyADl99cn5/2X lEjPxWua8iCmZsYJlGY0MNU3XoR+mezP69GnQi7gcoF5vJVOB2iFvBdYxFde34FY5yNe h8/SrWhH88vTTeNR0NBLiORHGwxtSKc7dLFuycDrsln+Xu2ydWlX6mC3Ks38B936gYYT M888BC/csCrzApmIcs+DdhTenSGjjEdlBMP38w/85c7Rsojh06jss7CEAXfYXQiZs6pa yaTag7f3Z97qnyQDVz6Ch2Nzr4YDKi40o1y3GPFEjMpd6IAgPPthgWIWsSRfX3KcByEK /QrQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=uSBw8AWRw8rqqhSwgkKx9CgEVqeWBbmYykqNrOKMFNI=; b=M/+FMeCOeCBTUhKfmK3qudmM7g4xCzLLRBk0M3Wj2ce4zsskeKZcsFcpwVVxOm0QFS Zr+FQW4pbOLgxwWuf5gkucg74gshHEGC+AZqUvhjbkMilR6DF1BHKjccXssc5aT69XiM hohvdM6WN5gRYKi2Wis5qnhdJmzs6NK30L590wZ1j8XVOip2CEtIKAgUnrDjZdh2VzvP gFVGylir2t3hskN72p06pMD0BLKhA8heqNe8b0bQxBaaMB4Cxxmbyad57I3W3/gpp8xR W9zwWkNGjZQBZnf2FR2kB4tKIYjl7CE/hwsN6BCypQBwJbAs22t3KgfcM+2yoEmNWY66 hHtA== X-Gm-Message-State: AO0yUKX7Ait4y/30dhstratTNXUp1DCzS84ENQUrh9gec61R/Hg/oSfv GxgQUisWZcVr+TZhFY4RXohaRR31DcuCWA== X-Google-Smtp-Source: AK7set9zZhccVc7p7VeAgjEnBnlW3ihleEtEOrbEhAFTG3wj8QZXZf+6WoFsrCgX9imch0jxTQtN0Q== X-Received: by 2002:a5d:688e:0:b0:2c5:8d06:75c2 with SMTP id h14-20020a5d688e000000b002c58d0675c2mr5924424wru.35.1676678238884; Fri, 17 Feb 2023 15:57:18 -0800 (PST) Received: from localhost.localdomain (h17-ipv4-77-240-224.mynet.it. [77.240.224.17]) by smtp.gmail.com with ESMTPSA id b16-20020adfee90000000b002c592535839sm4889155wro.17.2023.02.17.15.57.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Feb 2023 15:57:18 -0800 (PST) From: Enrico Mioso To: openwrt-devel@lists.openwrt.org Cc: Enrico Mioso , Andre Valentin , Karol Przybylski Subject: [PATCH 1/2] ipq807x: ZyXEL NBG7815: add fan support Date: Sat, 18 Feb 2023 00:56:51 +0100 Message-Id: <20230217235652.2184875-2-mrkiko.rs@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230217235652.2184875-1-mrkiko.rs@gmail.com> References: <20230217235652.2184875-1-mrkiko.rs@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230217_155721_653891_ED105889 X-CRM114-Status: GOOD ( 13.06 ) X-Spam-Score: -0.2 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Add on/off fan support for the ZyXEL NBG7815. Single CPU cores, cluster CPU temperatures and the Aquantia PHY temperature sensor are monitored. The tmp103 sensor is missing from this patch, and can be [...] Content analysis details: (-0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:429 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [mrkiko.rs[at]gmail.com] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org Add on/off fan support for the ZyXEL NBG7815. Single CPU cores, cluster CPU temperatures and the Aquantia PHY temperature sensor are monitored. The tmp103 sensor is missing from this patch, and can be added later, when kernel is bumped to 6.x, as it seems to require non-trivial hwmon backporting. Add kmod-phy-aquantia as default package while at it. Note: this patch has been marked RFT, since temperature values tuning is needed from someone actively using this device in high load conditions. Thanks to robimarko for helping me out. CC: Andre Valentin CC: Karol Przybylski Signed-off-by: Enrico Mioso --- .../arm64/boot/dts/qcom/ipq8074-nbg7815.dts | 119 ++++++++++++++++++ target/linux/ipq807x/image/generic.mk | 2 +- 2 files changed, 120 insertions(+), 1 deletion(-) diff --git a/target/linux/ipq807x/files/arch/arm64/boot/dts/qcom/ipq8074-nbg7815.dts b/target/linux/ipq807x/files/arch/arm64/boot/dts/qcom/ipq8074-nbg7815.dts index 537dd52032..0ec602cf31 100644 --- a/target/linux/ipq807x/files/arch/arm64/boot/dts/qcom/ipq8074-nbg7815.dts +++ b/target/linux/ipq807x/files/arch/arm64/boot/dts/qcom/ipq8074-nbg7815.dts @@ -39,6 +39,22 @@ gpios = <&tlmm 54 GPIO_ACTIVE_LOW>; }; }; + + fan: gpio_fan { + compatible = "gpio-fan"; + gpios = <&tlmm 21 GPIO_ACTIVE_HIGH>; + gpio-fan,speed-map = <0 0 + 4500 1>; + #cooling-cells = <2>; + }; + + thermal-zones { + aqr_thermal: aqr-thermal { + polling-delay-passive = <1000>; + polling-delay = <1000>; + thermal-sensors = <&aqr113c>; + }; + }; }; &tlmm { @@ -291,6 +307,7 @@ compatible = "ethernet-phy-ieee802.3-c45"; reg = <8>; reset-gpios = <&tlmm 63 GPIO_ACTIVE_LOW>; + #thermal-sensor-cells = <0>; }; }; @@ -443,3 +460,105 @@ qcom,ath11k-calibration-variant = "Zyxel-NBG7815"; }; + +&cpu0_thermal { + trips { + cpu0_active: cpu0-active { + temperature = <70000>; + hysteresis = <5000>; + type = "active"; + }; + }; + + cooling-maps { + map1 { + trip = <&cpu0_active>; + cooling-device = <&fan THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; + }; + }; +}; + +&cpu1_thermal { + trips { + cpu1_active: cpu1-active { + temperature = <70000>; + hysteresis = <5000>; + type = "active"; + }; + }; + + cooling-maps { + map1 { + trip = <&cpu1_active>; + cooling-device = <&fan THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; + }; + }; +}; + +&cpu2_thermal { + trips { + cpu2_active: cpu2-active { + temperature = <70000>; + hysteresis = <5000>; + type = "active"; + }; + }; + + cooling-maps { + map1 { + trip = <&cpu2_active>; + cooling-device = <&fan THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; + }; + }; +}; + +&cpu3_thermal { + trips { + cpu3_active: cpu3-active { + temperature = <70000>; + hysteresis = <5000>; + type = "active"; + }; + }; + + cooling-maps { + map1 { + trip = <&cpu3_active>; + cooling-device = <&fan THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; + }; + }; +}; + +&cluster_thermal { + trips { + cluster_active: cluster-active { + temperature = <70000>; + hysteresis = <5000>; + type = "active"; + }; + }; + + cooling-maps { + map1 { + trip = <&cluster_active>; + cooling-device = <&fan THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; + }; + }; +}; + +&aqr_thermal { + trips { + aqr_thermal_active: aqr-thermal-active { + temperature = <70000>; + hysteresis = <5000>; + type = "active"; + }; + }; + + cooling-maps { + map1 { + trip = <&aqr_thermal_active>; + cooling-device = <&fan THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; + }; + }; +}; diff --git a/target/linux/ipq807x/image/generic.mk b/target/linux/ipq807x/image/generic.mk index 38770a5f24..bbdb8c5d8b 100644 --- a/target/linux/ipq807x/image/generic.mk +++ b/target/linux/ipq807x/image/generic.mk @@ -141,6 +141,6 @@ define Device/zyxel_nbg7815 IMAGES += factory.bin sysupgrade.bin IMAGE/factory.bin := append-rootfs | pad-rootfs | pad-to 64k IMAGE/sysupgrade.bin/squashfs := append-rootfs | pad-to 64k | sysupgrade-tar rootfs=$$$$@ | append-metadata - DEVICE_PACKAGES := ipq-wifi-zyxel_nbg7815 kmod-ath11k-pci e2fsprogs kmod-fs-ext4 losetup kmod-hwmon-tmp103 + DEVICE_PACKAGES := ipq-wifi-zyxel_nbg7815 kmod-ath11k-pci e2fsprogs kmod-fs-ext4 losetup kmod-hwmon-tmp103 kmod-hwmon-gpiofan kmod-phy-aquantia endef TARGET_DEVICES += zyxel_nbg7815