From patchwork Thu Jun 8 02:18:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Billy Tsai X-Patchwork-Id: 10457 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp616851vqr; Wed, 7 Jun 2023 19:20:34 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6Z5ETYhBpiMWl3eFiZQq+Trtwb9m89YcfjKcgu2eeiUr8pTyMWINqas/B26hsupJLsEZ4h X-Received: by 2002:a05:6a21:3a8e:b0:114:6390:db06 with SMTP id zv14-20020a056a213a8e00b001146390db06mr2749660pzb.32.1686190834279; Wed, 07 Jun 2023 19:20:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686190834; cv=none; d=google.com; s=arc-20160816; b=pGSmnI3KMh0IpORO8B1O0W3QAAzRAg/R3+S4UEg9IicRQfs3/eqq+wUHUF3s22mRM2 Cd1YTroNQJGuql01CRRUNRKIxrQfRI78rfBGUZ/BPYusXnTip+l+EtlfCtyidAElR5o/ ztSpN4M0hwg5KHx/OW/VNXYJy/dy5TqqxchyPuXEEU+y+jvHP8Vaqbi2QykBBDpBztDM tOL8mk4Lach3RwRkzCtiGZTbVRpiAvJGceAYhr0aCzaAJ4tTvSEr06G+DLhNzArwgjeU lN3i1AAKhx4PiSBnwuzgnfgPTpS7YMBB6L59spVoMG4rbp3giOTEX41aslIQs/75SuqI 4PBA== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ku11-20020a170903288b00b001b02bd00c73si288679plb.253.2023.06.07.19.19.56; Wed, 07 Jun 2023 19:20:34 -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 S232466AbjFHCQa (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 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?1768099240394294261?= X-GMAIL-MSGID: =?utf-8?q?1768099240394294261?= 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