Skip to contentSkip to conversation

hwmon: (pmbus/ltc2978) Add support for LT7175 and LT7176P

PATCH In review Christopher de Guzman 3 participants 10 messages Nov 10 – Nov 11

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

v2 cover hwmon: (pmbus/ltc2978) Add support for LT7175 and LT7176P

Add support for the LT7175 and LT7176P PMBus buck regulators to the ltc2978 driver. Both belong to the LT7170 family (MFR_SPECIAL_ID 0x1C1D) and are identified by their PMBUS_IC_DEVICE_ID string.

Patch 2 also changes how LT7170-family chips are identified: the IC_DEVICE_ID string is matched against ltc2978_id[] instead of using a strncmp() per chip, as suggested in review. Patch 4 fixes a related documentation error for LT7170/LT7171.

Tested with LT7175 and LT7171-1 eval boards on a Raspberry Pi 3B. The chip identification change was tested on a 6.12 kernel because the board does not run hwmon-next; the series is build-tested on hwmon-next.

---
Changes in v2:
- Drop the -1 variants from the bindings and the i2c/of tables (Guenter)
- Add lt7175/lt7176p as case labels on the existing lt7170/lt7171
probe block instead of duplicating it (Guenter)
- Identify LT7170-family chips by matching IC_DEVICE_ID against
ltc2978_id[] with a length check instead of a strncmp() per chip;
this avoids reading past the returned data (Guenter, Sashiko)
- Don't list LT7175/LT7176P under the curr1 "iin" label (Sashiko)
- New patch 4: remove LT7170/LT7171 from the curr1 "iin" label for the
same reason
- Not addressed: ltc_get_max() compares IEEE754 peak values as LINEAR11
(Sashiko). This is pre-existing and also affects LT7170/LT7171; I can
send a separate fix if that is useful.
- Link to v1: https://patch.msgid.link/[email protected]

To: Guenter Roeck <[email protected]>
To: Rob Herring <[email protected]>
To: Krzysztof Kozlowski <[email protected]>
To: Conor Dooley <[email protected]>
To: Frank Li <[email protected]>
To: Jonathan Corbet <[email protected]>
To: Shuah Khan <[email protected]>
To: Randy Dunlap <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]

---
Christopher de Guzman (4):

      dt-bindings: hwmon: ltc2978: Add support for LT7175 and LT7176P
      hwmon: (pmbus/ltc2978) Add support for LT7175 and LT7176P
      hwmon: ltc2978: Document LT7175 and LT7176P support
      hwmon: ltc2978: Remove LT7170 and LT7171 from curr1 iin documentation
 .../devicetree/bindings/hwmon/lltc,ltc2978.yaml    |  4 ++-
 Documentation/hwmon/ltc2978.rst                    | 32 +++++++++++++++++-----
 drivers/hwmon/pmbus/Kconfig                        |  6 ++--
 drivers/hwmon/pmbus/ltc2978.c                      | 23 ++++++++++------
 4 files changed, 45 insertions(+), 20 deletions(-)

---
base-commit: 0b6eda22f9ab67ddb2a872b0c3fc578ad9f4e27e
change-id: 20261020-upstream-lt7175-lt7176p-b9e37cba8f2d

Best regards,

Signature · 1 line
Christopher de Guzman <[email protected]>
#1 lore raw

PATCH v2 1/4 dt-bindings: hwmon: ltc2978: Add support for LT7175 and LT7176P

Document the compatible strings for the LT7175 and LT7176P PMBus buck regulators supported by the ltc2978 driver.

---
 Documentation/devicetree/bindings/hwmon/lltc,ltc2978.yaml | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/hwmon/lltc,ltc2978.yaml +3 -1
index ea8b1553a3e9..04c8e68d3b39 100644
@@ -14,6 +14,8 @@ properties:
     enum:
       - lltc,lt7170
       - lltc,lt7171
+      - lltc,lt7175
+      - lltc,lt7176p
       - lltc,ltc2972
       - lltc,ltc2974
       - lltc,ltc2975
@@ -50,7 +52,7 @@ properties:
     description: |
       list of regulators provided by this controller.
       Valid names of regulators depend on number of supplies supported per device:
-      * lt7170, lt7171 : vout0
+      * lt7170, lt7171, lt7175, lt7176p : vout0
       * ltc2972 vout0 - vout1
       * ltc2974, ltc2975 : vout0 - vout3
       * ltc2977, ltc2979, ltc2980, ltm2987 : vout0 - vout7
Signature · 1 line
2.43.0
#2 lore raw

Re: [PATCH v2 1/4] dt-bindings: hwmon: ltc2978: Add support for LT7175 and LT7176P

Sashiko has reviewed this patch and found no issues.
Quoted 4 lines

Document the compatible strings for the LT7175 and LT7176P PMBus buck regulators supported by the ltc2978 driver.

Sashiko has reviewed this patch and found no issues.

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
Acked-by on v2 1/4
#3 lore raw

Re: [PATCH v2 1/4] dt-bindings: hwmon: ltc2978: Add support for LT7175 and LT7176P

In reply to Christopher de Guzman
Quoted 7 lines · Christopher de Guzman

Document the compatible strings for the LT7175 and LT7176P PMBus buck regulators supported by the ltc2978 driver.

---
 Documentation/devicetree/bindings/hwmon/lltc,ltc2978.yaml | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Best regards,
Krzysztof

#4 lore raw

PATCH v2 2/4 hwmon: (pmbus/ltc2978) Add support for LT7175 and LT7176P

In reply to Christopher de Guzman

Add support for the LT7175 and LT7176P PMBus buck regulators. Both share the LT7170 family MFR_SPECIAL_ID (0x1C1D, masked to 0x1C10) and use the same register layout and configuration as LT7170/LT7171.

Chips in this family are distinguished by their PMBUS_IC_DEVICE_ID string. Instead of adding another strncmp() per chip, match the returned string against ltc2978_id[], as is already done for the PMBUS_MFR_MODEL fallback. Only entries whose name fits within the returned data are compared, so the buffer is never read past the returned length. Suffixed variants such as LT7175-1 match their base entry.

---
 drivers/hwmon/pmbus/Kconfig   |  6 +++---
 drivers/hwmon/pmbus/ltc2978.c | 23 ++++++++++++++---------
 2 files changed, 17 insertions(+), 12 deletions(-)
drivers/hwmon/pmbus/Kconfig +3 -3
index fd6641316454..63fb4d5dd87d 100644
@@ -306,9 +306,9 @@ config SENSORS_LTC2978_REGULATOR
 	depends on SENSORS_LTC2978 && REGULATOR
 	help
 	  If you say yes here you get regulator support for Linear Technology
-	  LT7170, LT7171, LTC3880, LTC3883, LTC3884, LTC3886, LTC3887, LTC3889,
-	  LTC7841, LTC7880, LTM4644, LTM4673, LTM4675, LTM4676, LTM4677,
-	  LTM4678, LTM4680, LTM4686, and LTM4700.
+	  LT7170, LT7171, LT7175, LT7176P, LTC3880, LTC3883, LTC3884, LTC3886,
+	  LTC3887, LTC3889, LTC7841, LTC7880, LTM4644, LTM4673, LTM4675, LTM4676,
+	  LTM4677, LTM4678, LTM4680, LTM4686, and LTM4700.
 
 config SENSORS_LTC3815
 	tristate "Linear Technologies LTC3815"
drivers/hwmon/pmbus/ltc2978.c +14 -9
index aea7b6c93e74..888db3213a01 100644
@@ -23,8 +23,8 @@ enum chips {
 	/* Managers */
 	ltc2972, ltc2974, ltc2975, ltc2977, ltc2978, ltc2979, ltc2980,
 	/* Controllers */
-	lt7170, lt7171, ltc3880, ltc3882, ltc3883, ltc3884, ltc3886, ltc3887,
-	ltc3889, ltc7132, ltc7841, ltc7880,
+	lt7170, lt7171, lt7175, lt7176p, ltc3880, ltc3882, ltc3883, ltc3884,
+	ltc3886, ltc3887, ltc3889, ltc7132, ltc7841, ltc7880,
 	/* Modules */
 	ltm2987, ltm4664, ltm4673, ltm4675, ltm4676, ltm4677, ltm4678, ltm4680,
 	ltm4686, ltm4700,
@@ -540,6 +540,8 @@ static int ltc2978_write_word_data(struct i2c_client *client, int page,
 static const struct i2c_device_id ltc2978_id[] = {
 	{ .name = "lt7170", .driver_data = lt7170 },
 	{ .name = "lt7171", .driver_data = lt7171 },
+	{ .name = "lt7175", .driver_data = lt7175 },
+	{ .name = "lt7176p", .driver_data = lt7176p },
 	{ .name = "ltc2972", .driver_data = ltc2972 },
 	{ .name = "ltc2974", .driver_data = ltc2974 },
 	{ .name = "ltc2975", .driver_data = ltc2975 },
@@ -630,6 +632,7 @@ static int ltc2978_get_id(struct i2c_client *client)
 	chip_id &= LTC2978_ID_MASK;
 
 	if (chip_id == LT7170_ID) {
+		const struct i2c_device_id *id;
 		u8 buf[I2C_SMBUS_BLOCK_MAX];
 		int ret;
 
@@ -638,13 +641,11 @@ static int ltc2978_get_id(struct i2c_client *client)
 		if (ret < 0)
 			return ret;
 
-		if (ret < 6)
-			return -ENODEV;
-
-		if (!strncmp(buf, "LT7170", 6))
-			return lt7170;
-		if (!strncmp(buf, "LT7171", 6))
-			return lt7171;
+		for (id = &ltc2978_id[0]; strlen(id->name); id++) {
+			if (ret >= strlen(id->name) &&
+			    !strncasecmp(id->name, buf, strlen(id->name)))
+				return (int)id->driver_data;
+		}
 
 		return -ENODEV;
 	}
@@ -762,6 +763,8 @@ static int ltc2978_probe(struct i2c_client *client)
 	switch (data->id) {
 	case lt7170:
 	case lt7171:
+	case lt7175:
+	case lt7176p:
 		data->features |= FEAT_CLEAR_PEAKS | FEAT_NEEDS_POLLING;
 		info->read_word_data = ltc3883_read_word_data;
 		info->pages = LTC3883_NUM_PAGES;
@@ -962,6 +965,8 @@ static int ltc2978_probe(struct i2c_client *client)
 static const struct of_device_id ltc2978_of_match[] = {
 	{ .compatible = "lltc,lt7170" },
 	{ .compatible = "lltc,lt7171" },
+	{ .compatible = "lltc,lt7175" },
+	{ .compatible = "lltc,lt7176p" },
 	{ .compatible = "lltc,ltc2972" },
 	{ .compatible = "lltc,ltc2974" },
 	{ .compatible = "lltc,ltc2975" },
Signature · 1 line
2.43.0
#5 lore raw
Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [Medium] hwmon: (pmbus/ltc2978) IEEE-754 peaks compared as LINEAR11 in ltc_get_max() --

Thank you for your contribution! Sashiko AI review found 1 potential issue to consider:
- [Medium] hwmon: (pmbus/ltc2978) IEEE-754 peaks compared as LINEAR11 in ltc_get_max()
--

commit 201c09e7f06ead2d62e423cba00a536dde067159
Author: Christopher de Guzman <[email protected]>

hwmon: (pmbus/ltc2978) Add support for LT7175 and LT7176P

This commit adds support for the LT7175 and LT7176P PMBus buck regulators and matches PMBUS_IC_DEVICE_ID strings against ltc2978_id[] for the LT7170 family.

Quoted 4 lines
drivers/hwmon/pmbus/ltc2978.c +0 -0
index aea7b6c93e74b..888db3213a01e 100644

[ ... ]

drivers/hwmon/pmbus/ltc2978.c static int ltc2978_probe(struct i2c_client *client) · line 770

Quoted 9 lines
drivers/hwmon/pmbus/ltc2978.c +2 -0
@@ -762,6 +763,8 @@ static int ltc2978_probe(struct i2c_client *client)
 	switch (data->id) {
 	case lt7170:
 	case lt7171:
+	case lt7175:
+	case lt7176p:
 		data->features |= FEAT_CLEAR_PEAKS | FEAT_NEEDS_POLLING;
 		info->read_word_data = ltc3883_read_word_data;
 		info->pages = LTC3883_NUM_PAGES;

[Severity: Medium]
Does routing lt7175 and lt7176p (along with lt7170 and lt7171) through ltc3883_read_word_data() corrupt peak readings when the data format is ieee754?

ltc3883_read_word_data() -> ltc3880_read_word_data() -> ltc2978_read_word_data_common() reads PMBUS_VIRT_READ_IOUT_MAX, PMBUS_VIRT_READ_VIN_MAX, and PMBUS_VIRT_READ_TEMP_MAX via ltc_get_max():

drivers/hwmon/pmbus/ltc2978.c:ltc_get_max() {
    ...
	ret = ltc_read_word_data(client, page, 0xff, reg);
	if (ret >= 0) {
		if (lin11_to_val(ret) > lin11_to_val(*pmax))
			*pmax = ret;
		ret = *pmax;
	}
    ...
}

lin11_to_val() treats bit 10 as the two's-complement mantissa sign bit. In IEEE-754 binary16, bit 10 is the least-significant bit of the biased exponent, so positive values with an odd biased exponent (such as temperatures in [64, 128) C or voltages in [16, 32) V) decode as negative and are discarded in favor of smaller readings with an even biased exponent.

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=2
#6 lore raw

PATCH v2 3/4 hwmon: ltc2978: Document LT7175 and LT7176P support

In reply to Christopher de Guzman

Document support for the LT7175 and LT7176P PMBus buck regulators.

---
 Documentation/hwmon/ltc2978.rst | 26 ++++++++++++++++++++++----
 1 file changed, 22 insertions(+), 4 deletions(-)
Documentation/hwmon/ltc2978.rst +22 -4
index 0b72d566cac7..9e8448a9c1ed 100644
@@ -21,6 +21,22 @@ Supported chips:
 
     Datasheet: https://www.analog.com/en/products/lt7171.html
 
+  * Analog Devices LT7175
+
+    Prefix: 'lt7175'
+
+    Addresses scanned: -
+
+    Datasheet: https://www.analog.com/en/products/lt7175.html
+
+  * Analog Devices LT7176P
+
+    Prefix: 'lt7176p'
+
+    Addresses scanned: -
+
+    Datasheet: https://www.analog.com/en/products/lt7176p.html
+
   * Linear Technology LTC2972
 
     Prefix: 'ltc2972'
@@ -241,6 +257,8 @@ Description
 
 - LT7170 and LT7171 are 20 A, 16 V, single- or dual-phase Silent Switcher
 - step-down regulators with Digital Power System Management.
+- LT7175 and LT7176P are 24 A, 4 V, single-phase Silent Switcher step-down
+- regulators with Digital Power System Management.
 - LTC2974 and LTC2975 are quad digital power supply managers.
 - LTC2978 is an octal power supply monitor.
 - LTC2977 is a pin compatible replacement for LTC2978.
@@ -318,7 +336,7 @@ in1_reset_history	Reset input voltage history.
 
 in[N]_label		"vout[1-8]".
 
-			- LT7170, LT7171: N=2
+			- LT7170, LT7171, LT7175, LT7176P: N=2
 			- LTC2972: N=2-3
 			- LTC2974, LTC2975: N=2-5
 			- LTC2977, LTC2979, LTC2980, LTM2987: N=2-9
@@ -357,8 +375,8 @@ in[N]_reset_history	Reset output voltage history.
 
 temp[N]_input		Measured temperature.
 
-			- On LT7170 and LT7171, temp1 reports the chip
-			  temperature.
+			- On LT7170, LT7171, LT7175, and LT7176P, temp1 reports
+			  the chip temperature.
 			- On LTC2972, temp[1-2] report external temperatures,
 			  and temp 3 reports the chip temperature.
 			- On LTC2974 and LTC2975, temp[1-4] report external
@@ -452,7 +470,7 @@ curr1_reset_history	Reset input current history.
 
 curr[N]_label		"iout[1-4]".
 
-			- LT7170, LT7171: N=1
+			- LT7170, LT7171, LT7175, LT7176P: N=1
 			- LTC2972: N-1-2
 			- LTC2974, LTC2975: N=1-4
 			- LTC2977, LTC2979, LTC2980, LTM2987: not supported
Signature · 1 line
2.43.0
#7 lore raw

Re: [PATCH v2 3/4] hwmon: ltc2978: Document LT7175 and LT7176P support

Sashiko has reviewed this patch and found no issues.
Quoted 3 lines

Document support for the LT7175 and LT7176P PMBus buck regulators.

Sashiko has reviewed this patch and found no issues.

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=3
#8 lore raw

PATCH v2 4/4 hwmon: ltc2978: Remove LT7170 and LT7171 from curr1 iin documentation

In reply to Christopher de Guzman

LT7170 and LT7171 do not set PMBUS_HAVE_IIN, so curr1 reports the output current ("iout1") rather than the input current. Remove them from the list of chips with an "iin" curr1_label.

---
 Documentation/hwmon/ltc2978.rst | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
Documentation/hwmon/ltc2978.rst +3 -3
index 9e8448a9c1ed..7a95aefda301 100644
@@ -450,9 +450,9 @@ power[N]_input		Measured output power.
 
 curr1_label		"iin".
 
-			LT7170, LT7171, LTC3880, LTC3883, LTC3884, LTC3886,
-			LTC3887, LTC3889, LTM4644, LTM4675, LTM4676, LTM4677,
-			LTM4678, LTM4680, and LTM4700 only.
+			LTC3880, LTC3883, LTC3884, LTC3886, LTC3887, LTC3889,
+			LTM4644, LTM4675, LTM4676, LTM4677, LTM4678, LTM4680,
+			and LTM4700 only.
 
 curr1_input		Measured input current.
 
Signature · 1 line
2.43.0
#9 lore raw

Re: [PATCH v2 4/4] hwmon: ltc2978: Remove LT7170 and LT7171 from curr1 iin documentation

Sashiko has reviewed this patch and found no issues.
Quoted 5 lines

LT7170 and LT7171 do not set PMBUS_HAVE_IIN, so curr1 reports the output current ("iout1") rather than the input current. Remove them from the list of chips with an "iin" curr1_label.

Sashiko has reviewed this patch and found no issues.

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=4