我正在尝试将 Goodix 触摸屏集成到我的 imx7dsabresd 系统中。它工作正常,但在打开后 64 秒后。我使用示波器监控了触摸中断和 i2c 信号。芯片在上电时产生中断信号,但我在64分钟后观察到i2c信号。我在驱动程序中看不到这样的延迟(内核源代码中的goodix.c文件)。
如何解决这个延迟问题,有什么想法吗?
内核版本是;
Linux imx7dsabresd 5.4.70-2.3.11+gb34a9c9644c1 #1 SMP PREEMPT Thu Jan 18 17:23:50 UTC 2024 armv7l armv7l armv7l GNU/Linux
我的设备树文件的相关部分是这样的;
&i2c1 {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_i2c1>;
status = "okay";
clock-frequency = <100000>;
gt911@5d {
compatible = "goodix,gt911";
reg = <0x5d>;
interrupt-parent = <&gpio2>;
interrupts = <30 IRQ_TYPE_EDGE_FALLING>;
irq-gpios = <&gpio2 30 GPIO_ACTIVE_HIGH>;
reset-gpios = <&gpio1 12 GPIO_ACTIVE_LOW>;
touchscreen-size-x = <1024>;
touchscreen-size-y = <600>;
touchscreen-inverted-x = <0>;
touchscreen-inverted-y = <0>;
};
};
Dmesg 就是这样;
[1.521610] Goodix-TS 0-005d: probe
[1.521647] Goodix-TS 0-005d: 0-005d supply AVDD28 not found, using dummy regulator
[1.529432] Goodix-TS 0-005d: 0-005d supply VDDIO not found, using dummy regulator
[1.655325] Goodix-TS 0-005d: ID 911, version: 1060
[1.660320] Goodix-TS 0-005d: Direct firmware load for goodix_911_cfg.bin failed with error -2
[1.669108] i2c-core: driver [Goodix-TS] registered
[1.669410] Goodix-TS 0-005d: Falling back to sysfs fallback for: goodix_911_cfg.bin
[64.509368] input: Goodix Capacitive TouchScreen as /devices/soc0/soc/30800000.aips-bus/30a20000.i2c/i2c-0/0-005d/input/input1
提前致谢..
我将重置和中断引脚更改为不同的组合,但不起作用。我确信 i2c 工作正常,因为我用以下命令检查了芯片
i2cdetect -y 0
我看到芯片位于地址 0x5d,正如它应该的那样。但是,芯片在 64 秒内没有生成触摸信息的 i2c 信号。
我解决了这个问题。让我为那些使用汇顶触摸屏并希望防止启动延迟的人写下我的解决方案。
这是一个与驱动程序相关的问题,但它存在于所有驱动程序中,包括最新的驱动程序。也许这个问题已经被忽略了,因为没有人注意到 64 秒的延迟。然而,对于快速打开的设备来说,这一点很重要。
驱动程序中有一个部分用于搜索配置文件。如果未找到配置文件,则继续,但搜索文件的部分会产生时间延迟。在goodix.c文件中;
static int goodix_ts_probe(struct i2c_client *client,
const struct i2c_device_id *id)
{
struct goodix_ts_data *ts;
int error;
// some codes......
// some codes......
if (ts->gpiod_int && ts->gpiod_rst) {
/* update device config */
ts->cfg_name = devm_kasprintf(&client->dev, GFP_KERNEL,
"goodix_%d_cfg.bin", ts->id);
if (!ts->cfg_name)
return -ENOMEM;
error = request_firmware_nowait(THIS_MODULE, true, ts->cfg_name,
&client->dev, GFP_KERNEL, ts,
goodix_config_cb);
if (error) {
dev_err(&client->dev,
"Failed to invoke firmware loader: %d\n",
error);
return error;
}
return 0;
}
else {
error = goodix_configure_dev(ts);
if (error)
return error;
}
return 0;
}
我刚刚在这里改变..
//if (ts->gpiod_int && ts->gpiod_rst) {
if(0){
结果;
[1.490665] Goodix-TS 0-005d: probe
[1.504725] Goodix-TS 0-005d: 0-005d supply AVDD28 not found, using dummy regulator
[1.516019] Goodix-TS 0-005d: 0-005d supply VDDIO not found, using dummy regulator
[1.651437] Goodix-TS 0-005d: ID 911, version: 1060
[1.687225] input: Goodix Capacitive TouchScreen as /devices/soc0/soc/30800000.aips-bus/30a20000.i2c/i2c-0/0-005d/input/input0
[1.702867] i2c-core: driver [Goodix-TS] registered
2秒内完成工作..