cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Highlighted
Observer
Observer
5,740 Views
Registered: ‎03-05-2012

Using ADS7846 touchscreen controller with Linux

Hi,

 

I am trying to enable a touchscreen controller (ADS7846) in Linux (linux-xlnx). The controller is connected to SPI0 on CS. The #PENIRQ signal is connected to MIO52. I have compiled support for the driver into the kernel, and added the following to the device tree:

 

&spi0 {
    is-decoded-cs = <0>;
    num-cs = <2>;
    status = "okay";

    touchscreen@0 {
        reg = <0>;                    /* CS0 */
        compatible = "ti,ads7846";
        interrupt-parent = <&gpio0>;
        interrupts = <52 0>;
        spi-max-frequency = <1000000>;
        pendown-gpio = <&gpio0 52 0>;
        vcc-supply = <&regulator_vccpint>;        /* no idea! */
    };    

};

 

On boot, I get the following message:

 

ads7846: probe of spi32766.0 failed with error -22

 

Can anyone give me a clue as to what could be wrong? I think it is to do with setting up the interrupt, but I'm not sure.

 

Many thanks in advance

 

Will

0 Kudos
3 Replies
Highlighted
Scholar
Scholar
5,711 Views
Registered: ‎10-26-2012

Assuming you're using MIO 52 for the pen-down IRQ, your DT looks suspicous.

 

I'd expect that you need to specify either the gpio or the interrupt controller, but not both.

 

Usually the way to dig into this is to find the value "22" in errno.h, and if that doesn't help, look in the driver source where it would return that error. If that doesn't help, compile with DEBUG defined for that driver.

0 Kudos
Highlighted
Observer
Observer
5,695 Views
Registered: ‎03-05-2012

Thanks - I will try those debug tactics.

 

The idea with the &gpio0 in the interrupt parent was to use the GPIO controller as the interrupt controller. (See: https://ez.analog.com/message/153150?forceNoRedirect=true post 2) - this is a different device but also for Zynq.

 

"Try to avoid to connect the IRQ directly to the GIC, this is known to have issues. Connect the pin to a EMIO GPIO pin instead and then use the GPIO controller as the interrupt controller. To use the GPIO controller as the interrupt controller use the following lines to setup the interrupt for the ad7879."

 

Is this not the proper way to do it? If not, are there any examples on how to connect a GPIO as an interrupt source in the device tree? How do I know which IRQ numbers to use, etc.?

 

Thanks

Will

0 Kudos
Highlighted
Explorer
Explorer
777 Views
Registered: ‎02-05-2008

Hi

 

did you solve or find the solution for this issue?

0 Kudos