GPIO Interrupt not working with linux 4.9

Hi, Dear
I am using VIM3 to control some pins via GPIO intput and i can read its value but could not get any poll events.
PIN# 29/30/31/32
GPIO# 461/460/463/462

application code in GPIO IRQ Usage | Khadas Documentation
image : https://dl.khadas.com/Firmware/VIM3/Ubuntu/EMMC/VIM3_Ubuntu-server-focal_Linux-4.9_arm64_EMMC_V1.0.5-210430.img.xz

run: gpio-irq 461 both

result:
no responses from poll event

What can I do next? any comments?

I also tried with linux 5.12, reading pin value is OK but sysfs does not provide “edge” file, so I could not proceed more.

Regards,
Angie, Lee

These PINs are configured as I2S function by default, if you want to use them as GPIO you need to disable I2S.

Edit /boot/env.txt , remove i2s in node overlays, save & reboot.

2 Likes

Yes, I removed i2s in overlays already.
As I said, the GPIO is working but its interrupt is not working.

Or can you provide your SD image?

@Frank please check.

@nglee Hello, follow my doc , it work for me.

root@Khadas:/home/khadas# ./gpio-irq 460 rising down
.
GPIO 460 interrupt occurred!
..........^C
root@Khadas:/home/khadas# ./gpio-irq 461 rising down 
.
GPIO 461 interrupt occurred!
.
GPIO 461 interrupt occurred!
.
GPIO 461 interrupt occurred!
.
GPIO 461 interrupt occurred!
.
GPIO 461 interrupt occurred!
.
GPIO 461 interrupt occurred!
.
GPIO 461 interrupt occurred!
.
GPIO 461 interrupt occurred!
.
GPIO 461 interrupt occurred!
.
GPIO 461 interrupt occurred!
.
GPIO 461 interrupt occurred!
.
GPIO 461 interrupt occurred!
.
GPIO 461 interrupt occurred!
..^C
root@Khadas:/home/khadas# ./gpio-irq 460 rising down 
.
GPIO 460 interrupt occurred!
..
GPIO 460 interrupt occurred!
.
GPIO 460 interrupt occurred!
.
GPIO 460 interrupt occurred!
.
GPIO 460 interrupt occurred!
.
GPIO 460 interrupt occurred!
.^C
root@Khadas:/home/khadas# ./gpio-irq 463 rising down 
.
GPIO 463 interrupt occurred!
.
GPIO 463 interrupt occurred!
.
GPIO 463 interrupt occurred!
.
GPIO 463 interrupt occurred!
.
GPIO 463 interrupt occurred!
.
GPIO 463 interrupt occurred!
.
GPIO 463 interrupt occurred!
.
GPIO 463 interrupt occurred!
.
GPIO 463 interrupt occurred!
^C
root@Khadas:/home/khadas# ./gpio-irq 462 rising down 
.
GPIO 462 interrupt occurred!
.
GPIO 462 interrupt occurred!
.
GPIO 462 interrupt occurred!
.
GPIO 462 interrupt occurred!
.
GPIO 462 interrupt occurred!
.
GPIO 462 interrupt occurred!
.
GPIO 462 interrupt occurred!
.
GPIO 462 interrupt occurred!
.^C
root@Khadas:/home/khadas# ./gpio-irq 464 rising down 
.
GPIO 464 interrupt occurred!
.
GPIO 464 interrupt occurred!
.
GPIO 464 interrupt occurred!
.
GPIO 464 interrupt occurred!
.
GPIO 464 interrupt occurred!
.
GPIO 464 interrupt occurred!
^C

@Frank when I run the test codes, I am seeing following errors from the kernel.

[ 84.023088] genirq: Setting trigger mode 3 for irq 68 failed (meson_gpio_irq_set_type+0x0/0x158)
[ 104.120520] genirq: Setting trigger mode 3 for irq 69 failed (meson_gpio_irq_set_type+0x0/0x158)
[ 118.584548] genirq: Setting trigger mode 3 for irq 70 failed (meson_gpio_irq_set_type+0x0/0x158)
[ 130.833250] genirq: Setting trigger mode 3 for irq 71 failed (meson_gpio_irq_set_type+0x0/0x158)

I tried the PIN15/16//29/30. but all pins does not response.
in /boot/env.txt, the overlays is following:

#overlays=uart3 pwm_f i2c3 i2s os08a10 watchdog
overlays=i2c3 watchdog

I believe these pins are configured GPIO Input because pin values were verified via /sys/class/gpio/gpio###/value.
But I am not sure why interrupt is not working.
Do you have any idea about kernel errors above?

Kernel signature: Linux version 4.9.241 (khadas@b8b78b6b0b20) (gcc version 7.3.1 20180425 [linaro-7.3-2018.05 revision d29120a424ecfbc167ef90065c0eeb7f91977701] (Linaro GCC 7.3-2018.05) ) #13 SMP PREEMPT Thu May 20 10:40:43 CST 2021

Regards,
nglee