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: 2090 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp2619291wrr; Tue, 22 Nov 2022 22:19:51 -0800 (PST) X-Google-Smtp-Source: AA0mqf6DeODZKSd8F9hl2OYUV1gjaTb9pkZOOF3TARyCui29JY8zl9+Kp1yMjOAloOIbqo0EeNhy X-Received: by 2002:a63:fe01:0:b0:477:bf35:acb1 with SMTP id p1-20020a63fe01000000b00477bf35acb1mr541546pgh.439.1669184391408; Tue, 22 Nov 2022 22:19:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669184391; cv=none; d=google.com; s=arc-20160816; b=iQO93eA41vJbXyabu2acofODS7kWj2R9zw6gWPd3TvbgcGqoSTCp8M4OAhpK9SWa+H gLnrTFVoyW5M5zlv8YWhC3Qo8CvwI+S1LBo+JkjVMOMnrBLGDHaVHCAIkyLf6WMRoRHo 0U0Vr8aCqja8svoitRb7qF4JO0b9LDNH3pb3hJddd+3PAGThmmouOagJY3W2YyYNHRt0 77q9FTMiA7l7Bl6/xH58/uw0IJnuqNMWr5Tu1Op8jM6zUl8gvnRJw0bbyBuxIRVxK8xb kaO2pcZbd8WNZQh4AAc08r7RGJmT3ak2mP43sW1LmNFn3aFWzQr9gQy2YNYs7WgvoPFq /tBw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:to:from; bh=B3DPavxaRqC2ViQGVTD/L+vqukmVsx53lFxTiLtmQAQ=; b=HHYiuAFNPEQhVg2raeeJsqldXpNhEiqNbWYKaR8mF69EwaMYso+0SK23q/IEooxKqb gT4kJ6BprXsucF5Jr1QpUzMvQE99PpawFCg9PwxdGh8S+1qxZiVsK7fTUb+M6LYgLxmt QMYbxaGN338qdvsWI0iUxA1XnfK6Mrtg2GXWsnfM9ZnhuRmRjrtPuFFuGKKFOYSaCE/6 PLmek9NWmn1eV+Bm7NzEaVNk4RC9LUhtP3NIG1EjA8jQoTQKHcpYlKbmeZlxd31B5KBJ +PKucO6XfMLl3Wg6ZfGXy0JZHe8emvXpqcaEnI5kXgbpcDS3y54ItOzs7ZKIZ15cAIoh vc6g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f12-20020a056a0022cc00b00557bb4f6977si2313581pfj.106.2022.11.22.22.19.38; Tue, 22 Nov 2022 22:19:51 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236043AbiKWGTX (ORCPT + 99 others); Wed, 23 Nov 2022 01:19:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57508 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235799AbiKWGTO (ORCPT ); Wed, 23 Nov 2022 01:19:14 -0500 Received: from twspam01.aspeedtech.com (twspam01.aspeedtech.com [211.20.114.71]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C34E85C75B; Tue, 22 Nov 2022 22:19:13 -0800 (PST) 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-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1750266692658898839?= X-GMAIL-MSGID: =?utf-8?q?1750266692658898839?= 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