How do I add support for a custom touch screen on my Raspberry Pi?

I have a touch screen that I’d like to use that uses a goodix touch driver.

To get it working on raspbian you have to compile this dts file into a dtbo file: https://www.acmesystems.it/www/CM3-PANEL_microsd/goodix-7-acme.dts

add the dtbo file to the overlays directory in the boot partition

…and then add these lines to the config.txt file in the boot partition:

dtoverlay=i2c1-bcm2708,sda1_pin=44,scl1_pin=45,pin_func=6
dtoverlay=goodix-7-acme

How do I go about getting this working on ubuntu core? I tried copying that same dtbo file into the overlays folder and adding those two lines, but that didn’t work…I assume because it is compiled for raspbian and not ubuntu…

I also saw that there is an existing dtbo file called goodix.dtbo in the overlays folder in ubuntu core, so I tried adding this line to configure it:

dtoverlay=goodix,interrupt=42,reset=43

and these two lines

dtoverlay=i2c1-bcm2708,sda1_pin=44,scl1_pin=45,pin_func=6
dtoverlay=goodix,interrupt=42,reset=43

Neither worked.

Do I need to write a custom dts file for ubuntu core and then compile it somehow?

even if the dtb is in the overlay dir (and you should really use that one, not the raspbian one, there might be kernel incompatibilities), the touchscreen might need certain config options enabled in the kernel itself that could be missing. perhaps @ppisati can help you here if you find out what that device needs enabled.

So I definitely think I need to add these two lines (or something like it) in the config.txt file:

###Activate the I2C 1 port on GPIO44 and 45 to talk with touch screen
dtoverlay=i2c1-bcm2708,sda1_pin=44,scl1_pin=45,pin_func=6
dtoverlay=goodix,interrupt=42,reset=43

The first line seems to work, as it adds a device called i2c-1 in /dev. The second line causes the system to throw this error when it boots up. It looks like the issue is that the goodix.dts file probably has some incompatible pin mappings that I need to change and compile it into a dtbo file.

[ 1.508929] spi-bcm2835 3f204000.spi: could not get clk: -517
[ 1.914040] Error: Driver ‘sdhost-bcm2835’ is already registered, aborting…
[ 1.979422] pinctrl-bcm2835 3f200000.gpio: pin gpio9 already requested by leds; cannot claim for 3f204000.spi
[ 1.989526] pinctrl-bcm2835 3f200000.gpio: pin-9 (3f204000.spi) status -22
[ 1.996515] pinctrl-bcm2835 3f200000.gpio: could not request pin 9 (gpio9) from group gpio9 on device pinctrl-bcm2835
[ 2.007369] spi-bcm2835 3f204000.spi: Error applying setting, reverse things back
[ 2.015147] pinctrl-bcm2835 3f200000.gpio: pin gpio0 already requested by leds; cannot claim for 3f205000.i2c
[ 2.025216] pinctrl-bcm2835 3f200000.gpio: pin-0 (3f205000.i2c) status -22
[ 2.032199] pinctrl-bcm2835 3f200000.gpio: could not request pin 0 (gpio0) from group gpio0 on device pinctrl-bcm2835
[ 2.043052] i2c-bcm2835 3f205000.i2c: Error applying setting, reverse things back

My question is then:

1.) Where is the dts file that this goodix.dtbo was compiled from (the one in the ubuntu core overlays directory)? I’m guessing I don’t want to use the raspbian based ones – like this one? https://www.acmesystems.it/www/CM3-PANEL_microsd/goodix-7-acme.dts and I should instead use a dts template that is designed for ubuntu?

2.) Would it be best to modify the one shown here: https://github.com/torvalds/linux/blob/master/Documentation/devicetree/bindings/input/touchscreen/goodix.txt

…and then try to compile it into a dtbo? I was thinking of using the 32 bit ubuntu mate for raspberry pi to try to do this. Does that sound like the best option? It’s hard to test stuff on ubuntu core since everything is stripped out and I can’t run programs like i2c-detect

So out of curiosity I downloaded Ubuntu Mate (32 bit) for raspberry pi. My touch screen didn’t work (as expected) and so I added these two lines to config.txt in /boot and it started working:

dtoverlay=i2c1-bcm2708,sda1_pin=44,scl1_pin=45,pin_func=6
dtoverlay=goodix,interrupt=42,reset=43

I tried the same thing on Ubuntu Core, but it doesn’t work because of this issue:

[ 1.974002] pinctrl-bcm2835 3f200000.gpio: pin gpio0 already requested by leds; cannot claim for 3f205000.i2c
[ 1.984067] pinctrl-bcm2835 3f200000.gpio: pin-0 (3f205000.i2c) status -22
[ 1.991045] pinctrl-bcm2835 3f200000.gpio: could not request pin 0 (gpio0) from group gpio0 on device pinctrl-bcm2835
[ 2.001897] i2c-bcm2835 3f205000.i2c: Error applying setting, reverse things back

It looks like the Goodix touch driver is requesting access to pin0 but some driver/module called leds is using it. How do I disable leds? I tried commenting out these lines, but it didn’t do anything.

#dtparam=act_led_trigger=heartbeat
#dtparam=pwr_led_trigger=mmc0

Looks like the problem is that the kernel is compiled with LED support (/sys/class/leds/) and the goodix driver is asking for the same pin…

this is definitely worth a bug report:

Hi…did you get the touch sorted out? I have the 9" screen showing up tomorrow and I’m trusting I don’t go throughout the day attempting to figure everything out. I’ll invest enough energy 3d printing the bezel for a perfect fit in my Jeep… furthermore, I’m wanting to get everything introduced and running before my date.

With the newest ubuntu core image my touch screen works without needing to do anything.

1 Like