Re: [PATCH] regmap: irq: do not allow setting irq bits during ack
From: Mark Brown
Date: Thu Dec 31 2020 - 08:33:07 EST
On Wed, Dec 30, 2020 at 08:37:17AM -0800, Tim Harvey wrote:
> It 'is' inverted ack because the device I have requires a '0' to be
> written to clear the interrupt instead of a '1'.
Right, yes - misremembered there.
> The chip I'm using has a status register where bit values of 1
> indicate an interrupt assertion and to clear it you write a 0 (where
> as the typical non-ack-invert case you write a 1 to clear). The chip
> I'm using also allows you to 'set' (by writing a 1) to bits that were
> not already set which would keep it from de-asserting it's interrupt.
> Honestly I thought the commit message was very clear. What exactly is
> your suggestion? It is of course confusing when talking about code
> that handles both ack invert and the normal case (let alone the new
> case of 'clear_ack').
First you need to write a commit message which explains what the change
is supposed to do. Like I said it's things like talking about how "bits
are set" without specifying which bits you are talking about - which
bits? You mean other bits in the status/ack register but especially
given all the talk about ack_invert in the commit message and the fact
that it is very unusual to be able to assert an interrupt by writing to
the status/ack register it's a bit of a jump to get there. It could be
something to do with masking non-ack/status bits in the register, it
could be something to do with confusion about what inversion means, or
something else. Something like your above explanation is much clearer
than what you wrote since it explains the unusual behaviour of your chip
which causes problems which makes it clear which bits you are talking
about.
The behaviour you are trying to implement here also needs to be opt in
since it will be harmful for other controllers due to it being racy, as
far as I can see with your controller there is no way to acknowledge a
single interrupt, we have to acknowledge them all since the only
sensible thing to write for any bit is an acknowledgement. This means
that if handling an interrupt races with a different one being asserted
then the new interrupt will be acknowledged before it is seen as part of
acknowleding the original interrupt. You could also express this as
doing a read/modify/write to clear just the bits that are asserted but
the effect is the same so probably an ack all mode would be easier.
Attachment:
signature.asc
Description: PGP signature