Capacitive Touch Panel Ilitek 2511

Hi all

hope you are all well!

I am currently trying to add a touch control to TorizonCore 5.7.
The Touchscreen is a custom made 7inch panel which comes with a I2C touch controller from Ilitek, ili2511.
The Linux Kernel seems to have a driver for this, although it is not set in the config.

I used this code to create a module and compile and load it with TorizonCore Builder. Together with the following dts overlay I tried to get it running, but I seem to miss something.

#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/interrupt-controller/irq.h>
#include <dt-bindings/pwm/pwm.h>;

/dts-v1/;
/plugin/;

/ {
	compatible = "toradex,apalis-imx8",
		     "toradex,apalis-imx8qm";
};


&backlight {
	//compatible = "pwm-backlight";
	brightness-levels = <0 74 128 164 192 210 255>;
	default-brightness-level = <1>;
	enable-gpios = <&lsio_gpio1 4 GPIO_ACTIVE_HIGH>; /* Apalis BKL1_ON */
	pinctrl-names = "default";
	pinctrl-0 = <&pinctrl_gpio_bkl_on>;
	pwms = <&pwm_lvds1 0 5000000 PWM_POLARITY_INVERTED>;
	status = "okay";
};

&{/panel-lvds} {
	compatible = "panel-lvds";
	backlight = <&backlight>;

	status = "okay";

	data-mapping = "vesa-24";
	width-mm = <154>;
	height-mm = <86>;

	panel-timing {
		clock-frequency = <54000000>;
		hactive = <1024>;
		vactive = <600>;
		hback-porch = <160>;
		hfront-porch = <160>;
		vback-porch = <23>;
		vfront-porch = <12>;
		hsync-len = <70>;
		vsync-len = <5>;
	};

	port {
		panel_lvds1_in: endpoint {
			remote-endpoint = <&lvds1_out>;
		};
	};
};

&ldb2 {
	status = "okay";

	lvds-channel@0 {
		status = "okay";
		fsl,data-mapping = "spwg";
		fsl,data-width = <24>;

		port@1 {
			reg = <1>;
			lvds1_out: endpoint {
				remote-endpoint = <&panel_lvds1_in>;
			};
		};
	};
};

&pwm_lvds1 {
	status = "okay";
};

&i2c2 {
	#address-cells = <1>;
	#size-cells = <0>;	
	
	touchscreen0: ilitek@41 {
		compatible = "tchip,ilitek", 
			     "ilitek,ilitek_ts_i2c",
			     "ilitek_ts_i2c",
			     "ilitek,ili251x",
			     "ilitek,ili2511",
			     "ili251x";
		reg = <0x41>;
		pinctrl-names = "default";
		pinctrl-0 = <&pinctrl_gpio1>, <&pinctrl_gpio2>;
		interrupt-parent = <&lsio_gpio0>;
		interrupts = <9 IRQ_TYPE_EDGE_FALLING>;
		reset-gpios = <&lsio_gpio0 8 GPIO_ACTIVE_HIGH>;
		ilitek,irq-gpio = <&lsio_gpio0 9 0x0>;
		ilitek,reset-gpio = <&lsio_gpio0 8 0x0>;
		ilitek,vbus = "vcc_i2c";
		ilitek,vdd = "vdd";
		ilitek,name = "ilitek_i2c";
		max-fingers = <4>;
		status = "okay";
	};

};

The controller is connected using a custom Carrier board. The Touch interface is connected to the Apalis I2C1 (I2C1_SCL, I2C1_SDA) and GPIOs GPIO1 (CTP_RST) and GPIO2 (CTP_INT).

I think I missed something and maybe one of you can give me an idea or hint to where I can continue to try getting it running.

The device already shows up in evtest as input1, but tapping the screen is not recognized:

torizon@apalis-imx8-14760487:~$ evtest
No device specified, trying to scan all of /dev/input/event*
Not running as root, no devices may be available.
Available devices:
/dev/input/event0:      sc-powerkey
/dev/input/event1:      ILI210x Touchscreen
Select the device event number [0-1]: 1
Input driver version is 1.0.1
Input device ID: bus 0x18 vendor 0x0 product 0x0 version 0x0
Input device name: "ILI210x Touchscreen"
Supported events:
  Event type 0 (EV_SYN)
  Event type 1 (EV_KEY)
    Event code 330 (BTN_TOUCH)
  Event type 3 (EV_ABS)
    Event code 0 (ABS_X)
      Value      0
      Min        0
      Max    65535
    Event code 1 (ABS_Y)
      Value      0
      Min        0
      Max    65535
    Event code 24 (ABS_PRESSURE)
      Value      0
      Min        0
      Max       10
    Event code 47 (ABS_MT_SLOT)
      Value      0
      Min        0
      Max        9
    Event code 53 (ABS_MT_POSITION_X)
      Value      0
      Min        0
      Max    65535
    Event code 54 (ABS_MT_POSITION_Y)
      Value      0
      Min        0
      Max    65535
    Event code 57 (ABS_MT_TRACKING_ID)
      Value      0
      Min        0
      Max    65535
    Event code 58 (ABS_MT_PRESSURE)
      Value      0
      Min        0
      Max       10
Properties:
  Property type 1 (INPUT_PROP_DIRECT)
Testing ... (interrupt to exit)

I can see the following when checking /dev/input:

torizon@apalis-imx8-14760487:~$ cat /dev/input/
by-path/      event0        event1        touchscreen0

And the module with the driver is loaded but seems to not be used:

Module                  Size  Used by
ili210x                20480  0

Thank you, and best regards,

Greetings @bgo,

I can’t comment too much in detail regarding this display/touchscreen since I’m unfamiliar with it. Assuming everything is hooked up correctly from a hardware point of view, I can only look at your overlay.

Looking specifically at the part of the overlay where you specify the touchscreen details. How did you create this part of the overlay? When I check the in-kernel documentation for this: ilitek,ili2xxx.txt « input « bindings « devicetree « Documentation - linux-toradex.git - Linux kernel for Apalis, Colibri and Verdin modules

The example device tree node is a lot simpler than what you have. You also have a some undocumented fields like ilitek,vbus, ilitek,reset-gpio, and more.

Best Regards,
Jeremias

1 Like

Hello @jeremias.tx

Thank you for your quick reply!
The manufacturer of the display gave us a driver package which contained a .dts file. I extracted the touchscreen part and changed the GPIO configuration. The driver did not work and I started searching for another driver to use. I found it in the linux kernel and was glad to also find it in your linux-toradex. So I picked that code and created a module, but kept the overlay as is - that was a mistake. Following your guidance I changed the part to

touchscreen@41 {
                compatible = "ilitek,ili251x";
                reg = <0x41>;
                interrupt-parent = <&lsio_gpio0>;
                interrupts = <9 IRQ_TYPE_EDGE_FALLING>;
                reset-gpios = <&lsio_gpio0 8 GPIO_ACTIVE_LOW>;
        };

and now I get events and the touch works, although the resolution is totally off and needs to be configured correctly.

Thanks again!

Best regards,

Hi @bgo ,

Glad that it works now.

Can we consider this one as solved?

If there’s still something we can help you with feel free to open a new post.

Best Regards
Kevin

Hi @kevin.tx

yes, thank you! I already marked @jeremias.tx answer as solution.

Have a nice day!

Best regards,

Glad I was able to help clear things up!