Skip to contentSkip to conversation

dt-bindings: hwmon: Add MPS mp2925 and mp2929

PATCH New Jackson Liu 1 participant 3 messages Mar 19

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/3 dt-bindings: hwmon: Add MPS mp2925 and mp2929

From: Wensheng Wang <[email protected]>

Add support for MPS mp2925 and mp2929 controller.

(cherry picked from commit 933b9bc8bb2b9c348fbb2105e461780b8f89953e)
---
 Documentation/devicetree/bindings/trivial-devices.yaml | 4 ++++
 1 file changed, 4 insertions(+)
Documentation/devicetree/bindings/trivial-devices.yaml +4 -0
index 4aaec3a6d461..21432573185b 100644
@@ -301,6 +301,10 @@ properties:
           - mps,mp2888
             # Monolithic Power Systems Inc. multi-phase controller mp2891
           - mps,mp2891
+            # Monolithic Power Systems Inc. multi-phase controller mp2925
+          - mps,mp2925
+            # Monolithic Power Systems Inc. multi-phase controller mp2929
+          - mps,mp2929
             # Monolithic Power Systems Inc. multi-phase controller mp29502
           - mps,mp29502
             # Monolithic Power Systems Inc. multi-phase controller mp29608
Signature · 1 line
2.43.0
#1 lore raw

PATCH 2/3 hwmon: Add MP2925 and MP2929 driver

From: Wensheng Wang <[email protected]>

Add support for MPS VR mp2925 and mp2929 controller. This driver exposes telemetry and limit value readings and writtings.

(cherry picked from commit a79472e30be48e6693f83d298836880b56afc5a7)
---
 Documentation/hwmon/index.rst  |   1 +
 Documentation/hwmon/mp2925.rst | 151 ++++++++++++++++
 MAINTAINERS                    |   7 +
 drivers/hwmon/pmbus/Kconfig    |   9 +
 drivers/hwmon/pmbus/Makefile   |   1 +
 drivers/hwmon/pmbus/mp2925.c   | 316 +++++++++++++++++++++++++++++++++
 6 files changed, 485 insertions(+)
 create mode 100644 Documentation/hwmon/mp2925.rst
 create mode 100644 drivers/hwmon/pmbus/mp2925.c
Documentation/hwmon/index.rst +1 -0
index 2be07966fed6..960f9166ae8e 100644
@@ -177,6 +177,7 @@ Hardware Monitoring Kernel Drivers
    mp2869
    mp2888
    mp2891
+   mp2925
    mp29502
    mp2975
    mp2993
Documentation/hwmon/mp2925.rst new file +151 -0

151 lines not on this page · raw message

MAINTAINERS +7 -0
index 10b1f6f61afc..a697e450301d 100644
@@ -17501,6 +17501,13 @@ S:	Maintained
 F:	Documentation/hwmon/mp2891.rst
 F:	drivers/hwmon/pmbus/mp2891.c
 
+MPS MP2925 DRIVER
+M:	Noah Wang <[email protected]>
+L:	[email protected]
+S:	Maintained
+F:	Documentation/hwmon/mp2925.rst
+F:	drivers/hwmon/pmbus/mp2925.c
+
 MPS MP29502 DRIVER
 M:	Wensheng Wang <[email protected]>
 L:	[email protected]
drivers/hwmon/pmbus/Kconfig +9 -0
index 6860673bcecf..933dd3b71d21 100644
@@ -401,6 +401,15 @@ config SENSORS_MP2891
       This driver can also be built as a module. If so, the module will
       be called mp2891.
 
+config SENSORS_MP2925
+    tristate "MPS MP2925"
+    help
+      If you say yes here you get hardware monitoring support for MPS
+      MP2925 Dual Loop Digital Multi-Phase Controller.
+
+      This driver can also be built as a module. If so, the module will
+      be called mp2925.
+
 config SENSORS_MP29502
 	tristate "MPS MP29502"
 	help
drivers/hwmon/pmbus/Makefile +1 -0
index 57f23fb0ab86..be3884465641 100644
@@ -40,6 +40,7 @@ obj-$(CONFIG_SENSORS_MP2856)	+= mp2856.o
 obj-$(CONFIG_SENSORS_MP2869)	+= mp2869.o
 obj-$(CONFIG_SENSORS_MP2888)	+= mp2888.o
 obj-$(CONFIG_SENSORS_MP2891)	+= mp2891.o
+obj-$(CONFIG_SENSORS_MP2925)	+= mp2925.o
 obj-$(CONFIG_SENSORS_MP29502)	+= mp29502.o
 obj-$(CONFIG_SENSORS_MP2975)	+= mp2975.o
 obj-$(CONFIG_SENSORS_MP2993)	+= mp2993.o
drivers/hwmon/pmbus/mp2925.c new file +316 -0

316 lines not on this page · raw message

Signature · 1 line
2.43.0
#2 lore raw

PATCH 3/3 hwmon: (mp2925) Add vid offset for vid mode

In reply to Jackson Liu

From: Wensheng Wang <[email protected]>

In vid mode, the mp2925 vout telemetry has 49 vid step offset, add vid offset for this.

(cherry picked from commit a9c4ac630c8a38a0496c2b54cf27b318d38ab6e6)
---
 drivers/hwmon/pmbus/mp2925.c | 23 +++++++++++++++++++++--
 1 file changed, 21 insertions(+), 2 deletions(-)
drivers/hwmon/pmbus/mp2925.c +21 -2
index 6bebd6023021..ad094842cf2d 100644
@@ -40,6 +40,7 @@
 struct mp2925_data {
 	struct pmbus_driver_info info;
 	int vout_scale[MP2925_PAGE_NUM];
+	int vid_offset[MP2925_PAGE_NUM];
 };
 
 #define to_mp2925_data(x) container_of(x, struct mp2925_data, info)
@@ -94,8 +95,15 @@ static int mp2925_read_word_data(struct i2c_client *client, int page, int phase,
 		if (ret < 0)
 			return ret;
 
-		ret = DIV_ROUND_CLOSEST((ret & GENMASK(11, 0)) * data->vout_scale[page],
-					MP2925_VOUT_DIV);
+		/*
+		 * In vid mode, the MP2925 vout telemetry has 49 vid step offset, but
+		 * PMBUS_VOUT_OV_FAULT_LIMIT and PMBUS_VOUT_UV_FAULT_LIMIT do not take
+		 * this into consideration, its resolution is 1.95mV/LSB, as a result,
+		 * format[PSC_VOLTAGE_OUT] can not be set to vid directly. Adding extra
+		 * vid_offset variable for vout telemetry.
+		 */
+		ret = DIV_ROUND_CLOSEST(((ret & GENMASK(11, 0)) + data->vid_offset[page]) *
+					data->vout_scale[page], MP2925_VOUT_DIV);
 		break;
 	case PMBUS_VOUT_OV_FAULT_LIMIT:
 	case PMBUS_VOUT_UV_FAULT_LIMIT:
@@ -231,10 +239,21 @@ mp2925_identify_vout_scale(struct i2c_client *client, struct pmbus_driver_info *
 			data->vout_scale[page] = 2560;
 		else
 			data->vout_scale[page] = 5120;
+
+		/*
+		 * In vid mode, the MP2925 vout telemetry has 49 vid step offset, but
+		 * PMBUS_VOUT_OV_FAULT_LIMIT and PMBUS_VOUT_UV_FAULT_LIMIT do not take
+		 * this into consideration, its resolution is 1.95mV/LSB, as a result,
+		 * format[PSC_VOLTAGE_OUT] can not be set to vid directly. Adding extra
+		 * vid_offset variable for vout telemetry.
+		 */
+		data->vid_offset[page] = 49;
 	} else if (FIELD_GET(GENMASK(4, 4), ret)) {
 		data->vout_scale[page] = 1;
+		data->vid_offset[page] = 0;
 	} else {
 		data->vout_scale[page] = 512;
+		data->vid_offset[page] = 0;
 	}
 
 	return 0;
Signature · 1 line
2.43.0