linux-hwmon.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v4 0/5] hwmon: pmbus: Add support for MPM82504 and MPM3695 family
@ 2025-05-11  3:55 Pawel Dembicki
  2025-05-11  3:55 ` [PATCH v4 1/5] dt-bindings: hwmon: Add bindings for mpq8785 driver Pawel Dembicki
                   ` (4 more replies)
  0 siblings, 5 replies; 13+ messages in thread
From: Pawel Dembicki @ 2025-05-11  3:55 UTC (permalink / raw)
  To: linux-hwmon
  Cc: Pawel Dembicki, Jean Delvare, Guenter Roeck, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Jonathan Corbet, Noah Wang,
	Naresh Solanki, Fabio Estevam, Michal Simek, Grant Peltier,
	Laurent Pinchart, Greg KH, Shen Lichuan, Peter Zijlstra,
	Charles Hsu, devicetree, linux-kernel, linux-doc

This series extends the hwmon PMBus driver for the MPS MPQ8785 to support
two additional Monolithic Power Systems devices: the MPM82504 and
MPM3695 family.

The driver is restructured to support multiple devices using device tree
matching. It also introduces an optional
"mps,vout-fb-divider-ratio-permille" property to configure the
VOUT_SCALE_LOOP PMBus register, which adjusts reported output voltages
depending on the external feedback divider.

Device tree bindings are updated accordingly.

Changes have been tested on hardware with device-tree based matching
using the MPM82504 and MPM3695-10.

Signed-off-by: Pawel Dembicki <paweldembicki@gmail.com>

Pawel Dembicki (5):
  dt-bindings: hwmon: Add bindings for mpq8785 driver
  hwmon: pmbus: mpq8785: Prepare driver for multiple device support
  hwmon: pmbus: mpq8785: Implement VOUT feedback resistor divider ratio
    configuration
  hwmon: pmbus: mpq8785: Add support for MPM82504
  hwmon: pmbus: mpq8785: Add support for MPM3695 family

 .../bindings/hwmon/pmbus/mps,mpq8785.yaml     | 74 +++++++++++++++
 .../devicetree/bindings/trivial-devices.yaml  |  2 -
 Documentation/hwmon/mpq8785.rst               | 27 ++++--
 drivers/hwmon/pmbus/mpq8785.c                 | 91 +++++++++++++++++--
 4 files changed, 178 insertions(+), 16 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/hwmon/pmbus/mps,mpq8785.yaml

-- 
2.43.0


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH v4 1/5] dt-bindings: hwmon: Add bindings for mpq8785 driver
  2025-05-11  3:55 [PATCH v4 0/5] hwmon: pmbus: Add support for MPM82504 and MPM3695 family Pawel Dembicki
@ 2025-05-11  3:55 ` Pawel Dembicki
  2025-05-11 20:23   ` Krzysztof Kozlowski
  2025-05-12 16:41   ` Guenter Roeck
  2025-05-11  3:55 ` [PATCH v4 2/5] hwmon: pmbus: mpq8785: Prepare driver for multiple device support Pawel Dembicki
                   ` (3 subsequent siblings)
  4 siblings, 2 replies; 13+ messages in thread
From: Pawel Dembicki @ 2025-05-11  3:55 UTC (permalink / raw)
  To: linux-hwmon
  Cc: Pawel Dembicki, Jean Delvare, Guenter Roeck, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Jonathan Corbet, Noah Wang,
	Fabio Estevam, Naresh Solanki, Michal Simek, Grant Peltier,
	Laurent Pinchart, Shen Lichuan, Peter Zijlstra, Greg KH,
	Charles Hsu, devicetree, linux-kernel, linux-doc

Add device tree bindings for Monolithic Power Systems MPQ8785, MPM82504
and MPM3695 PMBus-compliant voltage regulators.

These bindings also documents the optional
"mps,vout-fb-divider-ratio-permille" property.

---
v4:
  - no changes done
v3:
  - added maximum and default value to 'mps,vout-fb-divider-ratio-permille'
  - add enum to compatible check
  - move 'required' to proper place
v2:
  - remove mps,mpq8785 from trivial-devices.yaml
  - fix alphabetical order
  - rename voltage-scale-loop to mps,vout-fb-divider-ratio-permille
  - add mps,vout-fb-divider-ratio-permille min and max values
  - rewrite mps,vout-fb-divider-ratio-permille description

Signed-off-by: Pawel Dembicki <paweldembicki@gmail.com>
---
 .../bindings/hwmon/pmbus/mps,mpq8785.yaml     | 74 +++++++++++++++++++
 .../devicetree/bindings/trivial-devices.yaml  |  2 -
 2 files changed, 74 insertions(+), 2 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/hwmon/pmbus/mps,mpq8785.yaml

diff --git a/Documentation/devicetree/bindings/hwmon/pmbus/mps,mpq8785.yaml b/Documentation/devicetree/bindings/hwmon/pmbus/mps,mpq8785.yaml
new file mode 100644
index 000000000000..90970a0433e9
--- /dev/null
+++ b/Documentation/devicetree/bindings/hwmon/pmbus/mps,mpq8785.yaml
@@ -0,0 +1,74 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/hwmon/pmbus/mps,mpq8785.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Monolithic Power Systems Multiphase Voltage Regulators with PMBus
+
+maintainers:
+  - Charles Hsu <ythsu0511@gmail.com>
+
+description:
+  Monolithic Power Systems digital multiphase voltage regulators with PMBus.
+
+properties:
+  compatible:
+    enum:
+      - mps,mpm3695
+      - mps,mpm3695-25
+      - mps,mpm82504
+      - mps,mpq8785
+
+  reg:
+    maxItems: 1
+
+  mps,vout-fb-divider-ratio-permille:
+    description:
+      The feedback resistor divider ratio, expressed in permille
+      (Vfb / Vout * 1000). This value is written to the PMBUS_VOUT_SCALE_LOOP
+      register and is required for correct output voltage presentation.
+    $ref: /schemas/types.yaml#/definitions/uint32
+    minimum: 1
+    maximum: 4095
+    default: 706
+
+required:
+  - compatible
+  - reg
+
+allOf:
+  - if:
+      properties:
+        compatible:
+          enum:
+            - mps,mpm3695
+            - mps,mpm82504
+    then:
+      properties:
+        mps,vout-fb-divider-ratio-permille:
+          maximum: 1023
+
+  - if:
+      properties:
+        compatible:
+          const: mps,mpq8785
+    then:
+      properties:
+        mps,vout-fb-divider-ratio-permille:
+          maximum: 2047
+
+additionalProperties: false
+
+examples:
+  - |
+    i2c {
+      #address-cells = <1>;
+      #size-cells = <0>;
+
+      pmic@30 {
+        compatible = "mps,mpm82504";
+        reg = <0x30>;
+        mps,vout-fb-divider-ratio-permille = <600>;
+      };
+    };
diff --git a/Documentation/devicetree/bindings/trivial-devices.yaml b/Documentation/devicetree/bindings/trivial-devices.yaml
index 8da408107e55..7c1c0cc29655 100644
--- a/Documentation/devicetree/bindings/trivial-devices.yaml
+++ b/Documentation/devicetree/bindings/trivial-devices.yaml
@@ -293,8 +293,6 @@ properties:
           - mps,mp5990
             # Monolithic Power Systems Inc. digital step-down converter mp9941
           - mps,mp9941
-            # Monolithic Power Systems Inc. synchronous step-down converter mpq8785
-          - mps,mpq8785
             # Temperature sensor with integrated fan control
           - national,lm63
             # Serial Interface ACPI-Compatible Microprocessor System Hardware Monitor
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v4 2/5] hwmon: pmbus: mpq8785: Prepare driver for multiple device support
  2025-05-11  3:55 [PATCH v4 0/5] hwmon: pmbus: Add support for MPM82504 and MPM3695 family Pawel Dembicki
  2025-05-11  3:55 ` [PATCH v4 1/5] dt-bindings: hwmon: Add bindings for mpq8785 driver Pawel Dembicki
@ 2025-05-11  3:55 ` Pawel Dembicki
  2025-05-12 16:42   ` Guenter Roeck
  2025-05-11  3:55 ` [PATCH v4 3/5] hwmon: pmbus: mpq8785: Implement VOUT feedback resistor divider ratio configuration Pawel Dembicki
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 13+ messages in thread
From: Pawel Dembicki @ 2025-05-11  3:55 UTC (permalink / raw)
  To: linux-hwmon
  Cc: Pawel Dembicki, Jean Delvare, Guenter Roeck, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Jonathan Corbet, Noah Wang,
	Naresh Solanki, Michal Simek, Fabio Estevam, Grant Peltier,
	Laurent Pinchart, Peter Zijlstra, Shen Lichuan, Greg KH,
	Charles Hsu, devicetree, linux-kernel, linux-doc

Refactor the driver to support multiple Monolithic Power Systems devices.
Introduce chip ID handling based on device tree matching.

No functional changes intended.

Signed-off-by: Pawel Dembicki <paweldembicki@gmail.com>

---
v4:
  - no changes done
v3:
 - replaced (uintptr_t) with (kernel_ulong_t)
 - used i2c_get_match_data() instead i2c_match_id(mpq8785_id, client)->driver_data
v2:
 - no changes done
---
 drivers/hwmon/pmbus/mpq8785.c | 38 +++++++++++++++++++++++++++--------
 1 file changed, 30 insertions(+), 8 deletions(-)

diff --git a/drivers/hwmon/pmbus/mpq8785.c b/drivers/hwmon/pmbus/mpq8785.c
index 331c274ca892..d0ac294b4bbc 100644
--- a/drivers/hwmon/pmbus/mpq8785.c
+++ b/drivers/hwmon/pmbus/mpq8785.c
@@ -8,6 +8,8 @@
 #include <linux/of_device.h>
 #include "pmbus.h"
 
+enum chips { mpq8785 };
+
 static int mpq8785_identify(struct i2c_client *client,
 			    struct pmbus_driver_info *info)
 {
@@ -53,26 +55,46 @@ static struct pmbus_driver_info mpq8785_info = {
 		PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT |
 		PMBUS_HAVE_IOUT | PMBUS_HAVE_STATUS_IOUT |
 		PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP,
-	.identify = mpq8785_identify,
-};
-
-static int mpq8785_probe(struct i2c_client *client)
-{
-	return pmbus_do_probe(client, &mpq8785_info);
 };
 
 static const struct i2c_device_id mpq8785_id[] = {
-	{ "mpq8785" },
+	{ "mpq8785", mpq8785 },
 	{ },
 };
 MODULE_DEVICE_TABLE(i2c, mpq8785_id);
 
 static const struct of_device_id __maybe_unused mpq8785_of_match[] = {
-	{ .compatible = "mps,mpq8785" },
+	{ .compatible = "mps,mpq8785", .data = (void *)mpq8785 },
 	{}
 };
 MODULE_DEVICE_TABLE(of, mpq8785_of_match);
 
+static int mpq8785_probe(struct i2c_client *client)
+{
+	struct device *dev = &client->dev;
+	struct pmbus_driver_info *info;
+	enum chips chip_id;
+
+	info = devm_kmemdup(dev, &mpq8785_info, sizeof(*info), GFP_KERNEL);
+	if (!info)
+		return -ENOMEM;
+
+	if (dev->of_node)
+		chip_id = (kernel_ulong_t)of_device_get_match_data(dev);
+	else
+		chip_id = (kernel_ulong_t)i2c_get_match_data(client);
+
+	switch (chip_id) {
+	case mpq8785:
+		info->identify = mpq8785_identify;
+		break;
+	default:
+		return -ENODEV;
+	}
+
+	return pmbus_do_probe(client, info);
+};
+
 static struct i2c_driver mpq8785_driver = {
 	.driver = {
 		   .name = "mpq8785",
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v4 3/5] hwmon: pmbus: mpq8785: Implement VOUT feedback resistor divider ratio configuration
  2025-05-11  3:55 [PATCH v4 0/5] hwmon: pmbus: Add support for MPM82504 and MPM3695 family Pawel Dembicki
  2025-05-11  3:55 ` [PATCH v4 1/5] dt-bindings: hwmon: Add bindings for mpq8785 driver Pawel Dembicki
  2025-05-11  3:55 ` [PATCH v4 2/5] hwmon: pmbus: mpq8785: Prepare driver for multiple device support Pawel Dembicki
@ 2025-05-11  3:55 ` Pawel Dembicki
  2025-05-12 16:43   ` Guenter Roeck
  2025-05-11  3:55 ` [PATCH v4 4/5] hwmon: pmbus: mpq8785: Add support for MPM82504 Pawel Dembicki
  2025-05-11  3:55 ` [PATCH v4 5/5] hwmon: pmbus: mpq8785: Add support for MPM3695 family Pawel Dembicki
  4 siblings, 1 reply; 13+ messages in thread
From: Pawel Dembicki @ 2025-05-11  3:55 UTC (permalink / raw)
  To: linux-hwmon
  Cc: Pawel Dembicki, Jean Delvare, Guenter Roeck, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Jonathan Corbet, Noah Wang,
	Michal Simek, Naresh Solanki, Fabio Estevam, Grant Peltier,
	Laurent Pinchart, Shen Lichuan, Peter Zijlstra, Greg KH,
	Charles Hsu, devicetree, linux-kernel, linux-doc

Implement support for setting the VOUT_SCALE_LOOP PMBus register
based on an optional device tree property
"mps,vout-fb-divider-ratio-permille".

This allows the driver to provide the correct VOUT value depending
on the feedback voltage divider configuration for chips where the
bootloader does not configure the VOUT_SCALE_LOOP register.

Signed-off-by: Pawel Dembicki <paweldembicki@gmail.com>

---
v4:
  - no changes done
v3:
  - droped comments and indexed the table with enums instead
  - use device_property_read_u32() instead of_property_read_u32()
v2:
  - renamed property to mps,vout-fb-divider-ratio-permille
  - added register value range checking
---
 drivers/hwmon/pmbus/mpq8785.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/drivers/hwmon/pmbus/mpq8785.c b/drivers/hwmon/pmbus/mpq8785.c
index d0ac294b4bbc..2e7c0d0c3f81 100644
--- a/drivers/hwmon/pmbus/mpq8785.c
+++ b/drivers/hwmon/pmbus/mpq8785.c
@@ -5,11 +5,16 @@
 
 #include <linux/i2c.h>
 #include <linux/module.h>
+#include <linux/property.h>
 #include <linux/of_device.h>
 #include "pmbus.h"
 
 enum chips { mpq8785 };
 
+static u16 voltage_scale_loop_max_val[] = {
+	[mpq8785] = GENMASK(10, 0),
+};
+
 static int mpq8785_identify(struct i2c_client *client,
 			    struct pmbus_driver_info *info)
 {
@@ -74,6 +79,8 @@ static int mpq8785_probe(struct i2c_client *client)
 	struct device *dev = &client->dev;
 	struct pmbus_driver_info *info;
 	enum chips chip_id;
+	u32 voltage_scale;
+	int ret;
 
 	info = devm_kmemdup(dev, &mpq8785_info, sizeof(*info), GFP_KERNEL);
 	if (!info)
@@ -92,6 +99,17 @@ static int mpq8785_probe(struct i2c_client *client)
 		return -ENODEV;
 	}
 
+	if (!device_property_read_u32(dev, "mps,vout-fb-divider-ratio-permille",
+				      &voltage_scale)) {
+		if (voltage_scale > voltage_scale_loop_max_val[chip_id])
+			return -EINVAL;
+
+		ret = i2c_smbus_write_word_data(client, PMBUS_VOUT_SCALE_LOOP,
+						voltage_scale);
+		if (ret)
+			return ret;
+	}
+
 	return pmbus_do_probe(client, info);
 };
 
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v4 4/5] hwmon: pmbus: mpq8785: Add support for MPM82504
  2025-05-11  3:55 [PATCH v4 0/5] hwmon: pmbus: Add support for MPM82504 and MPM3695 family Pawel Dembicki
                   ` (2 preceding siblings ...)
  2025-05-11  3:55 ` [PATCH v4 3/5] hwmon: pmbus: mpq8785: Implement VOUT feedback resistor divider ratio configuration Pawel Dembicki
@ 2025-05-11  3:55 ` Pawel Dembicki
  2025-05-12 16:44   ` Guenter Roeck
  2025-05-11  3:55 ` [PATCH v4 5/5] hwmon: pmbus: mpq8785: Add support for MPM3695 family Pawel Dembicki
  4 siblings, 1 reply; 13+ messages in thread
From: Pawel Dembicki @ 2025-05-11  3:55 UTC (permalink / raw)
  To: linux-hwmon
  Cc: Pawel Dembicki, Jean Delvare, Guenter Roeck, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Jonathan Corbet, Noah Wang,
	Naresh Solanki, Michal Simek, Fabio Estevam, Grant Peltier,
	Laurent Pinchart, Greg KH, Peter Zijlstra, Shen Lichuan,
	Charles Hsu, devicetree, linux-kernel, linux-doc

Add support for the Monolithic Power Systems MPM82504 digital voltage
regulator. MPM82504 uses PMBus direct format for voltage output.

Tested with device tree based matching.

Signed-off-by: Pawel Dembicki <paweldembicki@gmail.com>

---
v4:
  - do sign_extend32() without check the MPM82504_READ_TEMPERATURE_1_SIGN
v3:
  - fix alphabetical order in multiple places
  - change PMBUS_READ_TEMPERATURE_1_SIGN macro name to
    MPM82504_READ_TEMPERATURE_1_SIGN
  - use sign_extend32()
  - fix typo in documentation
v2:
  - fixed signedess for temperatures < 0 deg C
  - removed empty lines
---
 Documentation/hwmon/mpq8785.rst | 20 +++++++++++++++-----
 drivers/hwmon/pmbus/mpq8785.c   | 29 ++++++++++++++++++++++++++++-
 2 files changed, 43 insertions(+), 6 deletions(-)

diff --git a/Documentation/hwmon/mpq8785.rst b/Documentation/hwmon/mpq8785.rst
index bf8176b87086..b91fefb1a84c 100644
--- a/Documentation/hwmon/mpq8785.rst
+++ b/Documentation/hwmon/mpq8785.rst
@@ -5,6 +5,7 @@ Kernel driver mpq8785
 
 Supported chips:
 
+  * MPS MPM82504
   * MPS MPQ8785
 
     Prefix: 'mpq8785'
@@ -14,6 +15,14 @@ Author: Charles Hsu <ythsu0511@gmail.com>
 Description
 -----------
 
+The MPM82504 is a quad 25A, scalable, fully integrated power module with a PMBus
+interface. The device offers a complete power solution that achieves up to 25A
+per output channel. The MPM82504 has four output channels that can be paralleled
+to provide 50A, 75A, or 100A of output current for flexible configurations.
+The device can also operate in parallel with the MPM3695-100 and additional
+MPM82504 devices to provide a higher output current. The MPM82504 operates
+at high efficiency across a wide load range.
+
 The MPQ8785 is a fully integrated, PMBus-compatible, high-frequency, synchronous
 buck converter. The MPQ8785 offers a very compact solution that achieves up to
 40A output current per phase, with excellent load and line regulation over a
@@ -23,18 +32,19 @@ output current load range.
 The PMBus interface provides converter configurations and key parameters
 monitoring.
 
-The MPQ8785 adopts MPS's proprietary multi-phase digital constant-on-time (MCOT)
+The devices adopts MPS's proprietary multi-phase digital constant-on-time (MCOT)
 control, which provides fast transient response and eases loop stabilization.
-The MCOT scheme also allows multiple MPQ8785 devices to be connected in parallel
-with excellent current sharing and phase interleaving for high-current
+The MCOT scheme also allows multiple devices or channels to be connected in
+parallel with excellent current sharing and phase interleaving for high-current
 applications.
 
 Fully integrated protection features include over-current protection (OCP),
 over-voltage protection (OVP), under-voltage protection (UVP), and
 over-temperature protection (OTP).
 
-The MPQ8785 requires a minimal number of readily available, standard external
-components, and is available in a TLGA (5mmx6mm) package.
+All supported modules require a minimal number of readily available, standard
+external components. The MPM82504 is available in a BGA (15mmx30mmx5.18mm)
+package and the MPQ8785 is available in a TLGA (5mmx6mm) package.
 
 Device compliant with:
 
diff --git a/drivers/hwmon/pmbus/mpq8785.c b/drivers/hwmon/pmbus/mpq8785.c
index 2e7c0d0c3f81..8827d5a57310 100644
--- a/drivers/hwmon/pmbus/mpq8785.c
+++ b/drivers/hwmon/pmbus/mpq8785.c
@@ -4,14 +4,18 @@
  */
 
 #include <linux/i2c.h>
+#include <linux/bitops.h>
 #include <linux/module.h>
 #include <linux/property.h>
 #include <linux/of_device.h>
 #include "pmbus.h"
 
-enum chips { mpq8785 };
+#define MPM82504_READ_TEMPERATURE_1_SIGN_POS	9
+
+enum chips { mpm82504, mpq8785 };
 
 static u16 voltage_scale_loop_max_val[] = {
+	[mpm82504] = GENMASK(9, 0),
 	[mpq8785] = GENMASK(10, 0),
 };
 
@@ -41,6 +45,20 @@ static int mpq8785_identify(struct i2c_client *client,
 	return 0;
 };
 
+static int mpm82504_read_word_data(struct i2c_client *client, int page,
+				   int phase, int reg)
+{
+	int ret;
+
+	ret = pmbus_read_word_data(client, page, phase, reg);
+
+	if (ret < 0 || reg != PMBUS_READ_TEMPERATURE_1)
+		return ret;
+
+	/* Fix PMBUS_READ_TEMPERATURE_1 signedness */
+	return sign_extend32(ret, MPM82504_READ_TEMPERATURE_1_SIGN_POS) & 0xffff;
+}
+
 static struct pmbus_driver_info mpq8785_info = {
 	.pages = 1,
 	.format[PSC_VOLTAGE_IN] = direct,
@@ -63,12 +81,14 @@ static struct pmbus_driver_info mpq8785_info = {
 };
 
 static const struct i2c_device_id mpq8785_id[] = {
+	{ "mpm82504", mpm82504 },
 	{ "mpq8785", mpq8785 },
 	{ },
 };
 MODULE_DEVICE_TABLE(i2c, mpq8785_id);
 
 static const struct of_device_id __maybe_unused mpq8785_of_match[] = {
+	{ .compatible = "mps,mpm82504", .data = (void *)mpm82504 },
 	{ .compatible = "mps,mpq8785", .data = (void *)mpq8785 },
 	{}
 };
@@ -92,6 +112,13 @@ static int mpq8785_probe(struct i2c_client *client)
 		chip_id = (kernel_ulong_t)i2c_get_match_data(client);
 
 	switch (chip_id) {
+	case mpm82504:
+		info->format[PSC_VOLTAGE_OUT] = direct;
+		info->m[PSC_VOLTAGE_OUT] = 8;
+		info->b[PSC_VOLTAGE_OUT] = 0;
+		info->R[PSC_VOLTAGE_OUT] = 2;
+		info->read_word_data = mpm82504_read_word_data;
+		break;
 	case mpq8785:
 		info->identify = mpq8785_identify;
 		break;
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v4 5/5] hwmon: pmbus: mpq8785: Add support for MPM3695 family
  2025-05-11  3:55 [PATCH v4 0/5] hwmon: pmbus: Add support for MPM82504 and MPM3695 family Pawel Dembicki
                   ` (3 preceding siblings ...)
  2025-05-11  3:55 ` [PATCH v4 4/5] hwmon: pmbus: mpq8785: Add support for MPM82504 Pawel Dembicki
@ 2025-05-11  3:55 ` Pawel Dembicki
  2025-05-11  5:09   ` Guenter Roeck
  2025-05-12 16:45   ` Guenter Roeck
  4 siblings, 2 replies; 13+ messages in thread
From: Pawel Dembicki @ 2025-05-11  3:55 UTC (permalink / raw)
  To: linux-hwmon
  Cc: Pawel Dembicki, Jean Delvare, Guenter Roeck, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Jonathan Corbet, Noah Wang,
	Naresh Solanki, Michal Simek, Fabio Estevam, Grant Peltier,
	Laurent Pinchart, Shen Lichuan, Peter Zijlstra, Greg KH,
	Charles Hsu, devicetree, linux-kernel, linux-doc

Add support for the Monolithic Power Systems MPM3695 family.
It contains four devices with suffixes: -10, -20, -25 and -100.
The device is PMBus compliant and shares characteristics with the
MPM82504.

MPM3695-25 has different VOLTAGE_SCALE_LOOP register size [11:0]
and it needs to be separated because it will be configured in the next
commit.

Tested with device tree based matching (MPM3695-10).

Signed-off-by: Pawel Dembicki <paweldembicki@gmail.com>

---
v4:
  - no changes done
v3:
  - fix alphabetical order in couple places
  - adjust patch after patch order change
v2:
  - Added whole MPM3695 family
---
 Documentation/hwmon/mpq8785.rst | 13 +++++++++----
 drivers/hwmon/pmbus/mpq8785.c   | 10 +++++++++-
 2 files changed, 18 insertions(+), 5 deletions(-)

diff --git a/Documentation/hwmon/mpq8785.rst b/Documentation/hwmon/mpq8785.rst
index b91fefb1a84c..198d5dfd7c30 100644
--- a/Documentation/hwmon/mpq8785.rst
+++ b/Documentation/hwmon/mpq8785.rst
@@ -5,6 +5,7 @@ Kernel driver mpq8785
 
 Supported chips:
 
+  * MPS MPM3695 family
   * MPS MPM82504
   * MPS MPQ8785
 
@@ -15,6 +16,14 @@ Author: Charles Hsu <ythsu0511@gmail.com>
 Description
 -----------
 
+The MPM3695 family is a scalable, ultra-thin, fully integrated power module with
+a PMBus interface. It offers a complete power solution that achieves up to
+10A (-10 variant), 20A (-25 variant), 25A (-20 variant), 100A (-100 variant)
+of output current with excellent load and line regulation across a wide input
+voltage range. It operates at high efficiency over a wide load range, and can
+be parallled to deliver higher current. Variants -10,-20 and -100 have different
+voltage scale configuration register range (10 bits) than -25 version (11 bits).
+
 The MPM82504 is a quad 25A, scalable, fully integrated power module with a PMBus
 interface. The device offers a complete power solution that achieves up to 25A
 per output channel. The MPM82504 has four output channels that can be paralleled
@@ -42,10 +51,6 @@ Fully integrated protection features include over-current protection (OCP),
 over-voltage protection (OVP), under-voltage protection (UVP), and
 over-temperature protection (OTP).
 
-All supported modules require a minimal number of readily available, standard
-external components. The MPM82504 is available in a BGA (15mmx30mmx5.18mm)
-package and the MPQ8785 is available in a TLGA (5mmx6mm) package.
-
 Device compliant with:
 
 - PMBus rev 1.3 interface.
diff --git a/drivers/hwmon/pmbus/mpq8785.c b/drivers/hwmon/pmbus/mpq8785.c
index 8827d5a57310..1f56aaf4dde8 100644
--- a/drivers/hwmon/pmbus/mpq8785.c
+++ b/drivers/hwmon/pmbus/mpq8785.c
@@ -12,9 +12,11 @@
 
 #define MPM82504_READ_TEMPERATURE_1_SIGN_POS	9
 
-enum chips { mpm82504, mpq8785 };
+enum chips { mpm3695, mpm3695_25, mpm82504, mpq8785 };
 
 static u16 voltage_scale_loop_max_val[] = {
+	[mpm3695] = GENMASK(9, 0),
+	[mpm3695_25] = GENMASK(11, 0),
 	[mpm82504] = GENMASK(9, 0),
 	[mpq8785] = GENMASK(10, 0),
 };
@@ -81,6 +83,8 @@ static struct pmbus_driver_info mpq8785_info = {
 };
 
 static const struct i2c_device_id mpq8785_id[] = {
+	{ "mpm3695", mpm3695 },
+	{ "mpm3695-25", mpm3695_25 },
 	{ "mpm82504", mpm82504 },
 	{ "mpq8785", mpq8785 },
 	{ },
@@ -88,6 +92,8 @@ static const struct i2c_device_id mpq8785_id[] = {
 MODULE_DEVICE_TABLE(i2c, mpq8785_id);
 
 static const struct of_device_id __maybe_unused mpq8785_of_match[] = {
+	{ .compatible = "mps,mpm3695", .data = (void *)mpm3695 },
+	{ .compatible = "mps,mpm3695-25", .data = (void *)mpm3695_25 },
 	{ .compatible = "mps,mpm82504", .data = (void *)mpm82504 },
 	{ .compatible = "mps,mpq8785", .data = (void *)mpq8785 },
 	{}
@@ -112,6 +118,8 @@ static int mpq8785_probe(struct i2c_client *client)
 		chip_id = (kernel_ulong_t)i2c_get_match_data(client);
 
 	switch (chip_id) {
+	case mpm3695:
+	case mpm3695_25:
 	case mpm82504:
 		info->format[PSC_VOLTAGE_OUT] = direct;
 		info->m[PSC_VOLTAGE_OUT] = 8;
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH v4 5/5] hwmon: pmbus: mpq8785: Add support for MPM3695 family
  2025-05-11  3:55 ` [PATCH v4 5/5] hwmon: pmbus: mpq8785: Add support for MPM3695 family Pawel Dembicki
@ 2025-05-11  5:09   ` Guenter Roeck
  2025-05-12 16:45   ` Guenter Roeck
  1 sibling, 0 replies; 13+ messages in thread
From: Guenter Roeck @ 2025-05-11  5:09 UTC (permalink / raw)
  To: Pawel Dembicki, linux-hwmon
  Cc: Jean Delvare, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Jonathan Corbet, Noah Wang, Naresh Solanki, Michal Simek,
	Fabio Estevam, Grant Peltier, Laurent Pinchart, Shen Lichuan,
	Peter Zijlstra, Greg KH, Charles Hsu, devicetree, linux-kernel,
	linux-doc

On 5/10/25 20:55, Pawel Dembicki wrote:
> Add support for the Monolithic Power Systems MPM3695 family.
> It contains four devices with suffixes: -10, -20, -25 and -100.
> The device is PMBus compliant and shares characteristics with the
> MPM82504.
> 
> MPM3695-25 has different VOLTAGE_SCALE_LOOP register size [11:0]
> and it needs to be separated because it will be configured in the next
> commit.
> 

Leftover from previous version. No need to resend just for this, I can drop
it when applying. Only resend if the devicetree patches need further changes.

Thanks,
Guenter


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v4 1/5] dt-bindings: hwmon: Add bindings for mpq8785 driver
  2025-05-11  3:55 ` [PATCH v4 1/5] dt-bindings: hwmon: Add bindings for mpq8785 driver Pawel Dembicki
@ 2025-05-11 20:23   ` Krzysztof Kozlowski
  2025-05-12 16:41   ` Guenter Roeck
  1 sibling, 0 replies; 13+ messages in thread
From: Krzysztof Kozlowski @ 2025-05-11 20:23 UTC (permalink / raw)
  To: Pawel Dembicki, linux-hwmon
  Cc: Jean Delvare, Guenter Roeck, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Jonathan Corbet, Noah Wang, Fabio Estevam,
	Naresh Solanki, Michal Simek, Grant Peltier, Laurent Pinchart,
	Shen Lichuan, Peter Zijlstra, Greg KH, Charles Hsu, devicetree,
	linux-kernel, linux-doc

On 11/05/2025 05:55, Pawel Dembicki wrote:
> Add device tree bindings for Monolithic Power Systems MPQ8785, MPM82504
> and MPM3695 PMBus-compliant voltage regulators.
> 
> These bindings also documents the optional
> "mps,vout-fb-divider-ratio-permille" property.
> 

Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>


---

<form letter>
This is an automated instruction, just in case, because many review tags
are being ignored. If you know the process, you can skip it (please do
not feel offended by me posting it here - no bad intentions intended).
If you do not know the process, here is a short explanation:

Please add Acked-by/Reviewed-by/Tested-by tags when posting new versions
of patchset, under or above your Signed-off-by tag, unless patch changed
significantly (e.g. new properties added to the DT bindings). Tag is
"received", when provided in a message replied to you on the mailing
list. Tools like b4 can help here. However, there's no need to repost
patches *only* to add the tags. The upstream maintainer will do that for
tags received on the version they apply.

Full context and explanation:
https://elixir.bootlin.com/linux/v6.12-rc3/source/Documentation/process/submitting-patches.rst#L577
</form letter>

Best regards,
Krzysztof

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v4 1/5] dt-bindings: hwmon: Add bindings for mpq8785 driver
  2025-05-11  3:55 ` [PATCH v4 1/5] dt-bindings: hwmon: Add bindings for mpq8785 driver Pawel Dembicki
  2025-05-11 20:23   ` Krzysztof Kozlowski
@ 2025-05-12 16:41   ` Guenter Roeck
  1 sibling, 0 replies; 13+ messages in thread
From: Guenter Roeck @ 2025-05-12 16:41 UTC (permalink / raw)
  To: Pawel Dembicki
  Cc: linux-hwmon, Jean Delvare, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Jonathan Corbet, Noah Wang, Fabio Estevam,
	Naresh Solanki, Michal Simek, Grant Peltier, Laurent Pinchart,
	Shen Lichuan, Peter Zijlstra, Greg KH, Charles Hsu, devicetree,
	linux-kernel, linux-doc

On Sun, May 11, 2025 at 05:55:44AM +0200, Pawel Dembicki wrote:
> Add device tree bindings for Monolithic Power Systems MPQ8785, MPM82504
> and MPM3695 PMBus-compliant voltage regulators.
> 
> These bindings also documents the optional
> "mps,vout-fb-divider-ratio-permille" property.
> Signed-off-by: Pawel Dembicki <paweldembicki@gmail.com>
> Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

Applied.

Thanks,
Guenter

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v4 2/5] hwmon: pmbus: mpq8785: Prepare driver for multiple device support
  2025-05-11  3:55 ` [PATCH v4 2/5] hwmon: pmbus: mpq8785: Prepare driver for multiple device support Pawel Dembicki
@ 2025-05-12 16:42   ` Guenter Roeck
  0 siblings, 0 replies; 13+ messages in thread
From: Guenter Roeck @ 2025-05-12 16:42 UTC (permalink / raw)
  To: Pawel Dembicki
  Cc: linux-hwmon, Jean Delvare, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Jonathan Corbet, Noah Wang, Naresh Solanki,
	Michal Simek, Fabio Estevam, Grant Peltier, Laurent Pinchart,
	Peter Zijlstra, Shen Lichuan, Greg KH, Charles Hsu, devicetree,
	linux-kernel, linux-doc

On Sun, May 11, 2025 at 05:55:45AM +0200, Pawel Dembicki wrote:
> Refactor the driver to support multiple Monolithic Power Systems devices.
> Introduce chip ID handling based on device tree matching.
> 
> No functional changes intended.
> 
> Signed-off-by: Pawel Dembicki <paweldembicki@gmail.com>

Applied.

Thanks,
Guenter

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v4 3/5] hwmon: pmbus: mpq8785: Implement VOUT feedback resistor divider ratio configuration
  2025-05-11  3:55 ` [PATCH v4 3/5] hwmon: pmbus: mpq8785: Implement VOUT feedback resistor divider ratio configuration Pawel Dembicki
@ 2025-05-12 16:43   ` Guenter Roeck
  0 siblings, 0 replies; 13+ messages in thread
From: Guenter Roeck @ 2025-05-12 16:43 UTC (permalink / raw)
  To: Pawel Dembicki
  Cc: linux-hwmon, Jean Delvare, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Jonathan Corbet, Noah Wang, Michal Simek,
	Naresh Solanki, Fabio Estevam, Grant Peltier, Laurent Pinchart,
	Shen Lichuan, Peter Zijlstra, Greg KH, Charles Hsu, devicetree,
	linux-kernel, linux-doc

On Sun, May 11, 2025 at 05:55:46AM +0200, Pawel Dembicki wrote:
> Implement support for setting the VOUT_SCALE_LOOP PMBus register
> based on an optional device tree property
> "mps,vout-fb-divider-ratio-permille".
> 
> This allows the driver to provide the correct VOUT value depending
> on the feedback voltage divider configuration for chips where the
> bootloader does not configure the VOUT_SCALE_LOOP register.
> 
> Signed-off-by: Pawel Dembicki <paweldembicki@gmail.com>

Applied.

Thanks,
Guenter

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v4 4/5] hwmon: pmbus: mpq8785: Add support for MPM82504
  2025-05-11  3:55 ` [PATCH v4 4/5] hwmon: pmbus: mpq8785: Add support for MPM82504 Pawel Dembicki
@ 2025-05-12 16:44   ` Guenter Roeck
  0 siblings, 0 replies; 13+ messages in thread
From: Guenter Roeck @ 2025-05-12 16:44 UTC (permalink / raw)
  To: Pawel Dembicki
  Cc: linux-hwmon, Jean Delvare, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Jonathan Corbet, Noah Wang, Naresh Solanki,
	Michal Simek, Fabio Estevam, Grant Peltier, Laurent Pinchart,
	Greg KH, Peter Zijlstra, Shen Lichuan, Charles Hsu, devicetree,
	linux-kernel, linux-doc

On Sun, May 11, 2025 at 05:55:47AM +0200, Pawel Dembicki wrote:
> Add support for the Monolithic Power Systems MPM82504 digital voltage
> regulator. MPM82504 uses PMBus direct format for voltage output.
> 
> Tested with device tree based matching.
> 
> Signed-off-by: Pawel Dembicki <paweldembicki@gmail.com>

Applied.

Thanks,
Guenter

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v4 5/5] hwmon: pmbus: mpq8785: Add support for MPM3695 family
  2025-05-11  3:55 ` [PATCH v4 5/5] hwmon: pmbus: mpq8785: Add support for MPM3695 family Pawel Dembicki
  2025-05-11  5:09   ` Guenter Roeck
@ 2025-05-12 16:45   ` Guenter Roeck
  1 sibling, 0 replies; 13+ messages in thread
From: Guenter Roeck @ 2025-05-12 16:45 UTC (permalink / raw)
  To: Pawel Dembicki
  Cc: linux-hwmon, Jean Delvare, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Jonathan Corbet, Noah Wang, Naresh Solanki,
	Michal Simek, Fabio Estevam, Grant Peltier, Laurent Pinchart,
	Shen Lichuan, Peter Zijlstra, Greg KH, Charles Hsu, devicetree,
	linux-kernel, linux-doc

On Sun, May 11, 2025 at 05:55:48AM +0200, Pawel Dembicki wrote:
> Add support for the Monolithic Power Systems MPM3695 family.
> It contains four devices with suffixes: -10, -20, -25 and -100.
> The device is PMBus compliant and shares characteristics with the
> MPM82504.
> 
> MPM3695-25 has different VOLTAGE_SCALE_LOOP register size [11:0]
> and it needs to be separated because it will be configured in the next
> commit.
> 
> Tested with device tree based matching (MPM3695-10).
> 
> Signed-off-by: Pawel Dembicki <paweldembicki@gmail.com>

Aplied, after updating above statement about MPM3695-25 and the next commit.

Thanks,
Guenter

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2025-05-12 16:45 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-11  3:55 [PATCH v4 0/5] hwmon: pmbus: Add support for MPM82504 and MPM3695 family Pawel Dembicki
2025-05-11  3:55 ` [PATCH v4 1/5] dt-bindings: hwmon: Add bindings for mpq8785 driver Pawel Dembicki
2025-05-11 20:23   ` Krzysztof Kozlowski
2025-05-12 16:41   ` Guenter Roeck
2025-05-11  3:55 ` [PATCH v4 2/5] hwmon: pmbus: mpq8785: Prepare driver for multiple device support Pawel Dembicki
2025-05-12 16:42   ` Guenter Roeck
2025-05-11  3:55 ` [PATCH v4 3/5] hwmon: pmbus: mpq8785: Implement VOUT feedback resistor divider ratio configuration Pawel Dembicki
2025-05-12 16:43   ` Guenter Roeck
2025-05-11  3:55 ` [PATCH v4 4/5] hwmon: pmbus: mpq8785: Add support for MPM82504 Pawel Dembicki
2025-05-12 16:44   ` Guenter Roeck
2025-05-11  3:55 ` [PATCH v4 5/5] hwmon: pmbus: mpq8785: Add support for MPM3695 family Pawel Dembicki
2025-05-11  5:09   ` Guenter Roeck
2025-05-12 16:45   ` Guenter Roeck

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).