使用gpio中断开关灯 -新人小白

SOLUTION:

I traced (virtually) into the irq.c driver and found a suspicious line:

} while (p && of_get_property(p, "#interrupt-cells", NULL) == NULL);

I modified the cv180x_base_riscv.dtsi file, adding #interrupt-cells=<2> to the porta branch, as follows:

    gpio0: gpio@03020000 {
            porta: gpio-controller@0 {
                    interrupt-controller;
                    interrupts = <60 IRQ_TYPE_LEVEL_HIGH>;
                    interrupt-parent = <&plic0>;
                    #interrupt-cells = <2>;
            };
    };

Now Linux is passing the interrupt to the gpio driver, not to the top level interrupt controller driver, and my touchscreen is working correctly!

Checking the interrupt enable register for porta:

[root@milkv-duo]~# devmem 0x03020030
0x00006000

Bit 14 is now set to “1”, which means the hardware is configured.

Checking the interrupt status, I noticed that the ft6236 interrupt is taken care by the gpio-dwapb driver:

[root@milkv-duo]~# cat /proc/interrupts
...
 46:          0  gpio-dwapb  13  cd-gpio-irq
 48:       3008  gpio-dwapb  14  ft6236

Now the capacitive touch screen works with LVGL:

https://www.youtube.com/watch?v=CalmfGGC-Ic

Thank you @haha for inspiring me find this problem!

2 Likes