Skip to contentSkip to conversation

hwmon: Add driver for MPS MPQ8785 Synchronous Step-Down Converter

PATCH In review Charles Hsu 5 participants 12 messages Jan 31, 2024 – Feb 1, 2024

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

PATCH v3 1/2 hwmon: Add driver for MPS MPQ8785 Synchronous Step-Down Converter

Add support for mpq8785 device from Monolithic Power Systems, Inc. (MPS) vendor. This is synchronous step-down controller.

---
Change in v1:
Initial patchset.
Change in v2:
1.Add pmbus support status registers.
2.Add mpq8785 in trivial-devices.yaml.
3.Remove format[PSC_VOLTAGE_OUT].
4.Fix MODULE_DESCRIPTION.
Change in v3:
1.Identify vout_mode.
2.Separate dt-binding.

---
 Documentation/hwmon/index.rst   |  1 +
 Documentation/hwmon/mpq8785.rst | 94 +++++++++++++++++++++++++++++++++
 drivers/hwmon/pmbus/Kconfig     |  9 ++++
 drivers/hwmon/pmbus/Makefile    |  1 +
 drivers/hwmon/pmbus/mpq8785.c   | 91 +++++++++++++++++++++++++++++++
 5 files changed, 196 insertions(+)
 create mode 100644 Documentation/hwmon/mpq8785.rst
 create mode 100644 drivers/hwmon/pmbus/mpq8785.c
Documentation/hwmon/index.rst +1 -0
index c7ed1f73ac06..085ad6ca9b05 100644
@@ -163,6 +163,7 @@ Hardware Monitoring Kernel Drivers
    mp2975
    mp5023
    mp5990
+   mpq8785
    nct6683
    nct6775
    nct7802
Documentation/hwmon/mpq8785.rst new file +94 -0

94 lines not on this page · raw message

drivers/hwmon/pmbus/Kconfig +9 -0
index 294808f5240a..557ae0c414b0 100644
@@ -377,6 +377,15 @@ config SENSORS_MPQ7932
 	  This driver can also be built as a module. If so, the module will
 	  be called mpq7932.
 
+config SENSORS_MPQ8785
+	tristate "MPS MPQ8785"
+	help
+	  If you say yes here you get hardware monitoring functionality support
+	  for power management IC MPS MPQ8785.
+
+	  This driver can also be built as a module. If so, the module will
+	  be called mpq8785.
+
 config SENSORS_PIM4328
 	tristate "Flex PIM4328 and compatibles"
 	help
drivers/hwmon/pmbus/Makefile +1 -0
index cf8a76744545..f14ecf03ad77 100644
@@ -39,6 +39,7 @@ obj-$(CONFIG_SENSORS_MP2975)	+= mp2975.o
 obj-$(CONFIG_SENSORS_MP5023)	+= mp5023.o
 obj-$(CONFIG_SENSORS_MP5990)	+= mp5990.o
 obj-$(CONFIG_SENSORS_MPQ7932)	+= mpq7932.o
+obj-$(CONFIG_SENSORS_MPQ8785)	+= mpq8785.o
 obj-$(CONFIG_SENSORS_PLI1209BC)	+= pli1209bc.o
 obj-$(CONFIG_SENSORS_PM6764TR)	+= pm6764tr.o
 obj-$(CONFIG_SENSORS_PXE1610)	+= pxe1610.o
drivers/hwmon/pmbus/mpq8785.c new file +91 -0

91 lines not on this page · raw message

Signature · 1 line
2.34.1
#1 lore raw

PATCH v3 2/2 dt-bindings: Add MPQ8785 voltage regulator device

Monolithic Power Systems, Inc. (MPS) synchronous step-down converter.

---
 Documentation/devicetree/bindings/trivial-devices.yaml | 2 ++
 1 file changed, 2 insertions(+)
Documentation/devicetree/bindings/trivial-devices.yaml +2 -0
index 79dcd92c4a43..088b23ed2ae6 100644
@@ -129,6 +129,8 @@ properties:
           - mps,mp2975
             # Monolithic Power Systems Inc. multi-phase hot-swap controller mp5990
           - mps,mp5990
+            # Monolithic Power Systems Inc. synchronous step-down converter mpq8785
+          - mps,mpq8785
             # Honeywell Humidicon HIH-6130 humidity/temperature sensor
           - honeywell,hi6130
             # IBM Common Form Factor Power Supply Versions (all versions)
Signature · 1 line
2.34.1
maintainer
#2 lore raw

Re: [PATCH v3 2/2] dt-bindings: Add MPQ8785 voltage regulator device

Quoted 3 lines · Charles Hsu

Monolithic Power Systems, Inc. (MPS) synchronous step-down converter.

This should be the first patch of the series.

Thanks,
Guenter

Acked-by on v3 2/2
#3 lore raw

Re: [PATCH v3 2/2] dt-bindings: Add MPQ8785 voltage regulator device

In reply to Charles Hsu
Quoted 12 lines · Charles Hsu

Monolithic Power Systems, Inc. (MPS) synchronous step-down converter.

---
 Documentation/devicetree/bindings/trivial-devices.yaml | 2 ++
 1 file changed, 2 insertions(+)
Documentation/devicetree/bindings/trivial-devices.yaml +0 -0
index 79dcd92c4a43..088b23ed2ae6 100644

Documentation/devicetree/bindings/trivial-devices.yaml properties: · line 133

Quoted 5 lines
Documentation/devicetree/bindings/trivial-devices.yaml +2 -0
@@ -129,6 +129,8 @@ properties:
           - mps,mp2975
             # Monolithic Power Systems Inc. multi-phase hot-swap controller mp5990
           - mps,mp5990
+            # Monolithic Power Systems Inc. synchronous step-down converter mpq8785
+          - mps,mpq8785

q sorts before 2, otherwise

Cheers,
Conor.

Quoted 6 lines
Documentation/devicetree/bindings/trivial-devices.yaml +0 -0
             # Honeywell Humidicon HIH-6130 humidity/temperature sensor
           - honeywell,hi6130
             # IBM Common Form Factor Power Supply Versions (all versions)
Signature · 1 line
2.34.1
author
#4 lore raw

Re: [PATCH v3 2/2] dt-bindings: Add MPQ8785 voltage regulator device

Quoted 9 lines · Conor Dooley
Quoted 7 lines · Charles Hsu

Monolithic Power Systems, Inc. (MPS) synchronous step-down converter.

---
 Documentation/devicetree/bindings/trivial-devices.yaml | 2 ++
 1 file changed, 2 insertions(+)
Quoted 12 lines

Documentation/devicetree/bindings/trivial-devices.yaml properties: · line 133

Quoted 10 lines
Documentation/devicetree/bindings/trivial-devices.yaml +2 -0
index 79dcd92c4a43..088b23ed2ae6 100644
@@ -129,6 +129,8 @@ properties:
           - mps,mp2975
             # Monolithic Power Systems Inc. multi-phase hot-swap controller mp5990
           - mps,mp5990
+            # Monolithic Power Systems Inc. synchronous step-down converter mpq8785
+          - mps,mpq8785

q sorts before 2, otherwise

Okay, I got it.

Quoted 11 lines

Cheers,
Conor.

Quoted 6 lines
Documentation/devicetree/bindings/trivial-devices.yaml +0 -1
             # Honeywell Humidicon HIH-6130 humidity/temperature sensor
           - honeywell,hi6130
             # IBM Common Form Factor Power Supply Versions (all versions)
--

2.34.1

#5 lore raw

Re: [PATCH v3 2/2] dt-bindings: Add MPQ8785 voltage regulator device

Quoted 22 lines · 徐永謄
Quoted 9 lines · Conor Dooley
Quoted 7 lines · Charles Hsu

Monolithic Power Systems, Inc. (MPS) synchronous step-down converter.

---
 Documentation/devicetree/bindings/trivial-devices.yaml | 2 ++
 1 file changed, 2 insertions(+)
Quoted 12 lines

Documentation/devicetree/bindings/trivial-devices.yaml properties: · line 133

Quoted 10 lines
Documentation/devicetree/bindings/trivial-devices.yaml +2 -0
index 79dcd92c4a43..088b23ed2ae6 100644
@@ -129,6 +129,8 @@ properties:
           - mps,mp2975
             # Monolithic Power Systems Inc. multi-phase hot-swap controller mp5990
           - mps,mp5990
+            # Monolithic Power Systems Inc. synchronous step-down converter mpq8785
+          - mps,mpq8785

q sorts before 2, otherwise

Quoted 1 line

Okay, I got it.

Apparently I am wrong, sorry about that! Please ignore this comment.

Thanks,
Conor.

maintainer
#6 lore raw

Re: [PATCH v3 2/2] dt-bindings: Add MPQ8785 voltage regulator device

In reply to Conor Dooley
Quoted 8 lines · Conor Dooley
Quoted 7 lines · Charles Hsu

Monolithic Power Systems, Inc. (MPS) synchronous step-down converter.

---
  Documentation/devicetree/bindings/trivial-devices.yaml | 2 ++
  1 file changed, 2 insertions(+)
Quoted 12 lines

Documentation/devicetree/bindings/trivial-devices.yaml properties: · line 133

Quoted 10 lines
Documentation/devicetree/bindings/trivial-devices.yaml +2 -0
index 79dcd92c4a43..088b23ed2ae6 100644
@@ -129,6 +129,8 @@ properties:
            - mps,mp2975
              # Monolithic Power Systems Inc. multi-phase hot-swap controller mp5990
            - mps,mp5990
+            # Monolithic Power Systems Inc. synchronous step-down converter mpq8785
+          - mps,mpq8785

q sorts before 2, otherwise

It does ? Not in ASCII. Am I missing something ?

Thanks,
Guenter

#7 lore raw

Re: [PATCH v3 2/2] dt-bindings: Add MPQ8785 voltage regulator device

Quoted 22 lines · Guenter Roeck
Quoted 8 lines · Conor Dooley
Quoted 7 lines · Charles Hsu

Monolithic Power Systems, Inc. (MPS) synchronous step-down converter.

---
  Documentation/devicetree/bindings/trivial-devices.yaml | 2 ++
  1 file changed, 2 insertions(+)
Quoted 12 lines

Documentation/devicetree/bindings/trivial-devices.yaml properties: · line 133

Quoted 10 lines
Documentation/devicetree/bindings/trivial-devices.yaml +2 -0
index 79dcd92c4a43..088b23ed2ae6 100644
@@ -129,6 +129,8 @@ properties:
            - mps,mp2975
              # Monolithic Power Systems Inc. multi-phase hot-swap controller mp5990
            - mps,mp5990
+            # Monolithic Power Systems Inc. synchronous step-down converter mpq8785
+          - mps,mpq8785

q sorts before 2, otherwise

Quoted 1 line

It does ? Not in ASCII. Am I missing something ?

Also sort agrees with q being after numbers.

Best regards,
Krzysztof

#8 lore raw

Re: [PATCH v3 2/2] dt-bindings: Add MPQ8785 voltage regulator device

Quoted 23 lines · Krzysztof Kozlowski
Quoted 22 lines · Guenter Roeck
Quoted 20 lines · Conor Dooley
Quoted 12 lines · Charles Hsu

Monolithic Power Systems, Inc. (MPS) synchronous step-down converter.

---
  Documentation/devicetree/bindings/trivial-devices.yaml | 2 ++
  1 file changed, 2 insertions(+)
Documentation/devicetree/bindings/trivial-devices.yaml +0 -0
index 79dcd92c4a43..088b23ed2ae6 100644

Documentation/devicetree/bindings/trivial-devices.yaml properties: · line 133

Quoted 5 lines
Documentation/devicetree/bindings/trivial-devices.yaml +2 -0
@@ -129,6 +129,8 @@ properties:
            - mps,mp2975
              # Monolithic Power Systems Inc. multi-phase hot-swap controller mp5990
            - mps,mp5990
+            # Monolithic Power Systems Inc. synchronous step-down converter mpq8785
+          - mps,mpq8785

q sorts before 2, otherwise

Quoted 3 lines
Quoted 1 line

It does ? Not in ASCII. Am I missing something ?

Also sort agrees with q being after numbers.

Disregard that comment so.

#9 lore raw

Re: [PATCH v3 2/2] dt-bindings: Add MPQ8785 voltage regulator device

In reply to Conor Dooley
Quoted 20 lines · Conor Dooley
Quoted 12 lines · Charles Hsu

Monolithic Power Systems, Inc. (MPS) synchronous step-down converter.

---
 Documentation/devicetree/bindings/trivial-devices.yaml | 2 ++
 1 file changed, 2 insertions(+)
Documentation/devicetree/bindings/trivial-devices.yaml +0 -0
index 79dcd92c4a43..088b23ed2ae6 100644

Documentation/devicetree/bindings/trivial-devices.yaml properties: · line 133

Quoted 5 lines
Documentation/devicetree/bindings/trivial-devices.yaml +2 -0
@@ -129,6 +129,8 @@ properties:
           - mps,mp2975
             # Monolithic Power Systems Inc. multi-phase hot-swap controller mp5990
           - mps,mp5990
+            # Monolithic Power Systems Inc. synchronous step-down converter mpq8785
+          - mps,mpq8785

q sorts before 2, otherwise

Quoted 1 line

I will sort the file and my patch should go via Rob's tree, I guess, so maybe this one could go as well?

Best regards,
Krzysztof

maintainer
#10 lore raw

Re: [PATCH v3 2/2] dt-bindings: Add MPQ8785 voltage regulator device

Quoted 23 lines · Krzysztof Kozlowski
Quoted 20 lines · Conor Dooley
Quoted 12 lines · Charles Hsu

Monolithic Power Systems, Inc. (MPS) synchronous step-down converter.

---
  Documentation/devicetree/bindings/trivial-devices.yaml | 2 ++
  1 file changed, 2 insertions(+)
Documentation/devicetree/bindings/trivial-devices.yaml +0 -0
index 79dcd92c4a43..088b23ed2ae6 100644

Documentation/devicetree/bindings/trivial-devices.yaml properties: · line 133

Quoted 5 lines
Documentation/devicetree/bindings/trivial-devices.yaml +2 -0
@@ -129,6 +129,8 @@ properties:
            - mps,mp2975
              # Monolithic Power Systems Inc. multi-phase hot-swap controller mp5990
            - mps,mp5990
+            # Monolithic Power Systems Inc. synchronous step-down converter mpq8785
+          - mps,mpq8785

q sorts before 2, otherwise

Quoted 1 line
Quoted 3 lines

I will sort the file and my patch should go via Rob's tree, I guess, so maybe this one could go as well?

Sure, fine with me. I applied the patch to the hwmon tree, but I have no problems dropping it from there. Sorry, I never know if I should take .yaml patches or not.

Guenter

maintainer
#11 lore raw
In reply to Charles Hsu
Quoted 182 lines · Charles Hsu

Add support for mpq8785 device from Monolithic Power Systems, Inc. (MPS) vendor. This is synchronous step-down controller.

---
Change in v1:
Initial patchset.
Change in v2:
1.Add pmbus support status registers.
2.Add mpq8785 in trivial-devices.yaml.
3.Remove format[PSC_VOLTAGE_OUT].
4.Fix MODULE_DESCRIPTION.
Change in v3:
1.Identify vout_mode.
2.Separate dt-binding.

---
  Documentation/hwmon/index.rst   |  1 +
  Documentation/hwmon/mpq8785.rst | 94 +++++++++++++++++++++++++++++++++
  drivers/hwmon/pmbus/Kconfig     |  9 ++++
  drivers/hwmon/pmbus/Makefile    |  1 +
  drivers/hwmon/pmbus/mpq8785.c   | 91 +++++++++++++++++++++++++++++++
  5 files changed, 196 insertions(+)

create mode 100644 Documentation/hwmon/mpq8785.rst create mode 100644 drivers/hwmon/pmbus/mpq8785.c

Documentation/hwmon/index.rst +1 -0
index c7ed1f73ac06..085ad6ca9b05 100644
@@ -163,6 +163,7 @@ Hardware Monitoring Kernel Drivers
     mp2975
     mp5023
     mp5990
+   mpq8785
     nct6683
     nct6775
     nct7802
Documentation/hwmon/mpq8785.rst new file +94 -0
new file mode 100644
index 000000000000..bf8176b87086
@@ -0,0 +1,94 @@
+.. SPDX-License-Identifier: GPL-2.0-only
+
+Kernel driver mpq8785
+=======================
+
+Supported chips:
+
+  * MPS MPQ8785
+
+    Prefix: 'mpq8785'
+
+Author: Charles Hsu <[email protected]>
+
+Description
+-----------
+
+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
+wide input supply range. The MPQ8785 operates at high efficiency over a wide
+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)
+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
+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.
+
+Device compliant with:
+
+- PMBus rev 1.3 interface.
+
+The driver exports the following attributes via the 'sysfs' files
+for input voltage:
+
+**in1_input**
+
+**in1_label**
+
+**in1_max**
+
+**in1_max_alarm**
+
+**in1_min**
+
+**in1_min_alarm**
+
+**in1_crit**
+
+**in1_crit_alarm**
+
+The driver provides the following attributes for output voltage:
+
+**in2_input**
+
+**in2_label**
+
+**in2_alarm**
+
+The driver provides the following attributes for output current:
+
+**curr1_input**
+
+**curr1_label**
+
+**curr1_max**
+
+**curr1_max_alarm**
+
+**curr1_crit**
+
+**curr1_crit_alarm**
+
+The driver provides the following attributes for temperature:
+
+**temp1_input**
+
+**temp1_max**
+
+**temp1_max_alarm**
+
+**temp1_crit**
+
+**temp1_crit_alarm**
drivers/hwmon/pmbus/Kconfig +9 -0
index 294808f5240a..557ae0c414b0 100644
@@ -377,6 +377,15 @@ config SENSORS_MPQ7932
  	  This driver can also be built as a module. If so, the module will
  	  be called mpq7932.
 
+config SENSORS_MPQ8785
+	tristate "MPS MPQ8785"
+	help
+	  If you say yes here you get hardware monitoring functionality support
+	  for power management IC MPS MPQ8785.
+
+	  This driver can also be built as a module. If so, the module will
+	  be called mpq8785.
+
  config SENSORS_PIM4328
  	tristate "Flex PIM4328 and compatibles"
  	help
drivers/hwmon/pmbus/Makefile +1 -0
index cf8a76744545..f14ecf03ad77 100644
@@ -39,6 +39,7 @@ obj-$(CONFIG_SENSORS_MP2975)	+= mp2975.o
  obj-$(CONFIG_SENSORS_MP5023)	+= mp5023.o
  obj-$(CONFIG_SENSORS_MP5990)	+= mp5990.o
  obj-$(CONFIG_SENSORS_MPQ7932)	+= mpq7932.o
+obj-$(CONFIG_SENSORS_MPQ8785)	+= mpq8785.o
  obj-$(CONFIG_SENSORS_PLI1209BC)	+= pli1209bc.o
  obj-$(CONFIG_SENSORS_PM6764TR)	+= pm6764tr.o
  obj-$(CONFIG_SENSORS_PXE1610)	+= pxe1610.o
drivers/hwmon/pmbus/mpq8785.c new file +6 -0
new file mode 100644
index 000000000000..b5bfc5d8a96b
@@ -0,0 +1,91 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Driver for MPS MPQ8785 Step-Down Converter
+ */
+
+#include <linux/i2c.h>

drivers/hwmon/pmbus/mpq8785.c line 16

Quoted 10 lines
drivers/hwmon/pmbus/mpq8785.c new file +10 -0
+#include <linux/module.h>
+#include <linux/of_device.h>
+#include "pmbus.h"
+
+static int mpq8785_identify(struct i2c_client *client,
+			    struct pmbus_driver_info *info)
+{
+	int vout_mode;
+
+	vout_mode = pmbus_read_byte_data(client, 0, PMBUS_VOUT_MODE);

Excellent solution, but it will have to return an error if reading VOUT_MODE fails. Something like:

	vout_mode = ...;
	if (vout_mode < 0 || vout_mode == 0xff)
		return vout_mode < 0 ? vout_mode : -ENODEV;

	switch (vout_mode >> 5) {
	...

The output mode _has_ to be valid.

Thanks,
Guenter