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.

PROCESSOR-SDK-AM64X: GPIO Interrupt

Part Number: PROCESSOR-SDK-AM64X
Other Parts Discussed in Thread: AM6442

We use customer board based on AM6442. Is there any example that shows how to customize the dts to use one GPIO as the interrupt input pin?

  • Such as,

    interrupt-parent = <&main_gpio1>;
    interrupts = <75 IRQ_TYPE_LEVEL_LOW>;

    Does it mean use GPIO1_75 as interrupt input, and low level trigger? 

    How does the kernel source code bind an irq handler function using the gpio information in DTS?

  • interrupt-parent = <&main_gpio1>;
    interrupts = <75 IRQ_TYPE_LEVEL_LOW>;

    Does it mean use GPIO1_75 as interrupt input, and low level trigger? 

    Yes.

    How does the kernel source code bind an irq handler function using the gpio information in DTS?

    In a quick search in kernel source, I didn't find a simple driver as the example of such GPIO interrupt usage. I will look into it further next week to see if I can find one in kernel code.

  • Hi Bin,

    Thanks for your reply! If there's any update, please share to me.

    I tried modify dts like above, and I used

    request_irq(spimydev->spi->irq, spi_mydev_interrupt,IRQF_TRIGGER_LOW, "spimydev", NULL);

    in kernel code.

    And I got error below,

    genirq: Setting trigger mode 8 for irq 528 failed (gpio_irq_type+0x0/0x18)

    Best Regards

    xxg

  • interrupt-parent = <&main_gpio1>;
    interrupts = <75 IRQ_TYPE_LEVEL_LOW>;

    In the same DT node which specifies this GPIO interrupt, did you add the reference to the pinmux setting for gpio1_75? I am not sure if this would be related to gpio interrupt, but referring to the pinmux setting here is needed to activate the pinmux configuration.

  • I added the pinmux configuration,

    AM64X_IOPAD(0x028C, PIN_INPUT | PULL_DISABLE | INPUT_EN | (1<<21), 7)    /*GPIO1_75 */

    And also added this pinmux configuration to the device definition node.

    I found that request_irq with IRQF_TRIGGER_FALLING, it can request_irq success. But I don't know why request_irq with IRQF_TRIGGER_LOW  can not work.

    Best Regards

    xxg

  • Hi,

    I found that request_irq with IRQF_TRIGGER_FALLING, it can request_irq success. But I don't know why request_irq with IRQF_TRIGGER_LOW  can not work.

    The AM64x TRM section 12.1.2.1.1 "GPIO Features" states "Interrupt can be triggered by rising and/or falling edge", so it seem level interrupt is not supported on GPIO modules.

  • Hi Bin,

    Thank you,  I will check this later.

    Best Regards

    xxg