From patchwork Sun Jun 28 21:52:10 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Daniel_Gonz=C3=A1lez_Cabanelas?= X-Patchwork-Id: 1318678 X-Patchwork-Delegate: hauke@hauke-m.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.openwrt.org (client-ip=2001:8b0:10b:1231::1; helo=merlin.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=merlin.20170209 header.b=UZMxdCAx; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=II35bhWw; dkim-atps=neutral Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49w4J33cGGz9sQx for ; Mon, 29 Jun 2020 07:58:22 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe :List-Id:MIME-Version:Message-ID:Date:Subject:To:From:Reply-To:Cc:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Owner; bh=66aG5YeTg6Vc2HFZEf/zi8Br6W1lvzJzkml/9OfPUro=; b=UZMxdCAxoHMJkRai1r291d9/oB pgQ+UObLw85rGULuyTelNM0vtvFhadm4w5ul8BQxVFDhyHrW85K/3XMvuDSkYj08QIOXmha9o3kNV TkAzIG+hPfFqVPuDeZHvegaIrYyNbMk7ccMvCXSg6HwSC1vyPaORug43EGvc2NW2lkYx+ea3e+tWw p1XqDkLFQS8DKgl+yYpesEVPLbGbm7UyRKYvAOqW5NnN4dIO0hMfX2GcFvSahiR07srjrt8/OXdGq P1QqxNxAU4v96gHbDjCXDbDjEGhUAwurLnVkHpo5pnfI+Xag+UO+Cneel5QSVcCVAqNno2xBbHR0b irUNBwgA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jpfF6-0002PH-3S; Sun, 28 Jun 2020 21:53:40 +0000 Received: from mail-wm1-x342.google.com ([2a00:1450:4864:20::342]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jpfF2-0002P3-R6 for openwrt-devel@lists.openwrt.org; Sun, 28 Jun 2020 21:53:37 +0000 Received: by mail-wm1-x342.google.com with SMTP id j18so13601827wmi.3 for ; Sun, 28 Jun 2020 14:53:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=3elfVDk0lUGKkNPtZwqIWQKtqJ7fpn9HEGxK0jZ6Gyk=; b=II35bhWw7k+8VqHeLQvNf1QnWIVLwszjKyI+sbeHE6YAB8dpM0N3in1cLaLLoD1mL7 I07GUV/XaqbQI/x+PgXoV90Bs/PVs8VuLqUgwBnz3d6IjtQUrUfgVTWizMa8dgS8axL+ 3oknCag+u1b7VWwSgLgKkwTdWR7VMSr8L35dOG5rP9BJmRaK48TBDZHb0ofDtDF6dBHF ZfHHgt+MfW2x1PztPqZlED0265aX0WYcwrUy4W6VKlVdpKvut1Se6HWJl8hMBhNSoZNd qKH9GaJqaW0oVLbiw72qZEBwnzV93prh48ZE5xjArvOtrWdHg40TsbCUIe2uMu3Fip7R CtoA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=3elfVDk0lUGKkNPtZwqIWQKtqJ7fpn9HEGxK0jZ6Gyk=; b=aT+as8vtP47hlus8LaPqaPgYT7zVpfjy6hZ94HL1MXU3sQDsHh+KecwgnaEvquUgZQ cZjbIIYdoMjhgf5uX5D5YT+qSwRppExNMbZO1Zj/cgvEmvzP4BOGo39ghFrPSDEAYdIv fzG4xD7fPnYQm6MsfDkpylskOqv9SGubWCiHY+EGJBfBFZW90b6/DxI9Fj2o7KyFRwLM da0mSIZGQp7EipYd0eA0J1PLZZEPdTwthypXDxPzHIKLQfaLomIiyIpuQ0obxc9Oo8m9 1QLgi8DYMzrFEJNZe7jaaTwmltnXL68wBI0jGYmE03267uuRd2I4Bh4x/sf4/k8DXvwX 4sCg== X-Gm-Message-State: AOAM531DFqgtVAQbky2lLKk3O8MxnCfO4P5ZBGMWOWiRMvFwBBN5c70Y sI4v2romqROPpu4BfiQNaOB1jVJA X-Google-Smtp-Source: ABdhPJwPBtpp2gPvhzhaf4Zfd9sjiNi2vMkNhEKSBab0GRPvks8eJ8w8cEP0JD2cDl3PR0cfh+ZSBg== X-Received: by 2002:a7b:c0c9:: with SMTP id s9mr13091789wmh.166.1593381212833; Sun, 28 Jun 2020 14:53:32 -0700 (PDT) Received: from tool.localnet ([213.177.196.114]) by smtp.googlemail.com with ESMTPSA id w2sm36815960wrs.77.2020.06.28.14.53.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 28 Jun 2020 14:53:30 -0700 (PDT) From: Daniel =?iso-8859-1?q?Gonz=E1lez?= Cabanelas To: openwrt-devel@lists.openwrt.org Subject: [PATCH v2] mvebu: LS421DE: use automatic fan control with thermal zones Date: Sun, 28 Jun 2020 23:52:10 +0200 Message-ID: <2428141.4nU0hxDUYR@tool> MIME-Version: 1.0 X-Spam-Note: CRM114 invocation failed X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [dgcbueu[at]gmail.com] -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:342 listed in] [list.dnswl.org] -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.29 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 The Buffalo Linkstation LS421DE has a chassis fan for cooling two internal hard drives. Currently there is no control over this fan, running always at fixed medium speed. With the recent jump to the kernel 5.4, now we can monitor the hard drive temperature and control the fan with thermal zones. Install the kmod-hwmon-drivetemp module and wire up a thermal zone on the dts file to allow automatic fan control by the kernel. Tested succesfully using a single Crucial BX500 SSD drive. Signed-off-by: Daniel González Cabanelas --- Changes in v2: - Fixed sata related dtb warnings. - Deleted deprecated cooling-min/max properties. - Minor cosmetic changes. .../boot/dts/armada-370-buffalo-ls421de.dts | 65 ++++++++++++++++++- target/linux/mvebu/image/cortexa9.mk | 5 +- 2 files changed, 67 insertions(+), 3 deletions(-) diff --git a/target/linux/mvebu/files/arch/arm/boot/dts/armada-370-buffalo-ls421de.dts b/target/linux/mvebu/files/arch/arm/boot/dts/armada-370-buffalo-ls421de.dts index 4d2760eb72..ea392f9e41 100644 --- a/target/linux/mvebu/files/arch/arm/boot/dts/armada-370-buffalo-ls421de.dts +++ b/target/linux/mvebu/files/arch/arm/boot/dts/armada-370-buffalo-ls421de.dts @@ -11,6 +11,7 @@ #include "mvebu-linkstation-fan.dtsi" #include #include +#include / { model = "Buffalo LinkStation LS421DE"; @@ -40,10 +41,60 @@ MBUS_ID(0x09, 0x01) 0 0xf1100000 0x10000>; }; - gpio_fan { + system_fan: gpio_fan { gpios = <&gpio0 13 GPIO_ACTIVE_HIGH &gpio0 14 GPIO_ACTIVE_HIGH>; alarm-gpios = <&gpio0 10 GPIO_ACTIVE_HIGH>; + + #cooling-cells = <2>; + }; + + thermal-zones { + chassis-thermal { + polling-delay = <20000>; + polling-delay-passive = <2000>; + + thermal-sensors = <&hdd0_temp>, <&hdd1_temp>; + coefficients = <1 1>; + + trips { + chassis_alert1: chassis-alert1 { + temperature = <36000>; + hysteresis = <2000>; + type = "active"; + }; + chassis_alert2: chassis-alert2 { + temperature = <46000>; + hysteresis = <2000>; + type = "active"; + }; + chassis_alert3: chassis-alert3 { + temperature = <56000>; + hysteresis = <2000>; + type = "passive"; + }; + chassis_crit: chassis-crit { + temperature = <66000>; + hysteresis = <2000>; + type = "critical"; + }; + }; + + cooling-maps { + map1 { + trip = <&chassis_alert1>; + cooling-device = <&system_fan THERMAL_NO_LIMIT 1>; + }; + map2 { + trip = <&chassis_alert2>; + cooling-device = <&system_fan 2 2>; + }; + map3 { + trip = <&chassis_alert3>; + cooling-device = <&system_fan 3 THERMAL_NO_LIMIT>; + }; + }; + }; }; gpio_keys { @@ -225,6 +276,18 @@ &sata { nr-ports = <2>; status = "okay"; + #address-cells = <1>; + #size-cells = <0>; + + hdd0_temp: sata-port@0 { + reg = <0>; + #thermal-sensor-cells = <0>; + }; + + hdd1_temp: sata-port@1 { + reg = <1>; + #thermal-sensor-cells = <0>; + }; }; &sdio { diff --git a/target/linux/mvebu/image/cortexa9.mk b/target/linux/mvebu/image/cortexa9.mk index bb09d2b6f7..ae75700fe5 100644 --- a/target/linux/mvebu/image/cortexa9.mk +++ b/target/linux/mvebu/image/cortexa9.mk @@ -17,8 +17,9 @@ define Device/buffalo_ls421de KERNEL_INITRAMFS := kernel-bin | append-dtb | uImage none DEVICE_DTS := armada-370-buffalo-ls421de DEVICE_PACKAGES := \ - kmod-rtc-rs5c372a kmod-hwmon-gpiofan kmod-usb3 kmod-md-raid0 \ - kmod-md-raid1 kmod-md-mod kmod-fs-xfs mkf2fs e2fsprogs partx-utils + kmod-rtc-rs5c372a kmod-hwmon-gpiofan kmod-hwmon-drivetemp kmod-usb3 \ + kmod-md-raid0 kmod-md-raid1 kmod-md-mod kmod-fs-xfs mkf2fs e2fsprogs \ + partx-utils endef TARGET_DEVICES += buffalo_ls421de