mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Christopher de Guzman <christopher.deguzman@analog.com>
To: Guenter Roeck <linux@roeck-us.net>, Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>, Frank Li <Frank.Li@nxp.com>,
	Jonathan Corbet <corbet@lwn.net>,
	Shuah Khan <skhan@linuxfoundation.org>,
	Randy Dunlap <rdunlap@infradead.org>
Cc: <linux-hwmon@vger.kernel.org>, <devicetree@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>, <linux-doc@vger.kernel.org>,
	"Christopher de Guzman" <christopher.deguzman@analog.com>
Subject: [PATCH v2 2/4] hwmon: (pmbus/ltc2978) Add support for LT7175 and LT7176P
Date: Tue, 10 Nov 2026 18:00:41 +0800	[thread overview]
Message-ID: <20261110-upstream-lt7175-lt7176p-v2-2-dd60d28383bf@analog.com> (raw)
In-Reply-To: <20261110-upstream-lt7175-lt7176p-v2-0-dd60d28383bf@analog.com>

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.

Signed-off-by: Christopher de Guzman <christopher.deguzman@analog.com>
---
 drivers/hwmon/pmbus/Kconfig   |  6 +++---
 drivers/hwmon/pmbus/ltc2978.c | 23 ++++++++++++++---------
 2 files changed, 17 insertions(+), 12 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..888db3213a01 100644
--- a/drivers/hwmon/pmbus/ltc2978.c
+++ b/drivers/hwmon/pmbus/ltc2978.c
@@ -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" },

-- 
2.43.0


  parent reply	other threads:[~2026-11-10 10:01 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-10 10:00 [PATCH v2 0/4] " Christopher de Guzman
2026-11-10 10:00 ` [PATCH v2 1/4] dt-bindings: hwmon: ltc2978: " Christopher de Guzman
2026-11-11 12:05   ` Krzysztof Kozlowski
2026-11-17 18:41   ` Guenter Roeck
2026-11-10 10:00 ` Christopher de Guzman [this message]
2026-11-17 18:42   ` [PATCH v2 2/4] hwmon: (pmbus/ltc2978) " Guenter Roeck
2026-11-10 10:00 ` [PATCH v2 3/4] hwmon: ltc2978: Document LT7175 and LT7176P support Christopher de Guzman
2026-11-17 18:43   ` Guenter Roeck
2026-11-10 10:00 ` [PATCH v2 4/4] hwmon: ltc2978: Remove LT7170 and LT7171 from curr1 iin documentation Christopher de Guzman
2026-11-17 18:44   ` Guenter Roeck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261110-upstream-lt7175-lt7176p-v2-2-dd60d28383bf@analog.com \
    --to=christopher.deguzman@analog.com \
    --cc=Frank.Li@nxp.com \
    --cc=conor+dt@kernel.org \
    --cc=corbet@lwn.net \
    --cc=devicetree@vger.kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=rdunlap@infradead.org \
    --cc=robh@kernel.org \
    --cc=skhan@linuxfoundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®