From patchwork Wed Jun 21 00:03:08 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Leis X-Patchwork-Id: 9800445 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 3D239600C5 for ; Wed, 21 Jun 2017 00:03:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 20135283B4 for ; Wed, 21 Jun 2017 00:03:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 144412846B; Wed, 21 Jun 2017 00:03:22 +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 A7432283B4 for ; Wed, 21 Jun 2017 00:03:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752779AbdFUADU (ORCPT ); Tue, 20 Jun 2017 20:03:20 -0400 Received: from mail-pg0-f46.google.com ([74.125.83.46]:35239 "EHLO mail-pg0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752425AbdFUADS (ORCPT ); Tue, 20 Jun 2017 20:03:18 -0400 Received: by mail-pg0-f46.google.com with SMTP id 132so35850132pgb.2 for ; Tue, 20 Jun 2017 17:03:18 -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=tYH8ynz9FHlr6laEv/WjwPpt6bLgsxP7Ay9He/FEnF0=; b=ISDZeMxZiib4ANL+vl2jyZVZ2Or+Fmj9t0+SjLTtDSBQpXvlQ2sEc3K+mlpYhj8rkE TGWU012McXLbvAlO+WlYzKKmCwiXvrhgkzlZxnhfaZy0d2CQRdrigKUWCBT8+0qIBMCB TJUeIjpmTeHx4qZ3y/XWPzSdz5FZT8VdANJ1ipz6orjh91zzqqZnbZecsLgKaeuBHTi2 LkE6u4bw5HxcbRtaoTujHQWWIbtdGmqH2g5yo/Z84p+qFtnv+MljKZX1cOqNJ5GhWofZ 65veDGK+v4hUd/ti7gxHVKv21Feu0nBFv6hHognDl4SszPrJ3bEUn1XNFi+ndJN8mgb1 MGhw== 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=tYH8ynz9FHlr6laEv/WjwPpt6bLgsxP7Ay9He/FEnF0=; b=VS1O3VEIobdbGxq58yKzVw/kyZdhafY4UwmIrYycutQcyExpGZvbZU3FEuMsC0R0jB bfwpbcGbHU7DeEtTf5mGbGQpeTzXzf5yLX0Y0LRoWh8sHaXKmLltIHkU9STL4n3OFh85 R1YUkVKevhCp7icZqhWJ328DShctdHYCbw5CO0henxc8SaMUUcVcfUQlXW3S1WoBhS3Y MPbf6eauW/3Qf6Ih3zewbE7IXsszw699Y/f/t0oQiOOB1RW/MN8xe+3b9jNAFTIzPmZo IA3vi0E78LMcwgo+f188WMEjQtlwrigNVne4s7/4nJbrfWEk1iadDmIQKl/oS/CqQ07w Ozqw== X-Gm-Message-State: AKS2vOye8BmeruO9s6vh4NCm9EglUn95n0erEAQNHrYnWfFDfaDkKmA0 +2x9XWtb5RCJIB46iS1Zmg== X-Received: by 10.99.116.2 with SMTP id p2mr33504174pgc.162.1498003392452; Tue, 20 Jun 2017 17:03:12 -0700 (PDT) Received: from venture.svl.corp.google.com ([100.123.242.104]) by smtp.gmail.com with ESMTPSA id n71sm229322pfi.95.2017.06.20.17.03.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 20 Jun 2017 17:03:11 -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, emilyshaffer@google.com Subject: [PATCH v2] hwmon: (aspeed-pwm-tacho) reduce fan_tach period Date: Tue, 20 Jun 2017 17:03:08 -0700 Message-Id: <20170621000309.18234-1-venture@google.com> X-Mailer: git-send-email 2.13.1.611.g7e3b11ae1-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 via aspeed ast2400. 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 86e2ea8287a7..b2ab5612d8a4 100644 --- a/drivers/hwmon/aspeed-pwm-tacho.c +++ b/drivers/hwmon/aspeed-pwm-tacho.c @@ -160,7 +160,7 @@ * 11: reserved. */ #define M_TACH_MODE 0x02 /* 10b */ -#define M_TACH_UNIT 0x1000 +#define M_TACH_UNIT 0x00c0 #define INIT_FAN_CTRL 0xFF struct aspeed_pwm_tacho_data {