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>
---
drivers/hwmon/pmbus/q54sj108a2.c | 18 +++++++++++++++---
1 file changed, 15 insertions(+), 3 deletions(-)
diff --git a/drivers/hwmon/pmbus/q54sj108a2.c b/drivers/hwmon/pmbus/q54sj108a2.c
index 4d7086d83aa3..06f9db4912d7 100644
--- a/drivers/hwmon/pmbus/q54sj108a2.c
+++ b/drivers/hwmon/pmbus/q54sj108a2.c
@@ -269,6 +269,8 @@ static const struct file_operations q54sj108a2_fops = {
static const struct i2c_device_id q54sj108a2_id[] = {
{ "q54sj108a2", q54sj108a2 },
+ { "q54sn120a1", q54sj108a2 },
+ { "q54sw120a7", q54sj108a2 },
{ },
};
@@ -278,6 +280,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;
@@ -314,8 +317,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;
}
@@ -325,7 +332,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;
@@ -402,6 +412,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 },
{ },
};
--
2.34.1