首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >Goodix不适用于I2C

Goodix不适用于I2C
EN

Unix & Linux用户
提问于 2018-12-02 11:32:22
回答 1查看 2K关注 0票数 1

我使用了来自友好手臂的纳米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触摸屏:

代码语言:javascript
运行
复制
git clone https://github.com/friendlyarm/linux.git -b nanopi2-v4.4.y --depth 1

我在内核中使用active goodix作为模块,然后按照页面编译内核,最后将文件复制到sd(运行make命令、复制zimage和dtb文件引导sd)。当我运行这段代码时:

代码语言:javascript
运行
复制
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,我有:

代码语言:javascript
运行
复制
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

以及:

代码语言:javascript
运行
复制
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?

EN

回答 1

Unix & Linux用户

回答已采纳

发布于 2019-02-25 15:47:22

您需要将类似的内容添加到用于内核的设备树(dts)中:

代码语言:javascript
运行
复制
&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 -

};

参见此处的设备树绑定:https://github.com/torvalds/linux/blob/master/Documentation/devicetree/bindings/input/touchscreen/goodix.txt

当IRQ和复位引脚都可以由驱动程序控制时,它将自动为您在设备树中提供的地址配置芯片。(它通过使用正确的INT级别集重置gt911并将该行切换回输入),在上面的情况下,它的0x14,另一个可用地址是0x5d。

注意:当你有一个单向的INT线时:如果你只有一个单向信号(比如在它之间使用一个缓冲区),通过驱动程序使用重置线并不是一个困难的要求。只需确保GT911被正确重置,并提供您在重置期间配置的地址。

票数 3
EN
页面原文内容由Unix & Linux提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://unix.stackexchange.com/questions/485471

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档