Part Number: TMDS64GPEVM
Hi,
I want to toggle gpios using sysfs interface but i cannot find gpio number that i should use to export it in linux.
I am using the following formula to find the gpio number --> "N*32 + n"
for example for gpio_0_40 --> which is N17 it should be 12*32+17 = 401 (where N=12)
But for some gpios i am getting the following error -->
root@am64xx-evm:/sys/class/gpio# echo 595 > export
[ 1531.564597] ------------[ cut here ]------------
[ 1531.569256] invalid GPIO 595
[ 1531.572183] WARNING: CPU: 0 PID: 867 at drivers/gpio/gpiolib.c:122 gpio_to_desc+0xb0/0x100
[ 1531.580427] Modules linked in:
[ 1531.583482] CPU: 0 PID: 867 Comm: sh Not tainted 5.10.41-g4c2eade9f7 #1
[ 1531.590080] Hardware name: Texas Instruments AM642 EVM (DT)
[ 1531.595641] pstate: 40000005 (nZcv daif -PAN -UAO -TCO BTYPE=--)
[ 1531.601635] pc : gpio_to_desc+0xb0/0x100
[ 1531.605546] lr : gpio_to_desc+0xb0/0x100
[ 1531.609455] sp : ffff80001748fc40
[ 1531.612759] x29: ffff80001748fc40 x28: ffff0000368a2a00
[ 1531.618062] x27: 0000000000000000 x26: 0000000000000000
[ 1531.623363] x25: 0000000000000000 x24: ffff0000264efd20
[ 1531.628665] x23: ffff80001748fd78 x22: fffffffffffffff2
[ 1531.633967] x21: ffff8000112d3760 x20: 0000000000000253
[ 1531.639270] x19: 0000000000000000 x18: 0000000000000010
[ 1531.644572] x17: 0000000000000000 x16: 0000000000000000
[ 1531.649874] x15: ffff0000368a2f30 x14: 000000000000015e
[ 1531.655176] x13: ffff0000368a2f30 x12: 00000000ffffffea
[ 1531.660478] x11: ffff8000111ba360 x10: ffff8000111a2320
[ 1531.665780] x9 : ffff8000111a2378 x8 : 0000000000017fe8
[ 1531.671082] x7 : c0000000ffffefff x6 : 0000000000000001
[ 1531.676383] x5 : ffff00007fce1aa8 x4 : 0000000000000000
[ 1531.681686] x3 : 0000000000000027 x2 : 0000000000000023
[ 1531.686988] x1 : b4736ce9c01b2900 x0 : 0000000000000000
[ 1531.692291] Call trace:
[ 1531.694731] gpio_to_desc+0xb0/0x100
[ 1531.698299] export_store+0x44/0x178
[ 1531.701868] class_attr_store+0x1c/0x30
[ 1531.705696] sysfs_kf_write+0x44/0x58
[ 1531.709347] kernfs_fop_write_iter+0x118/0x1a8
[ 1531.713780] new_sync_write+0xe8/0x188
[ 1531.717520] vfs_write+0x234/0x368
[ 1531.720911] ksys_write+0x6c/0xf8
[ 1531.724217] __arm64_sys_write+0x1c/0x28
[ 1531.728133] el0_svc_common.constprop.0+0x78/0x1a0
[ 1531.732911] do_el0_svc+0x24/0x90
[ 1531.736220] el0_svc+0x14/0x20
[ 1531.739265] el0_sync_handler+0xb0/0xb8
[ 1531.743092] el0_sync+0x180/0x1c0
[ 1531.746397] ---[ end trace 421986fec6dc28d6 ]---
[ 1531.751053] export_store: invalid GPIO 595
-sh: echo: write error: Invalid argument
root@am64xx-evm:/sys/class/gpio# echo 626 > export
[ 1570.468650] ------------[ cut here ]------------
[ 1570.473317] invalid GPIO 626
[ 1570.476244] WARNING: CPU: 1 PID: 867 at drivers/gpio/gpiolib.c:122 gpio_to_desc+0xb0/0x100
[ 1570.484488] Modules linked in:
[ 1570.487544] CPU: 1 PID: 867 Comm: sh Tainted: G W 5.10.41-g4c2eade9f7 #1
[ 1570.495528] Hardware name: Texas Instruments AM642 EVM (DT)
[ 1570.501089] pstate: 40000005 (nZcv daif -PAN -UAO -TCO BTYPE=--)
[ 1570.507082] pc : gpio_to_desc+0xb0/0x100
[ 1570.510994] lr : gpio_to_desc+0xb0/0x100
[ 1570.514904] sp : ffff80001748fc40
[ 1570.518207] x29: ffff80001748fc40 x28: ffff0000368a2a00
[ 1570.523510] x27: 0000000000000000 x26: 0000000000000000
[ 1570.528813] x25: 0000000000000000 x24: ffff00002703f520
[ 1570.534115] x23: ffff80001748fd78 x22: fffffffffffffff2
[ 1570.539417] x21: ffff8000112d3760 x20: 0000000000000272
[ 1570.544719] x19: 0000000000000000 x18: 0000000000000010
[ 1570.550021] x17: 0000000000000000 x16: 0000000000000000
[ 1570.555323] x15: ffff0000368a2f30 x14: 0000000000000188
[ 1570.560625] x13: ffff0000368a2f30 x12: 00000000ffffffea
[ 1570.565927] x11: ffff8000111ba360 x10: ffff8000111a2320
[ 1570.571229] x9 : ffff8000111a2378 x8 : 0000000000017fe8
[ 1570.576531] x7 : c0000000ffffefff x6 : 0000000000000001
[ 1570.581833] x5 : ffff00007fd01aa8 x4 : 0000000000000000
[ 1570.587134] x3 : 0000000000000027 x2 : 0000000000000023
[ 1570.592436] x1 : b4736ce9c01b2900 x0 : 0000000000000000
[ 1570.597739] Call trace:
[ 1570.600178] gpio_to_desc+0xb0/0x100
[ 1570.603746] export_store+0x44/0x178
[ 1570.607316] class_attr_store+0x1c/0x30
[ 1570.611144] sysfs_kf_write+0x44/0x58
[ 1570.614796] kernfs_fop_write_iter+0x118/0x1a8
[ 1570.619229] new_sync_write+0xe8/0x188
[ 1570.622967] vfs_write+0x234/0x368
[ 1570.626359] ksys_write+0x6c/0xf8
[ 1570.629663] __arm64_sys_write+0x1c/0x28
[ 1570.633579] el0_svc_common.constprop.0+0x78/0x1a0
[ 1570.638357] do_el0_svc+0x24/0x90
[ 1570.641666] el0_svc+0x14/0x20
[ 1570.644712] el0_sync_handler+0xb0/0xb8
[ 1570.648538] el0_sync+0x180/0x1c0
[ 1570.651843] ---[ end trace 421986fec6dc28d7 ]---
[ 1570.656532] export_store: invalid GPIO 626
-sh: echo: write error: Invalid argument
Am i doing something wrong ?