From patchwork Thu Jul 14 14:23:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paul Fertser X-Patchwork-Id: 12918061 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 3E3CDC433EF for ; Thu, 14 Jul 2022 14:27:39 +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: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:In-Reply-To:References: List-Owner; bh=lTlsczWP5BbuorNp3FI+pLDtKnWqUs+Rc45CJ+AknxU=; b=QbhdGxBG8hbQhm Bi6YhAQDEs8L82s3Kq2JhQ//Otbd6vg/TaEhw2eGbeUxzJLpv1gSA1ZdYGdYcmy/gwkpkhQ5ExFXP bk51qU9Qdoc/jE+7D//dXfEOVlOINibks6cuQa0wPbBfCKDA64huqb4yw9bcSnLxbACEWrIisweNb dkz/UexWOa/sx1gF6F7c6bDZ41HGFyXqLV+HDh7/9HSqw0lIwo8kUrGcXEx/CZ0rlMPUN5MZ9RUiL oxqI5FqQkEyWGIvzi6SwXtRWNr1SU3BWpcJINMaLWcuIetAnt/y/ZQSgF+jQqqYE7SOtoNNVLAiOa m+c93qTrT6nPzXF99ntg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oBznc-00FBIx-Kn; Thu, 14 Jul 2022 14:26:40 +0000 Received: from mail-lj1-x235.google.com ([2a00:1450:4864:20::235]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oBznZ-00FBHY-An for linux-arm-kernel@lists.infradead.org; Thu, 14 Jul 2022 14:26:38 +0000 Received: by mail-lj1-x235.google.com with SMTP id w2so2365059ljj.7 for ; Thu, 14 Jul 2022 07:26:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=xhAdDwR7fkHmP5A2mwh6VjI19vPe0VaNlf9urUpx8Og=; b=hINe2A+4rDsO5qx9r85RBNBCkuJYvM+3sJiN3lY76d+aFcYM1FL4AzzIIMEQ9bBstP x2a+hNbdWpX2UFWFTcI/JqwAlb2WDj93S/d4pvcbo5HcL1XgKIDXRTmQ3EOJqlp7zmdy 3f3KsIkym9rNdc6a8ECB66yrOVz1mU473DSP+hIvYFH9+G8MM9Jz7IcY6g81EIt/a4DY UwT/Gk78TtX5CsazY8xdZt6M1GwQEdRXMnbR0k2jtlaA0eBQ3kXpZSv67jhIls9uG7gV 9wGeVkTCuKK3eSr7OpKj60z7aq9iweHaArBIqGtC7AJv405Hs7TDziT573dBeevw3aOh VHhQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=xhAdDwR7fkHmP5A2mwh6VjI19vPe0VaNlf9urUpx8Og=; b=azMNt+/4CbCi6hIkd0+dcwYasu9NEVq1nFcRvmKQAvxwFvmrj20t0vBF09TpvR5JmS TRsc45K0Ss4pLqMI4FczVpCibfXjyMSH01Bi5XR3Jp/EH7GPMMAu1NBxI/PbTOAYPCht qmiU1oaafDagG/UqQWUJLNE6r9F+gwwt8Jza6QWe0hqouvll3w1F1NnALtj8ixO+PSlP Helf8DFEIPJTHxOSrPoMJHQz+6w/DiQahWZ47llt58nI0eQGW6WvcoguRDqCd2cqf/0D YXfl4DdaQugn1GoPs/cR7fXsouSF5PqxqMOT8Zzo3oA/1Lhc34SBJg/WTK9GqJOlyxOJ Y57Q== X-Gm-Message-State: AJIora/IF215gSObPdAEHgHOR+uUexxb0w0y9q1ZFDrCg+9Mm4+lok8L AlI9eYSqQgLU2TISs/Dc1z4= X-Google-Smtp-Source: AGRyM1sI1Dl9Qmbe2UutdGzOYC6VzFsKnNHLtcRH+6OjgCWBc6AqXqI2QGNzP6O3eNnhay2PqUfk1g== X-Received: by 2002:a2e:944a:0:b0:24f:10bd:b7e8 with SMTP id o10-20020a2e944a000000b0024f10bdb7e8mr4980778ljh.238.1657808794231; Thu, 14 Jul 2022 07:26:34 -0700 (PDT) Received: from home.paul.comp (paulfertser.info. [2001:470:26:54b:226:9eff:fe70:80c2]) by smtp.gmail.com with ESMTPSA id q17-20020a056512211100b00489c665af61sm382594lfr.274.2022.07.14.07.26.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Jul 2022 07:26:33 -0700 (PDT) Received: from home.paul.comp (home.paul.comp [IPv6:0:0:0:0:0:0:0:1]) by home.paul.comp (8.15.2/8.15.2/Debian-22) with ESMTP id 26EEQT1u027118; Thu, 14 Jul 2022 17:26:31 +0300 Received: (from paul@localhost) by home.paul.comp (8.15.2/8.15.2/Submit) id 26EEQPC1027117; Thu, 14 Jul 2022 17:26:25 +0300 From: Paul Fertser To: Jean Delvare , Guenter Roeck , Joel Stanley , Patrick Venture Cc: Andrew Jeffery , linux-hwmon@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-aspeed@lists.ozlabs.org, linux-kernel@vger.kernel.org, Paul Fertser Subject: [PATCH] hwmon: (aspeed-pwm-tacho) increase fan tach period (again) Date: Thu, 14 Jul 2022 17:23:44 +0300 Message-Id: <20220714142344.27071-1-fercerpav@gmail.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220714_072637_394170_86216522 X-CRM114-Status: GOOD ( 15.98 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The old value allows measuring fan speeds down to about 970 RPM and gives timeout for anything less than that. It is problematic because it can also be used as an indicator for fan failure or absence. Despite having read the relevant section of "ASPEED AST2500/AST2520 A2 Datasheet – V1.7" multiple times I wasn't able to figure out what exactly "fan tach period" and "fan tach falling point of period" mean (both are set by the driver from the constant this patch is amending). Experimentation with a Tioga Pass OCP board (AST2500 BMC) showed that value of 0x0108 gives time outs for speeds below 1500 RPM and the value offered by the patch is good for at least 750 RPM (the fans can't spin any slower so the lower bound is unknown). Measuring with the fans spinning takes about 30 ms, sometimes down to 18 ms, so about the same as with the previous value. This constant was last changed in 762b1e88801357770889d013c5d20fe110d1f456. Signed-off-by: Paul Fertser --- drivers/hwmon/aspeed-pwm-tacho.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/hwmon/aspeed-pwm-tacho.c b/drivers/hwmon/aspeed-pwm-tacho.c index 3cb88d6fbec0..d11f674e3dc3 100644 --- a/drivers/hwmon/aspeed-pwm-tacho.c +++ b/drivers/hwmon/aspeed-pwm-tacho.c @@ -159,7 +159,7 @@ * 11: reserved. */ #define M_TACH_MODE 0x02 /* 10b */ -#define M_TACH_UNIT 0x0210 +#define M_TACH_UNIT 0x0420 #define INIT_FAN_CTRL 0xFF /* How long we sleep in us while waiting for an RPM result. */