]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
hwmon: (pmbus/d1u74t) Add Murata D1U74T PSU driver
authorAbdurrahman Hussain <abdurrahman@nexthop.ai>
Fri, 15 May 2026 03:03:26 +0000 (20:03 -0700)
committerGuenter Roeck <linux@roeck-us.net>
Tue, 9 Jun 2026 15:23:00 +0000 (08:23 -0700)
Add PMBUS driver for Murata D1U74T power supplies.

Signed-off-by: Abdurrahman Hussain <abdurrahman@nexthop.ai>
Link: https://lore.kernel.org/r/20260514-d1u74t-v4-2-1f1ee7b002ec@nexthop.ai
[groeck: Dropped inappropriate tags; added missing include files]
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Documentation/hwmon/d1u74t.rst [new file with mode: 0644]
Documentation/hwmon/index.rst
MAINTAINERS
drivers/hwmon/pmbus/Kconfig
drivers/hwmon/pmbus/Makefile
drivers/hwmon/pmbus/d1u74t.c [new file with mode: 0644]

diff --git a/Documentation/hwmon/d1u74t.rst b/Documentation/hwmon/d1u74t.rst
new file mode 100644 (file)
index 0000000..3a9eedb
--- /dev/null
@@ -0,0 +1,81 @@
+.. SPDX-License-Identifier: GPL-2.0-or-later
+
+Kernel driver d1u74t
+====================
+
+Supported chips:
+
+  * Murata D1U74T
+
+    Prefix: 'd1u74t'
+
+    Addresses scanned: -
+
+    Datasheet: Publicly available at the Murata website
+
+Authors:
+    Abdurrahman Hussain <abdurrahman@nexthop.ai>
+
+
+Description
+-----------
+
+This driver implements support for Murata D1U74T Power Supply with
+PMBus support.
+
+The driver is a client driver to the core PMBus driver.
+Please see Documentation/hwmon/pmbus.rst for details on PMBus client drivers.
+
+
+Usage Notes
+-----------
+
+This driver does not auto-detect devices. You will have to instantiate the
+devices explicitly. Please see Documentation/i2c/instantiating-devices.rst for
+details.
+
+
+Sysfs entries
+-------------
+
+======================= ======================================================
+curr1_label            "iin"
+curr1_input            Measured input current
+curr1_alarm            Input current alarm
+curr1_rated_max                Maximum rated input current
+
+curr2_label            "iout1"
+curr2_input            Measured output current
+curr2_max              Maximum output current
+curr2_max_alarm                Output current high alarm
+curr2_crit             Critical high output current
+curr2_crit_alarm       Output current critical high alarm
+curr2_rated_max                Maximum rated output current
+
+in1_label              "vin"
+in1_input              Measured input voltage
+in1_alarm              Input voltage alarm
+in1_rated_min          Minimum rated input voltage
+in1_rated_max          Maximum rated input voltage
+
+in2_label              "vout1"
+in2_input              Measured output voltage
+in2_alarm              Output voltage alarm
+in2_rated_min          Minimum rated output voltage
+in2_rated_max          Maximum rated output voltage
+
+power1_label           "pin"
+power1_input           Measured input power
+power1_alarm           Input power alarm
+power1_rated_max       Maximum rated input power
+
+temp[1-3]_input                Measured temperature
+temp[1-3]_max          Maximum temperature
+temp[1-3]_max_alarm    Maximum temperature alarm
+temp[1-3]_rated_max    Maximum rated temperature
+
+fan1_alarm             Fan 1 warning
+fan1_fault             Fan 1 fault
+fan1_input             Fan 1 speed in RPM
+fan1_target            Fan 1 target
+======================= ======================================================
index 78c783f11e2503ac1c1f4ba6a2a5896d9be85d84..e880c6ca84f03d307ac4b57043cfed6547dc12aa 100644 (file)
@@ -61,6 +61,7 @@ Hardware Monitoring Kernel Drivers
    corsair-psu
    cros_ec_hwmon
    crps
+   d1u74t
    da9052
    da9055
    dell-smm-hwmon
index 5d4453414e772cb08f827375c63a6eca6e494814..d57da4881737fc42b57911a06d44edceded3e583 100644 (file)
@@ -18284,6 +18284,13 @@ F:     drivers/mux/
 F:     include/dt-bindings/mux/
 F:     include/linux/mux/
 
+MURATA D1U74T PSU DRIVER
+M:     Abdurrahman Hussain <abdurrahman@nexthop.ai>
+L:     linux-hwmon@vger.kernel.org
+S:     Maintained
+F:     Documentation/hwmon/d1u74t.rst
+F:     drivers/hwmon/pmbus/d1u74t.c
+
 MUSB MULTIPOINT HIGH SPEED DUAL-ROLE CONTROLLER
 M:     Bin Liu <b-liu@ti.com>
 L:     linux-usb@vger.kernel.org
index c3bb6df2655ad86174dbde110e97f36a93457f6e..64f38654f4e7c4c0c32e13929a2ea1e3152fd937 100644 (file)
@@ -113,6 +113,15 @@ config SENSORS_CRPS
          This driver can also be built as a module. If so, the module will
          be called crps.
 
+config SENSORS_D1U74T
+       tristate "Murata D1U74T Power Supply"
+       help
+         If you say yes here you get hardware monitoring support for the Murata
+         D1U74T Power Supply.
+
+         This driver can also be built as a module. If so, the module will
+         be called d1u74t.
+
 config SENSORS_DELTA_AHE50DC_FAN
        tristate "Delta AHE-50DC fan control module"
        help
index efd70b00ca2eb991afc256cea4a4c29c50ae0b75..1f2c73b71953eee368e1fd1a4edd83f0255da107 100644 (file)
@@ -80,3 +80,4 @@ obj-$(CONFIG_SENSORS_XDPE1A2G7B)      += xdpe1a2g7b.o
 obj-$(CONFIG_SENSORS_ZL6100)   += zl6100.o
 obj-$(CONFIG_SENSORS_PIM4328)  += pim4328.o
 obj-$(CONFIG_SENSORS_CRPS)     += crps.o
+obj-$(CONFIG_SENSORS_D1U74T)   += d1u74t.o
diff --git a/drivers/hwmon/pmbus/d1u74t.c b/drivers/hwmon/pmbus/d1u74t.c
new file mode 100644 (file)
index 0000000..752df3a
--- /dev/null
@@ -0,0 +1,88 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright 2026 Nexthop Systems.
+ */
+
+#include <linux/i2c.h>
+#include <linux/of.h>
+#include <linux/module.h>
+#include <linux/pmbus.h>
+#include <linux/string.h>
+
+#include "pmbus.h"
+
+static const struct i2c_device_id d1u74t_id[] = {
+       { "d1u74t" },
+       {},
+};
+MODULE_DEVICE_TABLE(i2c, d1u74t_id);
+
+static struct pmbus_driver_info d1u74t_info = {
+       .pages = 1,
+       /* PSU uses default linear data format. */
+       .func[0] = PMBUS_HAVE_PIN | PMBUS_HAVE_IOUT | PMBUS_HAVE_STATUS_IOUT |
+                  PMBUS_HAVE_IIN | PMBUS_HAVE_VIN | PMBUS_HAVE_STATUS_INPUT |
+                  PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT | PMBUS_HAVE_TEMP |
+                  PMBUS_HAVE_TEMP2 | PMBUS_HAVE_TEMP3 |
+                  PMBUS_HAVE_STATUS_TEMP | PMBUS_HAVE_FAN12 |
+                  PMBUS_HAVE_STATUS_FAN12,
+};
+
+static int d1u74t_probe(struct i2c_client *client)
+{
+       char buf[I2C_SMBUS_BLOCK_MAX + 2] = { 0 };
+       struct device *dev = &client->dev;
+       int rc;
+
+       rc = i2c_smbus_read_block_data(client, PMBUS_MFR_ID, buf);
+       if (rc < 0)
+               return dev_err_probe(dev, rc, "Failed to read PMBUS_MFR_ID\n");
+
+       if (rc != 9 || strncmp(buf, "Murata-PS", 9)) {
+               buf[rc] = '\0';
+               return dev_err_probe(dev, -ENODEV,
+                                    "Unsupported Manufacturer ID '%s'\n",
+                                    buf);
+       }
+
+       rc = i2c_smbus_read_block_data(client, PMBUS_MFR_MODEL, buf);
+       if (rc < 0)
+               return dev_err_probe(dev, rc,
+                                    "Failed to read PMBUS_MFR_MODEL\n");
+
+       if (rc < 8 || strncmp(buf, "D1U74T-W", 8)) {
+               buf[rc] = '\0';
+               return dev_err_probe(dev, -ENODEV, "Model '%s' not supported\n",
+                                    buf);
+       }
+
+       rc = pmbus_do_probe(client, &d1u74t_info);
+       if (rc)
+               return dev_err_probe(dev, rc, "Failed to probe\n");
+
+       return 0;
+}
+
+static const struct of_device_id d1u74t_of_match[] = {
+       {
+               .compatible = "murata,d1u74t",
+       },
+       {},
+};
+MODULE_DEVICE_TABLE(of, d1u74t_of_match);
+
+static struct i2c_driver d1u74t_driver = {
+       .driver = {
+               .name = "d1u74t",
+               .of_match_table = d1u74t_of_match,
+       },
+       .probe = d1u74t_probe,
+       .id_table = d1u74t_id,
+};
+
+module_i2c_driver(d1u74t_driver);
+
+MODULE_AUTHOR("Abdurrahman Hussain");
+MODULE_DESCRIPTION("PMBus driver for Murata D1U74T-W power supplies");
+MODULE_LICENSE("GPL");
+MODULE_IMPORT_NS("PMBUS");