From patchwork Thu Dec 1 04:46:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saravanan Sekar X-Patchwork-Id: 13060977 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 A7AD9C4321E for ; Thu, 1 Dec 2022 05:09:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229627AbiLAFJh (ORCPT ); Thu, 1 Dec 2022 00:09:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37302 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229515AbiLAFJg (ORCPT ); Thu, 1 Dec 2022 00:09:36 -0500 X-Greylist: delayed 1355 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Wed, 30 Nov 2022 21:09:36 PST Received: from gateway33.websitewelcome.com (gateway33.websitewelcome.com [192.185.145.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3FA3197921 for ; Wed, 30 Nov 2022 21:09:36 -0800 (PST) Received: from atl1wswcm04.websitewelcome.com (unknown [50.6.129.165]) by atl4wswob04.websitewelcome.com (Postfix) with ESMTP id BC8871E38D for ; Thu, 1 Dec 2022 04:47:00 +0000 (UTC) Received: from md-in-79.webhostbox.net ([43.225.55.182]) by cmsmtp with ESMTP id 0bTOpZnZqgEOM0bTPpblmt; Thu, 01 Dec 2022 04:47:00 +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=a8sHx3T2VDeL3fegfd6hkMq1v2763qASnm4AuQfNaJU=; b=hxyKPInE+kMPMHDFRtfWsg3b61 RNtOx/S/5AURsyESZohEwJiiYnAsSZmHr62CmFIYmDHh5vR5FWZ6Ggd2LHkag7P2aMxaQipOpFZA7 gqory90ncb6IqKfxfnewYqW+DTGkFleOBNVVyRSHwO3s1gHMYHqXaSan9/1bSFCyzj+H4Mes9HTVS 2nCqvlCm6NPCH0IrZcnc7d6RiaBTZ9DNyiSXPHx7abIByk1RDsEqtytW63o4mkUggVwIe3HbZKPGI ydh7LJLt1a5BCxsxpsh/7UkiTiGMlOImIlnoCkmYyJfX8Y+e45AZ/vhIeHq3kvb2XosIGd3ApOWCq Md3SltCg==; Received: from [223.187.112.123] (port=34121 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 1p0bTM-003t5m-Qr; Thu, 01 Dec 2022 04:46:56 +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 v2 1/4] hwmon: pm_bus: core: Add min_uV in pmbus regulator helper macro Date: Thu, 1 Dec 2022 05:46:40 +0100 Message-Id: <20221201044643.1150870-2-saravanan@linumiz.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221201044643.1150870-1-saravanan@linumiz.com> References: <20221201044643.1150870-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: 223.187.112.123 X-Source-L: No X-Exim-ID: 1p0bTM-003t5m-Qr X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: (discovery..) [223.187.112.123]:34121 X-Source-Auth: saravanan@linumiz.com X-Email-Count: 16 X-Source-Cap: bGludW1jbWM7aG9zdGdhdG9yO21kLWluLTc5LndlYmhvc3Rib3gubmV0 X-Local-Domain: yes X-CMAE-Envelope: MS4xfPm6I3tutx1dQlgBIwF7IGLElrbff31UrDTt+j4DBr9F7rAZShcRkIapBhAxBO9aWUsDOeMwGAoU3I4NXngUCuZbhKs0AEQvb5012g+1IUTugofIO7dS GyRImyYMvbtjaw6UY4L0UY+JaCUZ8a99gt8ylk/FWDrOdIiLYtzcE5229HdfasCYP+0GStzgcmpztt+zR/3HihE6r1tgH3lo790= 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 7daaf0caf4d3..b8c7810c812a 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), \ .supply_name = "vin", \ @@ -476,9 +476,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 Thu Dec 1 04:46:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saravanan Sekar X-Patchwork-Id: 13060966 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 C91BAC4321E for ; Thu, 1 Dec 2022 04:47:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229534AbiLAErJ (ORCPT ); Wed, 30 Nov 2022 23:47:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44660 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229680AbiLAErF (ORCPT ); Wed, 30 Nov 2022 23:47:05 -0500 Received: from gateway30.websitewelcome.com (gateway30.websitewelcome.com [192.185.152.11]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3D2B79950C for ; Wed, 30 Nov 2022 20:47:02 -0800 (PST) Received: from atl1wswcm05.websitewelcome.com (unknown [50.6.129.166]) by atl3wswob01.websitewelcome.com (Postfix) with ESMTP id 695D5313F2 for ; Thu, 1 Dec 2022 04:47:02 +0000 (UTC) Received: from md-in-79.webhostbox.net ([43.225.55.182]) by cmsmtp with ESMTP id 0bTPpfI8zP2h50bTRptCHG; Thu, 01 Dec 2022 04:47:02 +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=7lBuiEwdQJRdSXgGk7zBmlsJAsmAdgyU5GERb3tmT4g=; b=NIONRG06ekXPN/zDMgFJ7JuKgb tzVj5HFQWRcCP9a/p9R8SUF28RQ9UCXRiNzmkh6dQfDpjdct+Dp6TmqTOj/Iy7uHB/RezxuILF300 JRb/TIoEgIySHUPoQVBv+qCCtk3oKWgGykzEnmp9qBw6AfvAIgnR4otp6kZBn9S8SturDuygxXH7z qU6XG/8iQ5+Fwsj2KFyoMumKAf2Hgiq6/ioal4QYcJ/tQKEbpli9xNhCqZFVjLmMFr0ynfKBs4sDS Yh2vQFSqqso2l7yWJ+2cx95Qwv1IS8KDMEvOvVs2mxIgjXgZJMOylcUU0kCn6twp3nrMhvuwp/kaw WKITwiZA==; Received: from [223.187.112.123] (port=34121 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 1p0bTO-003t5m-H7; Thu, 01 Dec 2022 04:46:58 +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 v2 2/4] dt-bindings: hwmon/pmbus: Add mps,mpq7932 power-management IC Date: Thu, 1 Dec 2022 05:46:41 +0100 Message-Id: <20221201044643.1150870-3-saravanan@linumiz.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221201044643.1150870-1-saravanan@linumiz.com> References: <20221201044643.1150870-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: 223.187.112.123 X-Source-L: No X-Exim-ID: 1p0bTO-003t5m-H7 X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: (discovery..) [223.187.112.123]:34121 X-Source-Auth: saravanan@linumiz.com X-Email-Count: 24 X-Source-Cap: bGludW1jbWM7aG9zdGdhdG9yO21kLWluLTc5LndlYmhvc3Rib3gubmV0 X-Local-Domain: yes X-CMAE-Envelope: MS4xfBDkftwjX3+aIHka534c9LbJGE9xalPbe5O5o9F/hVxzMJeKJ4uWvCPldHtR+PzS5l58q3msttyzNQBmLIQlVENUxC7KCahJi0y4LZKek1VbUTMCD8as uxAJujAJ4iySVPOl0WVaeEwhUbb8Rk0T/xi71SFs+LAog7rWOPqBWje7rbcq4UTnJVQOsJyRV0yv8C+qkBD+xyQldEvTflrmG5g= Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@vger.kernel.org Document mpq7932 power-management IC Signed-off-by: Saravanan Sekar --- .../bindings/hwmon/pmbus/mps,mpq7932.yaml | 63 +++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 Documentation/devicetree/bindings/hwmon/pmbus/mps,mpq7932.yaml diff --git a/Documentation/devicetree/bindings/hwmon/pmbus/mps,mpq7932.yaml b/Documentation/devicetree/bindings/hwmon/pmbus/mps,mpq7932.yaml new file mode 100644 index 000000000000..5f20c59eb7ff --- /dev/null +++ b/Documentation/devicetree/bindings/hwmon/pmbus/mps,mpq7932.yaml @@ -0,0 +1,63 @@ +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/hwmon/pmbus/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] + + "^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 = <400000>; + regulator-max-microvolt = <3587500>; + regulator-min-microamp = <460000>; + regulator-max-microamp = <7600000>; + regulator-boot-on; + }; + }; + }; + }; +... From patchwork Thu Dec 1 04:46:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saravanan Sekar X-Patchwork-Id: 13060967 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 9410AC4708C for ; Thu, 1 Dec 2022 04:47:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229680AbiLAErL (ORCPT ); Wed, 30 Nov 2022 23:47:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44680 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229688AbiLAErG (ORCPT ); Wed, 30 Nov 2022 23:47:06 -0500 Received: from gateway36.websitewelcome.com (gateway36.websitewelcome.com [50.116.124.69]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0523B9894E for ; Wed, 30 Nov 2022 20:47:04 -0800 (PST) Received: from atl1wswcm04.websitewelcome.com (unknown [50.6.129.165]) by atl3wswob06.websitewelcome.com (Postfix) with ESMTP id 177C54574B for ; Thu, 1 Dec 2022 04:47:04 +0000 (UTC) Received: from md-in-79.webhostbox.net ([43.225.55.182]) by cmsmtp with ESMTP id 0bTRpZnbxgEOM0bTTpblob; Thu, 01 Dec 2022 04:47:04 +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=L5X67zfOl/ICI08u5KNdGurEd/63s+v0R1tqBYiDipg=; b=nFIT8PUr43FK7oVtDFNPivIHiL 0A3CTJ949I+gDnHR8z63y1t6jvKNiVW3ucRv0QrfbX1XGnH2/SxZMjak4VtXGbepM9ccq403SXX4a NdN7R9lVTrpcjsf3JmNwHK8jooXllYJ5EKcrEutTXNh4on32lgnJGQGvMHLPJ4iXgixjZhKUZ4cdX Jpd7RnQx3Sy0EB5LPZFQjNLOkyGXAvdArR8Z/1g8E3hGGW1UprF8DrmoEg5+yoANKCNOIK8DZnyXC XoCR6XFG0AuUHQ6eJA0VFEIlz+tn90lIv/0CuiQVZ3hjwV5RcNi4Fu4VgM6RZB8kbA5ny2dLFJGV4 sqElmPrw==; Received: from [223.187.112.123] (port=34121 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 1p0bTQ-003t5m-27; Thu, 01 Dec 2022 04:47:00 +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 v2 3/4] hwmon: (pmbus/mpq7932) Add a support for mpq7932 Power Management IC Date: Thu, 1 Dec 2022 05:46:42 +0100 Message-Id: <20221201044643.1150870-4-saravanan@linumiz.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221201044643.1150870-1-saravanan@linumiz.com> References: <20221201044643.1150870-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: 223.187.112.123 X-Source-L: No X-Exim-ID: 1p0bTQ-003t5m-27 X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: (discovery..) [223.187.112.123]:34121 X-Source-Auth: saravanan@linumiz.com X-Email-Count: 32 X-Source-Cap: bGludW1jbWM7aG9zdGdhdG9yO21kLWluLTc5LndlYmhvc3Rib3gubmV0 X-Local-Domain: yes X-CMAE-Envelope: MS4xfAfjkryL7Dai42KuABcZUpdB8RIQP15HtGCh1kTRrPSGYAtETK0YeXtDOhuXmTeX5xVWpbzTH/wFU/+GDs8j1aMDEJnWB8ppVgWG7LyTvKNkT+68Ql2S yYWWfkVYXNPPsudmOWzboyk0lswrQnSiq+tvtYHm5Va8PjiM79p/6jlHt8dA0Rzjdxd04ZF4NsgRXT8rDo5za5xLSXaoFIX88HY= 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 | 10 +++ drivers/hwmon/pmbus/Makefile | 1 + drivers/hwmon/pmbus/mpq7932.c | 144 ++++++++++++++++++++++++++++++++++ 3 files changed, 155 insertions(+) create mode 100644 drivers/hwmon/pmbus/mpq7932.c diff --git a/drivers/hwmon/pmbus/Kconfig b/drivers/hwmon/pmbus/Kconfig index 89668af67206..4a1538949a73 100644 --- a/drivers/hwmon/pmbus/Kconfig +++ b/drivers/hwmon/pmbus/Kconfig @@ -317,6 +317,16 @@ config SENSORS_MP5023 This driver can also be built as a module. If so, the module will be called mp5023. +config SENSORS_MPQ7932 + tristate "MPS MPQ7932" + help + If you say yes here you get six integrated buck converter regulator + with 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..28a534629cc3 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_REGULATOR) += 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..3747d7862afd --- /dev/null +++ b/drivers/hwmon/pmbus/mpq7932.c @@ -0,0 +1,144 @@ +/* + * SPDX-License-Identifier: GPL-2.0+ + * + * mpq7932.c - regulator driver for mps mpq7932 + * Copyright 2022 Monolithic Power Systems, Inc + * + * Author: Saravanan Sekar + */ + +#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 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; +}; + +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), +}; + +static int mpq7932_write_word_data(struct i2c_client *client, int page, int reg, + u16 word) +{ + + switch (reg) { + case PMBUS_VOUT_COMMAND: + return pmbus_write_byte_data(client, page, reg, (u8)word); + + default: + return -ENODATA; + } +} + +static int mpq7932_read_word_data(struct i2c_client *client, int page, + int phase, int reg) +{ + + switch (reg) { + case PMBUS_MFR_VOUT_MIN: + return 0; + + case PMBUS_MFR_VOUT_MAX: + return MPQ7932_N_VOLTAGES; + + 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; + + if (!i2c_check_functionality(client->adapter, + I2C_FUNC_SMBUS_READ_WORD_DATA)) + return -ENODEV; + + data = devm_kzalloc(&client->dev, sizeof(struct mpq7932_data), + GFP_KERNEL); + if (!data) + return -ENOMEM; + + info = &data->info; + info->pages = MPQ7932_NUM_PAGES; + info->num_regulators = ARRAY_SIZE(mpq7932_regulators_desc); + info->reg_desc = mpq7932_regulators_desc; + 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; + } + + 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 Thu Dec 1 04:46:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saravanan Sekar X-Patchwork-Id: 13060976 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 56232C43217 for ; Thu, 1 Dec 2022 05:08:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229779AbiLAFIP (ORCPT ); Thu, 1 Dec 2022 00:08:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36576 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229751AbiLAFIO (ORCPT ); Thu, 1 Dec 2022 00:08:14 -0500 X-Greylist: delayed 1268 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Wed, 30 Nov 2022 21:08:13 PST Received: from gateway20.websitewelcome.com (gateway20.websitewelcome.com [192.185.70.14]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ADC619791B for ; Wed, 30 Nov 2022 21:08:13 -0800 (PST) Received: from atl1wswcm06.websitewelcome.com (unknown [50.6.129.167]) by atl1wswob01.websitewelcome.com (Postfix) with ESMTP id 7FA32400F018D for ; Thu, 1 Dec 2022 04:47:05 +0000 (UTC) Received: from md-in-79.webhostbox.net ([43.225.55.182]) by cmsmtp with ESMTP id 0bTSpcBlIPz0t0bTUpXm6z; Thu, 01 Dec 2022 04:47:05 +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=lt9ssPxraP7AVqIsyBoSkJvYwNULAALvMmqCxZgrk6g=; b=ov+DaIALsAqMIdNaVmoS0uPcOc DG4aWsV83JDARy8Lw0RcquU8bPpQ3JcBQRe8UVVSAvvVLBX6i1fiLBAU9/+Csqmtfp6Vv5UA3HdZV ul3uovvv0zmQ75tax5A/K3HGs8xZqRyA7arQJN/78eohykOkRCb2hkC9dSzl8A327Unt1zTfuhNCV Kxi1y2Uj61S6wBQcJ9rUtbVB5cRI+fTB57lVllGb6kqQCJUWSr2g8JglcwxiXHidYxi70lOIAJacr TDrxA7+Pq0wVY+l5UmEv7cPSyGH3RnPj116qJe+G2BkzjcVf4nFJ6vZEwdQXJ0/7Gr9ePRq4R8NcA 3lc2s2GQ==; Received: from [223.187.112.123] (port=34121 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 1p0bTR-003t5m-Jo; Thu, 01 Dec 2022 04:47:01 +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 v2 4/4] MAINTAINERS: Update the entry for MPQ7932 PMIC driver Date: Thu, 1 Dec 2022 05:46:43 +0100 Message-Id: <20221201044643.1150870-5-saravanan@linumiz.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221201044643.1150870-1-saravanan@linumiz.com> References: <20221201044643.1150870-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: 223.187.112.123 X-Source-L: No X-Exim-ID: 1p0bTR-003t5m-Jo X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: (discovery..) [223.187.112.123]:34121 X-Source-Auth: saravanan@linumiz.com X-Email-Count: 40 X-Source-Cap: bGludW1jbWM7aG9zdGdhdG9yO21kLWluLTc5LndlYmhvc3Rib3gubmV0 X-Local-Domain: yes X-CMAE-Envelope: MS4xfJxUl8ZsjdP9KW0LvsESd/bdB+iyJJ7R2Z94+H1i/v8RzAUkzfRABLIbjmN3+UjGC4TJkEy1JHJR8KUJHxCdcLHwsM7s93w8f6Kg1Sl/9pbYHQ7/LH2h 0U67Jmac24Az9qeXSQFu5GBPmNQhwnFOwqFocR7LQj9z3KwpYKzs9plizi0E3GqtBIv04zVmvtzjVNqZ3Df80SoYw6pew+OAGi8= Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@vger.kernel.org Update the MAINTAINERS file to include the path for the MPQ7932 and MPQ7932 devicetree bindings documentation. Signed-off-by: Saravanan Sekar --- MAINTAINERS | 2 ++ 1 file changed, 2 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index 379945f82a64..8e0dbf4c6cf3 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -13924,8 +13924,10 @@ F: scripts/module* MONOLITHIC POWER SYSTEM PMIC DRIVER M: Saravanan Sekar S: Maintained +F: Documentation/devicetree/bindings/hwmon/pmbus/mps,mpq7932.yaml 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