* [PATCH linux dev-6.6 1/2] hwmon: Add driver for MPS MPQ8785 Synchronous Step-Down Converter
@ 2025-08-06 12:12 Fred Chen
2025-08-06 12:12 ` [PATCH linux dev-6.6 2/2] hwmon: (pmbus/mpq8785) Convert comma to semicolon Fred Chen
2025-08-08 2:35 ` [PATCH linux dev-6.6 1/2] hwmon: Add driver for MPS MPQ8785 Synchronous Step-Down Converter Andrew Jeffery
0 siblings, 2 replies; 5+ messages in thread
From: Fred Chen @ 2025-08-06 12:12 UTC (permalink / raw)
To: andrew, openbmc, joel
From: Charles Hsu <ythsu0511@gmail.com>
Add support for mpq8785 device from Monolithic Power Systems, Inc.
(MPS) vendor. This is synchronous step-down controller.
Signed-off-by: Charles Hsu <ythsu0511@gmail.com>
Link: https://lore.kernel.org/r/20240131074822.2962078-2-ythsu0511@gmail.com
[groeck: probe_new --> probe; add MODULE_IMPORT_NS(PMBUS)]
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
(cherry picked from commit f20b4a931130cb574c40563cfda0fc2cb944b4df)
---
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 | 90 +++++++++++++++++++++++++++++++
5 files changed, 195 insertions(+)
create mode 100644 Documentation/hwmon/mpq8785.rst
create mode 100644 drivers/hwmon/pmbus/mpq8785.c
diff --git a/Documentation/hwmon/index.rst b/Documentation/hwmon/index.rst
index 88dadea85cfc..1f9dd8786609 100644
--- a/Documentation/hwmon/index.rst
+++ b/Documentation/hwmon/index.rst
@@ -158,6 +158,7 @@ Hardware Monitoring Kernel Drivers
mp2888
mp2975
mp5023
+ mpq8785
nct6683
nct6775
nct7802
diff --git a/Documentation/hwmon/mpq8785.rst b/Documentation/hwmon/mpq8785.rst
new file mode 100644
index 000000000000..bf8176b87086
--- /dev/null
+++ b/Documentation/hwmon/mpq8785.rst
@@ -0,0 +1,94 @@
+.. SPDX-License-Identifier: GPL-2.0-only
+
+Kernel driver mpq8785
+=======================
+
+Supported chips:
+
+ * MPS MPQ8785
+
+ Prefix: 'mpq8785'
+
+Author: Charles Hsu <ythsu0511@gmail.com>
+
+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**
diff --git a/drivers/hwmon/pmbus/Kconfig b/drivers/hwmon/pmbus/Kconfig
index b4e93bd5835e..705cf1cc07cc 100644
--- a/drivers/hwmon/pmbus/Kconfig
+++ b/drivers/hwmon/pmbus/Kconfig
@@ -349,6 +349,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
diff --git a/drivers/hwmon/pmbus/Makefile b/drivers/hwmon/pmbus/Makefile
index 84ee960a6c2d..14f004c26a3f 100644
--- a/drivers/hwmon/pmbus/Makefile
+++ b/drivers/hwmon/pmbus/Makefile
@@ -36,6 +36,7 @@ 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_MPQ8785) += mpq8785.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/mpq8785.c b/drivers/hwmon/pmbus/mpq8785.c
new file mode 100644
index 000000000000..4e2549cc8120
--- /dev/null
+++ b/drivers/hwmon/pmbus/mpq8785.c
@@ -0,0 +1,90 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Driver for MPS MPQ8785 Step-Down Converter
+ */
+
+#include <linux/i2c.h>
+#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);
+ if (vout_mode < 0 || vout_mode == 0xff)
+ return vout_mode < 0 ? vout_mode : -ENODEV;
+ switch (vout_mode >> 5) {
+ case 0:
+ info->format[PSC_VOLTAGE_OUT] = linear;
+ break;
+ case 1:
+ case 2:
+ info->format[PSC_VOLTAGE_OUT] = direct,
+ info->m[PSC_VOLTAGE_OUT] = 64;
+ info->b[PSC_VOLTAGE_OUT] = 0;
+ info->R[PSC_VOLTAGE_OUT] = 1;
+ break;
+ default:
+ return -ENODEV;
+ }
+
+ return 0;
+};
+
+static struct pmbus_driver_info mpq8785_info = {
+ .pages = 1,
+ .format[PSC_VOLTAGE_IN] = direct,
+ .format[PSC_CURRENT_OUT] = direct,
+ .format[PSC_TEMPERATURE] = direct,
+ .m[PSC_VOLTAGE_IN] = 4,
+ .b[PSC_VOLTAGE_IN] = 0,
+ .R[PSC_VOLTAGE_IN] = 1,
+ .m[PSC_CURRENT_OUT] = 16,
+ .b[PSC_CURRENT_OUT] = 0,
+ .R[PSC_CURRENT_OUT] = 0,
+ .m[PSC_TEMPERATURE] = 1,
+ .b[PSC_TEMPERATURE] = 0,
+ .R[PSC_TEMPERATURE] = 0,
+ .func[0] =
+ PMBUS_HAVE_VIN | PMBUS_HAVE_STATUS_INPUT |
+ 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", 0 },
+ { },
+};
+MODULE_DEVICE_TABLE(i2c, mpq8785_id);
+
+static const struct of_device_id __maybe_unused mpq8785_of_match[] = {
+ { .compatible = "mps,mpq8785" },
+ {}
+};
+MODULE_DEVICE_TABLE(of, mpq8785_of_match);
+
+static struct i2c_driver mpq8785_driver = {
+ .driver = {
+ .name = "mpq8785",
+ .of_match_table = of_match_ptr(mpq8785_of_match),
+ },
+ .probe = mpq8785_probe,
+ .id_table = mpq8785_id,
+};
+
+module_i2c_driver(mpq8785_driver);
+
+MODULE_AUTHOR("Charles Hsu <ythsu0511@gmail.com>");
+MODULE_DESCRIPTION("PMBus driver for MPS MPQ8785");
+MODULE_LICENSE("GPL");
+MODULE_IMPORT_NS(PMBUS);
--
2.49.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH linux dev-6.6 2/2] hwmon: (pmbus/mpq8785) Convert comma to semicolon
2025-08-06 12:12 [PATCH linux dev-6.6 1/2] hwmon: Add driver for MPS MPQ8785 Synchronous Step-Down Converter Fred Chen
@ 2025-08-06 12:12 ` Fred Chen
2025-08-08 2:35 ` [PATCH linux dev-6.6 1/2] hwmon: Add driver for MPS MPQ8785 Synchronous Step-Down Converter Andrew Jeffery
1 sibling, 0 replies; 5+ messages in thread
From: Fred Chen @ 2025-08-06 12:12 UTC (permalink / raw)
To: andrew, openbmc, joel
From: Shen Lichuan <shenlichuan@vivo.com>
To ensure code clarity and prevent potential errors, use ';' instead of
',' as a statement separator in the function mpq8785_identify.
Signed-off-by: Shen Lichuan <shenlichuan@vivo.com>
Message-ID: <20240919064939.3282-1-shenlichuan@vivo.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
(cherry picked from commit ff140456b5fbf03cbd04277c21d4fcdc5974e97b)
---
drivers/hwmon/pmbus/mpq8785.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/hwmon/pmbus/mpq8785.c b/drivers/hwmon/pmbus/mpq8785.c
index 4e2549cc8120..3b1d978508f8 100644
--- a/drivers/hwmon/pmbus/mpq8785.c
+++ b/drivers/hwmon/pmbus/mpq8785.c
@@ -22,7 +22,7 @@ static int mpq8785_identify(struct i2c_client *client,
break;
case 1:
case 2:
- info->format[PSC_VOLTAGE_OUT] = direct,
+ info->format[PSC_VOLTAGE_OUT] = direct;
info->m[PSC_VOLTAGE_OUT] = 64;
info->b[PSC_VOLTAGE_OUT] = 0;
info->R[PSC_VOLTAGE_OUT] = 1;
--
2.49.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH linux dev-6.6 1/2] hwmon: Add driver for MPS MPQ8785 Synchronous Step-Down Converter
2025-08-06 12:12 [PATCH linux dev-6.6 1/2] hwmon: Add driver for MPS MPQ8785 Synchronous Step-Down Converter Fred Chen
2025-08-06 12:12 ` [PATCH linux dev-6.6 2/2] hwmon: (pmbus/mpq8785) Convert comma to semicolon Fred Chen
@ 2025-08-08 2:35 ` Andrew Jeffery
2025-08-08 7:28 ` Fred Chen
1 sibling, 1 reply; 5+ messages in thread
From: Andrew Jeffery @ 2025-08-08 2:35 UTC (permalink / raw)
To: Fred Chen, openbmc, joel
On Wed, 2025-08-06 at 20:12 +0800, Fred Chen wrote:
> From: Charles Hsu <ythsu0511@gmail.com>
>
> Add support for mpq8785 device from Monolithic Power Systems, Inc.
> (MPS) vendor. This is synchronous step-down controller.
>
> Signed-off-by: Charles Hsu <ythsu0511@gmail.com>
> Link: https://lore.kernel.org/r/20240131074822.2962078-2-ythsu0511@gmail.com
> [groeck: probe_new --> probe; add MODULE_IMPORT_NS(PMBUS)]
> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
> (cherry picked from commit f20b4a931130cb574c40563cfda0fc2cb944b4df)
I'm not sure what you did here with the backported patches, because
trying to apply this series from the list lead to conflicts. However,
on the basis that there was no discussion of conflicts, I cherry-picked
back the changes as indicated by the commit IDs, which applied
successfully (though with auto-merge results).
Possibly it's differences in the tooling for patches vs existing
commits, but some discussion of your experiences would be helpful.
Did you try to apply your own series before sending it to the list?
Andrew
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH linux dev-6.6 1/2] hwmon: Add driver for MPS MPQ8785 Synchronous Step-Down Converter
2025-08-08 2:35 ` [PATCH linux dev-6.6 1/2] hwmon: Add driver for MPS MPQ8785 Synchronous Step-Down Converter Andrew Jeffery
@ 2025-08-08 7:28 ` Fred Chen
2025-08-10 23:41 ` Andrew Jeffery
0 siblings, 1 reply; 5+ messages in thread
From: Fred Chen @ 2025-08-08 7:28 UTC (permalink / raw)
To: Andrew Jeffery; +Cc: openbmc, joel
Andrew Jeffery <andrew@codeconstruct.com.au> 於 2025年8月8日 週五 上午10:35寫道:
>
> On Wed, 2025-08-06 at 20:12 +0800, Fred Chen wrote:
> > From: Charles Hsu <ythsu0511@gmail.com>
> >
> > Add support for mpq8785 device from Monolithic Power Systems, Inc.
> > (MPS) vendor. This is synchronous step-down controller.
> >
> > Signed-off-by: Charles Hsu <ythsu0511@gmail.com>
> > Link: https://lore.kernel.org/r/20240131074822.2962078-2-ythsu0511@gmail.com
> > [groeck: probe_new --> probe; add MODULE_IMPORT_NS(PMBUS)]
> > Signed-off-by: Guenter Roeck <linux@roeck-us.net>
> > (cherry picked from commit f20b4a931130cb574c40563cfda0fc2cb944b4df)
>
> I'm not sure what you did here with the backported patches, because
> trying to apply this series from the list lead to conflicts. However,
> on the basis that there was no discussion of conflicts, I cherry-picked
> back the changes as indicated by the commit IDs, which applied
> successfully (though with auto-merge results).
>
> Possibly it's differences in the tooling for patches vs existing
> commits, but some discussion of your experiences would be helpful.
>
> Did you try to apply your own series before sending it to the list?
>
> Andrew
Hi Andrew,
Thanks for pointing this out.
I realized I was using the wrong Linux 6.6 tree when testing — I used
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
(branch: linux-6.6.y) instead of the OpenBMC Linux kernel. That tree’s
index.rst doesn’t include mp5990, which caused the conflict. I’ll use
the OpenBMC Linux kernel for patch preparation next time to avoid this
issue.
Fred
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH linux dev-6.6 1/2] hwmon: Add driver for MPS MPQ8785 Synchronous Step-Down Converter
2025-08-08 7:28 ` Fred Chen
@ 2025-08-10 23:41 ` Andrew Jeffery
0 siblings, 0 replies; 5+ messages in thread
From: Andrew Jeffery @ 2025-08-10 23:41 UTC (permalink / raw)
To: Fred Chen; +Cc: openbmc, joel
On Fri, 2025-08-08 at 15:28 +0800, Fred Chen wrote:
> Andrew Jeffery <andrew@codeconstruct.com.au> 於 2025年8月8日 週五 上午10:35寫道:
> >
> > On Wed, 2025-08-06 at 20:12 +0800, Fred Chen wrote:
> > > From: Charles Hsu <ythsu0511@gmail.com>
> > >
> > > Add support for mpq8785 device from Monolithic Power Systems, Inc.
> > > (MPS) vendor. This is synchronous step-down controller.
> > >
> > > Signed-off-by: Charles Hsu <ythsu0511@gmail.com>
> > > Link: https://lore.kernel.org/r/20240131074822.2962078-2-ythsu0511@gmail.com
> > > [groeck: probe_new --> probe; add MODULE_IMPORT_NS(PMBUS)]
> > > Signed-off-by: Guenter Roeck <linux@roeck-us.net>
> > > (cherry picked from commit f20b4a931130cb574c40563cfda0fc2cb944b4df)
> >
> > I'm not sure what you did here with the backported patches, because
> > trying to apply this series from the list lead to conflicts. However,
> > on the basis that there was no discussion of conflicts, I cherry-picked
> > back the changes as indicated by the commit IDs, which applied
> > successfully (though with auto-merge results).
> >
> > Possibly it's differences in the tooling for patches vs existing
> > commits, but some discussion of your experiences would be helpful.
> >
> > Did you try to apply your own series before sending it to the list?
> >
> > Andrew
>
> Hi Andrew,
>
> Thanks for pointing this out.
>
> I realized I was using the wrong Linux 6.6 tree when testing — I used
> https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
> (branch: linux-6.6.y) instead of the OpenBMC Linux kernel. That tree’s
> index.rst doesn’t include mp5990, which caused the conflict. I’ll use
> the OpenBMC Linux kernel for patch preparation next time to avoid this
> issue.
>
Thanks for taking the time to understand what happened.
Andrew
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2025-08-10 23:41 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-06 12:12 [PATCH linux dev-6.6 1/2] hwmon: Add driver for MPS MPQ8785 Synchronous Step-Down Converter Fred Chen
2025-08-06 12:12 ` [PATCH linux dev-6.6 2/2] hwmon: (pmbus/mpq8785) Convert comma to semicolon Fred Chen
2025-08-08 2:35 ` [PATCH linux dev-6.6 1/2] hwmon: Add driver for MPS MPQ8785 Synchronous Step-Down Converter Andrew Jeffery
2025-08-08 7:28 ` Fred Chen
2025-08-10 23:41 ` Andrew Jeffery
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).