Using LS1021a/IRQ2 interrupt signal for I2C touch screen

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

Using LS1021a/IRQ2 interrupt signal for I2C touch screen

Jump to solution
956 Views
tnguyen3
Contributor I

Hello,

I'm trying to add supports for the the touch screen on our custom LS1021a board. The touchscreen I2C device AR1020/1021 interrupt line connects directly to the IRQ2 pin of the LS1021a. Using the default ar1021_i2c.c driver that comes with the QOIOQ-SDK-2.0, I manage to get the driver loaded and probed but I can't figure out the correct interrupt number to use for the IRQ2. I randomly use <GIC_SPI 90 IRQ_TYPE_EDGE_RISING> in the DTS file as:

&i2c0 {
    status = "okay";
    ar1021_i2c@4d {
        compatible = "microchip,ar1021-i2c";
        reg = <0x4d>;
        interrupts = <GIC_SPI 90 IRQ_TYPE_EDGE_RISING>;
        status = "okay";
    };
};

I think think it's the wrong interrupt id to use since the stat from /proc/interrupts doesn't have any anything:

root@ls1021atwr:~# cat /proc/interrupts
           CPU0       CPU1
 16:          0          0       GIC  29 Edge      arch_timer
 17:      24471      14098       GIC  30 Edge      arch_timer
 26:       4202          0       GIC 126 Level     mmc0
 27:          0          0       GIC 133 Level     3200000.sata
 31:          0          0       GIC 120 Level     2180000.i2c
 32:          0          0       GIC 122 Edge      ar1021_i2c
 38:        577          0       GIC 112 Level     fsl-lpuart
 39:          0          0       GIC 150 Level     29d0000.ftm0

Any idea what value to use for the "interrupts" line of the i2c in the DTS file?

cheers,

1 Solution
689 Views
Pavel
NXP Employee
NXP Employee

NXP SDK for LS1021a does not declare IRQ2 interrupt in DTS file. This SDK supports sysfs for GPIO using as interrupt source. Perhaps this possibility can be used for your task. If IRQ2 is needed, see attached files.

  1. Declare the IRQ properly in the DTS. See the fsl-ls1046a-qds.dts file as example. Find the "IRQ10_B" in this file. The value of the "interrupt"

It looks like that

                                                                                                                                                                                                            interrupts = <GIC_SPI 165 IRQ_TYPE_LEVEL_LOW>;

property should be added.

property is calculated as "Internal interrupt ID" - 32

  

  1. Request the interrupt property from the Open Firmware in the driver.

 

  1. Map the interrupt to the resource ID. This can be done by of_irq_to_resource() or by irq_of_parse_and_map().

  

  1. Request the interrupt by the resource number.


Have a great day,
Pavel Chubakov

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

View solution in original post

2 Replies
690 Views
Pavel
NXP Employee
NXP Employee

NXP SDK for LS1021a does not declare IRQ2 interrupt in DTS file. This SDK supports sysfs for GPIO using as interrupt source. Perhaps this possibility can be used for your task. If IRQ2 is needed, see attached files.

  1. Declare the IRQ properly in the DTS. See the fsl-ls1046a-qds.dts file as example. Find the "IRQ10_B" in this file. The value of the "interrupt"

It looks like that

                                                                                                                                                                                                            interrupts = <GIC_SPI 165 IRQ_TYPE_LEVEL_LOW>;

property should be added.

property is calculated as "Internal interrupt ID" - 32

  

  1. Request the interrupt property from the Open Firmware in the driver.

 

  1. Map the interrupt to the resource ID. This can be done by of_irq_to_resource() or by irq_of_parse_and_map().

  

  1. Request the interrupt by the resource number.


Have a great day,
Pavel Chubakov

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

689 Views
tnguyen3
Contributor I

Thank you! It works after modifying the dts' entry  with "GIC_SPI 165".

Cheers,

0 Kudos