Edt-ft5x06 Touchscreen Driver for Apalis T30

Good afternoon,

I am trying to backport the edt-ft5x06 driver to 3.1.10 kernel for my Apalis T30 but I have some issues.
I am using this driver as starting point:
edt-ft5x06.c

and added these lines in board-apalis_t30.c board file

static struct edt_ft5x06_platform_data edt_ft5x06_pdata = {
        .irq_pin = APALIS_GPIO5,
        .reset_pin = APALIS_GPIO6,
        .pinmux_fusion_pins	= &pinmux_fusion_pins,
};

The problem is that i get segmentation fault when I try to compile the code and though the touchscreen0 device is found it doesn’t work at all.

here is my dmesg when i load the module

[  564.592467] gpio_request: gpio-128 (edt-ft5x06 reset) status -16
[  564.779965] edt_ft5x06 0-0035: crc error: 0xfc expected, got 0x40
[  564.786426] edt_ft5x06 0-0035: crc error: 0xfc expected, got 0x70
[  564.792887] edt_ft5x06 0-0035: crc error: 0xfc expected, got 0x71
[  564.799308] edt_ft5x06 0-0035: crc error: 0xfc expected, got 0x48
[  564.805981] edt_ft5x06 0-0035: crc error: 0xfc expected, got 0x73
[  564.812429] edt_ft5x06 0-0035: crc error: 0xfc expected, got 0x74
[  564.818538] Unable to handle kernel NULL pointer dereference at virtual address 0000000c
[  564.826663] pgd = e6f24000
[  564.829378] [0000000c] *pgd=a73f0831, *pte=00000000, *ppte=00000000
[  564.835718] Internal error: Oops: 817 [#1] PREEMPT SMP
[  564.840859] Modules linked in: edt_ft5x06(+) [last unloaded: edt_ft5x06]
[  564.847610] CPU: 0    Tainted: G        W    (3.1.10-gbe10973-dirty #19)
[  564.854338] PC is at edt_ft5x06_ts_probe+0x2f8/0x53c [edt_ft5x06]
[  564.860447] LR is at console_unlock+0x1b8/0x1ec
[  564.864987] pc : [<bf000718>]    lr : [<c005ba58>]    psr: 60000113
[  564.864998] sp : e7895d40  ip : e7895bd8  fp : e7895da4
[  564.876478] r10: e65f1b14  r9 : e79a9420  r8 : e79a9400
[  564.881707] r7 : c095ac68  r6 : 00000000  r5 : 00000000  r4 : e65f1ad0
[  564.888239] r3 : 00000018  r2 : c095d7a0  r1 : 60000193  r0 : fffffffb
[  564.894771] Flags: nZCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment user
[  564.901910] Control: 10c5387d  Table: a6f2404a  DAC: 00000015
[  564.907660] 
[  564.907665] LR: 0xc005b9d8:
[  564.911943] b9d8  eaffffd6 e1a08006 e5952068 e1a0100a e1a00008 ebfffe02 e121f009 eaffffb9
[  564.920242] b9f8  e5942004 e3a03000 e59f007c e5843028 e1520003 15843004 eb1708bc e59f0060
[  564.928540] ba18  eb008dcc e59f0060 eb170a60 e5942010 e1a01009 e5943008 e59f004c e1520003
[  564.936837] ba38  13a07001 eb1708c6 e3570000 1a000004 e51b3030 e3530000 0a000006 ebffff70
[  564.945128] ba58  ea000004 ebfffe63 e3500000 0afffff7 e3a07001 eaffff9b e24bd028 e89daff0
[  564.953426] ba78  c09a4d98 c095d780 c095d740 c09a4e4c c095d7a8 e1a0c00d e92ddff0 e24cb004
[  564.961722] ba98  e24dd05c e52de004 e8bd4000 e59f540c e1a07000 e1a0a001 e5953034 e50b3064
[  564.970020] bab8  e59f33fc e5934004 e3540000 1a000013 e1a0300d e3c33d7f e3c3303f e5932004
[  564.978319] 
[  564.978324] SP: 0xe7895cc0:
[  564.982604] 5cc0  e7895cf0 00000000 c095ac68 e65f1ad0 00000000 00000000 bf000718 60000113
[  564.990893] 5ce0  ffffffff e7895d2c e7895da4 e7895cf8 c000db18 c00082d8 fffffffb 60000193
[  564.999189] 5d00  c095d7a0 00000018 e65f1ad0 00000000 00000000 c095ac68 e79a9400 e79a9420
[  565.007481] 5d20  e65f1b14 e7895da4 e7895bd8 e7895d40 c005ba58 bf000718 60000113 ffffffff
[  565.015779] 5d40  e7895d61 00000000 e7005d94 e7895d58 c0145f6c c01454bc c007f620 c007e77c
[  565.024074] 5d60  bbbbbb00 bbbbbbbb bbbbbbbb bbbbbbbb bbbbbbbb 00bbbbbb 00000000 bf0012b4
[  565.032369] 5d80  e79a9400 bf000420 e79a9404 bf001748 00000001 00000000 e7895dc4 e7895da8
[  565.040667] 5da0  c03e57b0 bf00042c e79a9420 e79a9454 c0a09bf0 c0980a18 e7895dec e7895dc8
[  565.048962] 
[  565.048967] IP: 0xe7895b58:
[  565.053243] 5b58  c007f884 c095fdc8 00292b28 e7895cf8 e7894000 e7895cf8 e6dc6580 e7894000
[  565.061534] 5b78  e7895bfc e7895b88 c0011b0c c000f1b4 00000006 0000000b 00000000 e73f0000
[  565.069827] 5b98  e65d1240 e65d1240 00000817 e65d127c e7895bcc e7895bb8 c06182d8 c005ba98
[  565.078123] 5bb8  e65d1240 e7895bd4 e7895bfc e7895be0 c00155fc c06182bc c07daa25 0000000c
[  565.086415] 5bd8  e7895cf8 00000817 e65d1240 e65d1240 00000817 e65d127c e7895c14 e7895c00
[  565.094707] 5bf8  c0617dd4 c0011a38 00000817 e6dc6580 e7895c4c e7895c18 c0015870 c0617d7c
[  565.103002] 5c18  0000000f 60000113 00000000 00000817 c0939264 0000000c e7895cf8 e79a9400
[  565.111295] 5c38  e79a9420 e65f1b14 e7895cf4 e7895c50 c0008310 c0015668 e79a60d0 e79a60c0
[  565.119593] 
[  565.119598] FP: 0xe7895d24:
[  565.123880] 5d24  e7895da4 e7895bd8 e7895d40 c005ba58 bf000718 60000113 ffffffff e7895d61
[  565.132179] 5d44  00000000 e7005d94 e7895d58 c0145f6c c01454bc c007f620 c007e77c bbbbbb00
[  565.140482] 5d64  bbbbbbbb bbbbbbbb bbbbbbbb bbbbbbbb 00bbbbbb 00000000 bf0012b4 e79a9400
[  565.148777] 5d84  bf000420 e79a9404 bf001748 00000001 00000000 e7895dc4 e7895da8 c03e57b0
[  565.157074] 5da4  bf00042c e79a9420 e79a9454 c0a09bf0 c0980a18 e7895dec e7895dc8 c0314e70
[  565.165369] 5dc4  c03e571c e79a9420 e79a9454 bf001748 c0980a18 e7894000 00000001 e7895e0c
[  565.173663] 5de4  e7895df0 c031500c c0314db0 00000000 bf001748 c0314f94 c0980a18 e7895e34
[  565.181959] 5e04  e7895e10 c0313a8c c0314fa0 e7937920 e799c478 c026f584 bf001748 e7946260
[  565.190251] 
[  565.190256] R2: 0xc095d720:
[  565.194535] d720  00000018 00000019 0000001a 0000001b 0000001c 0000001d 0000001e 0000001f
[  565.202831] d740  c09a525c 00020000 00000000 c095d74c c095d74c 00000000 00000000 000001f4
[  565.211128] d760  0000000a 00000000 00000000 00000000 0000000f 00000004 00000001 00000007
[  565.219420] d780  00000000 00000000 00000001 c095d78c c095d78c 00000001 00000000 00000000
[  565.227714] d7a0  c095d7a0 c095d7a0 00000004 ffffffff 00000000 00000001 ffffffff 00000001
[  565.236011] d7c0  00000000 00000001 00000000 00000000 c095d7d0 c095d7d0 00000000 00000000
[  565.244300] d7e0  c005cf30 c0958e10 00000000 00000001 00000000 00000000 c095d7f8 c095d7f8
[  565.252593] d800  00000000 00000000 c07b74cd c07812bc c0781291 c0781298 c07b60bd c078129f
[  565.260890] 
[  565.260895] R4: 0xe65f1a50:
[  565.265172] 1a50  6d726f66 6864732d 785c6963 65746432 2e617267 6d6d2d33 6f685f63 6d2d7473
[  565.273466] 1a70  2d30636d 30636d6d 3030303a 6c622d31 2d6b636f 62636d6d 2d306b6c 62636d6d
[  565.281760] 1a90  62306b6c 30746f6f 7665642e 2e656369 746e6177 f7ba0073 2000e87e 4630bdf8
[  565.290053] 1ab0  eadcf7ba 000bf06f bf00bdf8 4ff0e92d e79a9560 e79a9560 c03176ec 00000000
[  565.298351] 1ad0  e79a9400 00000000 fffbfffb 00000000 00000000 00000000 00000001 00000000
[  565.306648] 1af0  00000000 e65f1af4 e65f1af4 00000000 00000000 fffffffb fffffffb fffffffb
[  565.314944] 1b10  fffffffb bbbbbbbb bbbbbbbb bbbbbbbb bbbbbbbb bbbbbbbb 000000bb 2d6fdd21
[  565.323234] 1b30  80a0f000 2d70dd58 8145f000 d1202d73 2d737973 69766564 2d736563 74616c70
[  565.331535] 
[  565.331540] R7: 0xc095abe8:
[  565.335816] abe8  00000000 00000000 00000000 00000000 00000000 00000000 0000008f 000000a9
[  565.344103] ac08  00000001 c077f129 00000001 00000001 0000000a 00000000 00000000 00000000
[  565.352398] ac28  00000001 c0047c8c 00000001 0000000c 000002e0 00000002 00000000 00000000
[  565.360693] ac48  00000000 00000000 c095ac5c c095ac58 01000104 01000104 07030503 00000001
[  565.368989] ac68  00000096 00000080 c0047d98 00000000 00000000 00f42400 00000000 00000000
[  565.377288] ac88  00000000 00000000 00000001 00000001 00000001 ffffffff 00000000 00000002
[  565.385585] aca8  c095acf8 00000000 c095acd8 00000000 00000000 00000000 00000000 00000000
[  565.393873] acc8  00000000 00000000 00000000 00000000 c0047a2c c0047a14 00000000 00000003
[  565.402167] 
[  565.402172] R8: 0xe79a9380:
[  565.406449] 9380  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[  565.414743] 93a0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[  565.423033] 93c0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[  565.431322] 93e0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[  565.439617] 9400  00350000 2d746465 78357466 00003630 00000000 00000000 e79a60c0 bf001720
[  565.447912] 9420  e79a60f0 e799c440 e79ac220 e79aecfc e79a962c e79a60f8 e7819120 c09776d8
[  565.456211] 9440  e79ada28 00000003 00000007 00000000 c09809e8 00000000 00000000 00000000
[  565.464503] 9460  e79a9460 e79a9460 e6dc6580 c0980a18 bf001748 c095ac68 00000000 00000000
[  565.472797] 
[  565.472802] R9: 0xe79a93a0:
[  565.477078] 93a0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[  565.485364] 93c0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[  565.493662] 93e0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[  565.501957] 9400  00350000 2d746465 78357466 00003630 00000000 00000000 e79a60c0 bf001720
[  565.510254] 9420  e79a60f0 e799c440 e79ac220 e79aecfc e79a962c e79a60f8 e7819120 c09776d8
[  565.518548] 9440  e79ada28 00000003 00000007 00000000 c09809e8 00000000 00000000 00000000
[  565.526841] 9460  e79a9460 e79a9460 e6dc6580 c0980a18 bf001748 c095ac68 00000000 00000000
[  565.535133] 9480  00000000 00000000 e79aed58 e79a9688 7fffffff 00000000 00000000 e79a949c
[  565.543428] 
[  565.543433] R10: 0xe65f1a94:
[  565.547797] 1a94  30746f6f 7665642e 2e656369 746e6177 f7ba0073 2000e87e 4630bdf8 eadcf7ba
[  565.556091] 1ab4  000bf06f bf00bdf8 4ff0e92d e79a9560 e79a9560 c03176ec 00000000 e79a9400
[  565.564383] 1ad4  00000000 fffbfffb 00000000 00000000 00000000 00000001 00000000 00000000
[  565.572677] 1af4  e65f1af4 e65f1af4 00000000 00000000 fffffffb fffffffb fffffffb fffffffb
[  565.580969] 1b14  bbbbbbbb bbbbbbbb bbbbbbbb bbbbbbbb bbbbbbbb 000000bb 2d6fdd21 80a0f000
[  565.589265] 1b34  2d70dd58 8145f000 d1202d73 2d737973 69766564 2d736563 74616c70 6d726f66
[  565.597565] 1b54  6864732d 785c6963 65746432 2e617267 6d6d2d33 6f685f63 6d2d7473 2d30636d
[  565.605856] 1b74  30636d6d 3030303a 6c622d31 2d6b636f 62636d6d 2d306b6c 62636d6d 62306b6c
[  565.614155] Process modprobe (pid: 635, stack limit = 0xe78942f0)
[  565.620254] Stack: (0xe7895d40 to 0xe7896000)
[  565.624623] 5d40: e7895d61 00000000 e7005d94 e7895d58 c0145f6c c01454bc c007f620 c007e77c
[  565.632813] 5d60: bbbbbb00 bbbbbbbb bbbbbbbb bbbbbbbb bbbbbbbb 00bbbbbb 00000000 bf0012b4
[  565.641002] 5d80: e79a9400 bf000420 e79a9404 bf001748 00000001 00000000 e7895dc4 e7895da8
[  565.649191] 5da0: c03e57b0 bf00042c e79a9420 e79a9454 c0a09bf0 c0980a18 e7895dec e7895dc8
[  565.657380] 5dc0: c0314e70 c03e571c e79a9420 e79a9454 bf001748 c0980a18 e7894000 00000001
[  565.665568] 5de0: e7895e0c e7895df0 c031500c c0314db0 00000000 bf001748 c0314f94 c0980a18
[  565.673756] 5e00: e7895e34 e7895e10 c0313a8c c0314fa0 e7937920 e799c478 c026f584 bf001748
[  565.681944] 5e20: e7946260 00000000 e7895e44 e7895e38 c0314ab8 c0313a04 e7895e74 e7895e48
[  565.690132] 5e40: c03146e0 c0314a9c bf0015df e7895e58 c026f94c bf001748 c099eb80 bf004000
[  565.698321] 5e60: e7894000 e7894000 e7895e94 e7895e78 c03156e8 c03145f8 bf001720 c099eb80
[  565.706508] 5e80: bf004000 e7894000 e7895eac e7895e98 c03e7848 c0315644 bf0017a8 c099eb80
[  565.714694] 5ea0: e7895ebc e7895eb0 bf004018 c03e7804 e7895efc e7895ec0 c0008754 bf00400c
[  565.722880] 5ec0: e7895eec bf0017a8 00000001 e6586520 bf0017f0 bf0017a8 00000001 e6586520
[  565.731068] 5ee0: bf0017f0 e7894000 00000001 e6586544 e7895fa4 e7895f00 c00930bc c00086b8
[  565.739259] 5f00: bf0017b4 c0015668 00016d32 bf001904 c0090c3c 00000028 c061e488 c0274018
[  565.747444] 5f20: 00000000 00000000 00000000 00000000 00000000 00000000 e8fb1000 00024508
[  565.755633] 5f40: e8fd4d60 e8fcadc0 e8fcb9e0 e6cbf6c0 00001918 00001d38 00000000 00000000
[  565.763820] 5f60: 0000002f 00000030 00000019 00000016 00000012 00000000 00000002 00040000
[  565.772009] 5f80: 40132000 00016d32 00000080 c000e284 e7894000 00000000 00000000 e7895fa8
[  565.780198] 5fa0: c000e040 c0092390 00040000 40132000 40132000 00024508 00016d32 00000026
[  565.788387] 5fc0: 00040000 40132000 00016d32 00000080 00000000 00000000 00000000 0001edf0
[  565.796576] 5fe0: 402a6640 bebb9948 00012bf1 402a6650 60070010 40132000 f6dff339 c9eae840
[  565.804805] [<bf000718>] (edt_ft5x06_ts_probe+0x2f8/0x53c [edt_ft5x06]) from [<c03e57b0>] (i2c_device_probe+0xa0/0xd4)
[  565.815535] [<c03e57b0>] (i2c_device_probe+0xa0/0xd4) from [<c0314e70>] (driver_probe_device+0xcc/0x19c)
[  565.825038] [<c0314e70>] (driver_probe_device+0xcc/0x19c) from [<c031500c>] (__driver_attach+0x78/0x9c)
[  565.834453] [<c031500c>] (__driver_attach+0x78/0x9c) from [<c0313a8c>] (bus_for_each_dev+0x94/0xa4)
[  565.843519] [<c0313a8c>] (bus_for_each_dev+0x94/0xa4) from [<c0314ab8>] (driver_attach+0x28/0x30)
[  565.852409] [<c0314ab8>] (driver_attach+0x28/0x30) from [<c03146e0>] (bus_add_driver+0xf4/0x230)
[  565.861212] [<c03146e0>] (bus_add_driver+0xf4/0x230) from [<c03156e8>] (driver_register+0xb0/0x128)
[  565.870277] [<c03156e8>] (driver_register+0xb0/0x128) from [<c03e7848>] (i2c_register_driver+0x50/0xc0)
[  565.879705] [<c03e7848>] (i2c_register_driver+0x50/0xc0) from [<bf004018>] (edt_ft5x06_ts_driver_init+0x18/0x24 [edt_ft5x06])
[  565.891034] [<bf004018>] (edt_ft5x06_ts_driver_init+0x18/0x24 [edt_ft5x06]) from [<c0008754>] (do_one_initcall+0xa8/0x164)
[  565.902100] [<c0008754>] (do_one_initcall+0xa8/0x164) from [<c00930bc>] (sys_init_module+0xd38/0x1964)
[  565.911430] [<c00930bc>] (sys_init_module+0xd38/0x1964) from [<c000e040>] (ret_fast_syscall+0x0/0x30)
[  565.920662] Code: e1a00004 ebfffe8f e3a03018 e1c400ba (e1c630bc) 
[  565.932147] ---[ end trace aa6871aee5f6b830 ]---

and the result of i2cdetect

root@apalis-t30:~#  -y -r 0
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- 35 -- -- -- -- -- -- -- -- -- -- 
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
50: -- -- -- -- -- -- -- -- 58 -- -- -- -- -- -- -- 
60: -- -- -- -- -- -- -- -- UU -- -- -- -- -- -- -- 
70: -- -- -- -- -- -- -- --                         

Do you have any suggestions?

Best regards

Platform device registration and platform device is missing for binding the platform data.

static struct edt_ft5x06_platform_data edt_ft5x06_pdata = {
         .irq_pin = APALIS_GPIO5,
         .reset_pin = APALIS_GPIO6,
 };

  /* GEN1_I2C: I2C1_SDA/SCL on MXM3 pin 209/211 (e.g. RTC on carrier board) */
static struct i2c_board_info apalis_t30_i2c_bus1_board_info[] __initdata = {
	{
		/* M41T0M6 real time clock on carrier board */
		I2C_BOARD_INFO("rtc-ds1307", 0x68),
			.type = "m41t00",
	},
 	{
		/* EDT controller */
		I2C_BOARD_INFO("edt-ft5x06", 0x38),
			.platform_data = &edt_ft5x06_pdata,
	},
};

A platform device and platform data should be present on lines similar to the above. This then gets registered here.

There is no pinmux entry in the platform data as per here. Has it been added correctly?

Hi Sanchayan, thank you for your suggestions,
I made the corrections, I forgot to add the registration in apalis_t30_init().
Now I am getting another error while probing the driver:

[  632.226521] edt_ft5x06 0-0035: crc error: 0xfc expected, got 0x40
[  632.232942] edt_ft5x06 0-0035: crc error: 0xfc expected, got 0x70
[  632.239415] edt_ft5x06 0-0035: crc error: 0xfc expected, got 0x71
[  632.245832] edt_ft5x06 0-0035: crc error: 0xfc expected, got 0x48
[  632.252303] edt_ft5x06 0-0035: crc error: 0xfc expected, got 0x73
[  632.258768] edt_ft5x06 0-0035: crc error: 0xfc expected, got 0x74
[  632.264884] edt_ft5x06 0-0035: Unable to request touchscreen IRQ.
[  632.271030] edt_ft5x06: probe of 0-0035 failed with error -22

I checked with an oscilloscope and the IRQ signal is correct on GPIO5

GPIO5 and GPIO6 are used for the irq and reset functionality. Did you also disable them here? These are exported as regular GPIO’s by default.

The crc errors point to communication errors what was expected is not what was received. Are the I2C lines correctly connected? Can you check with a scope or logic analyzer if the communication on those lines is correct?

Please have a look at the platform device addition again. It should have been with I2C board info. I changed the answer to reflect that.

I tested with the scope the i2c line and it works correctly. When I run i2cdetect it answers as I expect.
I change my board file according to your advices and removed the default export of GPIO5 and GPIO6 but I still get this error when I try to probe the driver.

[   57.811423] gpio_request: gpio-128 (edt-ft5x06 reset) status -16
[   57.811459] edt_ft5x06 0-0035: Failed to request GPIO 128 as reset pin, error -16
[   57.818965] edt_ft5x06: probe of 0-0035 failed with error -16

I must be missing something…

Now it seems it could not get the reset pin. Note that a pin requested or registered by any other driver will result in a failed request which is what you see in the error logs. Can you share the diff of the kernel source tree? Just provide the output of

git diff

I believe you included the driver from the 3.14.52 tree as is or are there any changes to the platform data structure? The diff will help me see the changes you made.

I add the results of cat /sys/kernel/debug/gpio

GPIOs 0-255, tegra-gpio:
 gpio-26  (THERMD_ALERT_N      ) in  hi
 gpio-68  (RESET_MOCI_N        ) out hi
 gpio-77  (EN_+3.3_SDMMC3      ) out hi
 gpio-111 (HDMI1_HPD           ) in  lo
 gpio-128 (edt-ft5x06 reset    ) out hi
 gpio-129 (GPIO8 X1-15, FAN    ) in  hi
 gpio-146 (GPIO1 X1-1          ) in  hi
 gpio-147 (GPIO2 X1-3          ) in  lo
 gpio-148 (GPIO3 X1-5          ) in  lo
 gpio-149 (GPIO4 X1-7          ) in  hi
 gpio-150 (edt-ft5x06 irq      ) in  hi
 gpio-151 (PEX_PERST_N         ) out hi
 gpio-153 (VI_LevelShifter_DIR ) out lo
 gpio-168 (TOUCH_PEN_INT       ) in  hi
 gpio-169 (KEY_WAKEUP          ) in  hi
 gpio-170 (BKL1_ON             ) out hi
 gpio-171 (sdhci_cd            ) in  lo
 gpio-216 (LVDS: Single/Dual Ch) out lo
 gpio-219 (LVDS: 18/24 Bit Mode) out hi
 gpio-220 (LVDS: Output Enable ) out hi
 gpio-221 (LVDS: Power Down    ) out hi
 gpio-222 (LVDS: Clock Polarity) out hi
 gpio-223 (LVDS: Colour Mapping) out hi
 gpio-225 (LVDS: Swing Mode    ) out hi
 gpio-226 (LVDS: DDRclk Disable) out hi
 gpio-229 (sdhci_cd            ) in  hi
 gpio-232 (SATA1_ACT_N         ) out hi
 gpio-233 (usb_host_vbus       ) out hi

GPIOs 256-264, i2c/4-002d, tps6591x, can sleep:
 gpio-262 (fixed_reg_en_hdmi   ) out lo

It seems the pins are correctly assigned

putting the module in autoload when system is starting somehow fixed the -16 error.
still remains -22

[   13.654395] systemd-journald[122]: Received request to flush runtime journal from PID 1
[   14.100935] edt_ft5x06 0-0035: crc error: 0xfc expected, got 0x40
[   14.109976] edt_ft5x06 0-0035: crc error: 0xfc expected, got 0x70
[   14.126356] edt_ft5x06 0-0035: crc error: 0xfc expected, got 0x71
[   14.138011] edt_ft5x06 0-0035: crc error: 0xfc expected, got 0x48
[   14.147552] edt_ft5x06 0-0035: crc error: 0xfc expected, got 0x73
[   14.160155] edt_ft5x06 0-0035: crc error: 0xfc expected, got 0x74
[   14.168932] edt_ft5x06 0-0035: Unable to request touchscreen IRQ.
[   14.176634] edt_ft5x06: probe of 0-0035 failed with error -22

The I2C address you specify is 0x35. Should it not be 0x38? Is is really EDT based touch display? As per device tree binding documentation these contollers have I2C address 0x38. The IRQ request seems to be failing here. Can you check from where exactly it is returning EINVAL -22?

I see some discrepancies in your driver. Can you try with this?

I am trying with 2 different displays, one is 10" based on FT5606 and the other is 7" based on FT5306. The first one has address 0x38 and the second 0x35. The driver should be the same but I can’t manage to get none of them working.

I tried with 0x38 for the 7" and this is the dmesg

    [   18.461144] tegra-i2c tegra-i2c.0: I2c error status 0x00000008
    [   18.468045] tegra-i2c tegra-i2c.0: no acknowledge from address 0x38
    [   18.475338] tegra-i2c tegra-i2c.0: Packet status 0x00010009
    [   18.482572] edt_ft5x06 0-0038: touchscreen probe failed
    [   18.488979] edt_ft5x06: probe of 0-0038 failed with error -121

but if I use 0x35 this is what I get.

[   14.334081] edt_ft5x06 0-0035: crc error: 0xfc expected, got 0x40
[   14.348634] edt_ft5x06 0-0035: crc error: 0xfc expected, got 0x70
[   14.356493] edt_ft5x06 0-0035: crc error: 0xfc expected, got 0x71
[   14.364490] edt_ft5x06 0-0035: crc error: 0xfc expected, got 0x48
[   14.373666] edt_ft5x06 0-0035: crc error: 0xfc expected, got 0x73
[   14.383057] edt_ft5x06 0-0035: crc error: 0xfc expected, got 0x74
[   14.390242] edt_ft5x06 0-0035: Unable to request touchscreen IRQ.
[   14.397667] edt_ft5x06: probe of 0-0035 failed with error -22

I just tried overwriting the driver you sent me but i still get the same error.
The IRQ is failing just where you pointed at.

@Sengir You might want to have a look at the posts here and here.

This is the diff for the edt-ft5x06.c
diff --git a/drivers/input/touchscreen/edt-ft5x06.c b/drivers/input/touchscreen/edt-ft5x06.c
index 412a85e…35613448 100644
— a/drivers/input/touchscreen/edt-ft5x06.c
+++ b/drivers/input/touchscreen/edt-ft5x06.c
@@ -59,6 +59,20 @@
#define EDT_RAW_DATA_RETRIES 100
#define EDT_RAW_DATA_DELAY 1 /* msec */

+#ifndef dev_err_ratelimited
+#define dev_level_ratelimited(dev_level, dev, fmt, ...)                 \
+do {                                                                    \
+        static DEFINE_RATELIMIT_STATE(_rs,                              \
+                                      DEFAULT_RATELIMIT_INTERVAL,       \
+                                      DEFAULT_RATELIMIT_BURST);         \
+        if (__ratelimit(&_rs))                                          \
+                dev_level(dev, fmt, ##__VA_ARGS__);                     \
+} while (0)
+
+#define dev_err_ratelimited(dev, fmt, ...)                              \
+        dev_level_ratelimited(dev_err, dev, fmt, ##__VA_ARGS__)
+#endif
+
 struct edt_ft5x06_ts_data {
 	struct i2c_client *client;
 	struct input_dev *input;
@@ -489,6 +503,15 @@ static int edt_ft5x06_debugfs_mode_set(void *data, u64 mode)
 
 DEFINE_SIMPLE_ATTRIBUTE(debugfs_mode_fops, edt_ft5x06_debugfs_mode_get,
 			edt_ft5x06_debugfs_mode_set, "%llu\n");
+			
+static int edt_ft5x06_debugfs_raw_data_open(struct inode *inode,
+					    struct file *file)
+{
+	file->private_data = inode->i_private;
+
+	return 0;
+}
+
 
 static ssize_t edt_ft5x06_debugfs_raw_data_read(struct file *file,
 				char __user *buf, size_t count, loff_t *off)
@@ -570,7 +593,7 @@ out:
 
 
 static const struct file_operations debugfs_raw_data_fops = {
-	.open = simple_open,
+	.open = edt_ft5x06_debugfs_raw_data_open,
 	.read = edt_ft5x06_debugfs_raw_data_read,
 };
 
@@ -620,12 +643,12 @@ static int edt_ft5x06_ts_reset(struct i2c_client *client,
 					 int reset_pin)
 {
 	int error;
-
+	
 	if (gpio_is_valid(reset_pin)) {
 		/* this pulls reset down, enabling the low active reset */
-		error = devm_gpio_request_one(&client->dev, reset_pin,
-					      GPIOF_OUT_INIT_LOW,
-					      "edt-ft5x06 reset");
+		error = gpio_request(reset_pin, "edt-ft5x06 reset");
+		gpio_direction_output(reset_pin, 0);
+	
 		if (error) {
 			dev_err(&client->dev,
 				"Failed to request GPIO %d as reset pin, error %d\n",
@@ -711,7 +734,7 @@ static int edt_ft5x06_ts_probe(struct i2c_client *client,
 	struct input_dev *input;
 	int error;
 	char fw_version[EDT_NAME_LEN];
-
+	
 	dev_dbg(&client->dev, "probing for EDT FT5x06 I2C\n");
 
 	if (!pdata) {
@@ -724,8 +747,8 @@ static int edt_ft5x06_ts_probe(struct i2c_client *client,
 		return error;
 
 	if (gpio_is_valid(pdata->irq_pin)) {
-		error = devm_gpio_request_one(&client->dev, pdata->irq_pin,
-					      GPIOF_IN, "edt-ft5x06 irq");
+		error = gpio_request_one(pdata->irq_pin,
+					 GPIOF_IN, "edt-ft5x06 irq");
 		if (error) {
 			dev_err(&client->dev,
 				"Failed to request GPIO %d, error %d\n",
@@ -740,7 +763,7 @@ static int edt_ft5x06_ts_probe(struct i2c_client *client,
 		return -ENOMEM;
 	}
 
-	input = devm_input_allocate_device(&client->dev);
+	input = input_allocate_device();
 	if (!input) {
 		dev_err(&client->dev, "failed to allocate input device.\n");
 		return -ENOMEM;
@@ -778,7 +801,7 @@ static int edt_ft5x06_ts_probe(struct i2c_client *client,
 			     0, tsdata->num_x * 64 - 1, 0, 0);
 	input_set_abs_params(input, ABS_MT_POSITION_Y,
 			     0, tsdata->num_y * 64 - 1, 0, 0);
-	error = input_mt_init_slots(input, MAX_SUPPORT_POINTS, 0);
+	error = input_mt_init_slots(input, MAX_SUPPORT_POINTS);
 	if (error) {
 		dev_err(&client->dev, "Unable to init MT slots.\n");
 		return error;

and these are the modifications for makefile and kernel configs

diff --git a/arch/arm/mach-tegra/board-apalis_t30.c b/arch/arm/mach-tegra/board-apalis_t30.c
index 4715676..2c63fa4 100644
--- a/arch/arm/mach-tegra/board-apalis_t30.c
+++ b/arch/arm/mach-tegra/board-apalis_t30.c
@@ -16,6 +16,7 @@
 #include <linux/i2c.h>
 #include <linux/i2c-tegra.h>
 #include <linux/input/fusion_F0710A.h>
+#include <linux/input/edt-ft5x06.h>
 #include <linux/input.h>
 #include <linux/io.h>
 #include <linux/leds.h>
@@ -472,12 +473,16 @@ static struct gpio apalis_t30_gpios[] = {
 	{APALIS_GPIO2,		GPIOF_IN,		"GPIO2 X1-3"},
 	{APALIS_GPIO3,		GPIOF_IN,		"GPIO3 X1-5"},
 	{APALIS_GPIO4,		GPIOF_IN,		"GPIO4 X1-7"},
+	
+	/* tolgo i GPIO esportati di default
 #ifndef POWER_GPIO
 	{APALIS_GPIO5,		GPIOF_IN,		"GPIO5 X1-9"},
 #endif
 #ifndef FORCE_OFF_GPIO
 	{APALIS_GPIO6,		GPIOF_IN,		"GPIO6 X1-11"},
 #endif
+ */
+ 
 	/* GPIO7 is used by PCIe driver on Evaluation board */
 /*	{APALIS_GPIO7,		GPIOF_IN,		"GPIO7 X1-13"}, */
 	{APALIS_GPIO8,		GPIOF_IN,		"GPIO8 X1-15, FAN"},
@@ -537,6 +542,12 @@ static struct fusion_f0710a_init_data apalis_fusion_pdata = {
 	.pinmux_fusion_pins	= &pinmux_fusion_pins,
 };
 
+static struct edt_ft5x06_platform_data edt_ft5x06_pdata = {
+          .irq_pin = APALIS_GPIO5,
+          .reset_pin = APALIS_GPIO6,
+  };
+
+
 static int pinmux_fusion_pins(void)
 {
 	gpio_free(apalis_fusion_pdata.gpio_int);
@@ -552,18 +563,18 @@ static int pinmux_fusion_pins(void)
    for I2C */
 
 /* GEN1_I2C: I2C1_SDA/SCL on MXM3 pin 209/211 (e.g. RTC on carrier board) */
-static struct i2c_board_info apalis_t30_i2c_bus1_board_info[] __initdata = {
-	{
-		/* M41T0M6 real time clock on carrier board */
-		I2C_BOARD_INFO("rtc-ds1307", 0x68),
-			.type = "m41t00",
-	},
-	{
-		/* TouchRevolution Fusion 7 and 10 multi-touch controller */
-		I2C_BOARD_INFO("fusion_F0710A", 0x10),
-			.platform_data = &apalis_fusion_pdata,
-	},
-};
+ static struct i2c_board_info apalis_t30_i2c_bus1_board_info[] __initdata = {
+     {
+         /* M41T0M6 real time clock on carrier board */
+         I2C_BOARD_INFO("rtc-ds1307", 0x68),
+             .type = "m41t00",
+     },
+      {
+         /* EDT controller */
+         I2C_BOARD_INFO("edt-ft5x06", 0x35),
+             .platform_data = &edt_ft5x06_pdata,
+     },
+ };
 
 static struct tegra_i2c_platform_data apalis_t30_i2c1_platform_data = {
 	.adapter_nr	= 0,
diff --git a/drivers/input/touchscreen/Kconfig b/drivers/input/touchscreen/Kconfig
index 936f1e7..587a8dd 100644
--- a/drivers/input/touchscreen/Kconfig
+++ b/drivers/input/touchscreen/Kconfig
@@ -363,6 +363,19 @@ config TOUCHSCREEN_PENMOUNT
 	  To compile this driver as a module, choose M here: the
 	  module will be called penmount.
 
+config TOUCHSCREEN_EDT_FT5X06
+	tristate "EDT FocalTech FT5x06 I2C Touchscreen support"
+	depends on I2C
+	help
+	  Say Y here if you have an EDT "Polytouch" touchscreen based
+	  on the FocalTech FT5x06 family of controllers connected to
+	  your system.
+
+	  If unsure, say N.
+
+	  To compile this driver as a module, choose M here: the
+	  module will be called edt-ft5x06.
+
 config TOUCHSCREEN_MIGOR
 	tristate "Renesas MIGO-R touchscreen"
 	depends on SH_MIGOR && I2C
diff --git a/drivers/input/touchscreen/Makefile b/drivers/input/touchscreen/Makefile
index 2fa571b..ef6db6e 100644
--- a/drivers/input/touchscreen/Makefile
+++ b/drivers/input/touchscreen/Makefile
@@ -19,6 +19,7 @@ obj-$(CONFIG_TOUCHSCREEN_BU21013)       += bu21013_ts.o
 obj-$(CONFIG_TOUCHSCREEN_CY8CTMG110)	+= cy8ctmg110_ts.o
 obj-$(CONFIG_TOUCHSCREEN_DA9034)	+= da9034-ts.o
 obj-$(CONFIG_TOUCHSCREEN_DYNAPRO)	+= dynapro.o
+obj-$(CONFIG_TOUCHSCREEN_EDT_FT5X06)	+= edt-ft5x06.o
 obj-$(CONFIG_TOUCHSCREEN_HAMPSHIRE)	+= hampshire.o
 obj-$(CONFIG_TOUCHSCREEN_GUNZE)		+= gunze.o
 obj-$(CONFIG_TOUCHSCREEN_EETI)		+= eeti_ts.o

unable to find arch/arm/mach-tegra/board-apalis_t30.c from my kernal source.

And what exact sources might that be that you are using? Or asked differently what BSP version are you targeting?

I am using toradex_4.1-2.0.x-imx kernal source for colibri imx7 with voila board.

Could it be that you hijacked this thread? If you would actually read the question on top you may have noticed that this thread is about getting an edt-ft5x06 touchscreen working on Apalis T30. If that is not what you are looking for please ask a new question. Thanks!

Just for a reference i am looking arch/arm/mach-tegra/board-apalis_t30.c , or some thing like arch/arm/mach-imx/board-*.c for configure edt-ft5x06 gpio pins, I am also looking for same problem on colibri imx7d. but i unable to find the board-*.c file.

As mentioned above this whole thread is really only applicable to the older downstream Tegra T20/T30 stuff which still used platform data in such board files. Nowadays any such would simply be done via device tree as may be gleaned at from any pertinent documentation thereof.