Commit d0cf6a16 authored by Nuno Sá's avatar Nuno Sá Committed by Guenter Roeck
Browse files

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: default avatarNuno 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: default avatarGuenter Roeck <linux@roeck-us.net>
parent d782715a
Loading
Loading
Loading
Loading
+8 −7
Original line number Diff line number Diff line
@@ -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 (!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