Received: by 2002:a05:7412:5112:b0:fa:6e18:a558 with SMTP id fm18csp929500rdb; Tue, 23 Jan 2024 22:16:39 -0800 (PST) X-Google-Smtp-Source: AGHT+IEm7yai1ZKjxDuwCUhZzssn9VQ2eNUI63n/q1ChiRcz2qvw6GvsjXISXfvCOLv1uFOYWJrN X-Received: by 2002:a17:906:3089:b0:a28:e0aa:48d0 with SMTP id 9-20020a170906308900b00a28e0aa48d0mr808599ejv.3.1706076999006; Tue, 23 Jan 2024 22:16:39 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706076998; cv=pass; d=google.com; s=arc-20160816; b=UITb6i308Tu68M14mvSUSWf6dNqDy0V1ySuFQBbaawZpI+/KZeF7aQnVZTno1itjul oQUpwE0/wyVCQIDiyvCxN6BtQdGQ+izdW4g7KBn2lgrs8306agYFeQPwVWysCdQuUHi0 z8MRIVw+di5ab+MQzqZ3xvNsyz68bEmcDi+ztr2sC6Z22V9HkKhqAS+EawjN2BkJG+5N S4ty0/Qh+soPB4wFvJ4BRiQfYvb7+2a8pW2+XTG056yAisDg+mD7NwELbAuxJgJqvJai 0pOpvthi2fvGbFjSqW3zydJhN7YycxgMZqEWkBt9doajXnj3Zu0DxNgm6vHFa4cTN5bI Dtpg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:to:from; bh=5mUlxBC6Q5tsDEsWWqTtk3aV2VGOLnHdsS3xm28FLg0=; fh=yG/Sq/nLl7aMDg/n2Y1bmzSERdymmbUVMNDjVaZ8TwY=; b=qz4mHwAXPeHDgNoBVUkHFpAnM/2BH9vx28fLUFxtvFecltErnSBU+SV54hatsRrnn8 zLgtR1C9xueao936lE4OXzm/AsolXK9vTz5z1yo2nhcW18qa25Fafn6RELg5zL3esEw2 39fUvOtPue5xay6W4Kdo28Enm+x8ibjRYvxYlFUBwhOZpdLpvcbiuGz23thw5mCZFOMD vc1xxPrKdF4QVW3opAKSAxICeBJNClnN4jHJNj5osC3MST4kjIwNaV976sTZAicNfJmH gGThhXJSl3OzKClvQs7WENstwIuNNVtLnxB+qua5NesKDQ+H3DWauXW9bRQkwRirAbuq RamQ== ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=aspeedtech.com dmarc=pass fromdomain=aspeedtech.com); spf=pass (google.com: domain of linux-kernel+bounces-36499-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-36499-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=aspeedtech.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id v6-20020a509546000000b005533e54351asi13120448eda.452.2024.01.23.22.16.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Jan 2024 22:16:38 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-36499-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=aspeedtech.com dmarc=pass fromdomain=aspeedtech.com); spf=pass (google.com: domain of linux-kernel+bounces-36499-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-36499-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=aspeedtech.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 1FE121F2C41A for ; Wed, 24 Jan 2024 06:07:32 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0541BF9D1; Wed, 24 Jan 2024 06:07:22 +0000 (UTC) Received: from TWMBX02.aspeed.com (mail.aspeedtech.com [211.20.114.72]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A3BADF4F3; Wed, 24 Jan 2024 06:07:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=211.20.114.72 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706076441; cv=none; b=LmH7wAR6s7rKKoiVGsPGQCw/jZveFZ0A+zX+Fh+rw+H9yrkEXJ/A6rj5o2zWTvcMtpJxThgl6rZoQvxKIdKrL63wH8lbQ1XmO1E+7/lqT2LUgLuB1KxmO8+XdH4NCsXXWxG9VC9qklE3II6rEwulPAYrRU2fq1Bgrc1jsH5FxEI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706076441; c=relaxed/simple; bh=Kc1d2j+jkCpcf2qdDVWfdgxdZfcLEBWFJISvlWZjS64=; h=From:To:Subject:Date:Message-ID:MIME-Version:Content-Type; b=Q3dSKrbOJo6KzVvzPw9oo4WhxV1uHgN0oC2Sowb9Qo3RP3+zn0ORgFCYBAoqvXSqVQL1kZi3narT5oMg0JqHxcQ1vEC2y8+N0QMtTszgnb+kedyz9sQ6oSzoGNYNfC2BEQkcK1+FAdP0ub1rzXw0Ko7fA2iZ0ReWWCBq7IbqDnU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=aspeedtech.com; spf=pass smtp.mailfrom=aspeedtech.com; arc=none smtp.client-ip=211.20.114.72 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=aspeedtech.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=aspeedtech.com Received: from TWMBX03.aspeed.com (192.168.0.62) by TWMBX02.aspeed.com (192.168.0.24) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 24 Jan 2024 14:07:08 +0800 Received: from TWMBX02.aspeed.com (192.168.0.24) by TWMBX03.aspeed.com (192.168.0.62) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 24 Jan 2024 14:07:34 +0800 Received: from twmbx02.aspeed.com (192.168.10.10) by TWMBX02.aspeed.com (192.168.0.24) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Wed, 24 Jan 2024 14:07:07 +0800 From: Billy Tsai To: , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v13 0/3] Support pwm/tach driver for aspeed ast26xx Date: Wed, 24 Jan 2024 14:07:02 +0800 Message-ID: <20240124060705.1342461-1-billy_tsai@aspeedtech.com> X-Mailer: git-send-email 2.25.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain 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. This driver implements them by exposing two kernel subsystems: PWM and HWMON. The PWM subsystem can be utilized alongside existing drivers for controlling elements such as fans (pwm-fan.c), beepers (pwm-beeper.c) and so on. Through the HWMON subsystem, the driver provides sysfs interfaces for fan. Changes since v12: Merge the pwm-fan configure information into the fan node. Add the of_platform_populate function to the driver to treat the child node as a platform device. Changes since v11: Fix the compiler error of the driver. The owner member has to be moved to struct pwm_chip. Changes since v10: Add the enum for the 'fan-driving-mode' properties in the fan-common.yaml. Changes since v9: Change the type of fan-driving-mode to string Fix some typos and formatting issues. Changes since v8: Fix the fail of fan div register setting. (FIELD_GET -> FIELD_PREP) Change the type of tach-ch from uint32_t to uint8-array Add additional properties and apply constraints to certain properties. Changes since v7: Cherry-pick the fan-common.yaml and add the following properties: - min-rpm - div - mode - tach-ch Fix the warning which is reported by the kernel test robot. Changes since v6: Consolidate the PWM and TACH functionalities into a unified driver. 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 (2): dt-bindings: hwmon: Support Aspeed g6 PWM TACH Control hwmon: (aspeed-g6-pwm-tacho): Support for ASPEED g6 PWM/Fan tach Naresh Solanki (1): dt-bindings: hwmon: fan: Add fan binding to schema .../bindings/hwmon/aspeed,g6-pwm-tach.yaml | 73 +++ .../devicetree/bindings/hwmon/fan-common.yaml | 79 +++ Documentation/hwmon/aspeed-g6-pwm-tach.rst | 26 + Documentation/hwmon/index.rst | 1 + drivers/hwmon/Kconfig | 11 + drivers/hwmon/Makefile | 1 + drivers/hwmon/aspeed-g6-pwm-tach.c | 540 ++++++++++++++++++ 7 files changed, 731 insertions(+) create mode 100644 Documentation/devicetree/bindings/hwmon/aspeed,g6-pwm-tach.yaml create mode 100644 Documentation/devicetree/bindings/hwmon/fan-common.yaml create mode 100644 Documentation/hwmon/aspeed-g6-pwm-tach.rst create mode 100644 drivers/hwmon/aspeed-g6-pwm-tach.c -- 2.25.1