From patchwork Tue Jun 20 21:41:35 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Leis X-Patchwork-Id: 9800309 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 7DAC860329 for ; Tue, 20 Jun 2017 21:41:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 67A5F24B44 for ; Tue, 20 Jun 2017 21:41:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5BFE428323; Tue, 20 Jun 2017 21:41:54 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ED47E24B44 for ; Tue, 20 Jun 2017 21:41:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752784AbdFTVlx (ORCPT ); Tue, 20 Jun 2017 17:41:53 -0400 Received: from mail-pf0-f170.google.com ([209.85.192.170]:36321 "EHLO mail-pf0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752785AbdFTVll (ORCPT ); Tue, 20 Jun 2017 17:41:41 -0400 Received: by mail-pf0-f170.google.com with SMTP id x63so75157928pff.3 for ; Tue, 20 Jun 2017 14:41:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=uXm59BysfTQ/gGErjR08ScAVFaFhBNLoTrCSW1uDsAA=; b=iaVuQ8cVI69zda5XQpNmAaQOXMi7EOgWueVungVGvQsu50tdjTVNtJfp1M2gx3fiSO HiUccV7eNsw2LmHU2ApPO5TLOS8cgilIvZLimvphg/lDoI926dwnCsEgE9iVOeENM4ef xwev0ucLkC+5movwnLg2V3yo/WGFHH/ssxUu1Z3EXAI4lWBSX4+Sevc0FlHYLIwynR86 KSHeXjyyJ61BIJffcxJEqJHvTSAHEaYu2diKeUa9UTOItXljIhEPWIDsS6jtNH8As40e nrGaM85OLAwRLmipNN6sXCR1J/3W8OvRFqhK2vMQYWavcxDy9JGBljCIgBwAd4rI8Fuq voBQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=uXm59BysfTQ/gGErjR08ScAVFaFhBNLoTrCSW1uDsAA=; b=Kazw2WwHgnUayNDq++12xEbEbG3Vv5esg2DpC+ayc/Wwyj94u8KHA8xsXw8unx1GzX oGcq+O1isTCYo46zGsMCRiXQBbCEt/vWCxkqtZCmfMzoXdDVHjL5ThUICBD+aSK3XGbs wB+iQ/J5YF4cd4KfWp8Pm+7m6nqfAtOwsVx268/a9NUsCc3sCPrCwmeeVk0h9EbD/cg3 3yiM03aom2hfcwhQ0JTXGHI8vI/nPYdR2ICB/hmXR1auoYR8an4JW7BaWqd7l2b0bLBJ rUdynE7JXJNsFgrq0EYolwuLPvDzr1Zhs3Dn7QSYGBEANFBdVUMkr33kfqg0Zl/vTK6E HUFQ== X-Gm-Message-State: AKS2vOwCY4fldS7IkljOIACfiF4r7rfKXbe7EvSwXK0Y1vxrvnq4ZZvm gCGPeAHFX9dL6l6t X-Received: by 10.84.238.206 with SMTP id l14mr17177533pln.280.1497994900491; Tue, 20 Jun 2017 14:41:40 -0700 (PDT) Received: from venture.svl.corp.google.com ([100.123.242.104]) by smtp.gmail.com with ESMTPSA id 189sm28346324pgj.67.2017.06.20.14.41.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 20 Jun 2017 14:41:39 -0700 (PDT) From: Patrick Venture To: venture@google.com, joel@jms.id.au, linux@roeck-us.net Cc: linux-hwmon@vger.kernel.org, raltherr@google.com Subject: [PATCH] hwmon: (aspeed-pwm-tacho) reduce fan_tach period Date: Tue, 20 Jun 2017 14:41:35 -0700 Message-Id: <20170620214135.195572-1-venture@google.com> X-Mailer: git-send-email 2.13.1.518.g3df882009-goog Sender: linux-hwmon-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Through testing a variety of fan_tach values 0xc0 was found to provide ideal fan_tach read performance. The fans were also as responsive to speed changes as desired. This is part of a performance tweak for the responsiveness of the driver. Tested: This was tested on the Quanta-Q71l. Caveat: I found that if a fan is broken this fan_tach period is too short if used to get a reliable response and ETIMEDOUT will return. I also found that if I set a fan's PWM to below 30% it would have a similar issue returning the fan_tach. However, that was in combination with another patch that mimics the reference driver behavior that no longer sleeps. In our DCs, we never expect to run fans below this threshold and it increases the responsiveness of the read fan_tach response. If suggested, we could move these knobs into device-trees or allow device-tree overrides to these defaults with very few edits. Signed-off-by: Patrick Venture --- 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 48403a2115be..9b0796ead21d 100644 --- a/drivers/hwmon/aspeed-pwm-tacho.c +++ b/drivers/hwmon/aspeed-pwm-tacho.c @@ -150,7 +150,7 @@ #define M_PWM_PERIOD 0x5F #define M_TACH_CLK_DIV 0x00 #define M_TACH_MODE 0x00 -#define M_TACH_UNIT 0x1000 +#define M_TACH_UNIT 0x00c0 #define INIT_FAN_CTRL 0xFF struct aspeed_pwm_tacho_data {