Linux Hardware Monitor development
 help / color / mirror / Atom feed
* [PATCH 0/3] hwmon: (pmbus/ltc2978) Add support for LT7175 and LT7176P
@ 2026-10-20 11:45 Christopher de Guzman
  2026-10-20 11:45 ` [PATCH 1/3] dt-bindings: hwmon: ltc2978: " Christopher de Guzman
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Christopher de Guzman @ 2026-10-20 11:45 UTC (permalink / raw)
  To: Guenter Roeck, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Frank Li, Jonathan Corbet, Shuah Khan, Randy Dunlap
  Cc: linux-hwmon, devicetree, linux-kernel, linux-doc,
	Christopher de Guzman

Add support for the LT7175/LT7175-1 and LT7176P/LT7176P-1 PMBus buck
regulators to the existing ltc2978 driver. These parts share the LT7170
family MFR_SPECIAL_ID (0x1C1D masked to 0x1C10) and use the same PMBus
register layout, so they reuse the existing lt7170/lt7171 probe path.
Variants are distinguished by matching the PMBUS_IC_DEVICE_ID ASCII
string, following the same pattern already used for LT7170/LT7171.

Signed-off-by: Christopher de Guzman <christopher.deguzman@analog.com>
---
Christopher de Guzman (3):
      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

 .../devicetree/bindings/hwmon/lltc,ltc2978.yaml    |  6 +++-
 Documentation/hwmon/ltc2978.rst                    | 32 +++++++++++++++++-----
 drivers/hwmon/pmbus/Kconfig                        |  6 ++--
 drivers/hwmon/pmbus/ltc2978.c                      | 28 ++++++++++++++++++-
 4 files changed, 60 insertions(+), 12 deletions(-)
---
base-commit: 0b6eda22f9ab67ddb2a872b0c3fc578ad9f4e27e
change-id: 20261020-upstream-lt7175-lt7176p-b9e37cba8f2d

Best regards,
--  
Christopher de Guzman <christopher.deguzman@analog.com>


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 1/3] dt-bindings: hwmon: ltc2978: Add support for LT7175 and LT7176P
  2026-10-20 11:45 [PATCH 0/3] hwmon: (pmbus/ltc2978) Add support for LT7175 and LT7176P Christopher de Guzman
@ 2026-10-20 11:45 ` Christopher de Guzman
  2026-10-20 11:48   ` sashiko-bot
  2026-10-20 15:14   ` Guenter Roeck
  2026-10-20 11:45 ` [PATCH 2/3] hwmon: (pmbus/ltc2978) " Christopher de Guzman
  2026-10-20 11:45 ` [PATCH 3/3] hwmon: ltc2978: Document LT7175 and LT7176P support Christopher de Guzman
  2 siblings, 2 replies; 9+ messages in thread
From: Christopher de Guzman @ 2026-10-20 11:45 UTC (permalink / raw)
  To: Guenter Roeck, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Frank Li, Jonathan Corbet, Shuah Khan, Randy Dunlap
  Cc: linux-hwmon, devicetree, linux-kernel, linux-doc,
	Christopher de Guzman

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

Signed-off-by: Christopher de Guzman <christopher.deguzman@analog.com>
---
 Documentation/devicetree/bindings/hwmon/lltc,ltc2978.yaml | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/hwmon/lltc,ltc2978.yaml b/Documentation/devicetree/bindings/hwmon/lltc,ltc2978.yaml
index ea8b1553a3e9..467c6ab4a29f 100644
--- a/Documentation/devicetree/bindings/hwmon/lltc,ltc2978.yaml
+++ b/Documentation/devicetree/bindings/hwmon/lltc,ltc2978.yaml
@@ -14,6 +14,10 @@ properties:
     enum:
       - lltc,lt7170
       - lltc,lt7171
+      - lltc,lt7175
+      - lltc,lt7175-1
+      - lltc,lt7176p
+      - lltc,lt7176p-1
       - lltc,ltc2972
       - lltc,ltc2974
       - lltc,ltc2975
@@ -50,7 +54,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, lt7175-1, lt7176p, lt7176p-1 : vout0
       * ltc2972 vout0 - vout1
       * ltc2974, ltc2975 : vout0 - vout3
       * ltc2977, ltc2979, ltc2980, ltm2987 : vout0 - vout7

-- 
2.43.0


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 2/3] hwmon: (pmbus/ltc2978) Add support for LT7175 and LT7176P
  2026-10-20 11:45 [PATCH 0/3] hwmon: (pmbus/ltc2978) Add support for LT7175 and LT7176P Christopher de Guzman
  2026-10-20 11:45 ` [PATCH 1/3] dt-bindings: hwmon: ltc2978: " Christopher de Guzman
@ 2026-10-20 11:45 ` Christopher de Guzman
  2026-10-20 12:01   ` sashiko-bot
  2026-10-20 15:13   ` Guenter Roeck
  2026-10-20 11:45 ` [PATCH 3/3] hwmon: ltc2978: Document LT7175 and LT7176P support Christopher de Guzman
  2 siblings, 2 replies; 9+ messages in thread
From: Christopher de Guzman @ 2026-10-20 11:45 UTC (permalink / raw)
  To: Guenter Roeck, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Frank Li, Jonathan Corbet, Shuah Khan, Randy Dunlap
  Cc: linux-hwmon, devicetree, linux-kernel, linux-doc,
	Christopher de Guzman

Add support for LT7175/LT7175-1 and LT7176P/LT7176P-1 PMBus buck
regulators. These parts share the LT7170 family MFR_SPECIAL_ID
(0x1C1D masked to 0x1C10) and use the same PMBus register layout,
so they reuse the existing lt7170/lt7171 probe path. Variants are
distinguished by reading the PMBUS_IC_DEVICE_ID ASCII string.

Signed-off-by: Christopher de Guzman <christopher.deguzman@analog.com>
---
 drivers/hwmon/pmbus/Kconfig   |  6 +++---
 drivers/hwmon/pmbus/ltc2978.c | 28 +++++++++++++++++++++++++++-
 2 files changed, 30 insertions(+), 4 deletions(-)

diff --git a/drivers/hwmon/pmbus/Kconfig b/drivers/hwmon/pmbus/Kconfig
index fd6641316454..63fb4d5dd87d 100644
--- a/drivers/hwmon/pmbus/Kconfig
+++ b/drivers/hwmon/pmbus/Kconfig
@@ -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"
diff --git a/drivers/hwmon/pmbus/ltc2978.c b/drivers/hwmon/pmbus/ltc2978.c
index aea7b6c93e74..a42cdc1fe124 100644
--- a/drivers/hwmon/pmbus/ltc2978.c
+++ b/drivers/hwmon/pmbus/ltc2978.c
@@ -23,7 +23,7 @@ enum chips {
 	/* Managers */
 	ltc2972, ltc2974, ltc2975, ltc2977, ltc2978, ltc2979, ltc2980,
 	/* Controllers */
-	lt7170, lt7171, ltc3880, ltc3882, ltc3883, ltc3884, ltc3886, ltc3887,
+	lt7170, lt7171, lt7175, lt7176p, ltc3880, ltc3882, ltc3883, ltc3884, ltc3886, ltc3887,
 	ltc3889, ltc7132, ltc7841, ltc7880,
 	/* Modules */
 	ltm2987, ltm4664, ltm4673, ltm4675, ltm4676, ltm4677, ltm4678, ltm4680,
@@ -540,6 +540,10 @@ 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 = "lt7175-1", .driver_data = lt7175 },
+	{ .name = "lt7176p", .driver_data = lt7176p },
+	{ .name = "lt7176p-1", .driver_data = lt7176p },
 	{ .name = "ltc2972", .driver_data = ltc2972 },
 	{ .name = "ltc2974", .driver_data = ltc2974 },
 	{ .name = "ltc2975", .driver_data = ltc2975 },
@@ -645,6 +649,10 @@ static int ltc2978_get_id(struct i2c_client *client)
 			return lt7170;
 		if (!strncmp(buf, "LT7171", 6))
 			return lt7171;
+		if (!strncmp(buf, "LT7175", 6))
+			return lt7175;
+		if (!strncmp(buf, "LT7176P", 7))
+			return lt7176p;
 
 		return -ENODEV;
 	}
@@ -774,6 +782,20 @@ static int ltc2978_probe(struct i2c_client *client)
 		  | PMBUS_HAVE_IOUT | PMBUS_HAVE_STATUS_IOUT
 		  | PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP;
 		break;
+	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;
+		info->format[PSC_VOLTAGE_IN] = ieee754;
+		info->format[PSC_VOLTAGE_OUT] = ieee754;
+		info->format[PSC_CURRENT_OUT] = ieee754;
+		info->format[PSC_TEMPERATURE] = ieee754;
+		info->func[0] = PMBUS_HAVE_VIN | PMBUS_HAVE_STATUS_INPUT
+		  | PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT
+		  | PMBUS_HAVE_IOUT | PMBUS_HAVE_STATUS_IOUT
+		  | PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP;
+		break;
 	case ltc2972:
 		info->read_word_data = ltc2975_read_word_data;
 		info->pages = LTC2972_NUM_PAGES;
@@ -962,6 +984,10 @@ 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,lt7175-1" },
+	{ .compatible = "lltc,lt7176p" },
+	{ .compatible = "lltc,lt7176p-1" },
 	{ .compatible = "lltc,ltc2972" },
 	{ .compatible = "lltc,ltc2974" },
 	{ .compatible = "lltc,ltc2975" },

-- 
2.43.0


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 3/3] hwmon: ltc2978: Document LT7175 and LT7176P support
  2026-10-20 11:45 [PATCH 0/3] hwmon: (pmbus/ltc2978) Add support for LT7175 and LT7176P Christopher de Guzman
  2026-10-20 11:45 ` [PATCH 1/3] dt-bindings: hwmon: ltc2978: " Christopher de Guzman
  2026-10-20 11:45 ` [PATCH 2/3] hwmon: (pmbus/ltc2978) " Christopher de Guzman
@ 2026-10-20 11:45 ` Christopher de Guzman
  2026-10-20 11:54   ` sashiko-bot
  2 siblings, 1 reply; 9+ messages in thread
From: Christopher de Guzman @ 2026-10-20 11:45 UTC (permalink / raw)
  To: Guenter Roeck, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Frank Li, Jonathan Corbet, Shuah Khan, Randy Dunlap
  Cc: linux-hwmon, devicetree, linux-kernel, linux-doc,
	Christopher de Guzman

Document support for the LT7175/LT7175-1 and LT7176P/LT7176P-1 PMBus
buck regulators added in the previous commit.

Signed-off-by: Christopher de Guzman <christopher.deguzman@analog.com>
---
 Documentation/hwmon/ltc2978.rst | 32 +++++++++++++++++++++++++-------
 1 file changed, 25 insertions(+), 7 deletions(-)

diff --git a/Documentation/hwmon/ltc2978.rst b/Documentation/hwmon/ltc2978.rst
index 0b72d566cac7..3d30ce5cac95 100644
--- a/Documentation/hwmon/ltc2978.rst
+++ b/Documentation/hwmon/ltc2978.rst
@@ -21,6 +21,22 @@ Supported chips:
 
     Datasheet: https://www.analog.com/en/products/lt7171.html
 
+  * Analog Devices LT7175, LT7175-1
+
+    Prefix: 'lt7175'
+
+    Addresses scanned: -
+
+    Datasheet: https://www.analog.com/en/products/lt7175
+
+  * Analog Devices LT7176P, LT7176P-1
+
+    Prefix: 'lt7176p'
+
+    Addresses scanned: -
+
+    Datasheet: https://www.analog.com/en/products/lt7176p
+
   * 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
@@ -432,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.
+			LT7170, LT7171, LT7175, LT7176P, LTC3880, LTC3883,
+			LTC3884, LTC3886, LTC3887, LTC3889, LTM4644, LTM4675,
+			LTM4676, LTM4677, LTM4678, LTM4680, and LTM4700 only.
 
 curr1_input		Measured input current.
 
@@ -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

-- 
2.43.0


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/3] dt-bindings: hwmon: ltc2978: Add support for LT7175 and LT7176P
  2026-10-20 11:45 ` [PATCH 1/3] dt-bindings: hwmon: ltc2978: " Christopher de Guzman
@ 2026-10-20 11:48   ` sashiko-bot
  2026-10-20 15:14   ` Guenter Roeck
  1 sibling, 0 replies; 9+ messages in thread
From: sashiko-bot @ 2026-10-20 11:48 UTC (permalink / raw)
  To: Christopher de Guzman; +Cc: linux-hwmon

> Document the compatible strings for the LT7175/LT7175-1 and
> LT7176P/LT7176P-1 PMBus buck regulators newly supported by the
> ltc2978 driver.
> 
> Signed-off-by: Christopher de Guzman <christopher.deguzman@analog.com>

Sashiko has reviewed this patch and found no issues.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261020-upstream-lt7175-lt7176p-v1-0-86b9b728b95d@analog.com?part=1


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 3/3] hwmon: ltc2978: Document LT7175 and LT7176P support
  2026-10-20 11:45 ` [PATCH 3/3] hwmon: ltc2978: Document LT7175 and LT7176P support Christopher de Guzman
@ 2026-10-20 11:54   ` sashiko-bot
  0 siblings, 0 replies; 9+ messages in thread
From: sashiko-bot @ 2026-10-20 11:54 UTC (permalink / raw)
  To: Christopher de Guzman; +Cc: linux-hwmon, devicetree, robh, conor+dt

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Medium] hwmon: (pmbus/ltc2978) uninitialized stack read in ltc2978_get_id()
- [Low] hwmon: ltc2978: incorrect curr1_label documentation for LT7175 and LT7176P
--

commit 920a8e47ce82192a2f0425722db911c23eb2b4ca
Author: Christopher de Guzman <christopher.deguzman@analog.com>

hwmon: ltc2978: Document LT7175 and LT7176P support

This commit documents support for the LT7175/LT7175-1 and LT7176P/LT7176P-1
PMBus buck regulators in the ltc2978 hwmon driver documentation, which were
added in commit 51707b022513 ("hwmon: (pmbus/ltc2978) Add support for LT7175
and LT7176P").

> diff --git a/Documentation/hwmon/ltc2978.rst b/Documentation/hwmon/ltc2978.rst
> index 0b72d566cac70..3d30ce5cac95d 100644
> --- a/Documentation/hwmon/ltc2978.rst
> +++ b/Documentation/hwmon/ltc2978.rst
> @@ -21,6 +21,22 @@ Supported chips:
>  
>      Datasheet: https://www.analog.com/en/products/lt7171.html
>  
> +  * Analog Devices LT7175, LT7175-1
> +
> +    Prefix: 'lt7175'
> +
> +    Addresses scanned: -
> +
> +    Datasheet: https://www.analog.com/en/products/lt7175
> +
> +  * Analog Devices LT7176P, LT7176P-1
> +
> +    Prefix: 'lt7176p'
> +
> +    Addresses scanned: -
> +
> +    Datasheet: https://www.analog.com/en/products/lt7176p
> +

[Severity: Medium]
In the preceding commit 51707b022513 ("hwmon: (pmbus/ltc2978) Add support
for LT7175 and LT7176P"), can ltc2978_probe() -> ltc2978_get_id() in
drivers/hwmon/pmbus/ltc2978.c read an uninitialized byte from buf[6] on the
stack when checking for "LT7176P"?

In drivers/hwmon/pmbus/ltc2978.c:ltc2978_get_id():

	if ((chip_id & LTC2978_ID_MASK) == LT7170_ID) {
		u8 buf[I2C_SMBUS_BLOCK_MAX];

		ret = pmbus_read_smbus_i2c_block_data(client, PMBUS_IC_DEVICE_ID, buf);
		if (ret < 0)
			return ret;
		if (ret < 6)
			return -ENODEV;

		if (!strncmp(buf, "LT7170", 6))
			return lt7170;
		if (!strncmp(buf, "LT7171", 6))
			return lt7171;
		if (!strncmp(buf, "LT7175", 6))
			return lt7175;
		if (!strncmp(buf, "LT7176P", 7))
			return lt7176p;

pmbus_read_smbus_i2c_block_data() in drivers/hwmon/pmbus/pmbus_core.c copies
only ret bytes into buf without NUL-terminating it or initializing remaining
bytes.

Since the length check only enforces ret >= 6, if a device returns 6 bytes
with buf[0..5] containing "LT7176", strncmp(buf, "LT7176P", 7) will read the
uninitialized 7th byte at buf[6]. Should the "LT7176P" check verify ret >= 7
first?

[ ... ]

> @@ -432,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.
> +			LT7170, LT7171, LT7175, LT7176P, LTC3880, LTC3883,
> +			LTC3884, LTC3886, LTC3887, LTC3889, LTM4644, LTM4675,
> +			LTM4676, LTM4677, LTM4678, LTM4680, and LTM4700 only.
>  
>  curr1_input		Measured input current.
>  
> @@ -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

[Severity: Low]
Should LT7175 and LT7176P be omitted from the curr1_label "iin" list above?

In drivers/hwmon/pmbus/ltc2978.c:ltc2978_probe(), the lt7175 and lt7176p
configuration sets:

	case lt7175:
	case lt7176p:
		...
		info->func[0] = PMBUS_HAVE_VIN | PMBUS_HAVE_STATUS_INPUT
		  | PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT
		  | PMBUS_HAVE_IOUT | PMBUS_HAVE_STATUS_IOUT
		  | PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP;
		break;

Because PMBUS_HAVE_IIN is not enabled for these chips, curr1 is "iout1" (as
documented in the curr[N]_label N=1 entry) rather than "iin".

>  			- LTC2972: N-1-2
>  			- LTC2974, LTC2975: N=1-4
>  			- LTC2977, LTC2979, LTC2980, LTM2987: not supported

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261020-upstream-lt7175-lt7176p-v1-0-86b9b728b95d@analog.com?part=3

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/3] hwmon: (pmbus/ltc2978) Add support for LT7175 and LT7176P
  2026-10-20 11:45 ` [PATCH 2/3] hwmon: (pmbus/ltc2978) " Christopher de Guzman
@ 2026-10-20 12:01   ` sashiko-bot
  2026-10-20 15:13   ` Guenter Roeck
  1 sibling, 0 replies; 9+ messages in thread
From: sashiko-bot @ 2026-10-20 12:01 UTC (permalink / raw)
  To: Christopher de Guzman; +Cc: linux-hwmon, devicetree, robh, conor+dt

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Medium] hwmon: (ltc2978) uninitialized stack read in ltc2978_get_id() for LT7176P
- [Medium] hwmon: (pmbus/ltc2978) IEEE754 peak values compared as LINEAR11 in ltc_get_max()
--

commit 51707b0225138ad0d3a2b0dd58f194120d060f5a
Author: Christopher de Guzman <christopher.deguzman@analog.com>

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

This commit adds support for the LT7175/LT7175-1 and LT7176P/LT7176P-1 PMBus
buck regulators to the ltc2978 driver, distinguishing them via the
PMBUS_IC_DEVICE_ID string and configuring them with IEEE754 telemetry format.

> diff --git a/drivers/hwmon/pmbus/ltc2978.c b/drivers/hwmon/pmbus/ltc2978.c
> index aea7b6c93e74b..a42cdc1fe1246 100644
> --- a/drivers/hwmon/pmbus/ltc2978.c
> +++ b/drivers/hwmon/pmbus/ltc2978.c

[ ... ]

> @@ -645,6 +649,10 @@ static int ltc2978_get_id(struct i2c_client *client)
>  			return lt7170;
>  		if (!strncmp(buf, "LT7171", 6))
>  			return lt7171;
> +		if (!strncmp(buf, "LT7175", 6))
> +			return lt7175;
> +		if (!strncmp(buf, "LT7176P", 7))
> +			return lt7176p;

[Severity: Medium]
Can strncmp() read uninitialized stack memory in buf[6] here?

In drivers/hwmon/pmbus/ltc2978.c, ltc2978_get_id() reads PMBUS_IC_DEVICE_ID
into an uninitialized stack buffer via pmbus_read_smbus_i2c_block_data(),
which copies ret bytes without NUL-terminating buf, and then checks only
for ret < 6:

	if (chip_id == LT7170_ID) {
		u8 buf[I2C_SMBUS_BLOCK_MAX];
		int ret;

		ret = pmbus_read_smbus_i2c_block_data(client, PMBUS_IC_DEVICE_ID,
						      buf);
		if (ret < 0)
			return ret;

		if (ret < 6)
			return -ENODEV;

If a device returns a 6-byte PMBUS_IC_DEVICE_ID starting with "LT7176"
(where ret == 6), calling strncmp(buf, "LT7176P", 7) without checking
ret >= 7 will read buf[6] from the uninitialized stack buffer and falsely
match lt7176p if that byte happens to be 'P'.

>  
>  		return -ENODEV;
>  	}
> @@ -774,6 +782,20 @@ static int ltc2978_probe(struct i2c_client *client)
>  		  | PMBUS_HAVE_IOUT | PMBUS_HAVE_STATUS_IOUT
>  		  | PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP;
>  		break;
> +	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;
> +		info->format[PSC_VOLTAGE_IN] = ieee754;
> +		info->format[PSC_VOLTAGE_OUT] = ieee754;
> +		info->format[PSC_CURRENT_OUT] = ieee754;
> +		info->format[PSC_TEMPERATURE] = ieee754;
> +		info->func[0] = PMBUS_HAVE_VIN | PMBUS_HAVE_STATUS_INPUT
> +		  | PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT
> +		  | PMBUS_HAVE_IOUT | PMBUS_HAVE_STATUS_IOUT
> +		  | PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP;
> +		break;

[Severity: Medium]
Will wiring info->read_word_data to ltc3883_read_word_data cause corrupted
peak readings when the sensor formats are set to ieee754?

For lt7175 and lt7176p, virtual peak reads for PMBUS_VIRT_READ_VIN_MAX,
PMBUS_VIRT_READ_IOUT_MAX, and PMBUS_VIRT_READ_TEMP_MAX go through
ltc3883_read_word_data() -> ltc3880_read_word_data() ->
ltc2978_read_word_data_common() -> ltc_get_max():

static int ltc_get_max(struct ltc2978_data *data, struct i2c_client *client,
		       int page, int reg, u16 *pmax)
{
	int ret;

	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;
	}
	return ret;
}

Because lin11_to_val() treats bit 10 as the sign bit of an 11-bit two's
complement mantissa, whereas in IEEE754 binary16 bit 10 is the least
significant bit of the 5-bit biased exponent, any positive IEEE754 value with
an odd biased exponent (e.g. [1, 2), [4, 8), [16, 32), [64, 128)) has bit 10
set and is decoded by lin11_to_val() as negative.

As a result, when a peak reading increases from an even biased exponent into
an odd biased exponent (such as temperature rising from 40 C to 75 C, or IOUT
rising from 2.5 A to 6.0 A), ltc_get_max() will treat the new higher reading
as negative and fail to update *pmax, or overwrite a higher odd-exponent peak
with a lower even-exponent reading.

[ ... ]

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261020-upstream-lt7175-lt7176p-v1-0-86b9b728b95d@analog.com?part=2

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/3] hwmon: (pmbus/ltc2978) Add support for LT7175 and LT7176P
  2026-10-20 11:45 ` [PATCH 2/3] hwmon: (pmbus/ltc2978) " Christopher de Guzman
  2026-10-20 12:01   ` sashiko-bot
@ 2026-10-20 15:13   ` Guenter Roeck
  1 sibling, 0 replies; 9+ messages in thread
From: Guenter Roeck @ 2026-10-20 15:13 UTC (permalink / raw)
  To: Christopher de Guzman, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Frank Li, Jonathan Corbet, Shuah Khan, Randy Dunlap
  Cc: linux-hwmon, devicetree, linux-kernel, linux-doc

On 10/20/26 04:45, Christopher de Guzman wrote:
> Add support for LT7175/LT7175-1 and LT7176P/LT7176P-1 PMBus buck
> regulators. These parts share the LT7170 family MFR_SPECIAL_ID
> (0x1C1D masked to 0x1C10) and use the same PMBus register layout,
> so they reuse the existing lt7170/lt7171 probe path. Variants are
> distinguished by reading the PMBUS_IC_DEVICE_ID ASCII string.
> 
> Signed-off-by: Christopher de Guzman <christopher.deguzman@analog.com>
> ---
>   drivers/hwmon/pmbus/Kconfig   |  6 +++---
>   drivers/hwmon/pmbus/ltc2978.c | 28 +++++++++++++++++++++++++++-
>   2 files changed, 30 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/hwmon/pmbus/Kconfig b/drivers/hwmon/pmbus/Kconfig
> index fd6641316454..63fb4d5dd87d 100644
> --- a/drivers/hwmon/pmbus/Kconfig
> +++ b/drivers/hwmon/pmbus/Kconfig
> @@ -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"
> diff --git a/drivers/hwmon/pmbus/ltc2978.c b/drivers/hwmon/pmbus/ltc2978.c
> index aea7b6c93e74..a42cdc1fe124 100644
> --- a/drivers/hwmon/pmbus/ltc2978.c
> +++ b/drivers/hwmon/pmbus/ltc2978.c
> @@ -23,7 +23,7 @@ enum chips {
>   	/* Managers */
>   	ltc2972, ltc2974, ltc2975, ltc2977, ltc2978, ltc2979, ltc2980,
>   	/* Controllers */
> -	lt7170, lt7171, ltc3880, ltc3882, ltc3883, ltc3884, ltc3886, ltc3887,
> +	lt7170, lt7171, lt7175, lt7176p, ltc3880, ltc3882, ltc3883, ltc3884, ltc3886, ltc3887,
>   	ltc3889, ltc7132, ltc7841, ltc7880,
>   	/* Modules */
>   	ltm2987, ltm4664, ltm4673, ltm4675, ltm4676, ltm4677, ltm4678, ltm4680,
> @@ -540,6 +540,10 @@ 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 = "lt7175-1", .driver_data = lt7175 },
> +	{ .name = "lt7176p", .driver_data = lt7176p },
> +	{ .name = "lt7176p-1", .driver_data = lt7176p },

We don't usually add -x variants unless really needed.
Let's not start this here.

>   	{ .name = "ltc2972", .driver_data = ltc2972 },
>   	{ .name = "ltc2974", .driver_data = ltc2974 },
>   	{ .name = "ltc2975", .driver_data = ltc2975 },
> @@ -645,6 +649,10 @@ static int ltc2978_get_id(struct i2c_client *client)
>   			return lt7170;
>   		if (!strncmp(buf, "LT7171", 6))
>   			return lt7171;
> +		if (!strncmp(buf, "LT7175", 6))
> +			return lt7175;
> +		if (!strncmp(buf, "LT7176P", 7))
> +			return lt7176p;

Sashiko has a point. It may be better to start using
the same approach used for chips with no chip ID, which would
be something like

		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;
>   	}
> @@ -774,6 +782,20 @@ static int ltc2978_probe(struct i2c_client *client)
>   		  | PMBUS_HAVE_IOUT | PMBUS_HAVE_STATUS_IOUT
>   		  | PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP;
>   		break;
> +	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;
> +		info->format[PSC_VOLTAGE_IN] = ieee754;
> +		info->format[PSC_VOLTAGE_OUT] = ieee754;
> +		info->format[PSC_CURRENT_OUT] = ieee754;
> +		info->format[PSC_TEMPERATURE] = ieee754;
> +		info->func[0] = PMBUS_HAVE_VIN | PMBUS_HAVE_STATUS_INPUT
> +		  | PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT
> +		  | PMBUS_HAVE_IOUT | PMBUS_HAVE_STATUS_IOUT
> +		  | PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP;

Unless I am missing something, this is identical to lt7170 / lt71751.
No need to duplicate the code, just add the case statements.

> +		break;
>   	case ltc2972:
>   		info->read_word_data = ltc2975_read_word_data;
>   		info->pages = LTC2972_NUM_PAGES;
> @@ -962,6 +984,10 @@ 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,lt7175-1" },
> +	{ .compatible = "lltc,lt7176p" },
> +	{ .compatible = "lltc,lt7176p-1" },

Same as above. Please do not add -1 variants.

Thanks,
Guenter

>   	{ .compatible = "lltc,ltc2972" },
>   	{ .compatible = "lltc,ltc2974" },
>   	{ .compatible = "lltc,ltc2975" },
> 


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/3] dt-bindings: hwmon: ltc2978: Add support for LT7175 and LT7176P
  2026-10-20 11:45 ` [PATCH 1/3] dt-bindings: hwmon: ltc2978: " Christopher de Guzman
  2026-10-20 11:48   ` sashiko-bot
@ 2026-10-20 15:14   ` Guenter Roeck
  1 sibling, 0 replies; 9+ messages in thread
From: Guenter Roeck @ 2026-10-20 15:14 UTC (permalink / raw)
  To: Christopher de Guzman, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Frank Li, Jonathan Corbet, Shuah Khan, Randy Dunlap
  Cc: linux-hwmon, devicetree, linux-kernel, linux-doc

On 10/20/26 04:45, Christopher de Guzman wrote:
> Document the compatible strings for the LT7175/LT7175-1 and
> LT7176P/LT7176P-1 PMBus buck regulators newly supported by the
> ltc2978 driver.
> 
> Signed-off-by: Christopher de Guzman <christopher.deguzman@analog.com>
> ---
>   Documentation/devicetree/bindings/hwmon/lltc,ltc2978.yaml | 6 +++++-
>   1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/Documentation/devicetree/bindings/hwmon/lltc,ltc2978.yaml b/Documentation/devicetree/bindings/hwmon/lltc,ltc2978.yaml
> index ea8b1553a3e9..467c6ab4a29f 100644
> --- a/Documentation/devicetree/bindings/hwmon/lltc,ltc2978.yaml
> +++ b/Documentation/devicetree/bindings/hwmon/lltc,ltc2978.yaml
> @@ -14,6 +14,10 @@ properties:
>       enum:
>         - lltc,lt7170
>         - lltc,lt7171
> +      - lltc,lt7175
> +      - lltc,lt7175-1
> +      - lltc,lt7176p
> +      - lltc,lt7176p-1

The -1 variants are not needed and/or useful.

Guenter

>         - lltc,ltc2972
>         - lltc,ltc2974
>         - lltc,ltc2975
> @@ -50,7 +54,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, lt7175-1, lt7176p, lt7176p-1 : vout0
>         * ltc2972 vout0 - vout1
>         * ltc2974, ltc2975 : vout0 - vout3
>         * ltc2977, ltc2979, ltc2980, ltm2987 : vout0 - vout7
> 


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2026-10-20 15:14 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-20 11:45 [PATCH 0/3] hwmon: (pmbus/ltc2978) Add support for LT7175 and LT7176P Christopher de Guzman
2026-10-20 11:45 ` [PATCH 1/3] dt-bindings: hwmon: ltc2978: " Christopher de Guzman
2026-10-20 11:48   ` sashiko-bot
2026-10-20 15:14   ` Guenter Roeck
2026-10-20 11:45 ` [PATCH 2/3] hwmon: (pmbus/ltc2978) " Christopher de Guzman
2026-10-20 12:01   ` sashiko-bot
2026-10-20 15:13   ` Guenter Roeck
2026-10-20 11:45 ` [PATCH 3/3] hwmon: ltc2978: Document LT7175 and LT7176P support Christopher de Guzman
2026-10-20 11:54   ` sashiko-bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox