From: Guenter Roeck <linux@roeck-us.net>
To: Hardware Monitoring <linux-hwmon@vger.kernel.org>
Cc: Tzung-Bi Shih <tzungbi@kernel.org>, Guenter Roeck <linux@roeck-us.net>
Subject: [PATCH v2 09/14] hwmon: (ina2xx) Set alert latch
Date: Thu, 29 Aug 2024 18:05:49 -0700 [thread overview]
Message-ID: <20240830010554.1462861-10-linux@roeck-us.net> (raw)
In-Reply-To: <20240830010554.1462861-1-linux@roeck-us.net>
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.
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
v2: Moved patch after consolidation patch to keep it simple
Set latch bit once when initializing the chip and keep it active
drivers/hwmon/ina2xx.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/hwmon/ina2xx.c b/drivers/hwmon/ina2xx.c
index a9e3b23445b4..98338b7e7437 100644
--- a/drivers/hwmon/ina2xx.c
+++ b/drivers/hwmon/ina2xx.c
@@ -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,8 +641,10 @@ 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,
- FIELD_PREP(INA226_ALERT_POLARITY, active_high));
+ 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));
}
/*
--
2.45.2
next prev parent reply other threads:[~2024-08-30 1:06 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-30 1:05 [PATCH v2 00/14] hwmon: (ina2xx) Cleanup and convert to use with_info API Guenter Roeck
2024-08-30 1:05 ` [PATCH v2 01/14] hwmon: (ina2xx) Reorder include files to alphabetic order Guenter Roeck
2024-08-30 1:05 ` [PATCH v2 02/14] hwmon: (ina2xx) Replace platform data with device properties Guenter Roeck
2024-08-30 1:05 ` [PATCH v2 03/14] hwmon: (ina2xx) Use bit operations Guenter Roeck
2024-08-30 1:05 ` [PATCH v2 04/14] hwmon: (ina2xx) Mark regmap_config as const Guenter Roeck
2024-08-30 12:28 ` Tzung-Bi Shih
2024-08-30 1:05 ` [PATCH v2 05/14] hwmon: (ina2xx) Use local regmap pointer if used more than once Guenter Roeck
2024-08-30 1:05 ` [PATCH v2 06/14] hwmon: (ina2xx) Re-initialize chip using regmap functions Guenter Roeck
2024-08-30 12:29 ` Tzung-Bi Shih
2024-08-30 1:05 ` [PATCH v2 07/14] hwmon: (ina2xx) Fix various overflow issues Guenter Roeck
2024-08-30 1:05 ` [PATCH v2 08/14] hwmon: (ina2xx) Consolidate chip initialization code Guenter Roeck
2024-08-30 12:29 ` Tzung-Bi Shih
2024-08-30 1:05 ` Guenter Roeck [this message]
2024-08-30 12:29 ` [PATCH v2 09/14] hwmon: (ina2xx) Set alert latch Tzung-Bi Shih
2024-08-30 1:05 ` [PATCH v2 10/14] hwmon: (ina2xx) Move ina2xx_get_value() Guenter Roeck
2024-08-30 1:05 ` [PATCH v2 11/14] hwmon: (ina2xx) Convert to use with_info hwmon API Guenter Roeck
2024-08-30 12:30 ` Tzung-Bi Shih
2024-08-30 15:32 ` Guenter Roeck
2024-08-30 1:05 ` [PATCH v2 12/14] hwmon: (ina2xx) Pass register to alert limit write functions Guenter Roeck
2024-08-30 12:30 ` Tzung-Bi Shih
2024-08-30 1:05 ` [PATCH v2 13/14] hwmon: (ina2xx) Add support for current limits Guenter Roeck
2024-08-30 12:30 ` Tzung-Bi Shih
2024-08-30 1:05 ` [PATCH v2 14/14] hwmon: (ina2xx) Use shunt voltage to calculate current Guenter Roeck
2024-08-30 12:30 ` Tzung-Bi Shih
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240830010554.1462861-10-linux@roeck-us.net \
--to=linux@roeck-us.net \
--cc=linux-hwmon@vger.kernel.org \
--cc=tzungbi@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox