Skip to content

Instantly share code, notes, and snippets.

@i0annis
Created February 23, 2021 15:48
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save i0annis/1d7b6e8002070063127e513af376420c to your computer and use it in GitHub Desktop.
Save i0annis/1d7b6e8002070063127e513af376420c to your computer and use it in GitHub Desktop.
Device Tree overlay for GT9110 touch driver on Raspberry Pi

GT9110 DTS for RPi

This is a Device Tree (DT) overlay for Goodix GT9110 touch controllers connected to Raspberry Pi via I2C on GPIO pins.

To use it, download the .dts file below or create one yourself and store it somewhere where you can find it. From the same directory run the following command to compile it:

sudo dtc -I dts -O dtb -o /boot/overlays/gt9110.dtbo GT9110_overlay.dts 

This will compile the 'GT9110_overlay.dts' file into 'gt9110.dtbo' and store it under /boot/overlays.

Next you need to enable it in the /boot/config.txt file using the following:

dtoverlay=gt9110

** Also do not forget to enable the I2C interface on your board:

dtparam=i2c_arm=on

Pinout Table

This is how the pins are currently connected:

Pin GT9110 RPi GPIO Pin
1 SDA GPIO 2 3
2 SCL GPIO 3 5
3 RST GPIO 4 7
4 INT GPIO 27 13
5 VDD 3V3 1
6 GND Ground 9

For more information about Device Trees, visit here: https://www.raspberrypi.org/documentation/configuration/device-tree.md

For a quick guide to all DT overlays used in Raspberry Pi, visit below: https://github.com/raspberrypi/firmware/blob/master/boot/overlays/README

// Device tree overlay for Goodix GT9110 touch controller
// connected to Raspberry Pi via I2C on GPIO pins.
/dts-v1/;
/plugin/;
/ {
compatible = "brcm,bcm2835", "brcm,bcm2836", "brcm,bcm2708", "brcm,bcm2709";
fragment@0 {
target = <&gpio>; // Overlay for GPIO pins, using standard 'gpio' node
__overlay__ {
goodix_pins: goodix_pins { // create overlay labeled "goodix_pins"
brcm,pins = <27 4>; // use GPIO_27(pin 13), GPIO_4(pin 7)
brcm,function = <0 0>; // set pins as Output
brcm,pull = <2 2>; // enable internal pull-up resistors
};
};
};
fragment@1 {
target = <&i2c1>; // Overlay for I2C pins, using the 'i2c1' node
__overlay__ {
#address-cells = <1>;
#size-cells = <0>;
status = "okay"; // device is enabled
gt9110: gt9110@14 { // set GT9110 with i2c address 0x14
compatible = "goodix,gt9110"; // using 'goodix' kernel device driver
reg = <0x14>; // I2C address (needs to match above)
pinctrl-names = "default"; // default pin configuration
pinctrl-0 = <&goodix_pins>; // assign overlay to pin control
interrupt-parent = <&gpio>; // assign interrupt rutines
interrupts = <27 2>; // high-to-low edge triggered
irq-gpios = <&gpio 27 0>; // set Interupt pin on GPIO 27
reset-gpios = <&gpio 4 0>; // set Reset pin on GPIO 4
};
};
};
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment