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

hwmon: (pmbus/ltc2978) add support for lt717x

Add support for LT7170 and LT7171. The LT7170 and LT7171 are 20 A, 16 V,
Single- or Dual-Phase, Silent Switcher Step-Down Regulators with Digital
Power System Management.

The relevant registers in the LT7170 and LT7171 are similar to those in
the LTC3887, but with fewer channels. This adds the chip ID and
identification of ASCII to differentiate between the LT7170 and LT7171.
These devices support polling for status updates and clearing peak
values. The data format for voltage, current, and temperature is set to
IEEE754 for precision and compatibility.

Co-developed-by: Cherrence Sarip <cherrence.sarip@analog.com>
Signed-off-by: Cherrence Sarip <cherrence.sarip@analog.com>
Signed-off-by: Kim Seer Paller <kimseer.paller@analog.com>
Link: https://lore.kernel.org/r/20250317-hwmon-next-v1-3-da0218c38197@analog.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>

authored by

Kim Seer Paller and committed by
Guenter Roeck
c1d6afdb 156c6ebb

+44 -6
+3 -3
drivers/hwmon/pmbus/Kconfig
··· 233 233 depends on SENSORS_LTC2978 && REGULATOR 234 234 help 235 235 If you say yes here you get regulator support for Linear Technology 236 - LTC3880, LTC3883, LTC3884, LTC3886, LTC3887, LTC3889, LTC7841, 237 - LTC7880, LTM4644, LTM4673, LTM4675, LTM4676, LTM4677, LTM4678, 238 - LTM4680, LTM4686, and LTM4700. 236 + LT7170, LT7171, LTC3880, LTC3883, LTC3884, LTC3886, LTC3887, LTC3889, 237 + LTC7841, LTC7880, LTM4644, LTM4673, LTM4675, LTM4676, LTM4677, 238 + LTM4678, LTM4680, LTM4686, and LTM4700. 239 239 240 240 config SENSORS_LTC3815 241 241 tristate "Linear Technologies LTC3815"
+41 -3
drivers/hwmon/pmbus/ltc2978.c
··· 23 23 /* Managers */ 24 24 ltc2972, ltc2974, ltc2975, ltc2977, ltc2978, ltc2979, ltc2980, 25 25 /* Controllers */ 26 - ltc3880, ltc3882, ltc3883, ltc3884, ltc3886, ltc3887, ltc3889, ltc7132, 27 - ltc7841, ltc7880, 26 + lt7170, lt7171, ltc3880, ltc3882, ltc3883, ltc3884, ltc3886, ltc3887, 27 + ltc3889, ltc7132, ltc7841, ltc7880, 28 28 /* Modules */ 29 29 ltm2987, ltm4664, ltm4673, ltm4675, ltm4676, ltm4677, ltm4678, ltm4680, 30 30 ltm4686, ltm4700, ··· 62 62 63 63 #define LTC2978_ID_MASK 0xfff0 64 64 65 + #define LT7170_ID 0x1C10 65 66 #define LTC2972_ID 0x0310 66 67 #define LTC2974_ID 0x0210 67 68 #define LTC2975_ID 0x0220 ··· 538 537 } 539 538 540 539 static const struct i2c_device_id ltc2978_id[] = { 540 + {"lt7170", lt7170}, 541 + {"lt7171", lt7171}, 541 542 {"ltc2972", ltc2972}, 542 543 {"ltc2974", ltc2974}, 543 544 {"ltc2975", ltc2975}, ··· 618 615 ret = i2c_smbus_read_block_data(client, PMBUS_MFR_ID, buf); 619 616 if (ret < 0) 620 617 return ret; 621 - if (ret < 3 || strncmp(buf, "LTC", 3)) 618 + if (ret < 3 || (strncmp(buf, "LTC", 3) && strncmp(buf, "ADI", 3))) 622 619 return -ENODEV; 623 620 624 621 ret = i2c_smbus_read_block_data(client, PMBUS_MFR_MODEL, buf); ··· 632 629 } 633 630 634 631 chip_id &= LTC2978_ID_MASK; 632 + 633 + if (chip_id == LT7170_ID) { 634 + u8 buf[I2C_SMBUS_BLOCK_MAX]; 635 + int ret; 636 + 637 + ret = i2c_smbus_read_i2c_block_data(client, PMBUS_IC_DEVICE_ID, 638 + sizeof(buf), buf); 639 + if (ret < 0) 640 + return ret; 641 + 642 + if (!strncmp(buf + 1, "LT7170", 6) || 643 + !strncmp(buf + 1, "LT7170-1", 8)) 644 + return lt7170; 645 + if (!strncmp(buf + 1, "LT7171", 6) || 646 + !strncmp(buf + 1, "LT7171-1", 8)) 647 + return lt7171; 648 + 649 + return -ENODEV; 650 + } 635 651 636 652 if (chip_id == LTC2972_ID) 637 653 return ltc2972; ··· 763 741 data->temp2_max = 0x7c00; 764 742 765 743 switch (data->id) { 744 + case lt7170: 745 + case lt7171: 746 + data->features |= FEAT_CLEAR_PEAKS | FEAT_NEEDS_POLLING; 747 + info->read_word_data = ltc3883_read_word_data; 748 + info->pages = LTC3883_NUM_PAGES; 749 + info->format[PSC_VOLTAGE_IN] = ieee754; 750 + info->format[PSC_VOLTAGE_OUT] = ieee754; 751 + info->format[PSC_CURRENT_OUT] = ieee754; 752 + info->format[PSC_TEMPERATURE] = ieee754; 753 + info->func[0] = PMBUS_HAVE_VIN | PMBUS_HAVE_STATUS_INPUT 754 + | PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT 755 + | PMBUS_HAVE_IOUT | PMBUS_HAVE_STATUS_IOUT 756 + | PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP; 757 + break; 766 758 case ltc2972: 767 759 info->read_word_data = ltc2975_read_word_data; 768 760 info->pages = LTC2972_NUM_PAGES; ··· 963 927 964 928 #ifdef CONFIG_OF 965 929 static const struct of_device_id ltc2978_of_match[] = { 930 + { .compatible = "lltc,lt7170" }, 931 + { .compatible = "lltc,lt7171" }, 966 932 { .compatible = "lltc,ltc2972" }, 967 933 { .compatible = "lltc,ltc2974" }, 968 934 { .compatible = "lltc,ltc2975" },