hwmon: (nct7802) Fix non-working alarm on voltages
authorGilles Buloz <gilles.buloz@kontron.com>
Fri, 29 Nov 2019 09:56:05 +0000 (10:56 +0100)
committerGuenter Roeck <linux@roeck-us.net>
Fri, 17 Jan 2020 15:56:48 +0000 (07:56 -0800)
commite51a7dda299815e92f43960d620cdfc8dfc144f2
tree7a38489aa8e58a09b5ad8f083bc804229d8418a0
parent7713e62c8623c54dac88d1fa724aa487a38c3efb
hwmon: (nct7802) Fix non-working alarm on voltages

No alarm is reported by /sys/.../inX_alarm

In detail:

The SMI Voltage status register is the only register giving a status
for voltages, but it does not work like the non-SMI status registers
used for temperatures and fans.
A bit is set for each input crossing a threshold, in both direction,
but the "inside" or "outside" limits info is not available.
Also this register is cleared on read.
Note : this is not explicitly spelled out in the datasheet, but from
experiment.
As a result if an input is crossing a threshold (min or max in any
direction), the alarm is reported only once even if the input is
still outside limits. Also if the alarm for another input is read
before the one of this input, no alarm is reported at all.

Signed-off-by: Gilles Buloz <gilles.buloz@kontron.com>
Link: https://lore.kernel.org/r/5de0f566.tBga5POKAgHlmd0p%gilles.buloz@kontron.com
Fixes: 3434f3783580 ("hwmon: Driver for Nuvoton NCT7802Y")
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
drivers/hwmon/nct7802.c