Skip to content

Commit aa7d176

Browse files
committed
hwmon: (ina2xx) Set alert latch
Alerts should only be cleared after reported, not immediately after the alert condition has been cleared. Set the latch enable bit to keep alerts latched until the alert register has been read from the chip. Reviewed-by: Tzung-Bi Shih <[email protected]> Signed-off-by: Guenter Roeck <[email protected]>
1 parent 51c6fa3 commit aa7d176

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

drivers/hwmon/ina2xx.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@
6767

6868
#define INA226_READ_AVG(reg) FIELD_GET(INA226_AVG_RD_MASK, reg)
6969

70+
#define INA226_ALERT_LATCH_ENABLE BIT(0)
7071
#define INA226_ALERT_POLARITY BIT(1)
7172

7273
/* bit number of alert functions in Mask/Enable Register */
@@ -640,8 +641,10 @@ static int ina2xx_init(struct device *dev, struct ina2xx_data *data)
640641
if (data->chip == ina226) {
641642
bool active_high = device_property_read_bool(dev, "ti,alert-polarity-active-high");
642643

643-
regmap_update_bits(regmap, INA226_MASK_ENABLE, INA226_ALERT_POLARITY,
644-
FIELD_PREP(INA226_ALERT_POLARITY, active_high));
644+
regmap_update_bits(regmap, INA226_MASK_ENABLE,
645+
INA226_ALERT_LATCH_ENABLE | INA226_ALERT_POLARITY,
646+
INA226_ALERT_LATCH_ENABLE |
647+
FIELD_PREP(INA226_ALERT_POLARITY, active_high));
645648
}
646649

647650
/*

0 commit comments

Comments
 (0)