Trying to add touchscreen ( compatible = "ti,ads7846"; ) to my MT7621 based router through SPI, but it looks like OpenWrt doesn't want to route interrupt to ads7846 driver (https://github.com/torvalds/linux/blob/master/drivers/input/touchscreen/ads7846.c). I've got these lines in device tree:
....
#include "mt7621.dtsi"
....
xpt2046reg: xpt2046_reg {
compatible = "regulator-fixed";
regulator-name = "xpt2046_vcc";
regulator-min-microvolt = <3300000>;
regulator-max-microvolt = <3300000>;
regulator-always-on;
.....
&spi0 {
status = "okay";
....
spidev3@3 {
#address-cells = <1>;
#size-cells = <0>;
compatible = "ralink,mt7621-spi";
reg = <3>;
spi-max-frequency = <250000>;
status = "disabled";
};
xpt2046@4 {
compatible = "ti,ads7846";
reg = <3>;
vcc-supply = <&xpt2046reg>;
spi-max-frequency = <250000>;
interrupt-parent = <&gpio>;
interrupts = <18 IRQ_TYPE_EDGE_FALLING>;
pendown-gpio = <&gpio 18 GPIO_ACTIVE_LOW>;
ti,x-min = /bits/ 16 <0x0>;
ti,x-max = /bits/ 16 <0x0fff>;
ti,y-min = /bits/ 16 <0x0>;
ti,y-max = /bits/ 16 <0x0fff>;
ti,x-plate-ohms = /bits/ 16 <180>;
ti,pressure-max = /bits/ 16 <255>;
ti,debounce-max = /bits/ 16 <10>;
ti,debounce-tol = /bits/ 16 <5>;
ti,debounce-rep = /bits/ 16 <1>;
ti,keep-vref-on = <1>;
ti,settle-delay-usec = /bits/ 16 <150>;
wakeup-source;
status = "okay";
};
};
Interrupt is successfully registered in the system:
ads7846 spi0.3: touchscreen, irq 27
Driver is loaded:
input: ADS7846 Touchscreen as /devices/platform/1e000000.palmbus/1e000b00.spi/spi_master/spi0/spi0.3/input/input0
Event is located in /dev/input/event0
. MISO, MOSI, SCK and CS are working on spi0.3 and touchscreen driver is replying something meaningful during driver probe/initialization. There is corresponding line in /proc/interrupts:
27: 0 0 0 0 1e000600.gpio 18 ads7846
GPIO18 is pulled up externally through 10k resistor. But when touchscreen driver chip pulls down this gpio (pendown) nothing is happening in /proc/interrupts. ads7846_hard_irq() and ads7846_irq() functions from linux driver not even used.
If I remove any reference of GPIO18 in device tree - GPIO18 can be used freely as interrupt source through echo falling > /sys/class/gpio/gpio490/edge
, that is clearly seen in /proc/interrupts.