From: Markus Stockhausen <markus.stockhausen@gmx.de>
To: linux@roeck-us.net, robh@kernel.org, krzk+dt@kernel.org,
conor+dt@kernel.org, jdelvare@suse.com,
linux-hwmon@vger.kernel.org, devicetree@vger.kernel.org
Cc: Markus Stockhausen <markus.stockhausen@gmx.de>
Subject: [PATCH 2/2] hwmon: (lm75) Support active-high alert polarity
Date: Sat, 2 May 2026 21:04:08 +0200 [thread overview]
Message-ID: <20260502190408.3577731-3-markus.stockhausen@gmx.de> (raw)
In-Reply-To: <20260502190408.3577731-1-markus.stockhausen@gmx.de>
LM75 devices supported by this driver support configurable active-high
alert polarity. This is already documented in the devicetree description.
Add support for it to the driver.
Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
---
drivers/hwmon/lm75.c | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)
diff --git a/drivers/hwmon/lm75.c b/drivers/hwmon/lm75.c
index 8b74cc314196..9542f04e215e 100644
--- a/drivers/hwmon/lm75.c
+++ b/drivers/hwmon/lm75.c
@@ -123,7 +123,9 @@ struct lm75_data {
static const u8 lm75_sample_set_masks[] = { 0 << 5, 1 << 5, 2 << 5, 3 << 5 };
-#define LM75_SAMPLE_CLEAR_MASK (3 << 5)
+#define LM75_ALERT_POLARITY_HIGH_8_BIT (BIT(2))
+#define LM75_ALERT_POLARITY_HIGH_16_BIT (BIT(2) << 8)
+#define LM75_SAMPLE_CLEAR_MASK (3 << 5)
/* The structure below stores the configuration values of the supported devices.
* In case of being supported multiple configurations, the default one must
@@ -728,6 +730,7 @@ static int lm75_generic_probe(struct device *dev, const char *name,
struct device *hwmon_dev;
struct lm75_data *data;
int status, err;
+ u16 set_mask;
data = devm_kzalloc(dev, sizeof(struct lm75_data), GFP_KERNEL);
if (!data)
@@ -762,8 +765,15 @@ static int lm75_generic_probe(struct device *dev, const char *name,
return err;
data->orig_conf = status;
- err = lm75_write_config(data, data->params->set_mask,
- data->params->clr_mask);
+ set_mask = data->params->set_mask;
+ if (of_property_read_bool(dev->of_node, "ti,alert-polarity-active-high")) {
+ if (!data->params->config_reg_16bits)
+ set_mask |= LM75_ALERT_POLARITY_HIGH_8_BIT;
+ else
+ set_mask |= LM75_ALERT_POLARITY_HIGH_16_BIT;
+ }
+
+ err = lm75_write_config(data, set_mask, data->params->clr_mask);
if (err)
return err;
--
2.54.0
next prev parent reply other threads:[~2026-05-02 19:04 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-02 19:04 [PATCH v2 0/2] Support active-high alert polarity for LM75 Markus Stockhausen
2026-05-02 19:04 ` [PATCH v2 1/2] dt-bindings: hwmon: lm75: Add ti,alert-polarity-active-high property Markus Stockhausen
2026-05-03 18:13 ` Conor Dooley
2026-05-02 19:04 ` Markus Stockhausen [this message]
-- strict thread matches above, loose matches on Subject: below --
2026-05-01 12:05 [PATCH 0/2] Support active-high alert polarity for LM75 Markus Stockhausen
2026-05-01 12:05 ` [PATCH 2/2] hwmon: (lm75) Support active-high alert polarity Markus Stockhausen
2026-05-01 17:05 ` Conor Dooley
2026-05-01 19:32 ` Guenter Roeck
2026-05-03 18:00 ` Conor Dooley
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=20260502190408.3577731-3-markus.stockhausen@gmx.de \
--to=markus.stockhausen@gmx.de \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=jdelvare@suse.com \
--cc=krzk+dt@kernel.org \
--cc=linux-hwmon@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=robh@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