Received: by 2002:a05:7412:cfc7:b0:fc:a2b0:25d7 with SMTP id by7csp2277510rdb; Wed, 21 Feb 2024 02:40:52 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVk9+4avul7uTLzocsDYd5FNM5CgWiKZZ7eBdCpgYDJaCXRuSOOatThO53M49ErsSkZEwMQLECfSN9Iy3RyAYwhjwBKBV/xqN0MvSek2w== X-Google-Smtp-Source: AGHT+IGZVyC+xszpQvOfhmxJmPx6ecn3hz77Q59lrKm9NCejmkuyZEsocpjdARxKE0TYFLoGy9d3 X-Received: by 2002:a17:903:32cc:b0:1dc:157e:456a with SMTP id i12-20020a17090332cc00b001dc157e456amr5102255plr.49.1708512052257; Wed, 21 Feb 2024 02:40:52 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708512052; cv=pass; d=google.com; s=arc-20160816; b=ldK75fdHjcNO6h5FOH8qg1I72vO2ZTgyi07LWlx4hqUlEKECVZwQfE149L1GjrIdhm eWV6pSg0PpdsiRcMTHfLvp7SFuwHj0KCzZ7Eu3IjymN1dvTNDM/oxUuX88Danmpjo1c5 0h+6UBTbDZmSkO+xD2tUbc5Z+VBczW4THs26L+19u/20fBEY0Op4+sVcdAaWgoJHZLzB bGSgsbT9Iaf6aSLa1J0RBzUs/EMPrFU1okVeJBE8uYT0qq5GLVbNK+XvMAfS9fR7ZKrd haBboLoeJd5KMf1EbuTYXMk7gTsT1pRyRAFpET7ZjpqL29yw+7e5mwd11qq8UpbIcZh3 Sfbw== 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=29K1mxVkS5rDGY4PQ77ltSbVHfnSatMNhNxJlB/d3I8=; fh=yG/Sq/nLl7aMDg/n2Y1bmzSERdymmbUVMNDjVaZ8TwY=; b=ldXAQ/ZeSd0dIKtIBZPGNqljtKr9Vrn870mao3yUxPG6o4G8t1ynKB368lwk/r59fq pxTw56+lGOabgQxvBVJFQLC9nMFUN7f/bZvKj07E+RwPgnWCG3/8iGMI1iMMKkWf67Px wqrOhxyj9xgqcPPaTxv4EzsV4Z6QJGPZKAru0VW0K4AUKQPpkGOnTY3GGB+qI3MfSonI N7HnCeXLNzHfSZyeoX4I6cHy16tofG/6KSeW1JIOzCziJAUhES21jUebbK+e3ba1smO0 4GSw8BaUQtDhiSr9DbMst2+wHnbkbjGoQDi/6fOpi6TcmWpbj1D/YS1d9mkbdw1cco1V 4M0g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-74549-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-74549-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=aspeedtech.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id k16-20020a170902d59000b001dbe4001529si6146603plh.214.2024.02.21.02.40.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Feb 2024 02:40:52 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-74549-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-74549-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-74549-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id F2D2B282FCB for ; Wed, 21 Feb 2024 10:40:51 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B597B381A8; Wed, 21 Feb 2024 10:40:40 +0000 (UTC) Received: from TWMBX01.aspeed.com (211-20-114-70.hinet-ip.hinet.net [211.20.114.70]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 18C5E442A; Wed, 21 Feb 2024 10:40:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=211.20.114.70 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708512040; cv=none; b=Li5nqS8jl4wv2F5JEg7KTShS7Wc91MUQkKkXpBYY2GbtHNe7BZHv3CV8l5j1dbKws00nYAoOqR8zQRMTE5qEupqrPjkli3eaFg87WSt020WiOdCvIa4rUG5VccOCe3Psd/Nj4OJXjeDyJNkD4lfUZrz33smc37NbBojjGU6qeF0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708512040; c=relaxed/simple; bh=ZYQUxHkonFhaXRGYDsoLklvyyCireBnJY2HZQ4MAHEw=; h=From:To:Subject:Date:Message-ID:MIME-Version:Content-Type; b=jmqB7mpLJ9fHOJLBbP599gtVaHC0sGwliMdeKy1qnQwFbtvMuQY1Lr8uRuu8kBPuYcD6M9Pj1wdfl4kuIK3yHEdW9tQ3Cl83U1zYvJ96s/Cr2sTNfaqvfQgA+tWkx93dgj4kVl1eCWRWn4Sc7gDH40qZuZPZbv3lfad5QSoavP4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=aspeedtech.com; spf=fail smtp.mailfrom=aspeedtech.com; arc=none smtp.client-ip=211.20.114.70 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=aspeedtech.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=aspeedtech.com Received: from TWMBX02.aspeed.com (192.168.0.24) by TWMBX01.aspeed.com (192.168.0.124) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.2.1258.12; Wed, 21 Feb 2024 18:41:17 +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, 21 Feb 2024 18:40:27 +0800 From: Billy Tsai To: , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v14 0/3] Support pwm/tach driver for aspeed ast26xx Date: Wed, 21 Feb 2024 18:40:22 +0800 Message-ID: <20240221104025.1306227-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 v13: Restore Rob's "Reviewed-by" for fan-common.yaml. Remove the compatible string in the dts example in aspeed,g6-pwm-tach.yaml. Utilize devm_add_action_or_reset() to assert the reset. Resolve the compiler error. 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 | 71 +++ .../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 | 549 ++++++++++++++++++ 7 files changed, 738 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