From: Guenter Roeck <linux@roeck-us.net>
To: markus.stockhausen@gmx.de, sashiko@lists.linux.dev
Cc: linux-hwmon@vger.kernel.org
Subject: Re: AW: AW: [PATCH 2/2] hwmon: (lm75) Support active-high alert polarity
Date: Fri, 1 May 2026 14:19:20 -0700 [thread overview]
Message-ID: <b325afeb-e7db-49fb-9e38-93404e075b86@roeck-us.net> (raw)
In-Reply-To: <022201dcd9ab$0aba9fb0$202fdf10$@gmx.de>
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
next prev parent reply other threads:[~2026-05-01 21:19 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
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=b325afeb-e7db-49fb-9e38-93404e075b86@roeck-us.net \
--to=linux@roeck-us.net \
--cc=linux-hwmon@vger.kernel.org \
--cc=markus.stockhausen@gmx.de \
--cc=sashiko@lists.linux.dev \
/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