[Letux-kernel] Dual-edge GPIO IRQs (Re: SMP issue between LX16 and LX20 found...)
H. Nikolaus Schaller
hns at goldelico.com
Sun Jun 15 21:38:40 CEST 2025
> Am 15.06.2025 um 21:22 schrieb H. Nikolaus Schaller <hns at goldelico.com>:
>
> Hi Paul,
>
>> Am 15.06.2025 um 19:36 schrieb Paul Boddie <paul at boddie.org.uk>:
>>
>> On Sunday, 15 June 2025 18:53:34 CEST Paul Boddie wrote:
>>>
>>> Checking the GPIO registers would confirm whether the IRQs are
>>> misconfigured. I have tried to modify your jzgpio script to work with the
>>> X2000, complicated by the UART misbehaving again. This does seem to suggest
>>> that the GPIOs are indeed set to dual-edge triggering, which is a pretty
>>> bad default.
>>
>> Looking more closely at the output and checking with the device tree, it seems
>> that the PE31 pin is set to being an IRQ pin with active level low and is not
>> dual-edge triggered. So, it looks like the pinctrl configuration is working,
>> and I suppose it doesn't really matter if the default is dual-edge triggering
>> if the pins are not configured for IRQs.
>
> Hm. This sounds is if the polarity of being dual-edge or single-edge may be inverted...
>
>> Thinking a bit more about it, shouldn't WKUP actually have an interrupt
>> associated with it using IRQ_TYPE_EDGE_FALLING? Maybe something like this:
>>
>> interrupt-parent = <&gpe>;
>> interrupts = <31 IRQ_TYPE_EDGE_FALLING>;
>> irq-gpios = <&gpe 31 GPIO_ACTIVE_HIGH>;
>
> As far as I understand it is done in the gpio-keys driver which sets up all button
> gpios as dual-edge and installs some interrupt handler to handle button press or
> release by interrupt.
>
> Maybe here:
>
> https://elixir.bootlin.com/linux/v6.16-rc1/source/drivers/input/keyboard/gpio_keys.c#L984
more precisely here:
a) translate gpiod to irq
https://elixir.bootlin.com/linux/v6.16-rc1/source/drivers/input/keyboard/gpio_keys.c#L582
b) setup as rising and falling edge:
https://elixir.bootlin.com/linux/v6.16-rc1/source/drivers/input/keyboard/gpio_keys.c#L599
So it is done in code and there is no need for DTS.
I think for the LX16 we have exactly the same. But there is special code to handle
dual-egde in the x1600 pinctl driver for interrupts (toggling the edge after each interrupt).
For the x2000 this dual-edge hardware should be used but seems to be broken somehow.
>
>> See: arch/mips/boot/dts/ingenic/halley5.dts
>
> Unless I did miss something there is only a wifi and a touch interrupt. These
> are falling edge of course. Touch drivers usually use a timer and polling to
> track activities after the first touch interrupt.
>
> BR,
> Nikolaus
>
>
More information about the Letux-kernel
mailing list