ILI210x driver for ROCKO (linux 4.9) based yocto image

I am using the ili210x driver with a Yocto v.ROCKO (based on 4.9 linux-kernel).

Toradex has some info on how to use the ILI210x driver for a more recent kernel (5.4): ilitek,ili2xxx.txt « input « bindings « devicetree « Documentation - linux-toradex.git - Linux kernel for Apalis, Colibri and Verdin modules

but unfortunately, I cannot find such a file for my kernel :slightly_frowning_face:

When I am adding the ILI210x driver to my device-tree I am struggling to get it to load. I am using the following code but the driver does not seem to get loaded - I am unsure what to use in the “compatible” property. I saw that in the more recent drivers it is explicitly specified in code, while in the version of the driver I am using this is missing.

Note: before switching to ILI210x we used the Solomon SSD254x touchscreen so I have both in my device tree - I assume this should be fine?

&i2c1 {
  status = "okay";

  touchscreen@41 {
    /* Ilitek I2C Touchscreen Controller */
    /* see: https://git.toradex.com/cgit/linux-toradex.git/tree/Documentation/devicetree/bindings/input/ilitek,ili2xxx.txt?h=toradex_5.4-2.3.x-imx#n */
    compatible = "ili210x", "ili210x,ili210x", "ilitek,ili210x";
    reg = <0x41>;
    interrupt-parent = <&gpio4>;
    interrupts = <7 IRQ_TYPE_EDGE_FALLING>;
    reset-gpios = <&gpio5 21 GPIO_ACTIVE_LOW>;
    status = "okay";
  };

  solomon@48 {
    /* SSL SSD254X multi-touch controller */
    compatible = "solomon,solomon-ssd254x";
    reg = <0x48>;
    interrupt-parent = <&gpio1>;
    interrupts = <2 IRQ_TYPE_EDGE_FALLING>; /* Apalis GPIO7 */
    reset-gpios = <&gpio1 6 1>; /* Apalis GPIO8 */
    num_drive_lines = <26>;
    num_sense_lines = <16>;
    bias_resistor_value = <0x06>;
    min_finger_area = <0x01>;
    sense_line_offset = <0x14>;
    status = "okay";
  };
};

interestingly I see the following line in the console during boot. this STMPE-I2C seems to also be a touchscreen:
https://git.toradex.com/cgit/linux-toradex.git/tree/Documentation/devicetree/bindings/input/touchscreen/stmpe.txt?h=toradex_4.9-2.3.x-imx

stmpe-i2c 2-0041: stmpe811 detected, chip id: 0x811

Touch is not working when I connect the ILI210x based touch-device, but IS working with the SOLOMON touch-device.

I would greatly appreciate some hints on how I can proceed or if someone can point out to me what mistakes I made.

thanks, Tilli

Hi @tw.apex,

If you check the file at https://git.toradex.com/cgit/linux-toradex.git/tree/Documentation/devicetree/bindings/input/ilitek,ili2xxx.txt

Then you can see an example on how to use it. In your case the compatible should be:

compatible = "ilitek,ili251x

Can you try this and tell us how it went?

Best Regards
Kevin

hi Kevin, thanks for the info - as stated above this file does not exist for the toradex_4.9-2.3.x branch - I tried it anyways but it does not seem to load the driver.

The ili210x.c file in the above branch also does not define any of this. there is no mention of ili251x either

is there a way to debug this when I deployed my image to the board?

Hi again,

the driver is loading, but it is now reporting the following:
ili210x_i2c 1-0041: No platform data!
ili210x_i2c: probe of 1-0041 failed with error -22

I see that there is a ili210x_platform_data struct:

struct ili210x_platform_data {
  unsigned long irq_flags;
  unsigned int poll_period;
  bool (*get_pendown_state)(void);
};

but I am unsure why this is not found and where it is looking for this - does this come from my DTSI file?

Hi @tw.apex ,

Glad that you made some progress.

For clarification did you follow the steps here to integrate it?

Best Regards
Kevin

Hi Kevin,

I have a working image - I am just adding/replacing a driver. Which part in specific do you reference? I have not built our original yocto layer but I’m pretty sure it’s conform to this.

the whole image is working - also the driver is loading, it’s just not finding the configuration

Hi @tw.apex,

the whole image is working - also the driver is loading

May I ask how exactly did you check that? Could you please share the output of lsmod command?

The ILI210X driver is not enabled by default on kernel 4.9 for Apalis imx6. See the image below:

Before adding the driver to the device tree you will have to enable it in the menuconfig for that particular kernel. Have you already done that?
If not, you will find more details on Kernel Configuration here.

Since the driver is already available on the kernel you don’t have to do the customizations from Yocto that @kevin.tx suggested earlier. It is only needed for out-of-tree modules. You have to make sure that the module is enabled and then added to the device tree before you compile the kernel and device trees.

Hi @rudhi.tx ,

see above - I can see in the console that the driver is searching for the device:

the driver is loading, but it is now reporting the following:
ili210x_i2c 1-0041: No platform data!
ili210x_i2c: probe of 1-0041 failed with error -22

I see that there is a ili210x_platform_data struct:

struct ili210x_platform_data {
  unsigned long irq_flags;
  unsigned int poll_period;
  bool (*get_pendown_state)(void);
};

but I am unsure why this is not found and where it is looking for this - does this come from my DTSI file?

I have used menuconfig to enable the device, this creates a config file where the CONFIG_TOUCHSCREEN_ILI210X=y is set - so I set this line in my own layer layers/meta-gcu-apalis/recipes-kernel/linux/linux-toradex_4.9-2.3.x/apalis-imx6/defconfig which seems to activate the driver just fine (as I stated, I can see the driver searching for a device).

So you mean I should remove the relevant data from my device-tree then (the other hardware we were using before the ILI210x required us to add an additional driver).

I really appreciate your help, thank you!

Hello @tw.apex ,

Thanks for the clarification.

So you mean I should remove the relevant data from my device-tree then (the other hardware we were using before the ILI210x required us to add an additional driver).

That’s the next thing I would try: Remove the driver and nodes in device tree files related to the old touchscreen (Solomon SSD254x), recompile and deploy the kernel.

Also, could you please try setting the compatible property as compatible = "ilitek,ili210x";

Hi @rudhi.tx

ok, will try that.

My current dts file has this compatibility value set:

/ {
	model = "Toradex Apalis iMX6Q/D Module on APEX-G GCU Mainboard R01b";
	compatible = "toradex,apalis_imx6q-ixora-v1.1", "toradex,apalis_imx6q",
		     "fsl,imx6q";
};

just to confirm - you want me to change it to:

/ {
	model = "Toradex Apalis iMX6Q/D Module on APEX-G GCU Mainboard R01b";
	compatible = "toradex,apalis_imx6q-ixora-v1.1", "toradex,apalis_imx6q",
		     "fsl,imx6q", "ilitek,ili210x";
};

correct?

@rudhi.tx and in my dtsi file I will change

/*
 * GEN1_I2C: I2C1_SDA/SCL on MXM3 209/211 (e.g. RTC on carrier
 * board)
 */
&i2c1 {
	status = "okay";

	touchscreen@41 {
		// Ilitek I2C Touchscreen Controller
		// see: https://git.toradex.com/cgit/linux-toradex.git/tree/Documentation/devicetree/bindings/input/ilitek,ili2xxx.txt?h=toradex_5.4-2.3.x-imx#n
		// working: compatible = "ili210x", "ilitek,ili210x", "ilitek,ili251x";
		// compatible = "ili210x", "ilitek,ili210x", "ilitek,ili251x";

		// trying newer driver
		compatible = "ilitek,ili210x", "ilitek,ili251x";
		reg = <0x41>;
		interrupt-parent = <&gpio4>;
		interrupts = <7 IRQ_TYPE_EDGE_FALLING>;
	  reset-gpios = <&gpio5 21 GPIO_ACTIVE_LOW>;
		status = "okay";

		/* not working
		[    2.013364] ili210x_i2c 1-0048: Probing for ILI210X I2C Touschreen driver
		[    2.020504] ili210x_i2c 1-0048: i2c transfer failed
		[    2.025419] ili210x_i2c 1-0048: Failed to get firmware version, err: -5
		[    2.032048] ili210x_i2c: probe of 1-0048 failed with error -5
		reg = <0x48>;
		interrupt-parent = <&gpio1>;
		interrupts = <7 IRQ_TYPE_EDGE_FALLING>;
	  reset-gpios = <&gpio5 21 GPIO_ACTIVE_LOW>;
		status = "okay";
		*/

		/* not working: 
		[    2.013372] ili210x_i2c 1-0041: Probing for ILI210X I2C Touschreen driver
		[    2.020506] ili210x_i2c 1-0041: i2c transfer failed
		[    2.025415] ili210x_i2c 1-0041: Failed to get firmware version, err: -5
		[    2.032046] ili210x_i2c: probe of 1-0041 failed with error -5
		reg = <0x41>;
		interrupt-parent = <&gpio4>;
		interrupts = <2 IRQ_TYPE_EDGE_FALLING>;	// Apalis GPIO7
		reset-gpios = <&gpio1 6 1>; // Apalis GPIO8
		status = "okay";
		*/

		/*
		not working: SOLOMON
		// [    2.013380] ili210x_i2c 1-0048: Probing for ILI210X I2C Touschreen driver
		// [    2.020513] ili210x_i2c 1-0048: i2c transfer failed
		// [    2.025422] ili210x_i2c 1-0048: Failed to get firmware version, err: -5
		// [    2.032055] ili210x_i2c: probe of 1-0048 failed with error -5
		reg = <0x48>;
		interrupt-parent = <&gpio1>;
		interrupts = <2 IRQ_TYPE_EDGE_FALLING>;	// Apalis GPIO7
		reset-gpios = <&gpio1 6 1>; // Apalis GPIO8
		status = "okay";
		
		not working: ILI
		// [    2.013364] ili210x_i2c 1-0041: No platform data!
		// [    2.018087] ili210x_i2c: probe of 1-0041 failed with error -22
		// struct ili210x_platform_data { unsigned long irq_flags; unsigned int poll_period; bool (*get_pendown_state)(void); };
		reg = <0x41>;
		interrupt-parent = <&gpio4>;
		interrupts = <7 IRQ_TYPE_EDGE_FALLING>;
	  reset-gpios = <&gpio5 21 GPIO_ACTIVE_LOW>;
		status = "okay";
		*/
	};

  /*
	solomon@48 {
		// SSL SSD254X multi-touch controller
		compatible = "solomon,solomon-ssd254x";
		reg = <0x48>;
		interrupt-parent = <&gpio1>;
		interrupts = <2 IRQ_TYPE_EDGE_FALLING>;	// Apalis GPIO7
		reset-gpios = <&gpio1 6 1>; // Apalis GPIO8
		num_drive_lines = <26>;
		num_sense_lines = <16>;
		bias_resistor_value = <0x06>;
		min_finger_area = <0x01>;	
		sense_line_offset = <0x14>;
		status = "okay";
	};
	*/
};

to

&i2c1 {
	status = "okay";
};

that didn’t work - the driver no longer outputs and messages during boot, so I guess it’s not loading

I reverted my change in the dts file and changed the dtsi to

&i2c1 {
	status = "okay";
	touchscreen@41 {
		// Ilitek I2C Touchscreen Controller
		// see: https://git.toradex.com/cgit/linux-toradex.git/tree/Documentation/devicetree/bindings/input/ilitek,ili2xxx.txt?h=toradex_5.4-2.3.x-imx#n
		compatible = "ili210x", "ilitek,ili210x", "ilitek,ili251x";
		status = "okay";
	};
};

now the output during boot is as follows (not working):

[    0.120539] i2c i2c-1: of_i2c: invalid reg on /soc/aips-bus@02100000/i2c@021a0000/touchscreen@41
[    0.120554] i2c i2c-1: Failed to create I2C device for /soc/aips-bus@02100000/i2c@021a0000/touchscreen@41
[    0.120571] i2c i2c-1: IMX I2C adapter registered
[    0.120586] i2c i2c-1: can't use DMA, using PIO instead.
[    0.130242] stmpe-i2c 2-0041: stmpe811 detected, chip id: 0x811

Hi @rudhi.tx please see my latest output above - I can’t get this working :frowning: thanks!

Hi @tw.apex ,

Sorry for the delay.

Would it be possible that you provide two things?

  1. Full dmesg log so that we can have a look.
  2. Then ideally the output of the lsmod

Then I would like to try modprobe to add and remove the driver in question and see if that works.

Best Regards
Kevin