Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp5824222yba; Thu, 11 Apr 2019 06:33:33 -0700 (PDT) X-Google-Smtp-Source: APXvYqxyzP3l6f3VzlJluhZd13eIfUWisQkKEt5Qug8fYKlmGUIESoEuwQQnURvU5eVgOOndtH73 X-Received: by 2002:a63:6844:: with SMTP id d65mr47776651pgc.393.1554989613393; Thu, 11 Apr 2019 06:33:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554989613; cv=none; d=google.com; s=arc-20160816; b=YgM2OIlH0jmagTHnVRFC+YEZj0+TIwFPIVVHT6HxrGXPvxGPbk4h0QUqLUT53MQpyp x7Bkl2qH5fT6r36ujLSdYlndm/6hgn9aERPyPPghOcxVDsg411bX2VuQInJfV7o21BKi HX8NuqlVB3OLwOlWUdKZVRswSJ0hDSKLiISR8Czi4pzGznrZ3wrW3n3UBRl/hS3J9n/I azWCt8Say06Nl0bVedcmrjW0izv7oHTnA/Z4fyX2I0nKxZb+GvMRpwLCDswlMFy30qOA zhs8jp98QQjcrZt/F6IrN9Qw+5Sbo4uE3BBM6zdIL0xSccr/8W5s84EDOgt+i9Nqw+s6 Aotw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=8/qiZLVSgMnDfmmp+lzPJ5yIViHWYhcpGX4QF+kt+Uc=; b=JokFLDjOO/8uCnL6W5cunV8qEz1sEVybFmvnEkvUaHJnFdfrQ+Y+3bhxE72N7enBrP JmjIGq0hoEiz/ORoSEj5VI1lxWXDNsEWaoOQxlmOZTja43nhhuubK+4gSB2qAwObtVDl E+M3VJ8TYfRHAVOTgtJ0U76ZCrWuR2KvtrHpG9tuZzCZg+zhN/X0u3EU0vz6QBktLDfs 1b1gXDi6R7RST+AAL0xlU/0VQfz4hcloMMUFcKoZuW0OVAWydTwNRCyN1hSPEewyKGI5 K3kU+UyXZ6/AQG7tRUvuvgunJ0DxqwV+aKR/De9yjOhFlXZb9Esc9hc6OUoNP/JJSNeo wCfQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f1si35915947pld.32.2019.04.11.06.33.17; Thu, 11 Apr 2019 06:33:33 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726898AbfDKNbQ (ORCPT + 99 others); Thu, 11 Apr 2019 09:31:16 -0400 Received: from mout.kundenserver.de ([217.72.192.75]:48135 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726517AbfDKNbP (ORCPT ); Thu, 11 Apr 2019 09:31:15 -0400 Received: from stefan-Vostro-260.fritz.box ([109.104.50.113]) by mrelayeu.kundenserver.de (mreue108 [212.227.15.183]) with ESMTPSA (Nemesis) id 1MbAUg-1gdKDq2H1M-00beRR; Thu, 11 Apr 2019 15:30:34 +0200 From: Stefan Wahren To: Kamil Debski , Bartlomiej Zolnierkiewicz , Jean Delvare , Guenter Roeck , Rob Herring , Mark Rutland , Robin Murphy Cc: linux-hwmon@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Stefan Wahren Subject: [PATCH V5 0/3] hwmon: pwm-fan: Add RPM support Date: Thu, 11 Apr 2019 15:30:08 +0200 Message-Id: <1554989411-23666-1-git-send-email-stefan.wahren@i2se.com> X-Mailer: git-send-email 2.7.4 X-Provags-ID: V03:K1:9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9zlMk6MA= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Contrary to the gpio-fan the pwm-fan driver isn't easy to setup with pwmconfig/fancontrol because of the missing hwmon sysfs entry for actual revolutions per minute. This series adds this feature. Changes in V5: - address Guenter's and Robin's comments: - use of_property_read_u32 to get pulses-per-revolution - call platform_get_irq ealier to avoid glitches on the regulator - simplify pwm_fan_attrs_visible Changes in V4: - remove copy & paste artifact in dt-binding example - switch to u64 for rpm calculation - drop overflow handling and init atomic - handle 0 not as valid irq - reduce range of pulses_per_revolution - handle probe defer of platform_get_irq - delete timer properly in bail-out path Changes in V3: - rename property interrupt-ratio to pulses-per-revolution to avoid confusion with interrupt binding - handle error case pulses-per-revolution = 0 - bail out properly in case we are unable to request the irq Changes in V2: - address Guenter's comments: - improve description of interrupts - use atomic_t to avoid races of the pulse counter - measure sample time to make rpm more reliable under load - make sysfs entry fan1_input conditional - add dt-property to define interrupts per fan revolution - example for fan with RPM support Stefan Wahren (3): dt-bindings: hwmon: Add tachometer interrupt to pwm-fan Documentation: pwm-fan: Add description for RPM support hwmon: pwm-fan: Add RPM support via external interrupt .../devicetree/bindings/hwmon/pwm-fan.txt | 21 +++- Documentation/hwmon/pwm-fan | 3 + drivers/hwmon/pwm-fan.c | 107 ++++++++++++++++++++- 3 files changed, 126 insertions(+), 5 deletions(-) -- 2.7.4