* [PATCH linux dev-6.12 1/2] dt-bindings: trivial-devices: add mps,mp5998
@ 2025-10-12 7:16 Cosmo Chou
2025-10-12 7:16 ` [PATCH linux dev-6.12 2/2] hwmon: (pmbus/mp5990) add support for MP5998 Cosmo Chou
0 siblings, 1 reply; 2+ messages in thread
From: Cosmo Chou @ 2025-10-12 7:16 UTC (permalink / raw)
To: andrew, openbmc; +Cc: chou.cosmo, cosmo.chou
Add dt-bindings for MPS mp5998 hot-swap controller.
Signed-off-by: Cosmo Chou <chou.cosmo@gmail.com>
Acked-by: Conor Dooley <conor.dooley@microchip.com>
Link: https://lore.kernel.org/r/20250916095026.800164-1-chou.cosmo@gmail.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
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 edaba5cd8434..12cb7f64b988 100644
--- a/Documentation/devicetree/bindings/trivial-devices.yaml
+++ b/Documentation/devicetree/bindings/trivial-devices.yaml
@@ -297,6 +297,8 @@ properties:
- mps,mp5920
# Monolithic Power Systems Inc. multi-phase hot-swap controller mp5990
- mps,mp5990
+ # Monolithic Power Systems Inc. multi-phase hot-swap controller mp5998
+ - mps,mp5998
# Monolithic Power Systems Inc. digital step-down converter mp9941
- mps,mp9941
# Monolithic Power Systems Inc. synchronous step-down converter mpq8785
--
2.43.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [PATCH linux dev-6.12 2/2] hwmon: (pmbus/mp5990) add support for MP5998
2025-10-12 7:16 [PATCH linux dev-6.12 1/2] dt-bindings: trivial-devices: add mps,mp5998 Cosmo Chou
@ 2025-10-12 7:16 ` Cosmo Chou
0 siblings, 0 replies; 2+ messages in thread
From: Cosmo Chou @ 2025-10-12 7:16 UTC (permalink / raw)
To: andrew, openbmc; +Cc: chou.cosmo, cosmo.chou
Add support for the MPS MP5998 hot-swap controller. Like MP5990, MP5998
uses EFUSE_CFG (0xC4) bit 9 to indicate linear/direct data format.
Signed-off-by: Cosmo Chou <chou.cosmo@gmail.com>
Link: https://lore.kernel.org/r/20250916095026.800164-2-chou.cosmo@gmail.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
Documentation/hwmon/mp5990.rst | 30 +++++++++++++--
drivers/hwmon/pmbus/mp5990.c | 67 ++++++++++++++++++++++++++++++----
2 files changed, 85 insertions(+), 12 deletions(-)
diff --git a/Documentation/hwmon/mp5990.rst b/Documentation/hwmon/mp5990.rst
index 6f2f0c099d44..7fd536757ff2 100644
--- a/Documentation/hwmon/mp5990.rst
+++ b/Documentation/hwmon/mp5990.rst
@@ -9,9 +9,13 @@ Supported chips:
Prefix: 'mp5990'
- * Datasheet
+ Datasheet: Publicly available at the MPS website: https://www.monolithicpower.com/en/mp5990.html
- Publicly available at the MPS website : https://www.monolithicpower.com/en/mp5990.html
+ * MPS MP5998
+
+ Prefix: 'mp5998'
+
+ Datasheet: Not publicly available
Author:
@@ -21,7 +25,7 @@ Description
-----------
This driver implements support for Monolithic Power Systems, Inc. (MPS)
-MP5990 Hot-Swap Controller.
+MP5990 and MP5998 Hot-Swap Controller.
Device compliant with:
@@ -53,7 +57,7 @@ The driver provides the following attributes for output voltage:
**in2_alarm**
-The driver provides the following attributes for output current:
+The driver provides the following attributes for current:
**curr1_input**
@@ -63,6 +67,14 @@ The driver provides the following attributes for output current:
**curr1_max**
+**curr2_input**
+
+**curr2_label**
+
+**curr2_max**
+
+**curr2_max_alarm**
+
The driver provides the following attributes for input power:
**power1_input**
@@ -71,6 +83,16 @@ The driver provides the following attributes for input power:
**power1_alarm**
+The driver provides the following attributes for output power:
+
+**power2_input**
+
+**power2_label**
+
+**power2_max**
+
+**power2_max_alarm**
+
The driver provides the following attributes for temperature:
**temp1_input**
diff --git a/drivers/hwmon/pmbus/mp5990.c b/drivers/hwmon/pmbus/mp5990.c
index 4ce381a39480..9a4ee79712cf 100644
--- a/drivers/hwmon/pmbus/mp5990.c
+++ b/drivers/hwmon/pmbus/mp5990.c
@@ -8,6 +8,8 @@
#include <linux/of_device.h>
#include "pmbus.h"
+enum chips { mp5990, mp5998 };
+
#define MP5990_EFUSE_CFG (0xC4)
#define MP5990_VOUT_FORMAT BIT(9)
@@ -110,10 +112,53 @@ static struct pmbus_driver_info mp5990_info = {
.read_word_data = mp5990_read_word_data,
};
+static struct pmbus_driver_info mp5998_info = {
+ .pages = 1,
+ .format[PSC_VOLTAGE_IN] = direct,
+ .format[PSC_VOLTAGE_OUT] = direct,
+ .format[PSC_CURRENT_IN] = direct,
+ .format[PSC_CURRENT_OUT] = direct,
+ .format[PSC_POWER] = direct,
+ .format[PSC_TEMPERATURE] = direct,
+ .m[PSC_VOLTAGE_IN] = 64,
+ .b[PSC_VOLTAGE_IN] = 0,
+ .R[PSC_VOLTAGE_IN] = 0,
+ .m[PSC_VOLTAGE_OUT] = 64,
+ .b[PSC_VOLTAGE_OUT] = 0,
+ .R[PSC_VOLTAGE_OUT] = 0,
+ .m[PSC_CURRENT_IN] = 16,
+ .b[PSC_CURRENT_IN] = 0,
+ .R[PSC_CURRENT_IN] = 0,
+ .m[PSC_CURRENT_OUT] = 16,
+ .b[PSC_CURRENT_OUT] = 0,
+ .R[PSC_CURRENT_OUT] = 0,
+ .m[PSC_POWER] = 2,
+ .b[PSC_POWER] = 0,
+ .R[PSC_POWER] = 0,
+ .m[PSC_TEMPERATURE] = 1,
+ .b[PSC_TEMPERATURE] = 0,
+ .R[PSC_TEMPERATURE] = 0,
+ .func[0] =
+ 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,
+ .read_byte_data = mp5990_read_byte_data,
+ .read_word_data = mp5990_read_word_data,
+};
+
+static const struct i2c_device_id mp5990_id[] = {
+ {"mp5990", mp5990},
+ {"mp5998", mp5998},
+ { }
+};
+MODULE_DEVICE_TABLE(i2c, mp5990_id);
+
static int mp5990_probe(struct i2c_client *client)
{
struct pmbus_driver_info *info;
struct mp5990_data *data;
+ enum chips chip;
int ret;
data = devm_kzalloc(&client->dev, sizeof(struct mp5990_data),
@@ -121,7 +166,15 @@ static int mp5990_probe(struct i2c_client *client)
if (!data)
return -ENOMEM;
- memcpy(&data->info, &mp5990_info, sizeof(*info));
+ if (client->dev.of_node)
+ chip = (uintptr_t)of_device_get_match_data(&client->dev);
+ else
+ chip = i2c_match_id(mp5990_id, client)->driver_data;
+
+ if (chip == mp5990)
+ memcpy(&data->info, &mp5990_info, sizeof(*info));
+ else
+ memcpy(&data->info, &mp5998_info, sizeof(*info));
info = &data->info;
/* Read Vout Config */
@@ -140,6 +193,9 @@ static int mp5990_probe(struct i2c_client *client)
data->info.format[PSC_VOLTAGE_OUT] = linear;
data->info.format[PSC_CURRENT_OUT] = linear;
data->info.format[PSC_POWER] = linear;
+ if (chip == mp5998)
+ data->info.format[PSC_CURRENT_IN] = linear;
+
ret = i2c_smbus_read_word_data(client, PMBUS_READ_VOUT);
if (ret < 0) {
dev_err(&client->dev, "Can't get vout exponent.");
@@ -153,16 +209,11 @@ static int mp5990_probe(struct i2c_client *client)
}
static const struct of_device_id mp5990_of_match[] = {
- { .compatible = "mps,mp5990" },
+ { .compatible = "mps,mp5990", .data = (void *)mp5990 },
+ { .compatible = "mps,mp5998", .data = (void *)mp5998 },
{}
};
-static const struct i2c_device_id mp5990_id[] = {
- {"mp5990"},
- { }
-};
-MODULE_DEVICE_TABLE(i2c, mp5990_id);
-
static struct i2c_driver mp5990_driver = {
.driver = {
.name = "mp5990",
--
2.43.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-10-12 7:19 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-12 7:16 [PATCH linux dev-6.12 1/2] dt-bindings: trivial-devices: add mps,mp5998 Cosmo Chou
2025-10-12 7:16 ` [PATCH linux dev-6.12 2/2] hwmon: (pmbus/mp5990) add support for MP5998 Cosmo Chou
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox