* [PATCH 0/2] hwmon: Add support for MPS mp5998 chip
@ 2025-09-23 9:09 Yuxi Wang
2025-09-23 9:09 ` [PATCH 1/2] dt-bindings: hwmon: Add MPS mp5998 Yuxi Wang
2025-09-23 9:09 ` [PATCH 2/2] hwmon: add mp5998 driver Yuxi Wang
0 siblings, 2 replies; 5+ messages in thread
From: Yuxi Wang @ 2025-09-23 9:09 UTC (permalink / raw)
To: Yuxi.Wang, corbet, linux, jdelvare, robh, krzk+dt, conor+dt
Cc: wyx137120466, linux-kernel, linux-doc, linux-hwmon, devicetree
Add mp5998 driver in hwmon and add dt-binding for it.
Yuxi Wang (2):
dt-bindings: hwmon: Add MPS mp5998
hwmon: add mp5998 driver
.../devicetree/bindings/trivial-devices.yaml | 2 +
Documentation/hwmon/index.rst | 1 +
Documentation/hwmon/mp5998.rst | 92 ++++++++++
MAINTAINERS | 7 +
drivers/hwmon/pmbus/Kconfig | 9 +
drivers/hwmon/pmbus/Makefile | 1 +
drivers/hwmon/pmbus/mp5998.c | 162 ++++++++++++++++++
7 files changed, 274 insertions(+)
create mode 100644 Documentation/hwmon/mp5998.rst
create mode 100644 drivers/hwmon/pmbus/mp5998.c
--
2.39.2
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/2] dt-bindings: hwmon: Add MPS mp5998
2025-09-23 9:09 [PATCH 0/2] hwmon: Add support for MPS mp5998 chip Yuxi Wang
@ 2025-09-23 9:09 ` Yuxi Wang
2025-09-23 18:57 ` Conor Dooley
2025-09-23 9:09 ` [PATCH 2/2] hwmon: add mp5998 driver Yuxi Wang
1 sibling, 1 reply; 5+ messages in thread
From: Yuxi Wang @ 2025-09-23 9:09 UTC (permalink / raw)
To: Yuxi.Wang, corbet, linux, jdelvare, robh, krzk+dt, conor+dt
Cc: wyx137120466, linux-kernel, linux-doc, linux-hwmon, devicetree
Add support for MPS mp5998 controller
Signed-off-by: Yuxi Wang <Yuxi.Wang@monolithicpower.com>
---
Documentation/devicetree/bindings/trivial-devices.yaml | 2 ++
1 file changed, 2 insertions(+)
diff --git a/Documentation/devicetree/bindings/trivial-devices.yaml b/Documentation/devicetree/bindings/trivial-devices.yaml
index f3dd18681aa6..a8ec08182e97 100644
--- a/Documentation/devicetree/bindings/trivial-devices.yaml
+++ b/Documentation/devicetree/bindings/trivial-devices.yaml
@@ -305,6 +305,8 @@ properties:
- mps,mp5920
# Monolithic Power Systems Inc. multi-phase hot-swap controller mp5990
- mps,mp5990
+ # Monolithic Power Systems Inc. hot-swap controller mp5998
+ - mps,mp5998
# Monolithic Power Systems Inc. digital step-down converter mp9941
- mps,mp9941
# Temperature sensor with integrated fan control
--
2.39.2
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/2] hwmon: add mp5998 driver
2025-09-23 9:09 [PATCH 0/2] hwmon: Add support for MPS mp5998 chip Yuxi Wang
2025-09-23 9:09 ` [PATCH 1/2] dt-bindings: hwmon: Add MPS mp5998 Yuxi Wang
@ 2025-09-23 9:09 ` Yuxi Wang
2025-09-24 14:42 ` Guenter Roeck
1 sibling, 1 reply; 5+ messages in thread
From: Yuxi Wang @ 2025-09-23 9:09 UTC (permalink / raw)
To: Yuxi.Wang, corbet, linux, jdelvare, robh, krzk+dt, conor+dt
Cc: wyx137120466, linux-kernel, linux-doc, linux-hwmon, devicetree
Add support for MPS mp5998.
Signed-off-by: Yuxi Wang <Yuxi.Wang@monolithicpower.com>
---
Documentation/hwmon/index.rst | 1 +
Documentation/hwmon/mp5998.rst | 92 +++++++++++++++++++
MAINTAINERS | 7 ++
drivers/hwmon/pmbus/Kconfig | 9 ++
drivers/hwmon/pmbus/Makefile | 1 +
drivers/hwmon/pmbus/mp5998.c | 162 +++++++++++++++++++++++++++++++++
6 files changed, 272 insertions(+)
create mode 100644 Documentation/hwmon/mp5998.rst
create mode 100644 drivers/hwmon/pmbus/mp5998.c
diff --git a/Documentation/hwmon/index.rst b/Documentation/hwmon/index.rst
index d292a86ac5da..0b9ee6e8e922 100644
--- a/Documentation/hwmon/index.rst
+++ b/Documentation/hwmon/index.rst
@@ -180,6 +180,7 @@ Hardware Monitoring Kernel Drivers
mp5023
mp5920
mp5990
+ mp5998
mp9941
mpq8785
nct6683
diff --git a/Documentation/hwmon/mp5998.rst b/Documentation/hwmon/mp5998.rst
new file mode 100644
index 000000000000..b5609a5a5103
--- /dev/null
+++ b/Documentation/hwmon/mp5998.rst
@@ -0,0 +1,92 @@
+.. SPDX-License-Identifier: GPL-2.0
+
+Kernel driver mp5998
+====================
+
+Supported chips:
+
+ * MPS mp5998
+
+ Prefix: 'mp5998'
+
+ * Datasheet
+ https://www.monolithicpower.com/en/
+
+Author:
+
+ Yuxi Wang <Yuxi.Wang@monolithicpower.com>
+
+Description
+-----------
+
+This driver implements support for Monolithic Power Systems, Inc. (MPS)
+MP5998 Hot-Swap Controller.
+
+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_crit**
+
+**in1_crit_alarm**
+
+The driver provides the following attributes for output voltage:
+
+**in2_input**
+
+**in2_label**
+
+**in2_lcrit**
+
+**in2_lcrit_alarm**
+
+**in2_rated_max**
+
+**in2_rated_min**
+
+The driver provides the following attributes for input current:
+
+**curr1_input**
+
+**curr1_label**
+
+**curr1_max**
+
+**curr1_max_alarm**
+
+The driver provides the following attributes for output current:
+
+**curr2_input**
+
+**curr2_label**
+
+The driver provides the following attributes for input power:
+
+**power1_input**
+
+**power1_label**
+
+The driver provides the following attributes for output power:
+
+**power2_input**
+
+**power2_label**
+
+The driver provides the following attributes for temperature:
+
+**temp1_input**
+
+**temp1_crit**
+
+**temp1_crit_alarm**
+
+**temp1_max**
+
+**temp1_max_alarm**
diff --git a/MAINTAINERS b/MAINTAINERS
index f6206963efbf..d6bc9c10d908 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -17192,6 +17192,13 @@ S: Maintained
F: Documentation/hwmon/mp2993.rst
F: drivers/hwmon/pmbus/mp2993.c
+MPS MP5998 DRIVER
+M: Yuxi Wang <Yuxi.Wang@monolithicpower.com>
+L: linux-hwmon@vger.kernel.org
+S: Maintained
+F: Documentation/hwmon/mp5998.rst
+F: drivers/hwmon/pmbus/mp5998.c
+
MPS MP9941 DRIVER
M: Noah Wang <noahwang.wang@outlook.com>
L: linux-hwmon@vger.kernel.org
diff --git a/drivers/hwmon/pmbus/Kconfig b/drivers/hwmon/pmbus/Kconfig
index 55e492452ce8..35862f011a5b 100644
--- a/drivers/hwmon/pmbus/Kconfig
+++ b/drivers/hwmon/pmbus/Kconfig
@@ -443,6 +443,15 @@ config SENSORS_MP5990
This driver can also be built as a module. If so, the module will
be called mp5990.
+config SENSORS_MP5998
+ tristate "MPS MP5998"
+ help
+ If you say yes here you get hardware monitoring support for MPS
+ MP5998.
+
+ This driver can also be built as a module. If so, the module will
+ be called mp5998.
+
config SENSORS_MP9941
tristate "MPS MP9941"
help
diff --git a/drivers/hwmon/pmbus/Makefile b/drivers/hwmon/pmbus/Makefile
index 29cd8a3317d2..4fb45a7e3ac4 100644
--- a/drivers/hwmon/pmbus/Makefile
+++ b/drivers/hwmon/pmbus/Makefile
@@ -44,6 +44,7 @@ obj-$(CONFIG_SENSORS_MP2993) += mp2993.o
obj-$(CONFIG_SENSORS_MP5023) += mp5023.o
obj-$(CONFIG_SENSORS_MP5920) += mp5920.o
obj-$(CONFIG_SENSORS_MP5990) += mp5990.o
+obj-$(CONFIG_SENSORS_MP5998) += mp5998.o
obj-$(CONFIG_SENSORS_MP9941) += mp9941.o
obj-$(CONFIG_SENSORS_MPQ7932) += mpq7932.o
obj-$(CONFIG_SENSORS_MPQ8785) += mpq8785.o
diff --git a/drivers/hwmon/pmbus/mp5998.c b/drivers/hwmon/pmbus/mp5998.c
new file mode 100644
index 000000000000..1f192d85c250
--- /dev/null
+++ b/drivers/hwmon/pmbus/mp5998.c
@@ -0,0 +1,162 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * mp5998.c - pmbus driver for mps mp5998
+ *
+ * Copyright 2025 Monolithic Power Systems, Inc
+ *
+ * Author: Yuxi Wang <Yuxi.Wang@monolithicpower.com>
+ */
+
+#include <linux/bitfield.h>
+#include <linux/bits.h>
+#include <linux/i2c.h>
+#include <linux/module.h>
+#include <linux/of_device.h>
+#include "pmbus.h"
+
+/*Common Register*/
+#define PAGE 0x01
+#define EFUSE_CFG 0xC4
+#define MP5998_FUNC (PMBUS_HAVE_VIN | PMBUS_HAVE_VOUT | \
+ PMBUS_HAVE_IOUT | PMBUS_HAVE_IIN | \
+ PMBUS_HAVE_PIN | PMBUS_HAVE_POUT | \
+ PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_IOUT | \
+ PMBUS_HAVE_STATUS_INPUT | PMBUS_HAVE_STATUS_TEMP)
+
+static int mp5998_read_word_data(struct i2c_client *client, int page,
+ int phase, int reg)
+{
+ int ret;
+
+ switch (reg) {
+ case PMBUS_READ_VIN...PMBUS_READ_TEMPERATURE_1:
+ case PMBUS_READ_POUT...PMBUS_READ_PIN:
+ case PMBUS_STATUS_WORD:
+ ret = -ENODATA;
+ break;
+ default:
+ ret = -EINVAL;
+ break;
+ }
+
+ return ret;
+}
+
+static int mp5998_read_byte_data(struct i2c_client *client, int page,
+ int reg)
+{
+ int ret;
+
+ switch (reg) {
+ case PMBUS_STATUS_BYTE:
+ case PMBUS_STATUS_IOUT:
+ case PMBUS_STATUS_INPUT:
+ case PMBUS_STATUS_TEMPERATURE:
+ case PMBUS_STATUS_CML:
+ case PMBUS_STATUS_MFR_SPECIFIC:
+ ret = -ENODATA;
+ break;
+ default:
+ ret = -EINVAL;
+ break;
+ }
+ return ret;
+}
+
+static struct pmbus_driver_info mp5998_info_linear = {
+ .pages = PAGE,
+ .format[PSC_VOLTAGE_IN] = linear,
+ .format[PSC_CURRENT_IN] = linear,
+ .format[PSC_VOLTAGE_OUT] = linear,
+ .format[PSC_CURRENT_OUT] = linear,
+ .format[PSC_TEMPERATURE] = linear,
+ .format[PSC_POWER] = linear,
+
+ .read_word_data = mp5998_read_word_data,
+ .read_byte_data = mp5998_read_byte_data,
+ .func[0] = MP5998_FUNC,
+};
+
+static struct pmbus_driver_info mp5998_info_direct = {
+ .pages = PAGE,
+ .format[PSC_VOLTAGE_IN] = direct,
+ .format[PSC_CURRENT_IN] = direct,
+ .format[PSC_VOLTAGE_OUT] = direct,
+ .format[PSC_CURRENT_OUT] = direct,
+ .format[PSC_TEMPERATURE] = direct,
+ .format[PSC_POWER] = direct,
+
+ .m[PSC_VOLTAGE_IN] = 64,
+ .b[PSC_VOLTAGE_IN] = 0,
+ .R[PSC_VOLTAGE_IN] = 0,
+
+ .m[PSC_CURRENT_IN] = 16,
+ .b[PSC_CURRENT_IN] = 0,
+ .R[PSC_CURRENT_IN] = 0,
+
+ .m[PSC_VOLTAGE_OUT] = 64,
+ .b[PSC_VOLTAGE_OUT] = 0,
+ .R[PSC_VOLTAGE_OUT] = 0,
+
+ .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] = 3,
+
+ .m[PSC_POWER] = 2,
+ .b[PSC_POWER] = 0,
+ .R[PSC_POWER] = 0,
+
+ .read_word_data = mp5998_read_word_data,
+ .read_byte_data = mp5998_read_byte_data,
+ .func[0] = MP5998_FUNC,
+};
+
+static int mp5998_probe(struct i2c_client *client)
+{
+ int ret;
+
+ ret = i2c_smbus_read_word_data(client, EFUSE_CFG);
+
+ if (ret < 0)
+ return ret;
+
+ if (ret & BIT(9))
+ ret = pmbus_do_probe(client, &mp5998_info_linear);
+ else
+ ret = pmbus_do_probe(client, &mp5998_info_direct);
+
+ if (!ret)
+ dev_info(&client->dev, "%s chip found\n", client->name);
+ return ret;
+}
+
+static const struct i2c_device_id mp5998_id[] = {
+ { "mp5998", 0 },
+ {}
+};
+MODULE_DEVICE_TABLE(i2c, mp5998_id);
+
+static const struct of_device_id mp5998_of_match[] = {
+ { .compatible = "mps,mp5998" },
+ {}
+};
+MODULE_DEVICE_TABLE(of, mp5998_of_match);
+
+static struct i2c_driver mp5998_driver = {
+ .probe = mp5998_probe,
+ .driver = {
+ .name = "mp5998",
+ .of_match_table = mp5998_of_match,
+ },
+ .id_table = mp5998_id,
+};
+
+module_i2c_driver(mp5998_driver);
+MODULE_AUTHOR("Yuxi Wang <Yuxi.Wang@monolithicpower.com>");
+MODULE_DESCRIPTION("MPS MP5998 HWMON driver");
+MODULE_LICENSE("GPL");
+MODULE_IMPORT_NS("PMBUS");
--
2.39.2
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2] dt-bindings: hwmon: Add MPS mp5998
2025-09-23 9:09 ` [PATCH 1/2] dt-bindings: hwmon: Add MPS mp5998 Yuxi Wang
@ 2025-09-23 18:57 ` Conor Dooley
0 siblings, 0 replies; 5+ messages in thread
From: Conor Dooley @ 2025-09-23 18:57 UTC (permalink / raw)
To: Yuxi Wang
Cc: corbet, linux, jdelvare, robh, krzk+dt, conor+dt, wyx137120466,
linux-kernel, linux-doc, linux-hwmon, devicetree
[-- Attachment #1: Type: text/plain, Size: 52 bytes --]
Acked-by: Conor Dooley <conor.dooley@microchip.com>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 2/2] hwmon: add mp5998 driver
2025-09-23 9:09 ` [PATCH 2/2] hwmon: add mp5998 driver Yuxi Wang
@ 2025-09-24 14:42 ` Guenter Roeck
0 siblings, 0 replies; 5+ messages in thread
From: Guenter Roeck @ 2025-09-24 14:42 UTC (permalink / raw)
To: Yuxi Wang
Cc: corbet, jdelvare, robh, krzk+dt, conor+dt, wyx137120466,
linux-kernel, linux-doc, linux-hwmon, devicetree
On Tue, Sep 23, 2025 at 05:09:25PM +0800, Yuxi Wang wrote:
> Add support for MPS mp5998.
> Signed-off-by: Yuxi Wang <Yuxi.Wang@monolithicpower.com>
A separate patch was submitted adding support for this chip
to the mp5990 driver. I applied that patch instead.
Guenter
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2025-09-24 14:42 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-23 9:09 [PATCH 0/2] hwmon: Add support for MPS mp5998 chip Yuxi Wang
2025-09-23 9:09 ` [PATCH 1/2] dt-bindings: hwmon: Add MPS mp5998 Yuxi Wang
2025-09-23 18:57 ` Conor Dooley
2025-09-23 9:09 ` [PATCH 2/2] hwmon: add mp5998 driver Yuxi Wang
2025-09-24 14:42 ` Guenter Roeck
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox