hwmon: (ltc4282) Add default rsense value

Instead of failing probe when the "adi,rsense-nano-ohms" firmware property
is not provided, default rsense to (NANO/MILLI), or 1 milli-Ohm. This
allows the device to probe without requiring firmware properties, which
might be useful for some high level testing.

Signed-off-by: Nuno Sá <nuno.sa@analog.com>
Link: https://lore.kernel.org/r/20260304-hwmon-ltc4282-minor-improvs-v1-2-344622924d3a@analog.com
[groeck: Clarify that the default is 1 milli-Ohm. No functional change.]
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
This commit is contained in:
Nuno Sá 2026-03-04 10:17:48 +00:00 committed by Guenter Roeck
parent d782715ae7
commit d0cf6a161f

View File

@ -1328,15 +1328,16 @@ static int ltc4282_setup(struct ltc4282_state *st, struct device *dev)
if (ret)
return ret;
/* default to 1 milli-ohm so we can probe without FW properties */
st->rsense = 1 * (NANO / MILLI);
ret = device_property_read_u32(dev, "adi,rsense-nano-ohms",
&st->rsense);
if (ret)
return dev_err_probe(dev, ret,
"Failed to read adi,rsense-nano-ohms\n");
if (st->rsense < CENTI)
return dev_err_probe(dev, -EINVAL,
"adi,rsense-nano-ohms too small (< %lu)\n",
CENTI);
if (!ret) {
if (st->rsense < CENTI)
return dev_err_probe(dev, -EINVAL,
"adi,rsense-nano-ohms too small (< %lu)\n",
CENTI);
}
/*
* The resolution for rsense is tenths of micro (eg: 62.5 uOhm) which