Hello dear NXP community members!
I have an I2C touchscreen controller which uses open drain line to notify the OS that it wants to be serviced by the driver. I connected the line to the PAD_KEY_COL1__GPIO4_IO08 pin on the iMX6DL and I can see that the pull-up resistors and the open drain are working fine.
What is causing confusion is how to properly register the interrupt in the deice tree.
My platform is an iMX6DualLite on a TQMa6U-AA module on a MBa6x development board and am running Linux 4.1.6 from TQ's BSP.
What I did:
In the reference manual for iMX6DL (I'm using IMX6SDLRM Rev. 3, 09/2017, this is the newest version, as far as I can see), I can see on the page 221 that I should expect IRQ 104, because I'm using GPIO4 pin 8 and IRQ 104 is for pins 0-15.
Next, on page 1526, I can see that the base address for GPIO4 is 0x20A_80000. Looking into my decompiled device tree (decompiled from the actual dtb which is in use), I can see that gpio3 in device tree uses the address 0x20A_80000, so I selected gpio3 as my interrupt parent.
Next, looking at the dtsi files, I can see that the gpio port that I need to use has the following line:
compatible = "fsl,imx6q-gpio", "fsl,imx35-gpio";
So I went and checked documentation for Freescale i.MX/MXC GPIO controller, on https://www.kernel.org/doc/Documentation/devicetree/bindings/gpio/fsl-imx-gpio.txt and there is says the following:
- #interrupt-cells : Should be 2. The first cell is the GPIO number.
The second cell bits[3:0] is used to specify trigger type and level flags:
1 = low-to-high edge triggered.
2 = high-to-low edge triggered.
4 = active high level-sensitive.
8 = active low level-sensitive.
Given the above, I wrote the following in my device tree:
interrupt-parent = <&gpio3>;
interrupts = <8 8>;//IRQ_TYPE_LEVEL_LOW
When I start my system with the above settings, my touchscreen controller receives IRQ 111, instead of the expected 104. If I change the interrupts to:
interrupts = <1 8>;//IRQ_TYPE_LEVEL_LOW
The touchscreen then receives the expected IRQ 104.
Given the above, I'm confused on what is the correct way to assign the interrupt to the pin I want to use. Should I follow the instructions from the GPIO driver documentation and use the pin number, or should I try to match the IRQ number, even though it does not match what the driver documentation says.