[PATCH 2/2] hwmon: (pmbus/lm25066) add SMBus current limit configuration support

From: Potin Lai

Date: Thu Jun 11 2026 - 06:06:20 EST


Add support for the mutually exclusive 'ti,cl-smbus-high' and
'ti,cl-smbus-low' devicetree properties. When present, these properties
override the hardware configuration pins via the DEVICE_SETUP (0xD9)
register to set the Current Limit Configuration bit (bit 2) and
Current Limit Setting bit (bit 4) to SMBus settings.

The Bit 4 mapping to High/Low current limit is handled dynamically on
probe because it is swapped for lm25056 and lm25066 compared to other
supported chips (lm5064, lm5066, and lm5066i).

Signed-off-by: Potin Lai <potin.lai.pt@xxxxxxxxx>
---
drivers/hwmon/pmbus/lm25066.c | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)

diff --git a/drivers/hwmon/pmbus/lm25066.c b/drivers/hwmon/pmbus/lm25066.c
index dd7275a67a0a..20e114bdc882 100644
--- a/drivers/hwmon/pmbus/lm25066.c
+++ b/drivers/hwmon/pmbus/lm25066.c
@@ -34,6 +34,7 @@ enum chips { lm25056, lm25066, lm5064, lm5066, lm5066i };
#define LM25066_READ_AVG_PIN 0xdf

#define LM25066_DEV_SETUP_CL BIT(4) /* Current limit */
+#define LM25066_DEV_SETUP_CL_CFG BIT(2) /* Current limit configuration */

#define LM25066_SAMPLES_FOR_AVG_MAX 4096

@@ -464,6 +465,8 @@ MODULE_DEVICE_TABLE(of, lm25066_of_match);
static int lm25066_probe(struct i2c_client *client)
{
int config;
+ int config_new;
+ int ret;
u32 shunt;
struct lm25066_data *data;
struct pmbus_driver_info *info;
@@ -484,6 +487,28 @@ static int lm25066_probe(struct i2c_client *client)

data->id = (enum chips)(unsigned long)i2c_get_match_data(client);

+ config_new = config;
+ if (of_property_read_bool(client->dev.of_node, "ti,cl-smbus-high")) {
+ config_new |= LM25066_DEV_SETUP_CL_CFG;
+ if (data->id == lm25056 || data->id == lm25066)
+ config_new |= LM25066_DEV_SETUP_CL;
+ else
+ config_new &= ~LM25066_DEV_SETUP_CL;
+ } else if (of_property_read_bool(client->dev.of_node, "ti,cl-smbus-low")) {
+ config_new |= LM25066_DEV_SETUP_CL_CFG;
+ if (data->id == lm25056 || data->id == lm25066)
+ config_new &= ~LM25066_DEV_SETUP_CL;
+ else
+ config_new |= LM25066_DEV_SETUP_CL;
+ }
+
+ if (config_new != config) {
+ ret = i2c_smbus_write_byte_data(client, LM25066_DEVICE_SETUP, config_new);
+ if (ret < 0)
+ return ret;
+ config = config_new;
+ }
+
info = &data->info;

info->pages = 1;

--
2.52.0