[PATCH 0/2] fix: Allwinner GPIO interrupt handling

Strahinja Jankovic posted 2 patches 1 week, 6 days ago
There is a newer version of this series
hw/gpio/allwinner-gpio.c              | 19 +++++++++---
include/hw/gpio/allwinner-gpio-regs.h |  5 +--
tests/qtest/allwinner-gpio-test.c     | 57 ++++++++++++++++++++++++++---------
3 files changed, 57 insertions(+), 24 deletions(-)
[PATCH 0/2] fix: Allwinner GPIO interrupt handling
Posted by Strahinja Jankovic 1 week, 6 days ago
The original patches assumed that pin had to be configured as input in
order to be able to receive interrupt. However, after additional testing
with libgpiod and gpiomon, the pin is actually supposed to be configured
as EINT (0x06). In the following example with PH1

root@cubieboard-ng:~# gpioget -c 0 224
allwinner_gpio_read [PH:CFG0] -> 0x1061061
allwinner_gpio_write [PH:CFG0] <- 0x1061060
allwinner_gpio_read [PH:DAT] -> 0x49
"224"=active
root@cubieboard-ng:~# gpiomon -c 0 224
allwinner_gpio_read [PH:CFG0] -> 0x1061060
allwinner_gpio_write [PH:CFG0] <- 0x1061066
...

The CFG0 value on the lowest nibble changes from 0 to 6.

This patch set fixes that behavior to expect that pin is configured as
EINT in order to allow interrupt-related functionality.

Tests are also updated to reflect this change, and a new test for pins
configured as input is added.

Signed-off-by: Strahinja Jankovic <strahinja.p.jankovic@gmail.com>
---
Strahinja Jankovic (2):
      hw/gpio: Add EINT CFG to Allwinner GPIO, fix interrupt handling
      tests/qtest: Update Allwinner GPIO test

 hw/gpio/allwinner-gpio.c              | 19 +++++++++---
 include/hw/gpio/allwinner-gpio-regs.h |  5 +--
 tests/qtest/allwinner-gpio-test.c     | 57 ++++++++++++++++++++++++++---------
 3 files changed, 57 insertions(+), 24 deletions(-)
---
base-commit: 602e4f2da10ef642581cfcd5caf5d1534808caa2
change-id: 20261009-allwinner-gpio-eint-1818f24ae7d5

Best regards,
-- 
Strahinja Jankovic <strahinja.p.jankovic@gmail.com>
Re: [PATCH 0/2] fix: Allwinner GPIO interrupt handling
Posted by Peter Maydell 1 week, 3 days ago
On Fri, 9 Oct 2026 at 17:26, Strahinja Jankovic
<strahinja.p.jankovic@gmail.com> wrote:
>
> The original patches assumed that pin had to be configured as input in
> order to be able to receive interrupt. However, after additional testing
> with libgpiod and gpiomon, the pin is actually supposed to be configured
> as EINT (0x06). In the following example with PH1
>
> root@cubieboard-ng:~# gpioget -c 0 224
> allwinner_gpio_read [PH:CFG0] -> 0x1061061
> allwinner_gpio_write [PH:CFG0] <- 0x1061060
> allwinner_gpio_read [PH:DAT] -> 0x49
> "224"=active
> root@cubieboard-ng:~# gpiomon -c 0 224
> allwinner_gpio_read [PH:CFG0] -> 0x1061060
> allwinner_gpio_write [PH:CFG0] <- 0x1061066
> ...
>
> The CFG0 value on the lowest nibble changes from 0 to 6.
>
> This patch set fixes that behavior to expect that pin is configured as
> EINT in order to allow interrupt-related functionality.
>
> Tests are also updated to reflect this change, and a new test for pins
> configured as input is added.
>
> Signed-off-by: Strahinja Jankovic <strahinja.p.jankovic@gmail.com>
> ---
> Strahinja Jankovic (2):
>       hw/gpio: Add EINT CFG to Allwinner GPIO, fix interrupt handling
>       tests/qtest: Update Allwinner GPIO test

This series fails "make check" when patch 1 is applied but not 2.
We need to retain "builds and passes tests" at every point in a
multiple-commit series, so that "git bisect" works.

I would suggest moving the minimal changes to update the test
to match the new behaviour into patch 1, and adding the new
get_input_pins patch in patch 2.

thanks
-- PMM
Re: [PATCH 0/2] fix: Allwinner GPIO interrupt handling
Posted by Strahinja Jankovic 1 week, 3 days ago
Hi Peter,

Thanks for checking this and for detailed explanation. I will send new
patches with the fixes.

Best regards,
Strahinja

On Mon, Oct 12, 2026, 3:03 PM Peter Maydell <peter.maydell@linaro.org>
wrote:

> On Fri, 9 Oct 2026 at 17:26, Strahinja Jankovic
> <strahinja.p.jankovic@gmail.com> wrote:
> >
> > The original patches assumed that pin had to be configured as input in
> > order to be able to receive interrupt. However, after additional testing
> > with libgpiod and gpiomon, the pin is actually supposed to be configured
> > as EINT (0x06). In the following example with PH1
> >
> > root@cubieboard-ng:~# gpioget -c 0 224
> > allwinner_gpio_read [PH:CFG0] -> 0x1061061
> > allwinner_gpio_write [PH:CFG0] <- 0x1061060
> > allwinner_gpio_read [PH:DAT] -> 0x49
> > "224"=active
> > root@cubieboard-ng:~# gpiomon -c 0 224
> > allwinner_gpio_read [PH:CFG0] -> 0x1061060
> > allwinner_gpio_write [PH:CFG0] <- 0x1061066
> > ...
> >
> > The CFG0 value on the lowest nibble changes from 0 to 6.
> >
> > This patch set fixes that behavior to expect that pin is configured as
> > EINT in order to allow interrupt-related functionality.
> >
> > Tests are also updated to reflect this change, and a new test for pins
> > configured as input is added.
> >
> > Signed-off-by: Strahinja Jankovic <strahinja.p.jankovic@gmail.com>
> > ---
> > Strahinja Jankovic (2):
> >       hw/gpio: Add EINT CFG to Allwinner GPIO, fix interrupt handling
> >       tests/qtest: Update Allwinner GPIO test
>
> This series fails "make check" when patch 1 is applied but not 2.
> We need to retain "builds and passes tests" at every point in a
> multiple-commit series, so that "git bisect" works.
>
> I would suggest moving the minimal changes to update the test
> to match the new behaviour into patch 1, and adding the new
> get_input_pins patch in patch 2.
>
> thanks
> -- PMM
>