Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

hwmon: (pmbus/bpa-rs600) Support BPD-RS600

The BPD-RS600 is the DC version of the BPA-RS600. The PMBUS interface is
the same between the two models. Keep the same compatible string but
accept either BPA-RS600 or BPD-RS600 in the PMBUS_MFR_MODEL.

Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
Link: https://lore.kernel.org/r/20210708220618.23576-1-chris.packham@alliedtelesis.co.nz
Signed-off-by: Guenter Roeck <linux@roeck-us.net>

authored by

Chris Packham and committed by
Guenter Roeck
129cdce3 bd56c1e9

+15 -7
+15 -7
drivers/hwmon/pmbus/bpa-rs600.c
··· 21 21 #define BPARS600_MFR_IOUT_MAX 0xa6 22 22 #define BPARS600_MFR_POUT_MAX 0xa7 23 23 24 + enum chips { bpa_rs600, bpd_rs600 }; 25 + 24 26 static int bpa_rs600_read_byte_data(struct i2c_client *client, int page, int reg) 25 27 { 26 28 int ret; ··· 148 146 .read_word_data = bpa_rs600_read_word_data, 149 147 }; 150 148 149 + static const struct i2c_device_id bpa_rs600_id[] = { 150 + { "bpa-rs600", bpa_rs600 }, 151 + { "bpd-rs600", bpd_rs600 }, 152 + {}, 153 + }; 154 + MODULE_DEVICE_TABLE(i2c, bpa_rs600_id); 155 + 151 156 static int bpa_rs600_probe(struct i2c_client *client) 152 157 { 153 158 struct device *dev = &client->dev; 154 159 u8 buf[I2C_SMBUS_BLOCK_MAX + 1]; 155 160 int ret; 161 + const struct i2c_device_id *mid; 156 162 157 163 if (!i2c_check_functionality(client->adapter, 158 164 I2C_FUNC_SMBUS_READ_BYTE_DATA ··· 174 164 return ret; 175 165 } 176 166 177 - if (strncmp(buf, "BPA-RS600", 8)) { 167 + for (mid = bpa_rs600_id; mid->name[0]; mid++) { 168 + if (!strncasecmp(buf, mid->name, strlen(mid->name))) 169 + break; 170 + } 171 + if (!mid->name[0]) { 178 172 buf[ret] = '\0'; 179 173 dev_err(dev, "Unsupported Manufacturer Model '%s'\n", buf); 180 174 return -ENODEV; ··· 186 172 187 173 return pmbus_do_probe(client, &bpa_rs600_info); 188 174 } 189 - 190 - static const struct i2c_device_id bpa_rs600_id[] = { 191 - { "bpars600", 0 }, 192 - {}, 193 - }; 194 - MODULE_DEVICE_TABLE(i2c, bpa_rs600_id); 195 175 196 176 static const struct of_device_id __maybe_unused bpa_rs600_of_match[] = { 197 177 { .compatible = "blutek,bpa-rs600" },