[PATCH 6/6] gpio: macsmc: Add IRQ support

Hector Martin marcan at marcan.st
Tue Sep 6 00:00:31 PDT 2022


On 02/09/2022 22.21, Linus Walleij wrote:
>> +       switch (type & IRQ_TYPE_SENSE_MASK) {
>> +       case IRQ_TYPE_LEVEL_HIGH:
>> +               mode = IRQ_MODE_HIGH;
>> +               break;
>> +       case IRQ_TYPE_LEVEL_LOW:
>> +               mode = IRQ_MODE_LOW;
>> +               break;
>> +       case IRQ_TYPE_EDGE_RISING:
>> +               mode = IRQ_MODE_RISING;
>> +               break;
>> +       case IRQ_TYPE_EDGE_FALLING:
>> +               mode = IRQ_MODE_FALLING;
>> +               break;
>> +       case IRQ_TYPE_EDGE_BOTH:
>> +               mode = IRQ_MODE_BOTH;
>> +               break;
>> +       default:
>> +               return -EINVAL;
> 
> I don't know how level IRQs would work on this essentially
> message-passing process context interrupt. Maybe I am getting
> it all wrong, but for level the line should be held low/high until
> the IRQ is serviced, it would be possible to test if this actually
> works by *not* servicing an IRQ and see if the SMC then sends
> another message notifier for the same IRQ.
> 
> I strongly suspect that actually only edges are supported, but
> there might be semantics I don't understand here.

IIRC that is exactly what happens - the SMC will re-fire the IRQ after
the ACK if it is set to level mode and still at the active level.

I do remember testing all the modes carefully when implementing this to
figure out what the precise semantics are, and I *think* I agonized over
the flow handlers quite a bit and decided this way would work properly
for all the modes, but it's been a while so I'd have to take a look
again to convince myself again :)

- Hector



More information about the linux-arm-kernel mailing list