Set device tree for driver touchscreen ILI251x

Hello,

I have devkit b01 with Jetson Nano.
I would like to configure system for I2C touchpanel based on ILI251x. I connected touchscreen via I2C0 and PY.02 (INT) and PBB.00 (RST).
I added driver to Kernel modules - I event on list in evtest tool. But I have errors with configuration reset and interrupt pin. Log from dmesg: dmesg_log.txt (62.4 KB)
DTS file which I modify: tegra210-porg-p3448-common.dtsi (20.9 KB) tegra210-porg-pinmux-p3448-0000-b00.dtsi (38.2 KB)
Can you verify my definition of gpio and interrupt?

hello mateusz,

it reports an invalid GPIO failure.
for example,

...
[    1.184540] [ILITEK][ERR][ilitek_get_gpio_num:1557] reset_gpio = -22
[    1.184561] OF: /i2c@7000c000/ilitek@41: could not get #gpio-cells for /pinmux@700008d4
[    1.192589] [ILITEK][ERR][ilitek_get_gpio_num:1560] irq_gpio = -22
[    1.192593] [ILITEK][MSG][ilitek_get_gpio_num:1567] reset_gpio = -22 irq_gpio = -22
[    1.192599] [ILITEK][MSG][ilitek_reset:454] delay: 1000
[    1.192602] [ILITEK][ERR][ilitek_reset:494] reset pin is invalid...

for narrow down the issue,
could you please follow below formula to calculate the GPIO number, and using the GPIO number directly in the kernel APIs to access the pin,
for example,

#define TEGRA_GPIO_PORT_Y 24
#define TEGRA_GPIO(port, offset) \
  	((TEGRA_GPIO_PORT_##port * 8) + offset)

PY.02 = 24*8 + 2 = 194

I wrote pins number directly to dts, where driver is described:tegra210-porg-p3448-common.dtsi (20.8 KB)
PY.02 = 24 * 8 + 2 = 194
PBB.00 = 27 * 8 + 0 = 216
But problem is the same as previous. Dmesg:Jetson_dmesg.txt (62.3 KB)
Do you have any idea what is wrong?

hello mateusz,

could you please have a try to change the parent as GPIO.
for example,

		interrupt-parent = <&gpio>;

besides,
you should also have a try for not parsing through device tree but using kernel APIs to controls the pin,

I changed to:
interrupt-parent = <&gpio>;
interrupts = <194 IRQ_TYPE_EDGE_FALLING>;
ilitek,irq-gpio = <&gpio 194 GPIO_ACTIVE_HIGH>;
ilitek,reset-gpio = <&gpio 216 GPIO_ACTIVE_HIGH>;
It resolved my problem. Thank you for this advice.
Can you show me where is declaration about parent &gpio ? In tegra210-porg-pinmux-p3448-0000-b00.dtsi are only &pinmux.

hello mateusz,

please refer to tegra210-soc-base.dtsi for t210 node definition, (i.e. Nano and TX1 series platforms)
you may check below for GPIO definition,
$L4T_Sources/r32.6.1/Linux_for_Tegra/source/public/hardware/nvidia/soc/t210/kernel-dts/tegra210-soc/tegra210-soc-base.dtsi

        gpio: gpio@6000d000 {
                compatible = "nvidia,tegra210-gpio", "nvidia,tegra124-gpio", "nvidia,tegra30-gpio";
                reg = <0x0 0x6000d000 0x0 0x1000>;
                interrupts = <0 32 0x04
                                0 33 0x04
                                0 34 0x04
                                0 35 0x04
                                0 55 0x04
                                0 87 0x04
                                0 89 0x04
                                0 125 0x04>;
                #gpio-cells = <2>;
                gpio-controller;
                #interrupt-cells = <2>;
                interrupt-controller;
                gpio-ranges = <&pinmux 0 0 246>;
                status = "disabled";
        };

you should also check below for reference driver for using gpio interrupt.
$L4T_Sources/r32.6.1/Linux_for_Tegra/source/public/hardware/nvidia/platform/t210/common/kernel-dts/t210-common-platforms/tegra210-platform-common-sensor.dtsi

        i2c@7000c000 {
                icm20628@68 {
                        compatible = "invensense,mpu6xxx";
                        reg = <0x68>;
                        interrupt-parent = <&gpio>;
                        interrupts = <TEGRA_GPIO(X, 2) 0x00>;

It is necessary to change something in tegra210-platform-common-sensor.dtsi and tegra210-soc-base.dtsi ? Or do you sent me this fo reference to my question?

hello mateusz,

it just device tree driver for your reference,
those sources were code snippets from L4T Driver Package (BSP) Sources via Jetson Linux | NVIDIA Developer.
thanks

Can you check again my device tree declarations?
tegra210-porg-p3448-common.dtsi (20.8 KB)
tegra210-porg-pinmux-p3448-0000-b00.dtsi (38.2 KB)
I have problem with interrupt - system doesn’t see any interrupt from touchscreen. Driver is correctly installed. Log from dmesg: ILI251x_dmesg.txt (60.0 KB)

hello mateusz,

don’t you said you’ve resolved the issue?
please also check $ cat /proc/interrupts to examine your configuration.

I checked again on oscilloscope my hardware and for example, INT change when I touch the touchscreen. But in /proc/interrupts the number of interrupts is constant.
cat_proc_interrupts.txt (8.3 KB)
Could you check my device tree which I sent above?

hello mateusz,

I am not sure IRQ_TYPE_EDGE_FALLING actually works here.
could you please try define the property as below.
for example,

		ilitek@41 {
			compatible = "tchip,ilitek";
			reg = <0x41>;
			interrupt-parent = <&gpio>;
			interrupts = <194 0x01>;

please also enable kernel logs. $dmesg --follow,
please check whether kernel side detect your touch events.

Change the line: interrupts = <194 0x01> doesn’t help. I changed gpio int to PS.05:
interrupts = <149 0x01>;
ilitek,irq-gpio = <&gpio 149 GPIO_ACTIVE_HIGH>;
But this doesn’t help too.
In $dmesg --follow containt disturbing information on the end of file:
23.019041] [ILITEK][MSG][ilitek_irq_disable:284]
Do you know why ilitek_irq is disable?

please also check this topic for reference, gpio interrupts from user space

Thank you for reference but this topic is for user space. I want to use driver which need device tree.
I have questions about below line in gpio definition in device tree:
nvidia,function = “rsvd1”;

  1. rsvd means reserved?
  2. What I must set in nvidia.function when I want to use as gpio?

hello mateusz,

please also refer to [3.3 GPIO Pins] of Nano datasheets.
GPIO01/ GPIO3_PS.05, it has alternate function as Camera MCLK #2 (CLK).
please consider the pin without “Alternate Function”.
thanks

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.