* [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; 18+ 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] 18+ 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-01 12:24 ` sashiko-bot
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, 2 replies; 18+ 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] 18+ 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 12:45 ` sashiko-bot
2026-05-01 17:05 ` Conor Dooley
1 sibling, 2 replies; 18+ 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] 18+ 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-01 12:24 ` sashiko-bot
2026-05-02 17:37 ` AW: " markus.stockhausen
2026-05-03 18:02 ` Conor Dooley
1 sibling, 1 reply; 18+ messages in thread
From: sashiko-bot @ 2026-05-01 12:24 UTC (permalink / raw)
To: Markus Stockhausen; +Cc: linux-hwmon
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] The custom Device Tree property `lm75,alert-polarity-active-high` uses an unregistered and invalid vendor prefix.
--
commit 69df01a5031a4da5aac0d016930cd76771ff596c
Author: Markus Stockhausen <markus.stockhausen@gmx.de>
dt-bindings: hwmon: lm75: Add lm75,alert-polarity-active-high property
This commit adds an optional boolean property to override the LM75 alert
pin polarity. It allows configuring the alert pin to be active-high instead
of the default active-low behavior.
> diff --git a/Documentation/devicetree/bindings/hwmon/lm75.yaml b/Documentation/devicetree/bindings/hwmon/lm75.yaml
> index 0b9fda81e3ec5..173751a726f34 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:
Does this property use an unregistered vendor prefix?
Device tree conventions require using a valid, registered vendor prefix
from vendor-prefixes.yaml for device-specific properties. The string lm75
is a device part number rather than a registered vendor.
Should this property be named with the proper vendor prefix for the
original LM75, such as national,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
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260501120518.3085501-1-markus.stockhausen@gmx.de?part=1
^ permalink raw reply [flat|nested] 18+ 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 12:45 ` sashiko-bot
2026-05-01 14:06 ` AW: " markus.stockhausen
2026-05-01 17:05 ` Conor Dooley
1 sibling, 1 reply; 18+ messages in thread
From: sashiko-bot @ 2026-05-01 12:45 UTC (permalink / raw)
To: Markus Stockhausen; +Cc: linux-hwmon
Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
- [High] The active-high alert polarity configuration is completely ignored by the hardware because it is not added to the register update mask.
- [High] LM75_ALERT_POLARITY_HIGH_16_BIT targets the wrong byte of the configuration register.
- [High] Changing the AS6200 default from active-high to active-low breaks devicetree backward compatibility.
--
commit bf60f0ac922f126e93d4f54ae47d4c76d1c9caa9
Author: Markus Stockhausen <markus.stockhausen@gmx.de>
hwmon: (lm75) Support active-high alert polarity
This commit adds support for configuring active-high alert polarity based
on the devicetree property for LM75-compatible devices. It also adjusts
the default configuration value for the AS6200 to be active-low for
consistency.
> diff --git a/drivers/hwmon/lm75.c b/drivers/hwmon/lm75.c
> index f1a1e5b888f64..4b075a7b1cd76 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)
Should the 16-bit mask also use BIT(2)?
Since 16-bit configuration register accesses use i2c_smbus_read_word_data()
and i2c_smbus_write_word_data() which process the LSB first, the standard
LM75 configuration byte maps to the LSB (bits 0-7) of the 16-bit word. Using
BIT(2) << 8 seems to target the MSB instead.
> +#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 */
Does changing this default mask break backward compatibility for existing
devicetrees using the AS6200?
Systems currently using this chip might lack the newly introduced
lm75,alert-polarity-active-high property and rely on the previous
active-high default to route alarms correctly.
[ ... ]
> @@ -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);
Will the new polarity bits added to set_mask be ignored by the hardware?
Looking at lm75_write_config(), the clr_mask is passed as the mask argument
to regmap_update_bits():
static inline int lm75_write_config(struct lm75_data *data, u16 set_mask,
u16 clr_mask)
{
return regmap_update_bits(data->regmap, LM75_REG_CONF,
clr_mask | LM75_SHUTDOWN, set_mask);
}
Because clr_mask is not updated to include the polarity bits,
regmap_update_bits() won't modify them in the hardware register.
Would it also be safer to explicitly include the polarity bit in the
clr_mask so the hardware is deterministically reset from whatever state
the bootloader left it in?
> if (err)
> return err;
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260501120518.3085501-1-markus.stockhausen@gmx.de?part=2
^ permalink raw reply [flat|nested] 18+ messages in thread
* AW: [PATCH 2/2] hwmon: (lm75) Support active-high alert polarity
2026-05-01 12:45 ` sashiko-bot
@ 2026-05-01 14:06 ` markus.stockhausen
2026-05-01 17:37 ` Guenter Roeck
0 siblings, 1 reply; 18+ messages in thread
From: markus.stockhausen @ 2026-05-01 14:06 UTC (permalink / raw)
To: sashiko; +Cc: linux-hwmon
Hi bot,
> Von: sashiko-bot@kernel.org <sashiko-bot@kernel.org>
> Gesendet: Freitag, 1. Mai 2026 14:46
> An: Markus Stockhausen <markus.stockhausen@gmx.de>
> Cc: linux-hwmon@vger.kernel.org
> Betreff: Re: [PATCH 2/2] hwmon: (lm75) Support active-high alert polarity
>
> Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
> - [High] The active-high alert polarity configuration is completely ignored by the hardware because it is not added to the register update mask.
> - [High] LM75_ALERT_POLARITY_HIGH_16_BIT targets the wrong byte of the configuration register.
> - [High] Changing the AS6200 default from active-high to active-low breaks devicetree backward compatibility.
unsure if answering to you helps both of us further. So my 2 cents only shortly:
- Issue 1: Existing definitions for tmp1XX devices do not not obey "clr_mask is superset of set_mask".
- Issue 2: AS6200 datasheet states BIT(10) is polarity. Thus .set_mask = 0x94C0 can only align one way.
- Issue 3: Please advise.
Best regards.
Markus
^ permalink raw reply [flat|nested] 18+ 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 12:45 ` sashiko-bot
@ 2026-05-01 17:05 ` Conor Dooley
2026-05-01 19:32 ` Guenter Roeck
1 sibling, 1 reply; 18+ 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] 18+ messages in thread
* Re: AW: [PATCH 2/2] hwmon: (lm75) Support active-high alert polarity
2026-05-01 14:06 ` AW: " markus.stockhausen
@ 2026-05-01 17:37 ` Guenter Roeck
2026-05-01 19:00 ` AW: " markus.stockhausen
2026-05-01 20:14 ` Guenter Roeck
0 siblings, 2 replies; 18+ messages in thread
From: Guenter Roeck @ 2026-05-01 17:37 UTC (permalink / raw)
To: markus.stockhausen, sashiko; +Cc: linux-hwmon
On 5/1/26 07:06, markus.stockhausen@gmx.de wrote:
> Hi bot,
>
>> Von: sashiko-bot@kernel.org <sashiko-bot@kernel.org>
>> Gesendet: Freitag, 1. Mai 2026 14:46
>> An: Markus Stockhausen <markus.stockhausen@gmx.de>
>> Cc: linux-hwmon@vger.kernel.org
>> Betreff: Re: [PATCH 2/2] hwmon: (lm75) Support active-high alert polarity
>>
>> Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
>> - [High] The active-high alert polarity configuration is completely ignored by the hardware because it is not added to the register update mask.
>> - [High] LM75_ALERT_POLARITY_HIGH_16_BIT targets the wrong byte of the configuration register.
>> - [High] Changing the AS6200 default from active-high to active-low breaks devicetree backward compatibility.
>
> unsure if answering to you helps both of us further. So my 2 cents only shortly:
>
> - Issue 1: Existing definitions for tmp1XX devices do not not obey "clr_mask is superset of set_mask".
I think you are saying that this is a pre-existing bug and that set_mask is effectively
ignored. Is that a reason not to fix the problem ?
> - Issue 2: AS6200 datasheet states BIT(10) is polarity. Thus .set_mask = 0x94C0 can only align one way.
The reverse bit order of that register _is_ a bit confusing.
> - Issue 3: Please advise.
Above you are saying that the set mask is for all practical purposes
ignored. As far as I can say this is correct, meaning as6200 (and TMP112)
will default to its chip default, meaning the bit will be 0 anyway.
Looking into the AS6200 datasheet, changing this is not straightforward:
Setting the polarity bit to high also changes the value of the "alert"
bit, meaning the bit will be 1 if there is _no_ alarm. In other words,
this only works accidentally right now, and it does not really matter
if the default is changed. On the contrary, changing the default would result
in unexpected behavior since the alarm attribute would report alarms when
there is none.
So this will need separate patches:
1) Fix set_mask and alert handling for AS6200 to be low active
and to report the alarm correctly even if it is high active
(xor config register bit 5 and 10 (translated to 2 and 13)
when reporting the alarm).
2) Fix lm75_write_config() to add set_mask to clr_mask to ensure
that the bits which are supposed to be set are actually set.
Then add this series on top of it.
Thanks,
Guenter
^ permalink raw reply [flat|nested] 18+ messages in thread
* AW: AW: [PATCH 2/2] hwmon: (lm75) Support active-high alert polarity
2026-05-01 17:37 ` Guenter Roeck
@ 2026-05-01 19:00 ` markus.stockhausen
2026-05-01 19:24 ` Guenter Roeck
2026-05-01 20:14 ` Guenter Roeck
1 sibling, 1 reply; 18+ messages in thread
From: markus.stockhausen @ 2026-05-01 19:00 UTC (permalink / raw)
To: 'Guenter Roeck', sashiko; +Cc: linux-hwmon
> Von: Guenter Roeck <groeck7@gmail.com> Im Auftrag von Guenter Roeck
> Gesendet: Freitag, 1. Mai 2026 19:38
> Betreff: Re: AW: [PATCH 2/2] hwmon: (lm75) Support active-high alert polarity
> ...
>>> - [High] The active-high alert polarity configuration is completely ignored by the hardware because it is not added to the register update mask.
>>> - [High] LM75_ALERT_POLARITY_HIGH_16_BIT targets the wrong byte of the configuration register.
>>> - [High] Changing the AS6200 default from active-high to active-low breaks devicetree backward compatibility.
>>
>> unsure if answering to you helps both of us further. So my 2 cents only shortly:
>>
>> - Issue 1: Existing definitions for tmp1XX devices do not not obey "clr_mask is superset of set_mask".
>
> I think you are saying that this is a pre-existing bug and that set_mask is effectively
> ignored. Is that a reason not to fix the problem ?
> ...
> 2) Fix lm75_write_config() to add set_mask to clr_mask to ensure
> that the bits which are supposed to be set are actually set.
I did not expect a bug in the current driver and was baffled by the bots
response. From your feedback that qualifies a "Fixes" tag. Am I right to
assume that 6da24a2 ("hwmon: (lm75) Hide register size differences in
regmap access functions") is the commit to blame?
Markus
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: AW: AW: [PATCH 2/2] hwmon: (lm75) Support active-high alert polarity
2026-05-01 19:00 ` AW: " markus.stockhausen
@ 2026-05-01 19:24 ` Guenter Roeck
0 siblings, 0 replies; 18+ messages in thread
From: Guenter Roeck @ 2026-05-01 19:24 UTC (permalink / raw)
To: markus.stockhausen, sashiko; +Cc: linux-hwmon
On 5/1/26 12:00, markus.stockhausen@gmx.de wrote:
>> Von: Guenter Roeck <groeck7@gmail.com> Im Auftrag von Guenter Roeck
>> Gesendet: Freitag, 1. Mai 2026 19:38
>> Betreff: Re: AW: [PATCH 2/2] hwmon: (lm75) Support active-high alert polarity
>> ...
>>>> - [High] The active-high alert polarity configuration is completely ignored by the hardware because it is not added to the register update mask.
>>>> - [High] LM75_ALERT_POLARITY_HIGH_16_BIT targets the wrong byte of the configuration register.
>>>> - [High] Changing the AS6200 default from active-high to active-low breaks devicetree backward compatibility.
>>>
>>> unsure if answering to you helps both of us further. So my 2 cents only shortly:
>>>
>>> - Issue 1: Existing definitions for tmp1XX devices do not not obey "clr_mask is superset of set_mask".
>>
>> I think you are saying that this is a pre-existing bug and that set_mask is effectively
>> ignored. Is that a reason not to fix the problem ?
>> ...
>> 2) Fix lm75_write_config() to add set_mask to clr_mask to ensure
>> that the bits which are supposed to be set are actually set.
>
> I did not expect a bug in the current driver and was baffled by the bots
> response. From your feedback that qualifies a "Fixes" tag. Am I right to
> assume that 6da24a2 ("hwmon: (lm75) Hide register size differences in
> regmap access functions") is the commit to blame?
>
Correct.
Thanks,
Guenter
^ permalink raw reply [flat|nested] 18+ 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; 18+ 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] 18+ messages in thread
* Re: AW: [PATCH 2/2] hwmon: (lm75) Support active-high alert polarity
2026-05-01 17:37 ` Guenter Roeck
2026-05-01 19:00 ` AW: " markus.stockhausen
@ 2026-05-01 20:14 ` Guenter Roeck
2026-05-01 20:42 ` AW: " markus.stockhausen
1 sibling, 1 reply; 18+ messages in thread
From: Guenter Roeck @ 2026-05-01 20:14 UTC (permalink / raw)
To: markus.stockhausen, sashiko; +Cc: linux-hwmon
On 5/1/26 10:37, Guenter Roeck wrote:
> On 5/1/26 07:06, markus.stockhausen@gmx.de wrote:
>> Hi bot,
>>
>>> Von: sashiko-bot@kernel.org <sashiko-bot@kernel.org>
>>> Gesendet: Freitag, 1. Mai 2026 14:46
>>> An: Markus Stockhausen <markus.stockhausen@gmx.de>
>>> Cc: linux-hwmon@vger.kernel.org
>>> Betreff: Re: [PATCH 2/2] hwmon: (lm75) Support active-high alert polarity
>>>
>>> Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
>>> - [High] The active-high alert polarity configuration is completely ignored by the hardware because it is not added to the register update mask.
>>> - [High] LM75_ALERT_POLARITY_HIGH_16_BIT targets the wrong byte of the configuration register.
>>> - [High] Changing the AS6200 default from active-high to active-low breaks devicetree backward compatibility.
>>
>> unsure if answering to you helps both of us further. So my 2 cents only shortly:
>>
>> - Issue 1: Existing definitions for tmp1XX devices do not not obey "clr_mask is superset of set_mask".
>
> I think you are saying that this is a pre-existing bug and that set_mask is effectively
> ignored. Is that a reason not to fix the problem ?
>
>> - Issue 2: AS6200 datasheet states BIT(10) is polarity. Thus .set_mask = 0x94C0 can only align one way.
>
> The reverse bit order of that register _is_ a bit confusing.
>
>> - Issue 3: Please advise.
>
> Above you are saying that the set mask is for all practical purposes
> ignored. As far as I can say this is correct, meaning as6200 (and TMP112)
> will default to its chip default, meaning the bit will be 0 anyway.
>
> Looking into the AS6200 datasheet, changing this is not straightforward:
> Setting the polarity bit to high also changes the value of the "alert"
> bit, meaning the bit will be 1 if there is _no_ alarm. In other words,
> this only works accidentally right now, and it does not really matter
> if the default is changed. On the contrary, changing the default would result
> in unexpected behavior since the alarm attribute would report alarms when
> there is none.
>
> So this will need separate patches:
> 1) Fix set_mask and alert handling for AS6200 to be low active
> and to report the alarm correctly even if it is high active
> (xor config register bit 5 and 10 (translated to 2 and 13)
> when reporting the alarm).
> 2) Fix lm75_write_config() to add set_mask to clr_mask to ensure
> that the bits which are supposed to be set are actually set.
>
Turns out the default value for AS6200 has more problems. It is set to
0x94c0 which claims to be "8 sample/s, 4 CF, positive polarity".
0xc0 reflects the samples/s. So far so good. However, 0x94 is wrong.
It sets the single shot bit, effectively disabling the sensor, and
it does not set the CF bits as advertised. Please change the default
to 0x10c0 which reflects the intent more closely, except for the
negative polarity.
Thanks,
Guenter
> Then add this series on top of it.
>
> Thanks,
> Guenter
>
>
^ permalink raw reply [flat|nested] 18+ messages in thread
* AW: AW: [PATCH 2/2] hwmon: (lm75) Support active-high alert polarity
2026-05-01 20:14 ` Guenter Roeck
@ 2026-05-01 20:42 ` markus.stockhausen
2026-05-01 21:19 ` Guenter Roeck
0 siblings, 1 reply; 18+ messages in thread
From: markus.stockhausen @ 2026-05-01 20:42 UTC (permalink / raw)
To: 'Guenter Roeck', sashiko; +Cc: linux-hwmon
> Von: Guenter Roeck <groeck7@gmail.com> Im Auftrag von Guenter Roeck
> Gesendet: Freitag, 1. Mai 2026 22:14
> Betreff: Re: AW: [PATCH 2/2] hwmon: (lm75) Support active-high alert polarity
>
> > So this will need separate patches:
> > 1) Fix set_mask and alert handling for AS6200 to be low active
> > and to report the alarm correctly even if it is high active
> > (xor config register bit 5 and 10 (translated to 2 and 13)
> > when reporting the alarm).
> > 2) Fix lm75_write_config() to add set_mask to clr_mask to ensure
> > that the bits which are supposed to be set are actually set.
> >
>
> Turns out the default value for AS6200 has more problems. It is set to
> 0x94c0 which claims to be "8 sample/s, 4 CF, positive polarity".
>
> 0xc0 reflects the samples/s. So far so good. However, 0x94 is wrong.
> It sets the single shot bit, effectively disabling the sensor, and
> it does not set the CF bits as advertised. Please change the default
> to 0x10c0 which reflects the intent more closely, except for the
> negative polarity.
Understood. I still need advise about xor during alarm report.
Do you talk about this code?
case as6200:
case tmp112:
- *val = (regval >> 13) & 0x1;
+ *val = ((regval >> 13) & 0x1) ^ 0x1;
Mabye totally stupid but this bug and the deep dive follow up
hits my brain a little bit too hard.
Thanks.
Markus
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: AW: AW: [PATCH 2/2] hwmon: (lm75) Support active-high alert polarity
2026-05-01 20:42 ` AW: " markus.stockhausen
@ 2026-05-01 21:19 ` Guenter Roeck
0 siblings, 0 replies; 18+ messages in thread
From: Guenter Roeck @ 2026-05-01 21:19 UTC (permalink / raw)
To: markus.stockhausen, sashiko; +Cc: linux-hwmon
On 5/1/26 13:42, markus.stockhausen@gmx.de wrote:
>> Von: Guenter Roeck <groeck7@gmail.com> Im Auftrag von Guenter Roeck
>> Gesendet: Freitag, 1. Mai 2026 22:14
>> Betreff: Re: AW: [PATCH 2/2] hwmon: (lm75) Support active-high alert polarity
>>
>>> So this will need separate patches:
>>> 1) Fix set_mask and alert handling for AS6200 to be low active
>>> and to report the alarm correctly even if it is high active
>>> (xor config register bit 5 and 10 (translated to 2 and 13)
>>> when reporting the alarm).
>>> 2) Fix lm75_write_config() to add set_mask to clr_mask to ensure
>>> that the bits which are supposed to be set are actually set.
>>>
>>
>> Turns out the default value for AS6200 has more problems. It is set to
>> 0x94c0 which claims to be "8 sample/s, 4 CF, positive polarity".
>>
>> 0xc0 reflects the samples/s. So far so good. However, 0x94 is wrong.
>> It sets the single shot bit, effectively disabling the sensor, and
>> it does not set the CF bits as advertised. Please change the default
>> to 0x10c0 which reflects the intent more closely, except for the
>> negative polarity.
>
> Understood. I still need advise about xor during alarm report.
> Do you talk about this code?
>
> case as6200:
> case tmp112:
> - *val = (regval >> 13) & 0x1;
> + *val = ((regval >> 13) & 0x1) ^ 0x1;
>
No, you'll need to xor bit 2 (the polarity bit) and 13 (the alert bit).
Something like
alarm = !!(regval & BIT(13)) ^ !!(regval & BIT(2))
> Mabye totally stupid but this bug and the deep dive follow up
> hits my brain a little bit too hard.
>
:-)
Cheers,
Guenter
^ permalink raw reply [flat|nested] 18+ messages in thread
* AW: [PATCH 1/2] dt-bindings: hwmon: lm75: Add lm75,alert-polarity-active-high property
2026-05-01 12:24 ` sashiko-bot
@ 2026-05-02 17:37 ` markus.stockhausen
2026-05-02 18:10 ` Guenter Roeck
0 siblings, 1 reply; 18+ messages in thread
From: markus.stockhausen @ 2026-05-02 17:37 UTC (permalink / raw)
To: linux; +Cc: linux-hwmon
> Von: sashiko-bot@kernel.org <sashiko-bot@kernel.org>
> Gesendet: Freitag, 1. Mai 2026 14:24
> An: Markus Stockhausen <markus.stockhausen@gmx.de>
> Cc: linux-hwmon@vger.kernel.org
> Betreff: Re: [PATCH 1/2] dt-bindings: hwmon: lm75: Add lm75,alert-polarity-active-high property
> ...
> > + lm75,alert-polarity-active-high:
>
> Does this property use an unregistered vendor prefix?
Coming back to this before resending the "real" series ...
Looking around I'm pretty sure that "alert-polarity-active-high" should be ok.
But what prefix do you prefer for that property?
Best regards.
Markus
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: AW: [PATCH 1/2] dt-bindings: hwmon: lm75: Add lm75,alert-polarity-active-high property
2026-05-02 17:37 ` AW: " markus.stockhausen
@ 2026-05-02 18:10 ` Guenter Roeck
0 siblings, 0 replies; 18+ messages in thread
From: Guenter Roeck @ 2026-05-02 18:10 UTC (permalink / raw)
To: markus.stockhausen; +Cc: linux-hwmon
On 5/2/26 10:37, markus.stockhausen@gmx.de wrote:
>> Von: sashiko-bot@kernel.org <sashiko-bot@kernel.org>
>> Gesendet: Freitag, 1. Mai 2026 14:24
>> An: Markus Stockhausen <markus.stockhausen@gmx.de>
>> Cc: linux-hwmon@vger.kernel.org
>> Betreff: Re: [PATCH 1/2] dt-bindings: hwmon: lm75: Add lm75,alert-polarity-active-high property
>> ...
>>> + lm75,alert-polarity-active-high:
>>
>> Does this property use an unregistered vendor prefix?
>
> Coming back to this before resending the "real" series ...
>
> Looking around I'm pretty sure that "alert-polarity-active-high" should be ok.
> But what prefix do you prefer for that property?
>
Good question. Normally it would be the vendor prefix, but that is difficult
since the driver supports chips from many vendors. "lm75" as prefix is
definitely wrong. I would suggest to try "ti,alert-polarity-active-high"
since that is pre-existing and applies to some of the supported sensors
and see if DT maintainers accept it.
Thanks,
Guenter
^ permalink raw reply [flat|nested] 18+ 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; 18+ 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] 18+ 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-01 12:24 ` sashiko-bot
@ 2026-05-03 18:02 ` Conor Dooley
1 sibling, 0 replies; 18+ 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] 18+ messages in thread
end of thread, other threads:[~2026-05-03 18:02 UTC | newest]
Thread overview: 18+ 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-01 12:24 ` sashiko-bot
2026-05-02 17:37 ` AW: " markus.stockhausen
2026-05-02 18:10 ` Guenter Roeck
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 12:45 ` sashiko-bot
2026-05-01 14:06 ` AW: " markus.stockhausen
2026-05-01 17:37 ` Guenter Roeck
2026-05-01 19:00 ` AW: " markus.stockhausen
2026-05-01 19:24 ` Guenter Roeck
2026-05-01 20:14 ` Guenter Roeck
2026-05-01 20:42 ` AW: " markus.stockhausen
2026-05-01 21:19 ` Guenter Roeck
2026-05-01 17:05 ` Conor Dooley
2026-05-01 19:32 ` Guenter Roeck
2026-05-03 18:00 ` Conor Dooley
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox