【全志V821_FoxPi】3-2 Linux 5.4 SPI + XPT2046触摸 + tslib
一、背景
手上有一块3.5寸的TFT屏,电阻触摸,芯片型号是XPT2046,但是搜了内核,并没有相同名字的驱动
后来百度搜了一下,似乎
XPT2046和ADS7846是通用的,于是开始尝试移植
二、内核使能ADS7846
make kernel_menuconfig
然后搜索 ADS7846
使能该配置
三、设备树修改
3-1 查找配置方法
通过 find 查找设备树的配置
find ./ -name "*ads7846*"
root@foxpi:/opt/V821_SDK_V1.1# find ./ -name "*ads7846*"
./out/v821/kernel/build/include/config/touchscreen/ads7846.h
./out/v821/kernel/build/drivers/input/touchscreen/ads7846.o
./out/v821/kernel/build/drivers/input/touchscreen/.ads7846.o.cmd
./kernel/linux-5.4-ansc/Documentation/devicetree/bindings/input/touchscreen/ads7846.txt
./kernel/linux-5.4-ansc/include/linux/spi/ads7846.h
./kernel/linux-5.4-ansc/drivers/input/touchscreen/ads7846.c
cat ./kernel/linux-5.4-ansc/Documentation/devicetree/bindings/input/touchscreen/ads7846.txt
Example for a TSC2046 chip connected to an McSPI controller of an OMAP SoC::
spi_controller {
tsc2046@0 {
reg = <0>; /* CS0 */
compatible = "ti,tsc2046";
interrupt-parent = <&gpio1>;
interrupts = <8 0>; /* BOOT6 / GPIO 8 */
spi-max-frequency = <1000000>;
pendown-gpio = <&gpio1 8 0>;
vcc-supply = <®_vcc3>;
ti,x-min = /bits/