From patchwork Wed Nov 23 06:16:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Billy Tsai X-Patchwork-Id: 13053126 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 418C8C4332F for ; Wed, 23 Nov 2022 06:23:14 +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:To :From:Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=0dGELRDSr+DPFvpspeJ1CRYLFd50P8u1Y6D5TGhi36g=; b=wmBom3XGEqdTGi Y5fuOKZMrE4NAtMujOQdKXVm32wGFu6vuowYr22w4TQ3xyKGak7Xuaxu9ixeHAEoq2LF+J+GC0Y/+ ID4A7isH4mGhQgZzh42fhXE7LkIqzjBGb6firGg1o1ZsaudCwChwgP50mw3cppo9z1zg41DBxoeJq AHscRYUQN02lPRRJyeyFJc3dgoTma0Ozs/VmPKH9+Hxh7VR5OZvOzyoc5iC6sgHcnDsy+vkqIzhjU f4lN8gIM+Vwd+H2W1DTmvSN8i6Y2Zu72KjfGniKc6hoDjvKUASbzVEmQgy11s0zdQGZxxFq4nZPck lkkzZmoM8ExTtKllbiSA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oxj95-00EepX-CY; Wed, 23 Nov 2022 06:22:08 +0000 Received: from twspam01.aspeedtech.com ([211.20.114.71]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oxj4W-00Ecbw-EU for linux-arm-kernel@lists.infradead.org; Wed, 23 Nov 2022 06:17:29 +0000 Received: from mail.aspeedtech.com ([192.168.0.24]) by twspam01.aspeedtech.com with ESMTP id 2AN5pUK4081939; Wed, 23 Nov 2022 13:51:30 +0800 (GMT-8) (envelope-from billy_tsai@aspeedtech.com) Received: from BillyTsai-pc.aspeed.com (192.168.2.149) by TWMBX02.aspeed.com (192.168.0.24) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 23 Nov 2022 14:15:54 +0800 From: Billy Tsai To: , , , , , , , , , , , , , , , , , , Subject: [v4 0/5] Support pwm/tach driver for aspeed ast26xx Date: Wed, 23 Nov 2022 14:16:30 +0800 Message-ID: <20221123061635.32025-1-billy_tsai@aspeedtech.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Originating-IP: [192.168.2.149] X-ClientProxiedBy: TWMBX02.aspeed.com (192.168.0.24) To TWMBX02.aspeed.com (192.168.0.24) X-DNSRBL: X-MAIL: twspam01.aspeedtech.com 2AN5pUK4081939 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221122_221724_894978_E6E6D816 X-CRM114-Status: GOOD ( 13.11 ) 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 Unlike the old design that the register setting of the TACH should based on the configure of the PWM. In ast26xx, the dependency between pwm and tach controller is eliminated and becomes a separate hardware block. One is used to provide pwm output and another is used to monitor the frequency of the input. Therefore, this patch serials implements them by writing the two driver "pwm-aspeed-ast2600.c" and "tach-aspeed-ast2600.c". The former is following the pwm subsystem which can apply the existed driver to controller the fan(pwm-fan.c), beeper(pwm-beeper.c) and so on. The latter is following the sysfs interface of hwmon to creat the node for fan monitor. Changes since v3: - pwm - Remove unnecessary include header - Fix warning Prefer "GPL" over "GPL v2" - tach: - Remove the paremeter min_rpm and max_rpm and return the tach value directly without any polling or delay. - Fix warning Prefer "GPL" over "GPL v2" - dt-binding: - Replace underscore in node names with dashes - Split per subsystem Changes since v2: - pwm: - Use devm_* api to simplify the error cleanup - Fix the multi-line alignment problem - tach: - Add tach-aspeed-ast2600 to index.rst - Fix the multi-line alignment problem - Remove the tach enable/disable when read the rpm - Fix some coding format issue Changes since v1: - tach: - Add the document tach-aspeed-ast2600.rst - Use devm_* api to simplify the error cleanup. - Change hwmon register api to devm_hwmon_device_register_with_info Billy Tsai (5): dt-bindings: mfd: Add aspeed pwm-tach binding dt-bindings: pwm: Add bindings for aspeed pwm controller dt-bindings: hwmon: Add bindings for aspeed tach controller pwm: Add Aspeed ast2600 PWM support hwmon: Add Aspeed ast2600 TACH support .../bindings/hwmon/aspeed,ast2600-tach.yaml | 36 ++ .../bindings/mfd/aspeed,ast2600-pwm-tach.yaml | 73 ++++ .../bindings/pwm/aspeed,ast2600-pwm.yaml | 54 +++ Documentation/hwmon/index.rst | 1 + Documentation/hwmon/tach-aspeed-ast2600.rst | 24 ++ drivers/hwmon/Kconfig | 9 + drivers/hwmon/Makefile | 1 + drivers/hwmon/tach-aspeed-ast2600.c | 399 ++++++++++++++++++ drivers/pwm/Kconfig | 10 + drivers/pwm/Makefile | 1 + drivers/pwm/pwm-aspeed-ast2600.c | 318 ++++++++++++++ 11 files changed, 926 insertions(+) create mode 100644 Documentation/devicetree/bindings/hwmon/aspeed,ast2600-tach.yaml create mode 100644 Documentation/devicetree/bindings/mfd/aspeed,ast2600-pwm-tach.yaml create mode 100644 Documentation/devicetree/bindings/pwm/aspeed,ast2600-pwm.yaml create mode 100644 Documentation/hwmon/tach-aspeed-ast2600.rst create mode 100644 drivers/hwmon/tach-aspeed-ast2600.c create mode 100644 drivers/pwm/pwm-aspeed-ast2600.c