Goodix GT911 touchscreen controller starts generating i2c signals 64 seconds after device power-on

145 Views Asked by At

I am attempting to integrate a Goodix touchscreen into my imx7dsabresd system. It works fine but after 64 seconds later from the opening. I have monitored the touch interrupt and i2c signals using an oscilloscope. The chip generates the interrupt signal upon power-on, but I observe i2c signals after 64 seconds. I can't see such a delay in the driver (goodix.c file in kernel source).

How can I fix this delay problem, any idea?

Kernel version is; 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

Related part of my device tree file is like that;

&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 is like this:

[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

I changed reset and irq pins to different combinations, it didn't work. I'm sure that i2c is working fine because I check the chip with

i2cdetect -y 0

and I see chip at address 0x5d, as it supposed to be. However, chip does not generate i2c signals of touch information for 64 seconds.

1

There are 1 best solutions below

0
On

I solved the problem. Let me write my solution for those who use the Goodix touchscreens and want to prevent the startup delay.

It's a driver-related issue, but it's something that exists in all drivers including the latest one. Probably this problem have ignored since nobody paid attention to the 64-second delay. However, for fast-opening devices it is important.

There is a section in the driver where it searches for the configuration file. If the configuration file is not found, it continues, but the part where the file is searched creates a time delay. In goodix.c file:

static int goodix_ts_probe(struct i2c_client *client, const struct i2c_device_id *id)
{
    struct goodix_ts_data *ts;
    int error;

    // 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;
}

I just changed here.

 // if (ts->gpiod_int && ts->gpiod_rst) {
 if (0) {

And the result:

[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

It finishes the job in 2 seconds.