Re: [PATCH 0/4] hwmon: (ina2xx) Decouple in0 and curr1 alarms
From: Guenter Roeck
Date: Fri Jul 31 2026 - 10:42:31 EST
On 7/29/26 08:42, Jared Kangas wrote:
The in0 and curr1 alarms in the ina2xx driver are both based on shunt
voltage in the hardware, which causes unexpected behavior when reading
the two inputs' alarms:
1. Both alarms may read back 1, even though only one is set.
2. The "active" alarm may read back 0 even if the limit was reached due
to the use of alert latching. If the inactive alarm is read, it
clears the active alarm, and the alarm may not be set before the next
read:
# echo 1800 >curr1_lcrit
# head {in0,curr1}_lcrit_alarm
==> in0_lcrit_alarm <==
1
==> curr1_lcrit_alarm <==
0
To address this, track the active alarm's type in the driver, and when
reading alarms, return early without polling the hardware if the alarm
being read is inactive.
Some prep work is done in patches 1-3 to simplify the fix in patch 4.
Signed-off-by: Jared Kangas <jkangas@xxxxxxxxxx>
Please fix the issues reported by Sashiko (or explain why they don't apply).
Thanks,
Guenter