Tool/software: Linux
Hi,
a customer notices the non-deterministic mapping of physical gpioX_Y to /sys/class/gpio/gpiochipXXX virtual files. In previous kernels like Linux 4.1 there was a deterministic mapping. But if one looks at the mapping in Linux 4.4, the mapping to physical address of GPIO modules seems to be random.
root@am57xx-evm:~# ls -l /sys/class/gpio/
--w------- 1 root root 4096 Mar 30 00:56 export
lrwxrwxrwx 1 root root 0 Mar 30 00:56 gpiochip0 -> ../../devices/platform/44000000.ocp/4ae10000.gpio/gpio/gpiochip0
lrwxrwxrwx 1 root root 0 Mar 30 00:56 gpiochip128 -> ../../devices/platform/44000000.ocp/4805b000.gpio/gpio/gpiochip128
lrwxrwxrwx 1 root root 0 Mar 30 00:56 gpiochip160 -> ../../devices/platform/44000000.ocp/4805d000.gpio/gpio/gpiochip160
lrwxrwxrwx 1 root root 0 Mar 30 00:56 gpiochip192 -> ../../devices/platform/44000000.ocp/48051000.gpio/gpio/gpiochip192
lrwxrwxrwx 1 root root 0 Mar 30 00:56 gpiochip224 -> ../../devices/platform/44000000.ocp/48053000.gpio/gpio/gpiochip224
lrwxrwxrwx 1 root root 0 Mar 30 00:56 gpiochip32 -> ../../devices/platform/44000000.ocp/48055000.gpio/gpio/gpiochip32
lrwxrwxrwx 1 root root 0 Mar 30 00:56 gpiochip504 -> ../../devices/platform/44000000.ocp/48070000.i2c/i2c-0/0-0058/48070000.i2c:tps659038@58:tps659038_gpio/gpio/gpiochip504
lrwxrwxrwx 1 root root 0 Mar 30 00:56 gpiochip64 -> ../../devices/platform/44000000.ocp/48057000.gpio/gpio/gpiochip64
lrwxrwxrwx 1 root root 0 Mar 30 00:56 gpiochip96 -> ../../devices/platform/44000000.ocp/48059000.gpio/gpio/gpiochip96
--w------- 1 root root 4096 Mar 30 00:56 unexport
Could you help me understand how the allocation happens? Is it dynamic? How does one know what the mapping is beforehand to know what needs to be exported when toggling GPIO thru the sysfs interface?
Thanks,
--Gunter