03-10-2015 12:53 PM
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:
is-decoded-cs = <0>;
num-cs = <2>;
status = "okay";
reg = <0>; /* CS0 */
compatible = "ti,ads7846";
interrupt-parent = <&gpio0>;
interrupts = <52 0>;
spi-max-frequency = <1000000>;
pendown-gpio = <&gpio0 52 0>;
vcc-supply = <®ulator_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
03-12-2015 07:52 AM
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.
03-13-2015 04:42 AM
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.?