Issue with configuring GPIO as an interrupt - i.MX6Q

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Issue with configuring GPIO as an interrupt - i.MX6Q

Jump to solution
4,403 Views
jaymind
Contributor IV

Hi All,

I am trying to configure a GPIO as an interrupt in dts file of my i.MX6Q, but it is not configure.

I have i.MX6Q SoC with Pico-Nymph baseboard.

I can configure GPIOs as a GPIO-KEY in dts file and it is working properly. I get the entry in "/proc/interrupt" of gpio keys too.

My configuration in dts file is as below:

gpio-edm {
        status = "okay";
        compatible = "gpio-edm";
        pinctrl-0 = <&pinctrl_ext_gpio_nymph>;
        pinctrl-names = "default";

        int0: int {
            interrupt-controller;
            #interrupt-cells = <2>;

            interrupt-parent = <&gpio5>;
            interrupts = <20 2>;
        };
    };

and

pinctrl_ext_gpio_nymph: ext-gpio-grp-nymph {
            fsl,pins = <
                MX6QDL_PAD_CSI0_MCLK__GPIO5_IO19    0x4001b0b5 /* GPIO5_19 pico pin 24 */
                MX6QDL_PAD_CSI0_VSYNC__GPIO5_IO21    0x4001b0b5 /* GPIO5_21 pico pin 26 */
                MX6QDL_PAD_CSI0_DATA_EN__GPIO5_IO20    0x4001b0b5 /* GPIO5_20 pico pin 28 */
                MX6QDL_PAD_CSI0_DAT8__GPIO5_IO26    0x4001b0b5 /* GPIO5_26 pico pin 30 */
                MX6QDL_PAD_CSI0_DAT9__GPIO5_IO27    0x4001b0b5 /* GPIO5_27 pico pin xx */
                MX6QDL_PAD_CSI0_DAT12__GPIO5_IO30    0x4001b0b5 /* GPIO5_30 pico pin xx */
                MX6QDL_PAD_CSI0_DAT13__GPIO5_IO31    0x4001b0b5 /* GPIO5_31 pico pin 34 */
                MX6QDL_PAD_CSI0_DAT14__GPIO6_IO00    0x4001b0b5 /* GPIO6_00 pico pin xx */
                MX6QDL_PAD_CSI0_DAT15__GPIO6_IO01    0x4001b0b5 /* GPIO6_01 pico pin xx */
            >;
        };

I want to make GPIO5_IO20 as an interrupt.

Is GPIO configuration correct ?

What type of changes should I have to make ?

Share your suggestions.

Thanks,

Jaymin

0 Kudos
1 Solution
2,730 Views
jaymind
Contributor IV

Hi Carlos,

Thanks for quick response and files. It would be helpful.

Yes, interrupts are handled in kernel space.
I have written Kernel space code (with the help of your attached "ini_key.c" code) according to my development board environment, and it is working fine.

Thanks,

Jaymin

View solution in original post

0 Kudos
3 Replies
1,285 Views
yangao
Contributor III

Is GPIO configuration correct ?

0 Kudos
2,730 Views
Carlos_Musich
NXP Employee
NXP Employee

Hello Jaymin,

Attached you can find a kernel module that handles gpio interrupt, please note that interrupts are are handled in kernel space.

As an attachment you can also find .dtsi file. Look for intkey and pinctrl_key: key nodes.


Regards,
Carlos

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

2,731 Views
jaymind
Contributor IV

Hi Carlos,

Thanks for quick response and files. It would be helpful.

Yes, interrupts are handled in kernel space.
I have written Kernel space code (with the help of your attached "ini_key.c" code) according to my development board environment, and it is working fine.

Thanks,

Jaymin

0 Kudos