Linux版本使用的是4.10.y; 因为设备树里面没有关于gt911的io配置;发现5.2.y的设备树里面有,将其移植过来,如下:
&i2c0 {
status = "okay";
gt911: touchscreen@14 {
compatible = "goodix,gt911";
reg = <0x14>;
interrupt-parent = <&pio>;
interrupts = <1 3 IRQ_TYPE_EDGE_FALLING>; /* (PB3) */
pinctrl-names = "default";
//pinctrl-0 = <&i2c0_pins>;
irq-gpios = <&pio 1 3 GPIO_ACTIVE_HIGH>; /* (PB3) */
reset-gpios = <&pio 4 20 GPIO_ACTIVE_HIGH>; /* RST (PE20) */
/* touchscreen-swapped-x-y */
};
};
在内核中勾选goodix的电容屏驱动,去除ns2009的电阻屏驱动
--- Touchscreens │ │
│ │ < > ADS7846/TSC2046/AD7873 and AD(S)7843 based touchscreens │ │
│ │ < > AD7877 based touchscreens │ │
│ │ < > Analog Devices AD7879-1/AD7889-1 touchscreen interface │ │
│ │ < > Microchip AR1021 i2c touchscreen │ │
│ │ < > Atmel mXT I2C Touchscreen │ │
│ │ < > AUO in-cell touchscreen using Pixcir ICs │ │
│ │ < > BU21013 based touch panel controllers │ │
│ │ < > chipone icn8318 touchscreen controller │ │
│ │ < > cy8ctmg110 touchscreen │ │
│ │ < > Cypress TTSP touchscreen │ │
│ │ < > Cypress TrueTouch Gen4 Touchscreen Driver │ │
│ │ < > Dynapro serial touchscreen │ │
│ │ < > Hampshire serial touchscreen │ │
│ │ < > EETI touchscreen panel support │ │
│ │ < > EETI eGalax multi-touch panel support │ │
│ │ < > EETI eGalax serial touchscreen │ │
│ │ < > Fujitsu serial touchscreen │ │
│ │ <*> Goodix I2C touchscreen │ │
│ │ < > Ilitek ILI210X based touchscreen
| | < > Penmount serial touchscreen │ │
│ │ < > EDT FocalTech FT5x06 I2C Touchscreen support │ │
│ │ < > Nsiway NS2009 touchscreen
然后编译内核和设备树 更新之后启动可以成功识别gt911电容屏 但是使用tslib和hexdump都不能获取到触摸数据; 没有任何数据;
然后测试电路,发现中断管脚一直都是低电平,测试其他正常能用的电容屏有触摸是才是低电平,平常是高电平,说明io这块应该是有问题的;
测试别人提供的内核镜像是正常的,说明触摸屏是没有问题;应该还是io配置或者驱动的问题;io配置我是使用的5.2.y内核的设备树配置,
驱动使用的是4.10.y自带的驱动;加载驱动的时候可以识别出电容屏,可以正常读取id;如下:
[ 0.832410] usbcore: registered new interface driver lvs
[ 0.837920] musb-sunxi 1c19000.usb: Invalid or missing 'dr_mode' property
[ 0.844771] musb-sunxi: probe of 1c19000.usb failed with error -22
[ 0.851842] sun6i-rtc 1c20400.rtc: rtc core: registered rtc-sun6i as rtc0
[ 0.858719] sun6i-rtc 1c20400.rtc: RTC enabled
[ 0.863261] i2c /dev entries driver
[ 0.867897] Goodix-TS 0-0014: I2C Address: 0x14
[ 0.872471] Goodix-TS 0-0014: irq get irq GPIO: 0
[ 0.877323] Goodix-TS 0-0014: rst get reset GPIO: 0
[ 0.995912] Goodix-TS 0-0014: ID-> 911, version: 1060
[ 1.001681] Goodix-TS 0-0014: Direct firmware load for goodix_911_cfg.bin failed with error -2
[ 1.010886] sunxi-wdt 1c20ca0.watchdog: Watchdog enabled (timeout=16 sec, nowayout=0)
[ 1.036206] input: Goodix Capacitive TouchScreen as /devices/platform/soc/1c2ac00.i2c/i2c-0/0-0014/input/input0
[ 1.074451] sunxi-mmc 1c0f000.mmc: base:0xc4061000 irq:23
[ 1.082760] sun4i-codec 1c22c00.codec: ASoC: /soc/codec-analog@01c23000 not registered
[ 1.090833] sun4i-codec 1c22c00.codec: Failed to register our card
[ 1.098291] NET: Registered protocol family 17
[ 1.102858] Key type dns_resolver registered
其中有一个报错,提示加载固件goodix_911_cfg.bin失败,有人说这个不影响.
各位大牛有没有搞成功的,我基本上寻遍了整个论坛,没有找到明确搞定gt911驱动的分享,希望各位大牛不吝赐教;
希望晕哥能指点一二,谢谢各位!
离线
经过多次对比测试推测定位已经是中断没有触发的原因 推测应该是中断配置的问题 对比测试linux5.2.y是可以正常使用的 对比查看linux/drivers/pinctrl/sunxi/pinctrl-sun8i-v3s.c中有关中断的配置跟Linux4.10.y是不一样的
5.2.y中如下:
static const struct sunxi_pinctrl_desc sun8i_v3s_pinctrl_data = {
.pins = sun8i_v3s_pins,
.npins = ARRAY_SIZE(sun8i_v3s_pins),
.irq_banks = 2,
.irq_bank_map = sun8i_v3s_pinctrl_irq_bank_map,
.irq_read_needs_mux = true
};
4.10.y中如下:
static const struct sunxi_pinctrl_desc sun8i_v3s_pinctrl_data = {
.pins = sun8i_v3s_pins,
.npins = ARRAY_SIZE(sun8i_v3s_pins),
.irq_banks = 2,
.irq_read_needs_mux = true
};
在4.10.y中增加.irq_bank_base = 1即可正常触发中断
更改过后如下:
static const struct sunxi_pinctrl_desc sun8i_v3s_pinctrl_data = {
.pins = sun8i_v3s_pins,
.npins = ARRAY_SIZE(sun8i_v3s_pins),
.irq_banks = 2,
.irq_bank_base = 1,
.irq_read_needs_mux = true
};
至此4.10.y可以正常触发触摸中断了,gt911可以正常读取坐标点数据; 鉴于4.10.y的一些坑 本人目前已经切到5.2.y系统 也顺应解决了usb otg不能自动切换的问题 大家有需要的可以参考下 此坑已填
离线
hanzixi_angel 说:经过多次对比测试推测定位已经是中断没有触发的原因 推测应该是中断配置的问题 对比测试linux5.2.y是可以正常使用的 对比查看linux/drivers/pinctrl/sunxi/pinctrl-sun8i-v3s.c中有关中断的配置跟Linux4.10.y是不一样的
5.2.y中如下:
static const struct sunxi_pinctrl_desc sun8i_v3s_pinctrl_data = {
.pins = sun8i_v3s_pins,
.npins = ARRAY_SIZE(sun8i_v3s_pins),
.irq_banks = 2,
.irq_bank_map = sun8i_v3s_pinctrl_irq_bank_map,
.irq_read_needs_mux = true
};4.10.y中如下:
static const struct sunxi_pinctrl_desc sun8i_v3s_pinctrl_data = {
.pins = sun8i_v3s_pins,
.npins = ARRAY_SIZE(sun8i_v3s_pins),
.irq_banks = 2,
.irq_read_needs_mux = true
};在4.10.y中增加.irq_bank_base = 1即可正常触发中断
更改过后如下:
static const struct sunxi_pinctrl_desc sun8i_v3s_pinctrl_data = {
.pins = sun8i_v3s_pins,
.npins = ARRAY_SIZE(sun8i_v3s_pins),
.irq_banks = 2,
.irq_bank_base = 1,
.irq_read_needs_mux = true
};至此4.10.y可以正常触发触摸中断了,gt911可以正常读取坐标点数据; 鉴于4.10.y的一些坑 本人目前已经切到5.2.y系统 也顺应解决了usb otg不能自动切换的问题 大家有需要的可以参考下 此坑已填
楼主你最终自己写的驱动嘛,没有使用内核自带的驱动?我最近也在弄V3S+GT911这块东西,望不吝赐教
我使用的就是内核自带的gt911驱动 设备树是用的licheepi的 可以正常使用
离线