Compile custom dts

Hi,

i am developing a project with som verdin imx8mp and carrier board Mallow. I have to create a custom dts overlay for add touch display 10.1”. Inside the sistem is installed Linux Reference Multimedia Image. I started from this dts overlay file: verdin-imx8mp_panel-cap-touch-10inch-lvds_overlay.dts and i added a section for touch controller ilitek 2511. This is my device tree overlay.

// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
/*
 * Copyright 2023 Toradex
 */

// Verdin iMX8M Plus single-channel LVDS

/dts-v1/;
/plugin/;

#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/interrupt-controller/irq.h>
#include <dt-bindings/pwm/pwm.h>
#include "freescale/imx8mp-pinfunc.h"

/ {
	compatible = "toradex,verdin-imx8mp";
};

&{/} {
	backlight_lvds_native: backlight-lvds-native {
		compatible = "pwm-backlight";
		pinctrl-names = "default";
		pinctrl-0 = <&pinctrl_i2s_2_d_out_dsi_1_bkl_en>;
		brightness-levels = <0 45 63 88 119 158 203 255>;
		default-brightness-level = <4>;
		/* Verdin I2S_2_D_OUT as GPIO (SODIMM 46) */
		enable-gpios = <&gpio5 1 GPIO_ACTIVE_HIGH>;
		/* Verdin PWM_2 (SODIMM 16) */
		pwms = <&pwm2 0 6666667 PWM_POLARITY_INVERTED>;
	};

	panel-lvds-native {
		compatible = "panel-lvds";
		backlight = <&backlight_lvds_native>;
		data-mapping = "vesa-24";
		height-mm = <136>;
		width-mm = <217>;

		panel-timing {
			clock-frequency = <68900000 71100000 73400000>; /* 66.3 72.4 78.9 */
			de-active = <1>;
			hactive = <1280 1280 1280>; /* */
			hback-porch = <23 60 71>;
			hfront-porch = <23 60 71>;
			hsync-active = <0>;
			hsync-len = <15 40 47>;
			pixelclk-active = <1>; /* positive edge */
			vactive = <800 800 800>; /* */
			vback-porch = <5 7 10>;
			vfront-porch = <5 7 10>;
			vsync-active = <0>;
			vsync-len = <6 9 12>;
		};

		port {
			panel_lvds_native_in: endpoint {
				remote-endpoint = <&lvds_out>;
			};
		};
	};
};

&gpu_2d {
	status = "okay";
};

&gpu_3d {
	status = "okay";
};

/* Verdin I2C channel 4 */
&i2c4 {
	// Pin 44 (SAI3_TXFS, GPIO4_IO31) > INT_TOUCH#
    // Pin 48 (SAI3_RXD, GPIO4_IO30) > RST_TOUCH#
	#address-cells = <1>;
	#size-cells = <0>;
	status = "okay";

	touchscreen@41 {
		compatible = "ilitek, ilitek251x";
		reg = <0x41>;
		pinctrl-names = "default";
		pinctrl-0 = <&pinctrl_i2s_2_d_in_gpio>,
			<&pinctrl_i2s_2_sync_gpio>; 

		interrupt-parent = <&gpio4>;
		interrupts = <31 IRQ_TYPE_EDGE_FALLING>;

		reset-gpios = <&gpio4 30 GPIO_ACTIVE_LOW>;
		status = "okay";
	};
};

&lcdif2 {
	status = "okay";
};

&ldb {
	status = "okay";

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

		port@1 {
			reg = <1>;

			lvds_out: endpoint {
				remote-endpoint = <&panel_lvds_native_in>;
			};
		};
	};
};

&ldb_phy {
	status = "okay";
};

&mix_gpu_ml {
	status = "okay";
};

&ml_vipsi {
	status = "okay";
};

/* Verdin PWM_2 */
&pwm2 {
	status = "okay";
};

&iomuxc {
        pinctrl_i2s_2_d_in_gpio: gpio4io30grp {
                fsl,pins =
                        <MX8MP_IOMUXC_SAI3_RXD__GPIO4_IO30 0x1c4>;      /* SODIMM 48 */
        };

        pinctrl_i2s_2_sync_gpio: gpio4io31grp {
                fsl,pins =
                        <MX8MP_IOMUXC_SAI3_TXFS__GPIO4_IO31 0x184>;     /* SODIMM 44 */
        };
};

For compile my dts overlay file i run the follow commands:

cpp -nostdinc -I ../linux-toradex/arch/arm64/boot/dts -I ../linux-toradex/include -undef -x assembler-with-cpp verdin-imx8mp_panel-cap-touch-10inch-lvds_overlay.dts verdin-imx8mp_panel-cap-touch-10inch-lvds_overlay.dts.preprocessed

dtc -@ -Hepapr -I dts -O dtb -i ../linux-toradex/arch/arm64/boot/dts/ -o verdin-imx8mp_panel-cap-touch-10inch-lvds_overlay.dtbo verdin-imx8mp_panel-cap-touch-10inch-lvds_overlay.dts.preprocessed

The last command return:

verdin-imx8mp_panel-cap-touch-10inch-lvds_overlay.dts:108.4-14: Warning (reg_format): /fragment@5/__overlay__/lvds-channel@0/port@1:reg: property has invalid length (4 bytes) (#address-cells == 2, #size-cells == 1)
verdin-imx8mp_panel-cap-touch-10inch-lvds_overlay.dts:102.17-114.4: Warning (unit_address_vs_reg): /fragment@5/__overlay__/lvds-channel@0: node has a unit name, but no reg or ranges property
verdin-imx8mp_panel-cap-touch-10inch-lvds_overlay.dtbo: Warning (pci_device_reg): Failed prerequisite 'reg_format'
verdin-imx8mp_panel-cap-touch-10inch-lvds_overlay.dtbo: Warning (pci_device_bus_num): Failed prerequisite 'reg_format'
verdin-imx8mp_panel-cap-touch-10inch-lvds_overlay.dtbo: Warning (simple_bus_reg): Failed prerequisite 'reg_format'
verdin-imx8mp_panel-cap-touch-10inch-lvds_overlay.dtbo: Warning (i2c_bus_reg): Failed prerequisite 'reg_format'
verdin-imx8mp_panel-cap-touch-10inch-lvds_overlay.dtbo: Warning (spi_bus_reg): Failed prerequisite 'reg_format'
verdin-imx8mp_panel-cap-touch-10inch-lvds_overlay.dts:107.10-113.5: Warning (avoid_default_addr_size): /fragment@5/__overlay__/lvds-channel@0/port@1: Relying on default #address-cells value
verdin-imx8mp_panel-cap-touch-10inch-lvds_overlay.dts:107.10-113.5: Warning (avoid_default_addr_size): /fragment@5/__overlay__/lvds-channel@0/port@1: Relying on default #size-cells value
verdin-imx8mp_panel-cap-touch-10inch-lvds_overlay.dtbo: Warning (avoid_unnecessary_addr_size): Failed prerequisite 'avoid_default_addr_size'
verdin-imx8mp_panel-cap-touch-10inch-lvds_overlay.dtbo: Warning (unique_unit_address): Failed prerequisite 'avoid_default_addr_size'
verdin-imx8mp_panel-cap-touch-10inch-lvds_overlay.dts:107.10-113.5: Warning (graph_port): /fragment@5/__overlay__/lvds-channel@0/port@1: graph node '#address-cells' is -1, must be 1
verdin-imx8mp_panel-cap-touch-10inch-lvds_overlay.dts:107.10-113.5: Warning (graph_port): /fragment@5/__overlay__/lvds-channel@0/port@1: graph node '#size-cells' is -1, must be 0

My questions are:

  1. Is my dts file correct for touch controller ili2511?

  2. Why does the dtc command return warnings?

Thanks for the help.
Fabio

Hi, I’m the Toradex AI Assistant.

I might make mistakes or occasionally get you wrong. Our support team will step in if needed.


Device Tree Overlay Analysis for Verdin iMX8M Plus with Ilitek 2511 Touch Controller

Question 1: Is the DTS file correct for touch controller ili2511?

Your device tree overlay has several issues that need to be addressed:

Touchscreen Configuration Issues

  1. Compatible String: The compatible string "ilitek, ilitek251x" appears to have incorrect formatting. Device tree compatible strings typically don’t have spaces after commas.

  2. GPIO Pin Configuration: Based on the documentation for configuring I2C pins as GPIO on Verdin iMX8M Plus (1), you need to ensure proper pin multiplexing. Your pinctrl configuration looks correct for converting the I2S pins to GPIO functionality.

  3. I2C Bus Selection: You’re using I2C4, which should work for the Mallow carrier board configuration.

Question 2: Why does the dtc command return warnings?

The warnings are related to the LVDS channel configuration in your device tree overlay. The main issues are:

Address Cell Configuration Issues

The warnings indicate problems with the #address-cells and #size-cells properties in the LVDS port configuration. The device tree compiler expects specific addressing formats for port nodes (2).

Recommended Fixes

  1. Add proper address cell definitions to the port node:
port@1 {
    reg = <1>;
    #address-cells = <1>;
    #size-cells = <0>;
    
    lvds_out: endpoint {
        remote-endpoint = <&panel_lvds_native_in>;
    };
};
  1. Fix the lvds-channel node by adding proper addressing:
lvds-channel@0 {
    #address-cells = <1>;
    #size-cells = <0>;
    reg = <0>;
    fsl,data-mapping = "spwg";
    fsl,data-width = <24>;
    status = "okay";
    
    port@1 {
        reg = <1>;
        #address-cells = <1>;
        #size-cells = <0>;
        
        lvds_out: endpoint {
            remote-endpoint = <&panel_lvds_native_in>;
        };
    };
};

Recommended Approach

For creating device tree overlays, I recommend following the structured approach outlined in the Toradex documentation (2):

  1. Define the target hardware with proper compatible strings
  2. Create proper pin groups for your touch controller
  3. Enable the groups correctly
  4. Avoid pinmux conflicts by ensuring no other peripherals use the same pins

Building and Testing

For building and deploying your overlay, consider using TorizonCore Builder as described in the documentation (2), which provides a more streamlined approach than manual compilation and can help avoid some of these configuration issues.

The pre-built overlays available for Verdin iMX8M Plus (3) can serve as good reference examples for proper device tree structure and addressing configuration.

Best regards, Toradex AI Assistant.


Did you like my answer? :+1: :-1:

If I answered your question, please tick the “Solution” checkbox.

For follow-up questions to me, please use @ToradexAI in your post.

Dear @fmolon,

Thank you for contacting us.
May I ask which exact display you are using for your setup? It is also unclear to me, if the display is actually working, or in other words if there is anything visible on it. Would it be possible to describe what you are seeing?

Looking at the warnings, they look fine in my opinion and should not be a problem.

Best regards,
Collin

Hi @collin.tx ,

Thanks for your reply. At the moment, I am using the following display: DLC1010BCP36LF-C-2 with a touch screen. Currently, I don’t see anything on the screen — it’s completely black, although the backlight is on. I suspect this issue is caused by an error in the DTS overlay file that I uploaded a few days ago. Now the system (SOM Verdin iMX8MP and Mallow carrier board) does not start, so I need to try connecting via UART debug to restore the DTS overlay file. I have purchased an FTDI USB-to-UART adapter and will check as soon as possible.

Thanks for your support

Fabio

Hello @fmolon,

We are having trouble finding the datasheet for this display, can you send it?

Also, if an overlay stops your system from booting, you can set the skip_fdt_overlays variable to 1 in u-boot to avoid loading it when booting.
More information: U-Boot | Toradex Developer Center

Best Regards,
Bruno

Hi @bruno.tx,

I successfully completed the board restore, and now work fine. Now i have a question about i2c touch panel. This is my environment:

root@verdin-imx8mp-15603379:/boot# tdx-info

Software summary
------------------------------------------------------------
Bootloader:               U-Boot
Kernel version:           6.6.101-7.4.0 #1 SMP PREEMPT Thu Sep 25 07:49:28 UTC 2025
Kernel command line:      root=PARTUUID=12b3663b-02 ro rootwait console=tty1 console=ttymxc2,115200
Distro name:              NAME="TDX Wayland with XWayland"
Distro version:           VERSION_ID=7.4.0-build.10
Distro variant:           -
Hostname:                 verdin-imx8mp-15603379
------------------------------------------------------------

Hardware info
------------------------------------------------------------
HW model:                 Toradex Verdin iMX8M Plus WB on Verdin Development Board
Toradex version:          0064 V1.1A
Serial number:            15603379
Processor arch:           aarch64

I added the section about touch panel in my dts overlay file:

/* Verdin I2C channel 1 */
&i2c1 {
	// Pin 44 (SAI3_TXFS, GPIO4_IO31) > INT_TOUCH#
    // Pin 48 (SAI3_RXD, GPIO4_IO30) > RST_TOUCH#
	status = "okay";

	ilitek@41 {
		compatible = "ilitek,ili251x";
		reg = <0x41>;
		pinctrl-names = "default";
		pinctrl-0 = <&pinctrl_i2s_2_d_in_gpio>,
			<&pinctrl_i2s_2_sync_gpio>; 

		interrupt-parent = <&gpio4>;
		interrupts = <31 IRQ_TYPE_EDGE_FALLING>;

		reset-gpios = <&gpio4 30 GPIO_ACTIVE_LOW>;
		status = "okay";
	};
};

i detect the device with i2cdetect:

root@verdin-imx8mp-15603379:/boot# i2cdetect -y 1
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:                         -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- 41 -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --

The i2c device address is 0x41 conntected to channel 1. I saw that ilitek251x driver is not load.

root@verdin-imx8mp-15603379:/boot#  zcat /proc/config.gz | grep TOUCHSCREEN_ILI
# CONFIG_TOUCHSCREEN_ILI210X is not set
CONFIG_TOUCHSCREEN_ILITEK=m

Now, since the touch on my display is not working, how can I enable it ?

Fabio

I have an update regarding this topic. I uploaded ilitek module:


root@verdin-imx8mp-15603379:/# lsmod | grep ili
ili210x                20480  0
crc_ccitt              12288  1 ili210x

this is my deice tree configuration regardin iomux configuration and i2c1 channel:

/* Verdin I2C channel 1 */
&i2c1 {
	// Pin 44 (SAI3_TXFS, GPIO4_IO31) > INT_TOUCH#
    // Pin 48 (SAI3_RXD, GPIO4_IO30) > RST_TOUCH#
	status = "okay";
	ilitek@41 {
		compatible = "ilitek,ili210x", "ilitek,ili251x";
		reg = <0x41>;
		pinctrl-0 = <&pinctrl_i2s_2_d_in_gpio>,
			<&pinctrl_i2s_2_sync_gpio>; 

		interrupt-parent = <&gpio4>;
		interrupts = <31 IRQ_TYPE_EDGE_FALLING>;
		reset-gpios = <&gpio4 30 GPIO_ACTIVE_LOW>;
	};
};

&iomuxc {
		/* Reset pin */
        pinctrl_i2s_2_d_in_gpio: gpio4io30grp {
                fsl,pins =
                        <MX8MP_IOMUXC_SAI3_RXD__GPIO4_IO30 0x184>;
        };

		/* Interrupt pin */
        pinctrl_i2s_2_sync_gpio: gpio4io31grp {
                fsl,pins =
                        <MX8MP_IOMUXC_SAI3_TXFS__GPIO4_IO31 0x1c4>;
        };

};

The device is detected from the system, because when i run i2cdetetct command i have this response:


root@verdin-imx8mp-15603379:/#
root@verdin-imx8mp-15603379:/# i2cdetect -y 1
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:                         -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- 41 -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --

After applying the DTS configuration, when I touch the display, the kernel outputs the following messages:

root@verdin-imx8mp-15603379:/#
root@verdin-imx8mp-15603379:/# [ 2230.003429] ili210x_i2c 0-0041: ili210x_read_reg failed: -6
[ 2230.009043] ili210x_i2c 0-0041: Unable to get touch data: -6
[ 2230.055146] ili210x_i2c 0-0041: ili210x_read_reg failed: -6
[ 2230.060764] ili210x_i2c 0-0041: Unable to get touch data: -6
[ 2230.106869] ili210x_i2c 0-0041: ili210x_read_reg failed: -6
[ 2230.112505] ili210x_i2c 0-0041: Unable to get touch data: -6
[ 2230.158570] ili210x_i2c 0-0041: ili210x_read_reg failed: -6
[ 2230.164200] ili210x_i2c 0-0041: Unable to get touch data: -6
[ 2230.208570] ili210x_i2c 0-0041: ili210x_read_reg failed: -6
[ 2230.214179] ili210x_i2c 0-0041: Unable to get touch data: -6
[ 2230.220148] ili210x_i2c 0-0041: ili210x_read_reg failed: -6
[ 2230.225759] ili210x_i2c 0-0041: Unable to get touch data: -6
[ 2230.266644] ili210x_i2c 0-0041: ili210x_read_reg failed: -6
[ 2230.272274] ili210x_i2c 0-0041: Unable to get touch data: -6
[ 2230.318365] ili210x_i2c 0-0041: ili210x_read_reg failed: -6
[ 2230.324007] ili210x_i2c 0-0041: Unable to get touch data: -6
[ 2230.368337] ili210x_i2c 0-0041: ili210x_read_reg failed: -6
[ 2230.373974] ili210x_i2c 0-0041: Unable to get touch data: -6

How can i resolve this issue? Thanks in advance for your help.

Hello @fmolon,

If your display has the ilitek 2511 touchscreen controller, your compatible string should be as follows:

compatible = "ilitek,ili251x";

If the driver is not loading, there could be other reasons.
Can you share your dmesg output with the configuration above?

Best Regards,
Bruno

Hello @bruno.tx ,

i updated dts file:

/\* Verdin I2C channel 1 \*/
&i2c1 {
// Pin 44 (SAI3_TXFS, GPIO4_IO31) > INT_TOUCH#
// Pin 48 (SAI3_RXD, GPIO4_IO30) > RST_TOUCH#
status = “okay”;
ilitek@41 {
compatible = “ilitek,ili251x”;
reg = <0x41>;
pinctrl-0 = <&pinctrl_i2s_2_d_in_gpio>,
<&pinctrl_i2s_2_sync_gpio>;


	interrupt-parent = <&gpio4>;
	interrupts = <31 IRQ_TYPE_EDGE_FALLING>;
	reset-gpios = <&gpio4 30 GPIO_ACTIVE_LOW>;
};


};
&iomuxc {
/\* Reset pin */
pinctrl_i2s_2_d_in_gpio: gpio4io30grp {
fsl,pins =
<MX8MP_IOMUXC_SAI3_RXD__GPIO4_IO30 0x184>; /* SODIMM 48 \*/
};


	/* Interrupt pin */
    pinctrl_i2s_2_sync_gpio: gpio4io31grp {
            fsl,pins =
                    <MX8MP_IOMUXC_SAI3_TXFS__GPIO4_IO31 0x1c4>; /* SODIMM 44 */
    };

};

but i haven’t solved the problem. I attach the kernel log file with debug level 7. Moreover if i run

i2cdetetct -y 1

command, i have the follow result:

root@verdin-imx8mp-15603379:/#
root@verdin-imx8mp-15603379:/# i2cdetect -y 1
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:                         -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- 41 -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --

kernel_log.txt (35.8 KB)

Thanks for the help @bruno.tx

Fabio

Hello @fmolon,

The numbering of the i2c under linux and under the device tree is not always 1:1.

I think your touchscreen may be connected to i2c2 on the device tree.
Can you try to change this in your overlay?

Instead of:

&i2c1

Use:

&i2c2

Best Regards,
Bruno

Hi @bruno.tx ,

i chenged &i2c1 to &i2c2 and i resolved the issue. the touch panel work fine. Thanks soo muche for your help.

Fabio

Thanks for the update @fmolon.

I am glad you were able to get this resolved.

Best Regards,
Bruno