Received: by 10.223.185.116 with SMTP id b49csp362620wrg; Tue, 20 Feb 2018 23:00:19 -0800 (PST) X-Google-Smtp-Source: AH8x225VT93sKRYIZ5HGB5fQjINN6JIwStOooxmdX1WxDQQviZumdJD94XXlJVwp3fMCDcsiC7sK X-Received: by 10.99.182.12 with SMTP id j12mr1954431pgf.113.1519196419621; Tue, 20 Feb 2018 23:00:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519196419; cv=none; d=google.com; s=arc-20160816; b=sBRJBia722oLp+YTca1iSPf/h1mYfr/HJbGWUb9N7iomswMBmBIWK1VoJX3zrqdVQM l7m02mv8XR/PZmVgSdXogDfTQ+dCgcnSm7rR7rWi+m8NhVw87/unFvawsJNtQAN/Gabn DjpNqf9i1ZuyIxtUeGCu3gM7bI47YSGhOvj52B0QnYuY0UnJmIurOk2W1lRez6Hpf1KH KzUHZYYWaVzgBFNqZsGaXo5I0tFxPvyAsW3TNItXZsVDOuACkI6R4iW+w89juRlfbplV n28kN2geTZVPzBmTtSfB5PQR3lXSb9i7Y0dx51+VGnvix/OSafFnXMzV6IZIWocsmlQI f06Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from:arc-authentication-results; bh=08pxwqlhYD+9IoV0DNT5WDgqnOpnehFqxonQ5r8AMgw=; b=OvXzqOrNC+CkUZp13v4NRB/h2kuJcNFcIlnodnl0DlYjsn/g9lggfWv/DPXtjtttai l+rUo6jFnp7+vo3Oa1jpgujo47nfagcImP+gg9FNg4Upn/dTgKwv6h8KW+NoPGHRe1ku oDAU9I4NyIQSHPlkE0g9+nXOMZ+L5OSw59UPJqJQOYuP5XQUKEWrodufumuwScmtmfMy HZb+q5STzjGrKqlrgcBYS/8lEeAhIc94u9cD0FPmU6JKLngPMLozlpwh4XIV4tGjf7Yn BpWc6myl9YDC6P5YcGOK0e1SVhGMUbHz6/8uUj4RfJBJMD8Aneu631+4et97eq4qskag lYZg== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nvidia.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n68si5735589pga.524.2018.02.20.23.00.03; Tue, 20 Feb 2018 23:00:19 -0800 (PST) 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nvidia.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751501AbeBUG7U (ORCPT + 99 others); Wed, 21 Feb 2018 01:59:20 -0500 Received: from hqemgate14.nvidia.com ([216.228.121.143]:16202 "EHLO hqemgate14.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750752AbeBUG7S (ORCPT ); Wed, 21 Feb 2018 01:59:18 -0500 Received: from hqpgpgate101.nvidia.com (Not Verified[216.228.121.13]) by hqemgate14.nvidia.com id ; Tue, 20 Feb 2018 22:59:21 -0800 Received: from HQMAIL105.nvidia.com ([172.20.161.6]) by hqpgpgate101.nvidia.com (PGP Universal service); Tue, 20 Feb 2018 22:59:16 -0800 X-PGP-Universal: processed; by hqpgpgate101.nvidia.com on Tue, 20 Feb 2018 22:59:16 -0800 Received: from BGMAIL101.nvidia.com (10.25.59.10) by HQMAIL105.nvidia.com (172.20.187.12) with Microsoft SMTP Server (TLS) id 15.0.1347.2; Wed, 21 Feb 2018 06:59:14 +0000 Received: from HQMAIL105.nvidia.com (172.20.187.12) by bgmail101.nvidia.com (10.25.59.10) with Microsoft SMTP Server (TLS) id 15.0.1347.2; Wed, 21 Feb 2018 06:59:11 +0000 Received: from rrajk-ubuntu.nvidia.com (10.124.1.5) by HQMAIL105.nvidia.com (172.20.187.12) with Microsoft SMTP Server (TLS) id 15.0.1347.2 via Frontend Transport; Wed, 21 Feb 2018 06:59:02 +0000 From: Rajkumar Rampelli To: , , , , , , , , , , , , , , , , , , , , , , CC: , , , , , , , , Subject: [PATCH 00/10] Implementation of Tegra Tachometer driver Date: Wed, 21 Feb 2018 12:28:49 +0530 Message-ID: <1519196339-9377-1-git-send-email-rrajk@nvidia.com> X-Mailer: git-send-email 2.1.4 MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following patches adds support for PWM based Tegra Tachometer driver which implements PWM capture interface to analyze the PWM signal of a electronic fan and reports it in periods and duty cycles. Generic PWM Tachometer implemented to monitor the speed of fan in rpms using PWM interface. RPM of Fan will be exposed to user interface through HWMON sysfs interface avialable at below location /sys/devices/platform/generic_pwm_tachometer/hwmon/hwmon0/rpm Steps to validate Tachometer: A. push modules pwm-tegra.ko, pwm-tegra-tachometer.ko and generic-pwm-tachometer.ko to linux device using scp command. scp build/tegra186/drivers/pwm/pwm-tegra.ko ubuntu@10.19.65.176:/tmp/ scp build/tegra186/drivers/pwm/pwm-tegra-tachometer.ko ubuntu@10.19.65.176:/tmp/ scp build/tegra186/drivers/hwmon/generic-pwm-tachometer.ko ubuntu@10.19.65.176:/tmp/ B. On Linux device console, insert these modules using insmod command. insmod /tmp/pwm-tegra.ko insmod /tmp/pwm-tegra-tachometer.ko insmod /tmp/generic-pwm-tachometer.ko C. Read RPM value at below sysfs node cat /sys/devices/platform/generic_pwm_tachometer/hwmon/hwmon0/rpm D. Change the FAN speed using PWM sysfs interface. Follow below steps for the same: a. cd /sys/class/pwm/pwmchip0 b. ls -la (make sure pwm controller is c340000.pwm) Output should be: device -> ../../../c340000.pwm c. echo 0 > export d. cd pwmchip0:0 e. echo 8000 > period f. echo 1 > enable g. echo 7000 > duty_cycle # change duty_cycles from 0 to 7000 and see FAN speed h. cat /sys/devices/platform/generic_pwm_tachometer/hwmon/hwmon0/rpm i. echo 4000 > duty_cycle h. cat /sys/devices/platform/generic_pwm_tachometer/hwmon/hwmon0/rpm i. echo 2000 > duty_cycle h. cat /sys/devices/platform/generic_pwm_tachometer/hwmon/hwmon0/rpm i. echo 0 > duty_cycle h. cat /sys/devices/platform/generic_pwm_tachometer/hwmon/hwmon0/rpm Rajkumar Rampelli (10): pwm: core: Add support for PWM HW driver with pwm capture only dt-bindings: Tegra186 tachometer device tree bindings pwm: tegra: Add PWM based Tachometer driver hwmon: generic-pwm-tachometer: Add DT binding details hwmon: generic-pwm-tachometer: Add generic PWM based tachometer arm64: tegra: Add Tachometer Controller on Tegra186 arm64: tegra: Add PWM based Tachometer support on Tegra186 arm64: defconfig: enable Nvidia Tegra Tachometer as a module arm64: defconfig: Enable Generic PWM based Tachometer driver arm64: tegra: Add PWM controller on Tegra186 soc .../bindings/hwmon/generic-pwm-tachometer.txt | 25 ++ .../bindings/pwm/pwm-tegra-tachometer.txt | 31 +++ Documentation/hwmon/generic-pwm-tachometer | 17 ++ arch/arm64/boot/dts/nvidia/tegra186-p2771-0000.dts | 5 + arch/arm64/boot/dts/nvidia/tegra186.dtsi | 28 ++ arch/arm64/configs/defconfig | 2 + drivers/hwmon/Kconfig | 10 + drivers/hwmon/Makefile | 1 + drivers/hwmon/generic-pwm-tachometer.c | 112 ++++++++ drivers/pwm/Kconfig | 10 + drivers/pwm/Makefile | 1 + drivers/pwm/core.c | 4 + drivers/pwm/pwm-tegra-tachometer.c | 303 +++++++++++++++++++++ 13 files changed, 549 insertions(+) create mode 100644 Documentation/devicetree/bindings/hwmon/generic-pwm-tachometer.txt create mode 100644 Documentation/devicetree/bindings/pwm/pwm-tegra-tachometer.txt create mode 100644 Documentation/hwmon/generic-pwm-tachometer create mode 100644 drivers/hwmon/generic-pwm-tachometer.c create mode 100644 drivers/pwm/pwm-tegra-tachometer.c -- 2.1.4