我使用了来自友好手臂的纳米2火焰,我想使用GT911 goodix触摸屏。它有6个引脚:1个用于复位(我刚连接到一个gpio),2个用于vdd3.3伏特,3个用于GND,4个用于irq (我将其连接到gpioc11)和SDA和SCL (连接到引脚3&5作为I2C-0)。我使用此源代码将Linux内核4.4.y下载到active goodix触摸屏:
git clone https://github.com/friendlyarm/linux.git -b nanopi2-v4.4.y --depth 1我在内核中使用active goodix作为模块,然后按照页面编译内核,最后将文件复制到sd(运行make命令、复制zimage和dtb文件引导sd)。当我运行这段代码时:
root@NanoPi2-Fire:/# find -iname goodix*
./sys/bus/i2c/drivers/Goodix-TS
./sys/firmware/devicetree/base/soc/i2c@c00a6000/goodix_ts@5d
./sys/firmware/devicetree/base/soc/i2c@c00a6000/goodix_ts@5d/goodix,irq-gpio 为了检测i2c,我有:
root@NanoPi2-Fire:~# ls -l /sys/bus/i2c/devices/i2c*
lrwxrwxrwx 1 root root 0 Jan 1 1970 /sys/bus/i2c/devices/i2c-0 -> ../../../devices/platform/c0000000.soc/c00a4000.i2c/i2c-0
lrwxrwxrwx 1 root root 0 Jan 1 1970 /sys/bus/i2c/devices/i2c-1 -> ../../../devices/platform/c0000000.soc/c00a5000.i2c/i2c-1
lrwxrwxrwx 1 root root 0 Jan 1 1970 /sys/bus/i2c/devices/i2c-2 -> ../../../devices/platform/c0000000.soc/c00a6000.i2c/i2c-2
lrwxrwxrwx 1 root root 0 Jan 1 1970 /sys/bus/i2c/devices/i2c-3 -> ../../../devices/platform/c0000000.soc/c0000000.soc:i2c@3/i2c-3以及:
root@NanoPi2-Fire:/# i2cdetect -y 0
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- UU -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
root@NanoPi2-Fire:/# i2cdetect -y 1
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
root@NanoPi2-Fire:/# i2cdetect -y 2
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- UU
30: -- -- -- -- -- -- -- -- UU -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
root@NanoPi2-Fire:/# i2cdetect -y 3
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- UU -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
modprobe goodix_ts
modprobe: FATAL: Module goodix_ts not found in directory /lib/modules/4.4.49-s5p4418如何在linux上使用gt911?
发布于 2019-02-25 15:47:22
您需要将类似的内容添加到用于内核的设备树(dts)中:
&i2c1 { /* Use the correct name of the bus you're device is on */
- other dts code here -
gt911: touchscreen@14 {
compatible = "goodix,gt911";
reg = <0x14>;
interrupt-parent = <&gpioc>; /* Use the correct gpio controller here */
interrupts = <11 IRQ_TYPE_EDGE_FALLING>;
irq-gpios = <&gpioc 11 GPIO_ACTIVE_HIGH>;
reset-gpios = <&gpioc ? GPIO_ACTIVE_LOW>; /* Use the correct gpio controller and pin */
};
- other dts code here -};
当IRQ和复位引脚都可以由驱动程序控制时,它将自动为您在设备树中提供的地址配置芯片。(它通过使用正确的INT级别集重置gt911并将该行切换回输入),在上面的情况下,它的0x14,另一个可用地址是0x5d。
注意:当你有一个单向的INT线时:如果你只有一个单向信号(比如在它之间使用一个缓冲区),通过驱动程序使用重置线并不是一个困难的要求。只需确保GT911被正确重置,并提供您在重置期间配置的地址。
https://unix.stackexchange.com/questions/485471
复制相似问题