This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

SK-AM62A-LP: How do you use the User Interrupt button in Linux?

Part Number: SK-AM62A-LP

Tool/software:

I'm prototyping some interfaces that will make use of the GPIO pins. I can toggle the LD5 IO_EXP_TEST_LED using the command gpioset 5 23=1 and I can read the SW5 SoC INTn button with gpioget 3 23. Now I would like to do something as an interrupt when SW5 is pressed. gpiomon looks like it should do it, but it appears another IRQ is already registered for that gpio.

root@am62axx-evm:~# gpiomon 3 23
[89790.006734] genirq: Flags mismatch irq 418. 00002003 (gpiomon) vs. 00002082 (1-0022)
gpiomon: error waiting for events: Device or resource busy

1-0022 seems to be an i2c GPIO multiplexer?

root@am62axx-evm:~# dmesg | grep 0022
[ 2.527415] pca953x 1-0022: supply vcc not found, using dummy regulator
[ 2.534178] pca953x 1-0022: using AI

But I can't find a reference to it in the DTS.  Do I need to somehow setup an interrupt on the multiplexer instead?

  • Hello Jason,

    Our GPIO guy is out of office for the next 2 weeks. Feel free to ping the thread in the second week of July if he hasn't responded. If you need more urgent support, please ask your TI representative to escalate the thread to our apps team, and we'll figure something out while he is on vacation.

    Regards,

    Nick

  • Hi Jason,

    Thank you for your patience.

    There is an IO Expander on Main Domain I2C1. The IO expander is interrupt enabled which is connected to gpio1_23.

    See the Main Domain i2c1 DTS node: https://git.ti.com/cgit/ti-linux-kernel/ti-linux-kernel/tree/arch/arm64/boot/dts/ti/k3-am62a7-sk.dts?h=ti-linux-6.1.y#n542

    Can you share the output of 'cat /proc/interrupts'?

    Thanks,

    Anshu

  • I was hoping to execute some script in linux when the button was pressed, essentially a userspace IRQ handler.  I looked into a bit after I posted and determined that a kernel module is necessary to catch the interrupt and if I wanted to handle it in userspace I'd have to pass it to a listening service.  There is a generic kernel modules to do this UIO, but would require some modifications for this platform.

    Ultimately, for my use case I don't need to handle the event at the time of the interrupt, only report when an event has happened at some periodic rate.  So my solution was to monitor the /proc/interrupts for a change in event count in GPIO 23.

    awk '{ if( ( $6 == "GPIO" ) && ( $7 == "23" ) ) { print $2 } }' /proc/interrupts