GPIO interrupt

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

GPIO interrupt

9,148 Views
mathew_k_t
Contributor II

Hi,

I'm using imx6ull custom board, in that application I need to enable interrupt for two GPIOs.

These two pins are connected to ADC_READY pin of an SPI device.

Best Regards

Labels (2)
0 Kudos
6 Replies

5,980 Views
Carlos_Musich
NXP Employee
NXP Employee

Hi mathew_k_t,

please take a look to the following post:

https://community.nxp.com/thread/474144 

Regards,

Carlos

0 Kudos

5,980 Views
mathew_k_t
Contributor II

Hi Carlos,

Thank you for the response.

From your response, I understand that, we have to write separate driver for normal GPIO interrupts other than button interrupts (gpio-keys).

1. Is that possible to enable and handle interrupt using gpio-mxc?

2. If possible, what should be the dts configuration for that?

3. I have implemented the GPIO using gpio-keys, I'm getting interrupt, but kobject_uevent_env() not sending events to userspace?

4. Using gpio-keys for a normal gpio interrupt, is that a good option? i found issues with debouncing interval.

0 Kudos

5,980 Views
Carlos_Musich
NXP Employee
NXP Employee

Hi mathew,

as you may know, it is not possible to handle interrupts in user space. It is only in kernel space where you can handle them. This is why I made a kernel module to handle the gpio interrupt in the example.

the gpio-mxc.c is like an imx architecture HAL for the sysfs. It is not possible to use the functions in gpio.mxc on user space. In such case you may require to create a kernel module to abstarct such functions.

You may also take a look to the following links.

GPIO as interrupt 

i.MX6 Device Tree Entry for GPIO based LEDs 

Simple GPIO Example - quandry 


Regards,
Carlos
NXP Technical Support

0 Kudos

5,980 Views
mathew_k_t
Contributor II

Hi,

Please verify the below dts configuration for GPIO interrupt,

&gpio1{
    compatible ="fsl,imx6ul-gpio", "fsl,imx35-gpio";
    pinctrl-names = "default";
    pinctrl-0 = <&pinctrl_aferdy>;
    afe1rdy{
        label = "AFE1 ADC Ready";
        gpios = <&gpio1 30 8>;
        interrupts = <30 IRQ_TYPE_EDGE_RISING>;
        interrupt-parent = <&gpio1>;
    };

    afe2rdy{
        label = "AFE2 ADC Ready";
        gpios = <&gpio1 31 8>;
        interrupts = <31 IRQ_TYPE_EDGE_RISING>;
        interrupt-parent = <&gpio1>;
    };
}

pinctrl_aferdy: afegrp {
            fsl,pins =<
                MX6UL_PAD_UART5_TX_DATA__GPIO1_IO30        0x4001b0b0
                MX6UL_PAD_UART5_RX_DATA__GPIO1_IO31        0x4001b0b0
            >;
};

Whether the above code is good option to enable interrupt to GPIO1_IO30, GPIO1_IO31?

0 Kudos

5,980 Views
Carlos_Musich
NXP Employee
NXP Employee

Hi mathew,

In the following post I shared the C code of a kernel module and the .dtsi where you can look for intkey and pinctrl_key: key nodes which contain the gpio configuration for being used as interrupt. Please note that you can create your own nodes and that may be easier.

Issue with configuring GPIO as an interrupt - i.MX6Q 


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

0 Kudos

5,980 Views
mathew_k_t
Contributor II

Hi carlos,

I have gone through your links.

Could you help me in kconfig and makefile settings for adding intkey driver?

What about the userspace notification of interrupt? (like kobject_uevent_env)?

0 Kudos