Re: [PATCH] hwmon: (pmbus/ltc2978) Fix peak comparison for IEEE-754 chips
From: Guenter Roeck
Date: Mon Nov 23 2026 - 15:08:48 EST
On Mon, Nov 23, 2026 at 02:52:02PM +0800, Christopher de Guzman wrote:
> The LT7170, LT7171, LT7175 and LT7176P report their sensor values in
> IEEE-754 half-precision format, but ltc_get_max() and ltc_get_min()
> compare peak values with lin11_to_val(), which decodes LINEAR11. Bit 10
> is the lowest exponent bit in binary16, while LINEAR11 treats it as the
> mantissa sign bit. Positive values with an odd biased exponent, such as
> temperatures from 16 to 31 C or input voltages from 4 to 8 V, are
> therefore decoded as negative, and the reported peak stops following
> the real one.
>
> The peak start values have the same problem: 0x7c00 is the lowest
> LINEAR11 value, but it is +infinity in binary16.
>
> Add a FEAT_IEEE754 flag for these chips. Compare binary16 values as
> sign-magnitude integers, and start peak maximums at -infinity (0xfc00)
> and peak minimums at +infinity (0x7c00). The min attributes are not
> exposed for these chips, but the min path is fixed as well for
> consistency.
>
> Tested on an LT7171-1: after stepping VIN from 3.3 V to 5 V and back,
> in1_highest now reports 4992 mV instead of staying at 3294 mV.
>
> Fixes: c1d6afdbb8ed ("hwmon: (pmbus/ltc2978) add support for lt717x")
> Reported-by: sashiko-bot <sashiko-bot@xxxxxxxxxx>
> Closes: https://lore.kernel.org/all/sashiko-outbox-206843@xxxxxxxxxx/
> Signed-off-by: Christopher de Guzman <christopher.deguzman@xxxxxxxxxx>
Applied.
Thanks,
Guenter