Skip to content

Commit c1d6afd

Browse files
kseerpgroeck
authored andcommitted
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 <[email protected]> Signed-off-by: Cherrence Sarip <[email protected]> Signed-off-by: Kim Seer Paller <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Guenter Roeck <[email protected]>
1 parent 156c6eb commit c1d6afd

File tree

2 files changed

+44
-6
lines changed

2 files changed

+44
-6
lines changed

drivers/hwmon/pmbus/Kconfig

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -233,9 +233,9 @@ config SENSORS_LTC2978_REGULATOR
233233
depends on SENSORS_LTC2978 && REGULATOR
234234
help
235235
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.
239239

240240
config SENSORS_LTC3815
241241
tristate "Linear Technologies LTC3815"

drivers/hwmon/pmbus/ltc2978.c

Lines changed: 41 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ enum chips {
2323
/* Managers */
2424
ltc2972, ltc2974, ltc2975, ltc2977, ltc2978, ltc2979, ltc2980,
2525
/* 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,
2828
/* Modules */
2929
ltm2987, ltm4664, ltm4673, ltm4675, ltm4676, ltm4677, ltm4678, ltm4680,
3030
ltm4686, ltm4700,
@@ -62,6 +62,7 @@ enum chips {
6262

6363
#define LTC2978_ID_MASK 0xfff0
6464

65+
#define LT7170_ID 0x1C10
6566
#define LTC2972_ID 0x0310
6667
#define LTC2974_ID 0x0210
6768
#define LTC2975_ID 0x0220
@@ -537,6 +538,8 @@ static int ltc2978_write_word_data(struct i2c_client *client, int page,
537538
}
538539

539540
static const struct i2c_device_id ltc2978_id[] = {
541+
{"lt7170", lt7170},
542+
{"lt7171", lt7171},
540543
{"ltc2972", ltc2972},
541544
{"ltc2974", ltc2974},
542545
{"ltc2975", ltc2975},
@@ -615,7 +618,7 @@ static int ltc2978_get_id(struct i2c_client *client)
615618
ret = i2c_smbus_read_block_data(client, PMBUS_MFR_ID, buf);
616619
if (ret < 0)
617620
return ret;
618-
if (ret < 3 || strncmp(buf, "LTC", 3))
621+
if (ret < 3 || (strncmp(buf, "LTC", 3) && strncmp(buf, "ADI", 3)))
619622
return -ENODEV;
620623

621624
ret = i2c_smbus_read_block_data(client, PMBUS_MFR_MODEL, buf);
@@ -630,6 +633,25 @@ static int ltc2978_get_id(struct i2c_client *client)
630633

631634
chip_id &= LTC2978_ID_MASK;
632635

636+
if (chip_id == LT7170_ID) {
637+
u8 buf[I2C_SMBUS_BLOCK_MAX];
638+
int ret;
639+
640+
ret = i2c_smbus_read_i2c_block_data(client, PMBUS_IC_DEVICE_ID,
641+
sizeof(buf), buf);
642+
if (ret < 0)
643+
return ret;
644+
645+
if (!strncmp(buf + 1, "LT7170", 6) ||
646+
!strncmp(buf + 1, "LT7170-1", 8))
647+
return lt7170;
648+
if (!strncmp(buf + 1, "LT7171", 6) ||
649+
!strncmp(buf + 1, "LT7171-1", 8))
650+
return lt7171;
651+
652+
return -ENODEV;
653+
}
654+
633655
if (chip_id == LTC2972_ID)
634656
return ltc2972;
635657
else if (chip_id == LTC2974_ID)
@@ -741,6 +763,20 @@ static int ltc2978_probe(struct i2c_client *client)
741763
data->temp2_max = 0x7c00;
742764

743765
switch (data->id) {
766+
case lt7170:
767+
case lt7171:
768+
data->features |= FEAT_CLEAR_PEAKS | FEAT_NEEDS_POLLING;
769+
info->read_word_data = ltc3883_read_word_data;
770+
info->pages = LTC3883_NUM_PAGES;
771+
info->format[PSC_VOLTAGE_IN] = ieee754;
772+
info->format[PSC_VOLTAGE_OUT] = ieee754;
773+
info->format[PSC_CURRENT_OUT] = ieee754;
774+
info->format[PSC_TEMPERATURE] = ieee754;
775+
info->func[0] = PMBUS_HAVE_VIN | PMBUS_HAVE_STATUS_INPUT
776+
| PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT
777+
| PMBUS_HAVE_IOUT | PMBUS_HAVE_STATUS_IOUT
778+
| PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP;
779+
break;
744780
case ltc2972:
745781
info->read_word_data = ltc2975_read_word_data;
746782
info->pages = LTC2972_NUM_PAGES;
@@ -927,6 +963,8 @@ static int ltc2978_probe(struct i2c_client *client)
927963

928964
#ifdef CONFIG_OF
929965
static const struct of_device_id ltc2978_of_match[] = {
966+
{ .compatible = "lltc,lt7170" },
967+
{ .compatible = "lltc,lt7171" },
930968
{ .compatible = "lltc,ltc2972" },
931969
{ .compatible = "lltc,ltc2974" },
932970
{ .compatible = "lltc,ltc2975" },

0 commit comments

Comments
 (0)