]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
hwmon: (pmbus) Add Delta Q54SN120A1 Q54SW120A7 chip
authorColin Huang <u8813345@gmail.com>
Mon, 16 Mar 2026 08:39:34 +0000 (16:39 +0800)
committerGuenter Roeck <linux@roeck-us.net>
Tue, 31 Mar 2026 02:45:06 +0000 (19:45 -0700)
Add the DELTA chips Q54SN120A1, Q54SW120A7 in q54sj108a2,
1/4 Brick DC/DC Regulated Power Module with PMBus support

Signed-off-by: Colin Huang <u8813345@gmail.com>
Link: https://lore.kernel.org/r/20260316-add-q54sn120a1-q54q54sw120a7-v2-2-60e6182cc4a7@gmail.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
drivers/hwmon/pmbus/q54sj108a2.c

index 7e799f36f923edfd8833ab242578b17b5b23d5ab..a368cfa9d45ac26b7751ac42a57d11ba2db26ba8 100644 (file)
@@ -271,6 +271,8 @@ static const struct file_operations q54sj108a2_fops = {
 
 static const struct i2c_device_id q54sj108a2_id[] = {
        { "q54sj108a2", q54sj108a2 },
+       { "q54sn120a1", q54sj108a2 },
+       { "q54sw120a7", q54sj108a2 },
        { },
 };
 
@@ -280,6 +282,7 @@ static int q54sj108a2_probe(struct i2c_client *client)
 {
        struct device *dev = &client->dev;
        u8 buf[I2C_SMBUS_BLOCK_MAX + 1];
+       const struct i2c_device_id *mid;
        enum chips chip_id;
        int ret, i;
        struct dentry *debugfs;
@@ -313,8 +316,12 @@ static int q54sj108a2_probe(struct i2c_client *client)
                dev_err(dev, "Failed to read Manufacturer Model\n");
                return ret;
        }
-       if (ret != 14 || strncmp(buf, "Q54SJ108A2", 10)) {
-               buf[ret] = '\0';
+       buf[ret] = '\0';
+       for (mid = q54sj108a2_id; mid->name[0]; mid++) {
+               if (!strncasecmp(mid->name, buf, strlen(mid->name)))
+                       break;
+       }
+       if (!mid->name[0]) {
                dev_err(dev, "Unsupported Manufacturer Model '%s'\n", buf);
                return -ENODEV;
        }
@@ -324,7 +331,10 @@ static int q54sj108a2_probe(struct i2c_client *client)
                dev_err(dev, "Failed to read Manufacturer Revision\n");
                return ret;
        }
-       if (ret != 4 || buf[0] != 'S') {
+       /*
+        * accept manufacturer revision with optional NUL byte
+        */
+       if (!(ret == 4 || ret == 5) || buf[0] != 'S') {
                buf[ret] = '\0';
                dev_err(dev, "Unsupported Manufacturer Revision '%s'\n", buf);
                return -ENODEV;
@@ -401,6 +411,8 @@ static int q54sj108a2_probe(struct i2c_client *client)
 
 static const struct of_device_id q54sj108a2_of_match[] = {
        { .compatible = "delta,q54sj108a2", .data = (void *)q54sj108a2 },
+       { .compatible = "delta,q54sn120a1", .data = (void *)q54sj108a2 },
+       { .compatible = "delta,q54sw120a7", .data = (void *)q54sj108a2 },
        { },
 };