From patchwork Wed Dec 7 17:37:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saravanan Sekar X-Patchwork-Id: 13067490 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 592C0C352A1 for ; Wed, 7 Dec 2022 18:00:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229777AbiLGSAu (ORCPT ); Wed, 7 Dec 2022 13:00:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33466 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229676AbiLGSAs (ORCPT ); Wed, 7 Dec 2022 13:00:48 -0500 X-Greylist: delayed 1391 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Wed, 07 Dec 2022 10:00:47 PST Received: from gateway22.websitewelcome.com (gateway22.websitewelcome.com [192.185.47.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BB4E35AE35 for ; Wed, 7 Dec 2022 10:00:47 -0800 (PST) Received: from atl1wswcm05.websitewelcome.com (unknown [50.6.129.166]) by atl1wswob02.websitewelcome.com (Postfix) with ESMTP id 9803C13BD0E for ; Wed, 7 Dec 2022 17:37:35 +0000 (UTC) Received: from md-in-79.webhostbox.net ([43.225.55.182]) by cmsmtp with ESMTP id 2yMPpom2hI9C52yMQpLGLE; Wed, 07 Dec 2022 17:37:35 +0000 X-Authority-Reason: nr=8 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=linumiz.com ; s=default; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=yJr3yuqK+1G1bLkCzGBFbDK6G14y9MID0sp5A55GL7k=; b=MS587yx8xANUGZP2zLjcciRHLS sTXl581o/JpWQ6TUtVoyZr2Y2ZEloga7pREZDsQv6UIF6JQqI83VfmySjD9mpbQhtz4v/WaQ11FC/ xhDX6fY5HBy3p5a9J3IPVtP9Pz8DVQbSTpBGuSe24yBa2HmAHRVQYjDumlQnC9ZE3lttJE3EK9WhV HquAH3apc4giwzau0mOKusWm8mHL63u3W0OJhhPIhCnIha+JrTkQXI0Nn/OwaVugqEd2O/0BVIvrr tPQ3PjKeLpYKCWC6Nk7AZJr5BEd+ygRfYlbFUvjXNjN+C8aKSt0miza34ifiVVjLKhLhGvqDlpyHq seRWnVBg==; Received: from [106.222.117.249] (port=8172 helo=discovery..) by md-in-79.webhostbox.net with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1p2yMN-0025qb-So; Wed, 07 Dec 2022 17:37:32 +0000 From: Saravanan Sekar To: jdelvare@suse.com, linux@roeck-us.net, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, marten.lindahl@axis.com Cc: linux-hwmon@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Saravanan Sekar Subject: [PATCH v3 1/4] hwmon: pm_bus: core: Add min_uV in pmbus regulator helper macro Date: Wed, 7 Dec 2022 18:37:13 +0100 Message-Id: <20221207173716.123223-2-saravanan@linumiz.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221207173716.123223-1-saravanan@linumiz.com> References: <20221207173716.123223-1-saravanan@linumiz.com> MIME-Version: 1.0 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - md-in-79.webhostbox.net X-AntiAbuse: Original Domain - vger.kernel.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - linumiz.com X-BWhitelist: no X-Source-IP: 106.222.117.249 X-Source-L: No X-Exim-ID: 1p2yMN-0025qb-So X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: (discovery..) [106.222.117.249]:8172 X-Source-Auth: saravanan@linumiz.com X-Email-Count: 11 X-Source-Cap: bGludW1jbWM7aG9zdGdhdG9yO21kLWluLTc5LndlYmhvc3Rib3gubmV0 X-Local-Domain: yes X-CMAE-Envelope: MS4xfPEpSF4nrFl4MPC2KAbrXd41s0m5vceJi1fgqWLcF0PVVtHWbhjr4Jt48IOpVJW1LhFook1CdWySE0XnZKU07SvvdJHWkQyIKiZxSWzdZQ/ThDwJjFQp I6q6l+QpeHusKeg36G4DGVc9uX8cVnTgzKI6rZOTBscAfl2IljXp/FS72aUsk4kOOMoABMaDDm2lv2e5Im9/Ac8YdX/itjxBgRs= Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@vger.kernel.org Some regulator operates in a range of voltage which should not allow below the lower threshold. Signed-off-by: Saravanan Sekar --- drivers/hwmon/pmbus/ltc2978.c | 16 ++++++++-------- drivers/hwmon/pmbus/pmbus.h | 5 +++-- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/drivers/hwmon/pmbus/ltc2978.c b/drivers/hwmon/pmbus/ltc2978.c index 6d2592731ba3..406a36885ef3 100644 --- a/drivers/hwmon/pmbus/ltc2978.c +++ b/drivers/hwmon/pmbus/ltc2978.c @@ -569,14 +569,14 @@ MODULE_DEVICE_TABLE(i2c, ltc2978_id); #define LTC2978_N_VOLTAGES ((LTC2978_MAX_UV / LTC2978_UV_STEP) + 1) static const struct regulator_desc ltc2978_reg_desc[] = { - PMBUS_REGULATOR_STEP("vout", 0, LTC2978_N_VOLTAGES, LTC2978_UV_STEP), - PMBUS_REGULATOR_STEP("vout", 1, LTC2978_N_VOLTAGES, LTC2978_UV_STEP), - PMBUS_REGULATOR_STEP("vout", 2, LTC2978_N_VOLTAGES, LTC2978_UV_STEP), - PMBUS_REGULATOR_STEP("vout", 3, LTC2978_N_VOLTAGES, LTC2978_UV_STEP), - PMBUS_REGULATOR_STEP("vout", 4, LTC2978_N_VOLTAGES, LTC2978_UV_STEP), - PMBUS_REGULATOR_STEP("vout", 5, LTC2978_N_VOLTAGES, LTC2978_UV_STEP), - PMBUS_REGULATOR_STEP("vout", 6, LTC2978_N_VOLTAGES, LTC2978_UV_STEP), - PMBUS_REGULATOR_STEP("vout", 7, LTC2978_N_VOLTAGES, LTC2978_UV_STEP), + PMBUS_REGULATOR_STEP("vout", 0, LTC2978_N_VOLTAGES, LTC2978_UV_STEP, 0), + PMBUS_REGULATOR_STEP("vout", 1, LTC2978_N_VOLTAGES, LTC2978_UV_STEP, 0), + PMBUS_REGULATOR_STEP("vout", 2, LTC2978_N_VOLTAGES, LTC2978_UV_STEP, 0), + PMBUS_REGULATOR_STEP("vout", 3, LTC2978_N_VOLTAGES, LTC2978_UV_STEP, 0), + PMBUS_REGULATOR_STEP("vout", 4, LTC2978_N_VOLTAGES, LTC2978_UV_STEP, 0), + PMBUS_REGULATOR_STEP("vout", 5, LTC2978_N_VOLTAGES, LTC2978_UV_STEP, 0), + PMBUS_REGULATOR_STEP("vout", 6, LTC2978_N_VOLTAGES, LTC2978_UV_STEP, 0), + PMBUS_REGULATOR_STEP("vout", 7, LTC2978_N_VOLTAGES, LTC2978_UV_STEP, 0), }; static const struct regulator_desc ltc2978_reg_desc_default[] = { diff --git a/drivers/hwmon/pmbus/pmbus.h b/drivers/hwmon/pmbus/pmbus.h index 10fb17879f8e..713ea7915425 100644 --- a/drivers/hwmon/pmbus/pmbus.h +++ b/drivers/hwmon/pmbus/pmbus.h @@ -464,7 +464,7 @@ struct pmbus_driver_info { extern const struct regulator_ops pmbus_regulator_ops; /* Macros for filling in array of struct regulator_desc */ -#define PMBUS_REGULATOR_STEP(_name, _id, _voltages, _step) \ +#define PMBUS_REGULATOR_STEP(_name, _id, _voltages, _step, _min_uV) \ [_id] = { \ .name = (_name # _id), \ .id = (_id), \ @@ -475,9 +475,10 @@ extern const struct regulator_ops pmbus_regulator_ops; .owner = THIS_MODULE, \ .n_voltages = _voltages, \ .uV_step = _step, \ + .min_uV = _min_uV, \ } -#define PMBUS_REGULATOR(_name, _id) PMBUS_REGULATOR_STEP(_name, _id, 0, 0) +#define PMBUS_REGULATOR(_name, _id) PMBUS_REGULATOR_STEP(_name, _id, 0, 0, 0) /* Function declarations */ From patchwork Wed Dec 7 17:37:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saravanan Sekar X-Patchwork-Id: 13067463 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2B10BC47089 for ; Wed, 7 Dec 2022 17:37:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229944AbiLGRho (ORCPT ); Wed, 7 Dec 2022 12:37:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43466 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230031AbiLGRhm (ORCPT ); Wed, 7 Dec 2022 12:37:42 -0500 Received: from gateway34.websitewelcome.com (gateway34.websitewelcome.com [192.185.149.77]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5DC51DA3 for ; Wed, 7 Dec 2022 09:37:38 -0800 (PST) Received: from atl1wswcm02.websitewelcome.com (unknown [50.6.129.163]) by atl3wswob05.websitewelcome.com (Postfix) with ESMTP id 77FC215BDF for ; Wed, 7 Dec 2022 17:37:37 +0000 (UTC) Received: from md-in-79.webhostbox.net ([43.225.55.182]) by cmsmtp with ESMTP id 2yMQpMpVOpVRN2yMSpmBnl; Wed, 07 Dec 2022 17:37:37 +0000 X-Authority-Reason: nr=8 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=linumiz.com ; s=default; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=+5Bpf6w0b7QD/SF/Lp8AD5I90AMS2QjMrFwXHi0/feQ=; b=BMC/0ASwRm4c34g3YXLxQJf8ym nv8V74ujCjzfXEwZAY2JzdDKRyWY5ZozEMwwZpDcmdql2jTSq//V3tlov1u0Wzf6ozsYc0a5jsP3y NlHXqTQD9M5kPFbMHxRRMi1eD1PqtCXBvPLvCyMwc4K3eENYrI9f3EBopyE0NghCsY7aMPR+eBdK5 RygqEg0YSBpaihueTKbypLWiuKNX9q3QjOTfcRqEw1G8LMox+b2EASur4KyobGCeZTyC3hAA2rTcU +/kzYepATjWLE0p+jt8r48nnf3TZo/kuS33X+plwqh9gE0fe5dxvGEXBsJTBxDn9yC60ak0jwFz3+ WFbJqavg==; Received: from [106.222.117.249] (port=8172 helo=discovery..) by md-in-79.webhostbox.net with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1p2yMP-0025qb-ON; Wed, 07 Dec 2022 17:37:33 +0000 From: Saravanan Sekar To: jdelvare@suse.com, linux@roeck-us.net, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, marten.lindahl@axis.com Cc: linux-hwmon@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Saravanan Sekar Subject: [PATCH v3 2/4] dt-bindings: regulator: Add mps,mpq7932 power-management IC Date: Wed, 7 Dec 2022 18:37:14 +0100 Message-Id: <20221207173716.123223-3-saravanan@linumiz.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221207173716.123223-1-saravanan@linumiz.com> References: <20221207173716.123223-1-saravanan@linumiz.com> MIME-Version: 1.0 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - md-in-79.webhostbox.net X-AntiAbuse: Original Domain - vger.kernel.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - linumiz.com X-BWhitelist: no X-Source-IP: 106.222.117.249 X-Source-L: No X-Exim-ID: 1p2yMP-0025qb-ON X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: (discovery..) [106.222.117.249]:8172 X-Source-Auth: saravanan@linumiz.com X-Email-Count: 19 X-Source-Cap: bGludW1jbWM7aG9zdGdhdG9yO21kLWluLTc5LndlYmhvc3Rib3gubmV0 X-Local-Domain: yes X-CMAE-Envelope: MS4xfN/NqocAAo1Kh7i4hRaIZFlnlyovPzquD6F1fbXyEqUFkyMLKd0BlM9lvlIpFbv7O2jTT4j9kmJrWRyHqMNub9J6wDgwoelo/mwMI7rhIZ/phdgoE2FA GUlz63h7uSwilm4luFL7z3184L8vdGVhTJ2kKOgi/Ic4cZ2pkArhYwbJK/PZsnREr/KBF5fK4LzkawcwJZzpPjAZLA4OixXlNQQ= Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@vger.kernel.org Document mpq7932 power-management IC Signed-off-by: Saravanan Sekar Reviewed-by: Krzysztof Kozlowski Acked-by: Guenter Roeck --- .../bindings/regulator/mps,mpq7932.yaml | 68 +++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 Documentation/devicetree/bindings/regulator/mps,mpq7932.yaml diff --git a/Documentation/devicetree/bindings/regulator/mps,mpq7932.yaml b/Documentation/devicetree/bindings/regulator/mps,mpq7932.yaml new file mode 100644 index 000000000000..2185cd011c46 --- /dev/null +++ b/Documentation/devicetree/bindings/regulator/mps,mpq7932.yaml @@ -0,0 +1,68 @@ +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/regulator/mps,mpq7932.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Monolithic Power System MPQ7932 PMIC + +maintainers: + - Saravanan Sekar + +properties: + compatible: + enum: + - mps,mpq7932 + + reg: + maxItems: 1 + + regulators: + type: object + description: | + list of regulators provided by this controller, must be named + after their hardware counterparts BUCK[1-6] + + patternProperties: + "^buck[1-6]$": + type: object + $ref: regulator.yaml# + unevaluatedProperties: false + + additionalProperties: false + +required: + - compatible + - reg + - regulators + +additionalProperties: false + +examples: + - | + i2c { + #address-cells = <1>; + #size-cells = <0>; + + pmic@3 { + compatible = "mps,mpq7932"; + reg = <0x3>; + + regulators { + buck1 { + regulator-name = "buck1"; + regulator-min-microvolt = <1600000>; + regulator-max-microvolt = <1800000>; + regulator-boot-on; + }; + + buck2 { + regulator-name = "buck2"; + regulator-min-microvolt = <1700000>; + regulator-max-microvolt = <1800000>; + regulator-boot-on; + }; + }; + }; + }; +... From patchwork Wed Dec 7 17:37:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saravanan Sekar X-Patchwork-Id: 13067464 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CCE3CC352A1 for ; Wed, 7 Dec 2022 17:37:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230046AbiLGRhw (ORCPT ); Wed, 7 Dec 2022 12:37:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43732 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230052AbiLGRhp (ORCPT ); Wed, 7 Dec 2022 12:37:45 -0500 Received: from gateway33.websitewelcome.com (gateway33.websitewelcome.com [192.185.145.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E20D326118 for ; Wed, 7 Dec 2022 09:37:39 -0800 (PST) Received: from atl1wswcm01.websitewelcome.com (unknown [50.6.129.162]) by atl4wswob04.websitewelcome.com (Postfix) with ESMTP id 3F5ED773B for ; Wed, 7 Dec 2022 17:37:39 +0000 (UTC) Received: from md-in-79.webhostbox.net ([43.225.55.182]) by cmsmtp with ESMTP id 2yMSpBIsfDsCK2yMUpG6HK; Wed, 07 Dec 2022 17:37:39 +0000 X-Authority-Reason: nr=8 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=linumiz.com ; s=default; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=wVWfEFOzMBLqUL1rWpwXsPoqdXN3/xrh+/ZFlA2PqQY=; b=jQWoOEFTbqzGXAMBYgoDkezzCN NnyMmO76yahFPgu4Bndu14s3LzXcFzrLR9czGAqwheo0AIySfMHP85ExTuGSk3DEZCNqRePP+q+N5 g9riiRllElpCFYhsKhi1eMBHGoHRKLaOxeOmCbnUkZ2pHeOTb3+Xo1TSFARDtAFQOJ1XPdsC/mFIp JworZ6d2CzzzMHiQYQA00EBN5OiKiOUApvMMQ47YRV6aShl1udkZ1F43EYIqYUT6PDcJZ9ZdjlAl1 SBnTjHSzQSgmoNCJeBTqxI9t910pzpjfa8PlpdUXYKdYn9ZvExxweUhc3YdDDP3IC+kC3p+H1m/Ul Ig6aTTuQ==; Received: from [106.222.117.249] (port=8172 helo=discovery..) by md-in-79.webhostbox.net with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1p2yMR-0025qb-98; Wed, 07 Dec 2022 17:37:35 +0000 From: Saravanan Sekar To: jdelvare@suse.com, linux@roeck-us.net, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, marten.lindahl@axis.com Cc: linux-hwmon@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Saravanan Sekar Subject: [PATCH v3 3/4] hwmon: (pmbus/mpq7932) Add a support for mpq7932 Power Management IC Date: Wed, 7 Dec 2022 18:37:15 +0100 Message-Id: <20221207173716.123223-4-saravanan@linumiz.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221207173716.123223-1-saravanan@linumiz.com> References: <20221207173716.123223-1-saravanan@linumiz.com> MIME-Version: 1.0 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - md-in-79.webhostbox.net X-AntiAbuse: Original Domain - vger.kernel.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - linumiz.com X-BWhitelist: no X-Source-IP: 106.222.117.249 X-Source-L: No X-Exim-ID: 1p2yMR-0025qb-98 X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: (discovery..) [106.222.117.249]:8172 X-Source-Auth: saravanan@linumiz.com X-Email-Count: 27 X-Source-Cap: bGludW1jbWM7aG9zdGdhdG9yO21kLWluLTc5LndlYmhvc3Rib3gubmV0 X-Local-Domain: yes X-CMAE-Envelope: MS4xfJUxUcNCd68Od9WoFuZxP0QTplCbMgVSew/Kpf5jiESwWdfSDq9jnVT0cxXPy3MpwiIznXYkkeWm3nlsFUFMmkulIeeBNUVr1+zdtDp5NLOROaU3hpVE mX/yCGJyrERMbGCtEYcZIp/aOQqcuowCrk3FGaxwXZ67cPb4QoWYhLdMigCCxWlwyrgx0rzSA9Zw3DWnUAYloCEM+2Bx5Ys9H04= Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@vger.kernel.org The MPQ7932 is a power management IC designed to operate from 5V buses to power a variety of Advanced driver-assistance system SOCs. Six integrated buck converters with hardware monitoring capability powers a variety of target rails configurable over PMBus interface. Signed-off-by: Saravanan Sekar --- drivers/hwmon/pmbus/Kconfig | 16 ++++ drivers/hwmon/pmbus/Makefile | 1 + drivers/hwmon/pmbus/mpq7932.c | 153 ++++++++++++++++++++++++++++++++++ 3 files changed, 170 insertions(+) create mode 100644 drivers/hwmon/pmbus/mpq7932.c diff --git a/drivers/hwmon/pmbus/Kconfig b/drivers/hwmon/pmbus/Kconfig index 89668af67206..30448e049486 100644 --- a/drivers/hwmon/pmbus/Kconfig +++ b/drivers/hwmon/pmbus/Kconfig @@ -317,6 +317,22 @@ config SENSORS_MP5023 This driver can also be built as a module. If so, the module will be called mp5023. +config SENSORS_MPQ7932_REGULATOR + bool "Regulator support for MPQ7932" + depends on SENSORS_MPQ7932 && REGULATOR + help + If you say yes here you get six integrated buck converter regulator + support for power management IC MPS MPQ7932. + +config SENSORS_MPQ7932 + tristate "MPS MPQ7932" + help + If you say yes here you get hardware monitoring functionality support + for power management IC MPS MPQ7932. + + This driver can also be built as a module. If so, the module will + be called mpq7932. + config SENSORS_PIM4328 tristate "Flex PIM4328 and compatibles" help diff --git a/drivers/hwmon/pmbus/Makefile b/drivers/hwmon/pmbus/Makefile index 0002dbe22d52..d9d2fa4bd6f7 100644 --- a/drivers/hwmon/pmbus/Makefile +++ b/drivers/hwmon/pmbus/Makefile @@ -34,6 +34,7 @@ obj-$(CONFIG_SENSORS_MAX8688) += max8688.o obj-$(CONFIG_SENSORS_MP2888) += mp2888.o obj-$(CONFIG_SENSORS_MP2975) += mp2975.o obj-$(CONFIG_SENSORS_MP5023) += mp5023.o +obj-$(CONFIG_SENSORS_MPQ7932) += mpq7932.o obj-$(CONFIG_SENSORS_PLI1209BC) += pli1209bc.o obj-$(CONFIG_SENSORS_PM6764TR) += pm6764tr.o obj-$(CONFIG_SENSORS_PXE1610) += pxe1610.o diff --git a/drivers/hwmon/pmbus/mpq7932.c b/drivers/hwmon/pmbus/mpq7932.c new file mode 100644 index 000000000000..1dc1ab71957b --- /dev/null +++ b/drivers/hwmon/pmbus/mpq7932.c @@ -0,0 +1,153 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * mpq7932.c - hwmon with optional regulator driver for mps mpq7932 + * Copyright 2022 Monolithic Power Systems, Inc + * + * Author: Saravanan Sekar + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include "pmbus.h" + +#define MPQ7932_BUCK_UV_MIN 206250 +#define MPQ7932_UV_STEP 6250 +#define MPQ7932_N_VOLTAGES 256 +#define MPQ7932_VOUT_MAX 0xFF +#define MPQ7932_NUM_PAGES 6 + +#define MPQ7932_TON_DELAY 0x60 +#define MPQ7932_VOUT_STARTUP_SLEW 0xA3 +#define MPQ7932_VOUT_SHUTDOWN_SLEW 0xA5 +#define MPQ7932_VOUT_SLEW_MASK GENMASK(1, 0) +#define MPQ7932_TON_DELAY_MASK GENMASK(4, 0) + +struct mpq7932_data { + struct pmbus_driver_info info; + struct pmbus_platform_data pdata; +}; + +#if IS_ENABLED(CONFIG_SENSORS_MPQ7932_REGULATOR) +static struct regulator_desc mpq7932_regulators_desc[] = { + PMBUS_REGULATOR_STEP("buck", 0, MPQ7932_N_VOLTAGES, + MPQ7932_UV_STEP, MPQ7932_BUCK_UV_MIN), + PMBUS_REGULATOR_STEP("buck", 1, MPQ7932_N_VOLTAGES, + MPQ7932_UV_STEP, MPQ7932_BUCK_UV_MIN), + PMBUS_REGULATOR_STEP("buck", 2, MPQ7932_N_VOLTAGES, + MPQ7932_UV_STEP, MPQ7932_BUCK_UV_MIN), + PMBUS_REGULATOR_STEP("buck", 3, MPQ7932_N_VOLTAGES, + MPQ7932_UV_STEP, MPQ7932_BUCK_UV_MIN), + PMBUS_REGULATOR_STEP("buck", 4, MPQ7932_N_VOLTAGES, + MPQ7932_UV_STEP, MPQ7932_BUCK_UV_MIN), + PMBUS_REGULATOR_STEP("buck", 5, MPQ7932_N_VOLTAGES, + MPQ7932_UV_STEP, MPQ7932_BUCK_UV_MIN), +}; +#endif + +static int mpq7932_write_word_data(struct i2c_client *client, int page, int reg, + u16 word) +{ + switch (reg) { + /* chip support only byte access for VOUT_COMMAND otherwise + * results -EREMOTEIO + */ + case PMBUS_VOUT_COMMAND: + return pmbus_write_byte_data(client, page, reg, word & 0xFF); + + default: + return -ENODATA; + } +} + +static int mpq7932_read_word_data(struct i2c_client *client, int page, + int phase, int reg) +{ + switch (reg) { + /* chip support neither (PMBUS_VOUT_MARGIN_HIGH, PMBUS_VOUT_MARGIN_LOW) + * nor (PMBUS_MFR_VOUT_MIN, PMBUS_MFR_VOUT_MAX). As a result set voltage + * fails due to error in pmbus_regulator_get_low_margin, so faked. + */ + case PMBUS_MFR_VOUT_MIN: + return 0; + + case PMBUS_MFR_VOUT_MAX: + return MPQ7932_VOUT_MAX; + + /* chip support only byte access for VOUT_COMMAND otherwise + * results -EREMOTEIO + */ + case PMBUS_READ_VOUT: + return pmbus_read_byte_data(client, page, PMBUS_VOUT_COMMAND); + + default: + return -ENODATA; + } +} + +static int mpq7932_probe(struct i2c_client *client) +{ + struct mpq7932_data *data; + struct pmbus_driver_info *info; + struct device *dev = &client->dev; + int i; + + data = devm_kzalloc(dev, sizeof(struct mpq7932_data), GFP_KERNEL); + if (!data) + return -ENOMEM; + + info = &data->info; + info->pages = MPQ7932_NUM_PAGES; + info->format[PSC_VOLTAGE_OUT] = direct; + info->m[PSC_VOLTAGE_OUT] = 160; + info->b[PSC_VOLTAGE_OUT] = -33; + for (i = 0; i < info->pages; i++) { + info->func[i] = PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT + | PMBUS_HAVE_STATUS_TEMP; + } + +#if IS_ENABLED(CONFIG_SENSORS_MPQ7932_REGULATOR) + info->num_regulators = ARRAY_SIZE(mpq7932_regulators_desc); + info->reg_desc = mpq7932_regulators_desc; +#endif + + info->read_word_data = mpq7932_read_word_data; + info->write_word_data = mpq7932_write_word_data; + + data->pdata.flags = PMBUS_NO_CAPABILITY; + dev->platform_data = &data->pdata; + + return pmbus_do_probe(client, info); +} + +static const struct of_device_id mpq7932_of_match[] = { + { .compatible = "mps,mpq7932"}, + {}, +}; +MODULE_DEVICE_TABLE(of, mpq7932_of_match); + +static const struct i2c_device_id mpq7932_id[] = { + { "mpq7932", }, + { }, +}; +MODULE_DEVICE_TABLE(i2c, mpq7932_id); + +static struct i2c_driver mpq7932_regulator_driver = { + .driver = { + .name = "mpq7932", + .of_match_table = mpq7932_of_match, + }, + .probe_new = mpq7932_probe, + .id_table = mpq7932_id, +}; +module_i2c_driver(mpq7932_regulator_driver); + +MODULE_AUTHOR("Saravanan Sekar "); +MODULE_DESCRIPTION("MPQ7932 PMIC regulator driver"); +MODULE_LICENSE("GPL"); +MODULE_IMPORT_NS(PMBUS); From patchwork Wed Dec 7 17:37:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saravanan Sekar X-Patchwork-Id: 13067533 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B0E63C47089 for ; Wed, 7 Dec 2022 18:55:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229470AbiLGSzV (ORCPT ); Wed, 7 Dec 2022 13:55:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57030 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229734AbiLGSzU (ORCPT ); Wed, 7 Dec 2022 13:55:20 -0500 Received: from gateway36.websitewelcome.com (gateway36.websitewelcome.com [50.116.124.69]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 57A956E545 for ; Wed, 7 Dec 2022 10:55:18 -0800 (PST) Received: from atl1wswcm01.websitewelcome.com (unknown [50.6.129.162]) by atl3wswob06.websitewelcome.com (Postfix) with ESMTP id 41749A75A for ; Wed, 7 Dec 2022 17:37:41 +0000 (UTC) Received: from md-in-79.webhostbox.net ([43.225.55.182]) by cmsmtp with ESMTP id 2yMUpBIvRDsCK2yMWpG6KP; Wed, 07 Dec 2022 17:37:41 +0000 X-Authority-Reason: nr=8 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=linumiz.com ; s=default; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=efIW6hYLqncAPSwH8N/keo9ht9eCT94RVCVQpGph/EU=; b=IlO2ZhGRDhAUWELkp0cP9iD2dg z4hkWig6r8qCAuIaS2QPqqQObUPCCp3rRq3RfUnajSp3Is8o3AlAbY9QDKPS8405K/IrDzlxMb90l 7EgUDuMYWOJ76rvYl0NVsyy1KkoRbI3MPXRnCy+Hp8Tqq/zLaroejwDRSuK/LWVq45mJ4GfEklE6A z4f4D/GLfIJ3QQIVf+42IGw4v7rqUMmLKe2Wg5Tzmp5te2EfVeAo0Az4/1435gWQ3YgDJd+blhl+2 ffW58qs83zD6tJ/8bcRO4Z4qq502ghyP8/xu7P226Gs8ZePG7vh3DpF08jaohyN4tIlSQ4PDYFcrh gfUuKU2Q==; Received: from [106.222.117.249] (port=8172 helo=discovery..) by md-in-79.webhostbox.net with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1p2yMT-0025qb-AU; Wed, 07 Dec 2022 17:37:37 +0000 From: Saravanan Sekar To: jdelvare@suse.com, linux@roeck-us.net, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, marten.lindahl@axis.com Cc: linux-hwmon@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Saravanan Sekar Subject: [PATCH v3 4/4] MAINTAINERS: Update the entry for MPQ7932 PMIC driver Date: Wed, 7 Dec 2022 18:37:16 +0100 Message-Id: <20221207173716.123223-5-saravanan@linumiz.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221207173716.123223-1-saravanan@linumiz.com> References: <20221207173716.123223-1-saravanan@linumiz.com> MIME-Version: 1.0 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - md-in-79.webhostbox.net X-AntiAbuse: Original Domain - vger.kernel.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - linumiz.com X-BWhitelist: no X-Source-IP: 106.222.117.249 X-Source-L: No X-Exim-ID: 1p2yMT-0025qb-AU X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: (discovery..) [106.222.117.249]:8172 X-Source-Auth: saravanan@linumiz.com X-Email-Count: 35 X-Source-Cap: bGludW1jbWM7aG9zdGdhdG9yO21kLWluLTc5LndlYmhvc3Rib3gubmV0 X-Local-Domain: yes X-CMAE-Envelope: MS4xfEG7uhppEGHul1tdTeFfWaggaglTEZSDqjuiRJmxgl9deVH4b9kGbFyCcaYmbHeH1hdOHmLEki+c2wHa0ZqrrphUd/f/2ezg5BOajkhxlY1lFIyVNWpd JHGTFiev8fgE/MRf1Gqup/pyEtcesbDfW1unxviQBgp1oLAejID4aEVxf4WaIYMgf8s1k99zEKAVb3mPeC9bYmjHGYK77YQs8oU= Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@vger.kernel.org Update the MAINTAINERS file to include the path for the MPQ7932 Signed-off-by: Saravanan Sekar --- MAINTAINERS | 1 + 1 file changed, 1 insertion(+) diff --git a/MAINTAINERS b/MAINTAINERS index 1daadaa4d48b..469ff520c479 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -13932,6 +13932,7 @@ M: Saravanan Sekar S: Maintained F: Documentation/devicetree/bindings/mfd/mps,mp2629.yaml F: Documentation/devicetree/bindings/regulator/mps,mp*.yaml +F: drivers/hwmon/pmbus/mpq7932.c F: drivers/iio/adc/mp2629_adc.c F: drivers/mfd/mp2629.c F: drivers/power/supply/mp2629_charger.c