Commit aa7d1763 authored by Guenter Roeck's avatar Guenter Roeck

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: default avatarTzung-Bi Shih <tzungbi@kernel.org>
Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
parent 51c6fa32
......@@ -67,6 +67,7 @@
#define INA226_READ_AVG(reg) FIELD_GET(INA226_AVG_RD_MASK, reg)
#define INA226_ALERT_LATCH_ENABLE BIT(0)
#define INA226_ALERT_POLARITY BIT(1)
/* bit number of alert functions in Mask/Enable Register */
......@@ -640,7 +641,9 @@ static int ina2xx_init(struct device *dev, struct ina2xx_data *data)
if (data->chip == ina226) {
bool active_high = device_property_read_bool(dev, "ti,alert-polarity-active-high");
regmap_update_bits(regmap, INA226_MASK_ENABLE, INA226_ALERT_POLARITY,
regmap_update_bits(regmap, INA226_MASK_ENABLE,
INA226_ALERT_LATCH_ENABLE | INA226_ALERT_POLARITY,
INA226_ALERT_LATCH_ENABLE |
FIELD_PREP(INA226_ALERT_POLARITY, active_high));
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment