Issue with configuring GPIO expander as an interrupt - i.MX8MM

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

Issue with configuring GPIO expander as an interrupt - i.MX8MM

1,609 Views
tamdo
Contributor I

Hi everyone, 

I am following example code in thread https://community.nxp.com/thread/458270 and migrate to IMX8MM for testing, but it did not run as expected.

- Device tree: I added "intkey":

intkey {

compatible = "arrow,intkey";
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_imu_int>;
gpios = <&gpio1 14 0>;
interrupts = <14 0>;
interrupt-parent = <&gpio1>;

};

....

&iomuxc {
       pinctrl-names = "default";

imx8mm-evk {

pinctrl_imu_int: imuint_iogrp {
fsl,pins = <
MX8MM_IOMUXC_GPIO1_IO14_GPIO1_IO14 0x19
>;
};

};

};

- Driver: I keep as ref thread: https://community.nxp.com/servlet/JiveServlet/download/936147-1-408514/int_key.c.zip 

My firstly problem is: No irq signal was fired.

I also checked on gpio469 (EXP_IO14) on sysfs:

- Value its changed (0 to 1 and 1 to 0 in interval)

- Don't have file "edge" in folder /sys/class/gpio/gpio496 as other gpio

# ls /sys/class/gpio/gpio496/
active_low device direction power subsystem uevent value

- Debug of g pio, i did not see "IRQ" in gpio-496

cat /sys/kernel/debug/gpio

gpiochip0: GPIOs 0-31, parent: platform/30200000.gpio, 30200000.gpio:
gpio-13 ( |gpio-ir-recv ) in hi IRQ
gpio-15 ( |cd ) in hi IRQ

gpiochip1: GPIOs 32-63, parent: platform/30210000.gpio, 30210000.gpio:
gpio-38 ( |? ) out hi
gpio-42 ( |WLAN_EN ) out hi
gpio-51 ( |VSD_3V3 ) out lo

gpiochip2: GPIOs 64-95, parent: platform/30220000.gpio, 30220000.gpio:
gpio-80 ( |status ) out hi

gpiochip3: GPIOs 96-127, parent: platform/30230000.gpio, 30230000.gpio:

gpiochip4: GPIOs 128-159, parent: platform/30240000.gpio, 30240000.gpio:
gpio-149 ( |wlf,mute ) out hi

gpiochip5: GPIOs 496-511, parent: i2c/2-0020, tca6416, can sleep:
gpio-496 ( |sysfs ) in hi
gpio-497 ( |EXT_PWREN ) out hi
gpio-499 ( |ak5558,pdn ) out lo

- In debug of pinctrl-handles, I did not find any pinctrl of pin "MX8MM_IOMUXC_GPIO1_IO14_GPIO1_IO14"

- A part of /proc/interrupts:

cat /proc/interrupts

70: 0 0 0 0 gpio-mxc 3 Edge bd71837
80: 57 0 0 0 gpio-mxc 13 Edge gpio-ir-recv-irq
81: 0 0 0 0 gpio-mxc 14 Edge MY_SWITCH
82: 0 0 0 0 gpio-mxc 15 Edge 30b50000.mmc cd
110: 37 0 0 0 gpio-mxc 11 Level 1-0050
111: 13 0 0 0 gpio-mxc 12 Level 1-0052

=====

Second problem, when I try to change "intkey" node and example driver, IRQ fired, run infinitely and block all my console (include serial and ssh)

My changed as below:

intkey {

compatible = "arrow,intkey";
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_imu_int>;
gpios = <&gpio1 14 GPIO_ACTIVE_HIGH>;
interrupts = <14 GPIO_ACTIVE_HIGH>;
interrupt-parent = <&gpio1>;

};

And edit driver from "IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING" to "IRQF_TRIGGER_HIGH":

/*Register the interrupt handler*/
ret_val = devm_request_irq(dev, irq, hello_keys_isr, IRQF_SHARED | IRQF_TRIGGER_HIGH,  HELLO_KEYS_NAME, pdev->dev.of_node);

Anyone, could you give me some advices to fix these problems ?

Thanks !

0 Kudos
1 Reply

1,514 Views
igorpadykov
NXP Employee
NXP Employee

Hi dynimlab

for i.MX8MM GPIO expander one can look at

How to enable interrupts of EXP_GPIOs from PCA6416 in IMX8M Mini EVK 

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

0 Kudos