Article 56MKB ADS7846 linux driver with mediatek devices

ADS7846 linux driver with mediatek devices

by
arktrin
from LinuxQuestions.org on (#56MKB)
Hello!
Trying to add touchscreen ( compatible = "ti,ads7846"; ) to my MT7621 based router through SPI, but it looks like OpenWrt (kernel 5.4.52) doesn't want to route interrupt to ads7846 driver (https://github.com/torvalds/linux/bl...reen/ads7846.c). I've got these lines in device tree:
Code:....
#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:
Code:ads7846 spi0.3: touchscreen, irq 27Driver is loaded:
Code:input: ADS7846 Touchscreen as /devices/platform/1e000000.palmbus/1e000b00.spi/spi_master/spi0/spi0.3/input/input0Event 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:

Code:27: 0 0 0 0 1e000600.gpio 18 ads7846GPIO18 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.

Code:# cat /proc/bus/input/devices
I: Bus=0000 Vendor=0000 Product=0000 Version=0000
N: Name="ADS7846 Touchscreen"
P: Phys=spi0.3/input0
S: Sysfs=/devices/platform/1e000000.palmbus/1e000b00.spi/spi_master/spi0/spi0.3/input/input0
U: Uniq=
H: Handlers=event0
B: PROP=0
B: EV=b
B: KEY=400 0 0 0 0 0 0 0 0 0 0
B: ABS=1000003How else can I debug this issue?latest?d=yIl2AUoC8zA latest?i=Pmrr-hOwi7Q:EaU6MgSfzvs:F7zBnMy latest?i=Pmrr-hOwi7Q:EaU6MgSfzvs:V_sGLiP latest?d=qj6IDK7rITs latest?i=Pmrr-hOwi7Q:EaU6MgSfzvs:gIN9vFwPmrr-hOwi7Q
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments