From patchwork Tue Jun 6 09:45:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Billy Tsai X-Patchwork-Id: 10343 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp3279746vqr; Tue, 6 Jun 2023 03:09:08 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7jcSTmonNHyfAvs7pdOZMWJATEIzRXLkT+qbEyXrAdnkQ/yg/iTyxu5Rp1W7NW2v1tHR4q X-Received: by 2002:a17:903:2301:b0:1ae:5c72:d63c with SMTP id d1-20020a170903230100b001ae5c72d63cmr990346plh.11.1686046148409; Tue, 06 Jun 2023 03:09:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686046148; cv=none; d=google.com; s=arc-20160816; b=QopXuwnDudPsmwhR7Roe7jDdcNvW8l/LP4+kBqoLly0Yxzv3wjUgjtkQ1wRMcXFiVd fIrU5JPcfcm4SYXs9kXnP5oX6DtFD0BPDblazvpMxgZntKC5ZivKq+V1x33gicANMSY5 8m4WDH5RFPk6s9SnXhUZfP90STsZSSPmxBo/Ie5v5KerqCw/f23vKGLztE3m/zaL+6U8 8UnnLCi9lpbU+YKStrPTnWa4QaI7V+xwOZJQmrj0jHhbHPmEFTSyTDfuXj/O1DPv85Ag A8sytJmD4WCO57ukW0dH0zMAwlmhm4GB/efPs0CEVe3eg4ANaKTEcxnZDotX3ZRCiYBz gWpQ== 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=ksR2vY1THtliTY0/cAi22DsEZDFPfpxcdc5Beyt6x/M=; b=ANN4i/hh1z0hjGUhWaR4/HjCV5XQV6ltoKbJbcas/5HH1M4lISSSN//jmTeL40+XPf sl0yxHs6LZHg2Br0dU4fizAn5dQss1v9mOnDuZlDOVmOVq8o+7iyiur1h27QcKdgoTFz 6adFqCRu5q6U4RvBjUI0Sr3c9BZaqhQ1sUDCiI0sLnPNCgSjNMeOLr8/stNVPrmQ47sL xM2Z2B35ZHoWQm2WfVoMlmPOQ8dDNlMYMdBTl6furWsLr1te/9qEWbQzL4kF7ZkTCeif 6k7aQzKevEyZwBPEcY4F0XO3ZlfSuVkMUfS9CFXO/xIcm2OUNzZ/y9GVudLdPf2cqZZ0 LEtA== 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 p5-20020a170902e74500b001ab06251f98si7320593plf.429.2023.06.06.03.08.55; Tue, 06 Jun 2023 03:09:08 -0700 (PDT) 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 S236240AbjFFJ6h (ORCPT + 99 others); Tue, 6 Jun 2023 05:58:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60754 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235078AbjFFJ61 (ORCPT ); Tue, 6 Jun 2023 05:58:27 -0400 X-Greylist: delayed 623 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Tue, 06 Jun 2023 02:58:16 PDT Received: from mail.aspeedtech.com (mail.aspeedtech.com [211.20.114.72]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 08D1C10D2; Tue, 6 Jun 2023 02:58:15 -0700 (PDT) Received: from BillyTsai-pc.aspeed.com (192.168.1.221) by TWMBX02.aspeed.com (192.168.0.24) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 6 Jun 2023 17:43:41 +0800 From: Billy Tsai To: , , , , , , , , , , , , , , , , , , , Subject: [v5 0/5] Support pwm/tach driver for aspeed ast26xx Date: Tue, 6 Jun 2023 17:45:30 +0800 Message-ID: <20230606094535.5388-1-billy_tsai@aspeedtech.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Originating-IP: [192.168.1.221] X-ClientProxiedBy: TWMBX02.aspeed.com (192.168.0.24) To TWMBX02.aspeed.com (192.168.0.24) X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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?1767947525825578629?= X-GMAIL-MSGID: =?utf-8?q?1767947525825578629?= 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 v4: - pwm: - Fix the return type of get_status function. - tach: - read clk source once and re-use it - Remove the constants variables - Allocate tach_channel as array - Use dev->parent - dt-binding: - Fix the order of the patches - Add example and description for tach child node - Remove pwm extension property 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: pwm: Add bindings for aspeed pwm controller dt-bindings: hwmon: Add bindings for aspeed tach controller dt-bindings: mfd: Add aspeed pwm-tach binding pwm: Add Aspeed ast2600 PWM support hwmon: Add Aspeed ast2600 TACH support .../bindings/hwmon/aspeed,ast2600-tach.yaml | 40 ++ .../bindings/mfd/aspeed,ast2600-pwm-tach.yaml | 76 ++++ .../bindings/pwm/aspeed,ast2600-pwm.yaml | 32 ++ Documentation/hwmon/index.rst | 1 + Documentation/hwmon/tach-aspeed-ast2600.rst | 25 ++ drivers/hwmon/Kconfig | 9 + drivers/hwmon/Makefile | 1 + drivers/hwmon/tach-aspeed-ast2600.c | 367 ++++++++++++++++++ drivers/pwm/Kconfig | 10 + drivers/pwm/Makefile | 1 + drivers/pwm/pwm-aspeed-ast2600.c | 319 +++++++++++++++ 11 files changed, 881 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