* [PATCH 0/2] Support active-high alert polarity for LM75
@ 2026-05-01 12:05 Markus Stockhausen
2026-05-01 12:05 ` [PATCH 1/2] dt-bindings: hwmon: lm75: Add lm75,alert-polarity-active-high property Markus Stockhausen
2026-05-01 12:05 ` [PATCH 2/2] hwmon: (lm75) Support active-high alert polarity Markus Stockhausen
0 siblings, 2 replies; 8+ messages in thread
From: Markus Stockhausen @ 2026-05-01 12:05 UTC (permalink / raw)
To: linux, robh, krzk+dt, conor+dt, jdelvare, linux-hwmon, devicetree
Cc: Markus Stockhausen
The LM75 configuration register allows to switch the alert polarity.
In default mode the alert output pin is active-low. There are hardware
designs that use this alert output for an hardware assisted automatic
fan speed control. E.g. the D-Link DGS-1250. Implementation is.
- temperature below Tmax threshold -> alert pin low -> fan slow speed
- temperature above Tmax threshold -> alert pin high -> fan high speed
Provide a devicetree configuration option and a driver enhancement to
support these hardware designs.
Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 1/2] dt-bindings: hwmon: lm75: Add lm75,alert-polarity-active-high property
2026-05-01 12:05 [PATCH 0/2] Support active-high alert polarity for LM75 Markus Stockhausen
@ 2026-05-01 12:05 ` Markus Stockhausen
2026-05-03 18:02 ` Conor Dooley
2026-05-01 12:05 ` [PATCH 2/2] hwmon: (lm75) Support active-high alert polarity Markus Stockhausen
1 sibling, 1 reply; 8+ messages in thread
From: Markus Stockhausen @ 2026-05-01 12:05 UTC (permalink / raw)
To: linux, robh, krzk+dt, conor+dt, jdelvare, linux-hwmon, devicetree
Cc: Markus Stockhausen
The LM75 alert pin is asserted based on the value of alert polarity bit of
the configuration register. The device/driver default is 0 which means alert
pin is configured to be active-low. A value of 1 maps to inverted (active-high).
Add an optional boolean property "lm75,alert-polarity-active-high" to
override the alert pin polarity. When absent, the default active-low
polarity is kept.
Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
---
Documentation/devicetree/bindings/hwmon/lm75.yaml | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/Documentation/devicetree/bindings/hwmon/lm75.yaml b/Documentation/devicetree/bindings/hwmon/lm75.yaml
index 0b9fda81e3ec..173751a726f3 100644
--- a/Documentation/devicetree/bindings/hwmon/lm75.yaml
+++ b/Documentation/devicetree/bindings/hwmon/lm75.yaml
@@ -54,6 +54,13 @@ properties:
interrupts:
maxItems: 1
+ lm75,alert-polarity-active-high:
+ description: Alert pin is asserted based on the value of alert polarity
+ bit of configuration register. Default value is normal (0 which maps to
+ active-low). The other value is inverted (1 which maps to active-high).
+ Specify this property to set the alert polarity to active-high.
+ $ref: /schemas/types.yaml#/definitions/flag
+
required:
- compatible
- reg
--
2.54.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 2/2] hwmon: (lm75) Support active-high alert polarity
2026-05-01 12:05 [PATCH 0/2] Support active-high alert polarity for LM75 Markus Stockhausen
2026-05-01 12:05 ` [PATCH 1/2] dt-bindings: hwmon: lm75: Add lm75,alert-polarity-active-high property Markus Stockhausen
@ 2026-05-01 12:05 ` Markus Stockhausen
2026-05-01 17:05 ` Conor Dooley
1 sibling, 1 reply; 8+ messages in thread
From: Markus Stockhausen @ 2026-05-01 12:05 UTC (permalink / raw)
To: linux, robh, krzk+dt, conor+dt, jdelvare, linux-hwmon, devicetree
Cc: Markus Stockhausen
All chips 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.
The default polarity of the devices is 0 (active-low). So there is
no need to change the clear mask. For consistency reasons adapt the
hard-coded configuration value of the AS6200. It is the only device
that defaults to active-high polarity.
Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
---
drivers/hwmon/lm75.c | 18 ++++++++++++++----
1 file changed, 14 insertions(+), 4 deletions(-)
diff --git a/drivers/hwmon/lm75.c b/drivers/hwmon/lm75.c
index f1a1e5b888f6..4b075a7b1cd7 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
@@ -137,7 +139,7 @@ static const struct lm75_params device_params[] = {
},
[as6200] = {
.config_reg_16bits = true,
- .set_mask = 0x94C0, /* 8 sample/s, 4 CF, positive polarity */
+ .set_mask = 0x90C0, /* 8 sample/s, 4 CF */
.default_resolution = 12,
.default_sample_time = 125,
.num_sample_times = 4,
@@ -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, "lm75,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
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 2/2] hwmon: (lm75) Support active-high alert polarity
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
0 siblings, 1 reply; 8+ messages in thread
From: Conor Dooley @ 2026-05-01 17:05 UTC (permalink / raw)
To: Markus Stockhausen
Cc: linux, robh, krzk+dt, conor+dt, jdelvare, linux-hwmon, devicetree
[-- Attachment #1: Type: text/plain, Size: 2774 bytes --]
On Fri, May 01, 2026 at 02:05:18PM +0200, Markus Stockhausen wrote:
> All chips 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.
>
> The default polarity of the devices is 0 (active-low). So there is
> no need to change the clear mask. For consistency reasons adapt the
> hard-coded configuration value of the AS6200. It is the only device
> that defaults to active-high polarity.
Uh, I dunno if you can do this, changing defaults is an ABI break
typically. What makes it okay to do that in this case?
>
> Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
> ---
> drivers/hwmon/lm75.c | 18 ++++++++++++++----
> 1 file changed, 14 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/hwmon/lm75.c b/drivers/hwmon/lm75.c
> index f1a1e5b888f6..4b075a7b1cd7 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
> @@ -137,7 +139,7 @@ static const struct lm75_params device_params[] = {
> },
> [as6200] = {
> .config_reg_16bits = true,
> - .set_mask = 0x94C0, /* 8 sample/s, 4 CF, positive polarity */
> + .set_mask = 0x90C0, /* 8 sample/s, 4 CF */
> .default_resolution = 12,
> .default_sample_time = 125,
> .num_sample_times = 4,
> @@ -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, "lm75,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
>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 2/2] hwmon: (lm75) Support active-high alert polarity
2026-05-01 17:05 ` Conor Dooley
@ 2026-05-01 19:32 ` Guenter Roeck
2026-05-03 18:00 ` Conor Dooley
0 siblings, 1 reply; 8+ messages in thread
From: Guenter Roeck @ 2026-05-01 19:32 UTC (permalink / raw)
To: Conor Dooley, Markus Stockhausen
Cc: robh, krzk+dt, conor+dt, jdelvare, linux-hwmon, devicetree
On 5/1/26 10:05, Conor Dooley wrote:
> On Fri, May 01, 2026 at 02:05:18PM +0200, Markus Stockhausen wrote:
>> All chips 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.
>>
>> The default polarity of the devices is 0 (active-low). So there is
>> no need to change the clear mask. For consistency reasons adapt the
>> hard-coded configuration value of the AS6200. It is the only device
>> that defaults to active-high polarity.
>
> Uh, I dunno if you can do this, changing defaults is an ABI break
> typically. What makes it okay to do that in this case?
>
Turns out the driver doesn't actually set the polarity bit due to a driver
bug, and no one noticed. Also, _if_ active high polarity is set, the _alarm
attribute shows the wrong value due to a second bug in the driver.
Given all that, there is no real ABI breakage.
Guenter
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 2/2] hwmon: (lm75) Support active-high alert polarity
2026-05-02 19:04 [PATCH v2 0/2] Support active-high alert polarity for LM75 Markus Stockhausen
@ 2026-05-02 19:04 ` Markus Stockhausen
0 siblings, 0 replies; 8+ messages in thread
From: Markus Stockhausen @ 2026-05-02 19:04 UTC (permalink / raw)
To: linux, robh, krzk+dt, conor+dt, jdelvare, linux-hwmon, devicetree
Cc: Markus Stockhausen
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
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 2/2] hwmon: (lm75) Support active-high alert polarity
2026-05-01 19:32 ` Guenter Roeck
@ 2026-05-03 18:00 ` Conor Dooley
0 siblings, 0 replies; 8+ messages in thread
From: Conor Dooley @ 2026-05-03 18:00 UTC (permalink / raw)
To: Guenter Roeck
Cc: Markus Stockhausen, robh, krzk+dt, conor+dt, jdelvare,
linux-hwmon, devicetree
[-- Attachment #1: Type: text/plain, Size: 1087 bytes --]
On Fri, May 01, 2026 at 12:32:47PM -0700, Guenter Roeck wrote:
> On 5/1/26 10:05, Conor Dooley wrote:
> > On Fri, May 01, 2026 at 02:05:18PM +0200, Markus Stockhausen wrote:
> > > All chips 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.
> > >
> > > The default polarity of the devices is 0 (active-low). So there is
> > > no need to change the clear mask. For consistency reasons adapt the
> > > hard-coded configuration value of the AS6200. It is the only device
> > > that defaults to active-high polarity.
> >
> > Uh, I dunno if you can do this, changing defaults is an ABI break
> > typically. What makes it okay to do that in this case?
> >
>
> Turns out the driver doesn't actually set the polarity bit due to a driver
> bug, and no one noticed. Also, _if_ active high polarity is set, the _alarm
> attribute shows the wrong value due to a second bug in the driver.
> Given all that, there is no real ABI breakage.
Cool :)
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] dt-bindings: hwmon: lm75: Add lm75,alert-polarity-active-high property
2026-05-01 12:05 ` [PATCH 1/2] dt-bindings: hwmon: lm75: Add lm75,alert-polarity-active-high property Markus Stockhausen
@ 2026-05-03 18:02 ` Conor Dooley
0 siblings, 0 replies; 8+ messages in thread
From: Conor Dooley @ 2026-05-03 18:02 UTC (permalink / raw)
To: Markus Stockhausen
Cc: linux, robh, krzk+dt, conor+dt, jdelvare, linux-hwmon, devicetree
[-- Attachment #1: Type: text/plain, Size: 1666 bytes --]
On Fri, May 01, 2026 at 02:05:17PM +0200, Markus Stockhausen wrote:
> The LM75 alert pin is asserted based on the value of alert polarity bit of
> the configuration register. The device/driver default is 0 which means alert
> pin is configured to be active-low. A value of 1 maps to inverted (active-high).
>
> Add an optional boolean property "lm75,alert-polarity-active-high" to
> override the alert pin polarity. When absent, the default active-low
> polarity is kept.
>
> Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
> ---
> Documentation/devicetree/bindings/hwmon/lm75.yaml | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/hwmon/lm75.yaml b/Documentation/devicetree/bindings/hwmon/lm75.yaml
> index 0b9fda81e3ec..173751a726f3 100644
> --- a/Documentation/devicetree/bindings/hwmon/lm75.yaml
> +++ b/Documentation/devicetree/bindings/hwmon/lm75.yaml
> @@ -54,6 +54,13 @@ properties:
> interrupts:
> maxItems: 1
>
> + lm75,alert-polarity-active-high:
This should be "national" or "adi" as a prefix, lm75 isn't a vendor!
Otherwise, seems reasonable enough to me.
pw-bot: changes-requested
Cheers,
Conor.
> + description: Alert pin is asserted based on the value of alert polarity
> + bit of configuration register. Default value is normal (0 which maps to
> + active-low). The other value is inverted (1 which maps to active-high).
> + Specify this property to set the alert polarity to active-high.
> + $ref: /schemas/types.yaml#/definitions/flag
> +
> required:
> - compatible
> - reg
> --
> 2.54.0
>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2026-05-03 18:02 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-01 12:05 [PATCH 0/2] Support active-high alert polarity for LM75 Markus Stockhausen
2026-05-01 12:05 ` [PATCH 1/2] dt-bindings: hwmon: lm75: Add lm75,alert-polarity-active-high property Markus Stockhausen
2026-05-03 18:02 ` Conor Dooley
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
-- strict thread matches above, loose matches on Subject: below --
2026-05-02 19:04 [PATCH v2 0/2] Support active-high alert polarity for LM75 Markus Stockhausen
2026-05-02 19:04 ` [PATCH 2/2] hwmon: (lm75) Support active-high alert polarity Markus Stockhausen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox