Touch I2C for Goodix GT928

Hi,

I am currently trying enable goodix / GT928 I2C touch,
Can you please let me know, is goodix driver enabled by default in Colibri IMX8DX,
If yes, can you please provide me an approach to apply I2C1 device tree / overlay to Colibri IMX8DX
for the same

Thank you

Hi @Shreejit,

Thanks for posting your query to Toradex Community.

Unfortunately the driver for chip is not enabled on default BSP, you will require to customise kernel and enable same. [Link]

Once you have driver in place you can modify device tree to enable same. Please check below community post for reference

You can also refer to below documentation
https://www.kernel.org/doc/Documentation/devicetree/bindings/input/touchscreen/goodix.txt
Please note now you have option to use device tree overlay as well.

Let me know if you have any queries.
Best Regards
Ritesh Kumar

Thank you very much @ritesh.tx , for the above information.
I will try above process

Hi @Shreejit,

Above steps we mentioned is for our BSP, unfortunately I missed OS tag while replying. Please note for TorizonCore we can help you adding in kernel drivers/config. Depending on the effort it can be provided in one of nightly build for you to test.
I will check internally and update you accordingly.

Please check below link for more detail

Best Regards
Ritesh Kumar

Thank you @ritesh.tx I am waiting for your reply
I am using image ( Colibri iMX8X 6.3.0+build.4 2023/07/25 198.92 MiB)

and also torizon-core-docker-colibri-imx8x-Tezi_5.7.2+build.20.tar

I got below message from boot, after configuring goodix gt928 (for i2c1)
in device tree : device-trees/dts-arm64/imx8qxp-colibri-lvds-single-channel.dts

what can be the issue
[ 8.535213] Goodix-TS 17-005d: i2c test failed attempt 1: -5
[ 8.600937] Goodix-TS 17-005d: i2c test failed attempt 2: -5
[ 8.640828] Goodix-TS 17-005d: I2C communication failure: -5

Hi @Shreejit,

Kernel config for goodix is already enabled. please check below

torizon@colibri-imx8x-06995821:~$ zcat /proc/config.gz | grep -i goodix
CONFIG_TOUCHSCREEN_GOODIX=m
 # CONFIG_I2C_HID_OF_GOODIX is not set
torizon@colibri-imx8x-06995821:~$ cat /etc/os-release 
ID=torizon
NAME="TorizonCore"
VERSION="6.3.0-devel-20230726+build.339 (kirkstone)"
VERSION_ID=6.3.0-devel-20230726-build.339
PRETTY_NAME="TorizonCore 6.3.0-devel-20230726+build.339 (kirkstone)"
DISTRO_CODENAME="kirkstone"
BUILD_ID="339"
ANSI_COLOR="1;34"
VARIANT="Docker"

Regarding error you receive can you please share complete setup you are testing. How you are interfacing touch controller, modification you have done for device tree overlay. Since we do not have exact touchscreen, it is difficult to tell what is exact reason causing i2c failure. Please do check if other device are connected on I2C is not in conflict with touch screen.

Best Regards
Ritesh Kumar

@ritesh.tx
Please find the below configuration done
using image torizon-core-docker-colibri-imx8x-Tezi_5.7.2+build.20.tar

1) device-trees/overlays/colibri-imx8_goodix-gt928-ts_overlay.dts
// Capacitive Goodix GT928 touchscreen for the 10.4 inch display.

/dts-v1/;
/plugin/;

/ {
compatible = “toradex,colibri-imx8x”;
};

&goodix_ts {
pinctrl-names = “default”;
pinctrl-0 = <&pinctrl_cap_ts>;
status = “okay”;
};

2) device-trees/dts-arm64/imx8x-colibri.dtsi
&i2c1 {
clock-frequency = <400000>;
pinctrl-names = “default”;
pinctrl-0 = <&pinctrl_i2c1>;
status = “okay”;

    goodix_ts: gt928@5d {
            compatible = "goodix,gt928";
            reg = <0x5d>;
            interrupt-parent = <&lsio_gpio3>;
            interrupts = <22 IRQ_TYPE_EDGE_FALLING>; // SODIMM 102
            reset-gpios = <&lsio_gpio0 31 GPIO_ACTIVE_HIGH>; // SODIMM 100
            touchscreen-size-x = <1024>;
            touchscreen-size-y = <600>;
            status = "disabled";
    };

};

&iomuxc {
pinctrl-names = “default”;
pinctrl-0 = <&pinctrl_hog0>, <&pinctrl_hog1>, <&pinctrl_hog2>,
<&pinctrl_ext_io0>, <&pinctrl_lpspi2_cs2>;

    colibri-imx8qxp {

            pinctrl_cap_ts: captsgrp {
                    fsl,pins = <
                            IMX8QXP_SAI1_RXFS_LSIO_GPIO0_IO31               0x20            /* SODIMM 100 */
                            IMX8QXP_QSPI0B_DQS_LSIO_GPIO3_IO22              0x20            /* SODIMM 102 */
                    >;
            };
			
			pinctrl_hog1: hog1grp {
				fsl,pins = <
					/*IMX8QXP_SAI1_RXFS_LSIO_GPIO0_IO31		0x20*/	
					/*IMX8QXP_QSPI0B_DQS_LSIO_GPIO3_IO22		0x20*/	
				>;
			};				

			/* Colibri I2C */
			pinctrl_i2c1: i2c1grp {
				fsl,pins = <
					IMX8QXP_MIPI_DSI0_GPIO0_00_ADMA_I2C1_SCL	0x06000021	/* SODIMM 196 */
					IMX8QXP_MIPI_DSI0_GPIO0_01_ADMA_I2C1_SDA	0x06000021	/* SODIMM 194 */
				>;
			};
			
	}

}

3) tcbuild.yaml

Sample configuration file:

input:
easy-installer:
local: torizon-core-docker-colibri-imx8x-Tezi_5.7.2+build.20.tar

customization:
device-tree:
include-dirs:
- device-trees/include/
custom: device-trees/dts-arm64/imx8qxp-colibri-lvds-single-channel.dts
overlays:
add:
- device-trees/overlays/colibri-imx8_goodix-gt928-ts_overlay.dts

output:
easy-installer:
local: torizon-core-docker-colibri-imx8x-Tezi_5.7.2.CUSTOM

4) Hardware connections
CTP_RST–> SODIMM_100
CTP_INT–> SODIMM_102
I2C_SDA–> X22_16
I2C_SCK–> X22_15

Error:
orizon@colibri-imx8x-07202984:~$ dmesg | grep Goodix
[ 8.612136] Goodix-TS 17-005d: 17-005d supply AVDD28 not found, using dummy regulator
[ 8.612229] Goodix-TS 17-005d: 17-005d supply VDDIO not found, using dummy regulator
[ 8.733008] Goodix-TS 17-005d: i2c test failed attempt 1: -5
[ 8.771357] Goodix-TS 17-005d: i2c test failed attempt 2: -5
[ 8.821427] Goodix-TS 17-005d: I2C communication failure: -5
[ 8.834897] Goodix-TS: probe of 17-005d failed with error -5

Hi @Shreejit,

Thanks for sharing all detail. device tree changes looks good. Error what you get seems like chip is not getting up. Can you please try adding below and see if you are able to get touch running

irq-gpios = <&lsio_gpio3 22 0>;

Additionally you can check manually loading driver, use i2cdetect and verify if chip is getting recognise on i2c bus.

Best Regards
Ritesh Kumar

Thank you, touch works :slightly_smiling_face: