Re: [PATCH] hwmon: (pmbus/lm25066) Fix PMBus coefficient calculations

[email protected] Tue, 04 Aug 2026 21:44:22 +0000
Newsgroups org.kernel.vger.linux-hwmon
Message-ID <[email protected]>
> In lm25066_probe(), the PMBus coefficients for current and power are
> scaled based on the shunt resistor value. The calculation evaluates the
> multiplication using 32-bit arithmetic because info->m is an int and
> shunt is a u32:
>=20
> static int lm25066_probe(struct i2c_client *client) {
>     ...
>     info->m[PSC_CURRENT_IN] =3D info->m[PSC_CURRENT_IN] * shunt / 1000;
>     info->m[PSC_POWER] =3D info->m[PSC_POWER] * shunt / 1000;
>     ...
> }
>=20
> For large coefficients like 26882 (LM25056) or 15076 (LM5066i), a device
> tree shunt-resistor-micro-ohms value exceeding approximately 159,000
> (159 mOhm, which is physically valid for low-current applications) causes
> [ ... ]
> shunt resistor values.
>=20
> Reported-by: Sashiko <[email protected]>
> Fixes: 94ee5fcc240fe ("hwmon: (pmbus/lm25066) Support configurable sense =
resistor values")
> Signed-off-by: Guenter Roeck <[email protected]>

Sashiko has reviewed this patch and found no issues. It looks great!

--=20
Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20260804213627.1522=
[email protected]?part=3D1