Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp58824rwd; Wed, 7 Jun 2023 19:20:09 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4K1+pOMOXG3UYt28OgvG/Z4MmmiRxi+Biv9b2eDASl3eaq1a6s2nQBcysGb6tKpzTn/tBc X-Received: by 2002:a05:6a20:e68d:b0:117:c0a5:5f39 with SMTP id mz13-20020a056a20e68d00b00117c0a55f39mr3026075pzb.29.1686190808665; Wed, 07 Jun 2023 19:20:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686190808; cv=none; d=google.com; s=arc-20160816; b=xEcIaL9P4dCHpTIVSaY0RByVIGAI7/s7j060/tmn2dgmO4WDrLKfyXpp0TUziaXHm3 S2Nmm/aW1b/Xtb/GrsrHzj1NGjuzBWWTmksQVCbzlM2H2JkhZGht8RtLpcQ3pd19bZKA ucfH0oitS4qvsxw01nUmBd94i9a5aZWPR2GTtuINA+0LvjPDxrL+qlkO756NHteIv2dv KzzfFD81KGIqq6f92sLm2FpsdgSifE29y3xe7H6W1I6ygJePbIQHAhlBtYWGviwqN7Ff tM0x/6lvFM7OsV5gPDhZd92yWAB2J/c9qWWAwl5zhHepHjFAzYcKNzwY74d+jswMNsEQ 4rIw== 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=25eZ21Z9ltMd1hRpKi1aplewMvszFp9lxBM/euw5eKc=; b=U1QfNnPyXMhGWYzCSNeB/Z/KkGaxwo8S+pUH31h1dNMfrzyuji4SKSPzJS0d6xLVej teyxoXkW7119RUazuNTDYfRZWPWzWYMEaA6J2ZoDZcSy+AHEmdwqS6AiC2ZWKbLWMghO 2fZqCtt93shk6Y2zJbSJYb/5WhdWDJbDFm2p/vbL88EsLN7P3hvBKyJaGMnhNC1QDqQg 8mLQlxis0k/r66walLmefCgj0WhrDpOq/8nqN7H3jtj4UNKDWI7PMVenZHvrHdj+vQ/6 /EcMTEw+if9G8k+dijtBHHOkfieq5TMDAdBLWHRMdwgPNUw9ITf1DIt48tUaSTdrorD5 Ih2Q== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c18-20020a170902f31200b001a69d1be184si255876ple.506.2023.06.07.19.19.54; Wed, 07 Jun 2023 19:20: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 S233162AbjFHCQa (ORCPT + 99 others); Wed, 7 Jun 2023 22:16:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36442 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229454AbjFHCQ2 (ORCPT ); Wed, 7 Jun 2023 22:16:28 -0400 Received: from mail.aspeedtech.com (mail.aspeedtech.com [211.20.114.72]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B5B471984; Wed, 7 Jun 2023 19:16:25 -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; Thu, 8 Jun 2023 10:16:21 +0800 From: Billy Tsai To: , , , , , , , , , , , , , , , , , , Subject: [v6 0/4] Support pwm/tach driver for aspeed ast26xx Date: Thu, 8 Jun 2023 10:18:35 +0800 Message-ID: <20230608021839.12769-1-billy_tsai@aspeedtech.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII 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 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 v5: - pwm/tach: - Remove the utilization of common resources from the parent node. - Change the concept to 16 PWM/TACH controllers, each with one channel, instead of 1 PWM/TACH controller with 16 channels. - dt-binding: - Eliminate the usage of simple-mfd. 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 (4): dt-bindings: pwm: Add ASPEED PWM Control documentation dt-bindings: hwmon: Add ASPEED TACH Control documentation pwm: Add Aspeed ast2600 PWM support hwmon: Add Aspeed ast2600 TACH support .../bindings/hwmon/aspeed,ast2600-tach.yaml | 32 ++ .../bindings/pwm/aspeed,ast2600-pwm.yaml | 38 +++ Documentation/hwmon/index.rst | 1 + Documentation/hwmon/tach-aspeed-ast2600.rst | 25 ++ drivers/hwmon/Kconfig | 10 + drivers/hwmon/Makefile | 1 + drivers/hwmon/tach-aspeed-ast2600.c | 305 +++++++++++++++++ drivers/pwm/Kconfig | 10 + drivers/pwm/Makefile | 1 + drivers/pwm/pwm-aspeed-ast2600.c | 309 ++++++++++++++++++ 10 files changed, 732 insertions(+) create mode 100644 Documentation/devicetree/bindings/hwmon/aspeed,ast2600-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 -- 2.25.1