GPIO export and device tree overlay on boot.


I encountered the following behavior (an issue for me) while working with PRUs, device trees overlays and the gpio export filesystem.

I guess this is a kernel related problem to the filesystem drivers in /sys/class/gpio/export, I have a stable-4.4-bone-rt kernel on a debian.

when I define a custom boot configuration, for example two gpios of the peripheral gpio2 they get correctly configured as outputs and the PRU normally manages them (or other process that access to the gpio2 peripheral through memory mapping) until I export another GPIO from the same peripheral (gpio2) but another gpio. It’s like if they are all reset to inputs during the export ignoring the initial device tree configuration.
I discovered thsi while using BeagleG + Adafruit python library (that uses internally the filesystem exports) and what I found was that the dto configuration gets overridden during the export.
What I did to solve the problem was a simple script that exported for each peripheral the first gpio solving the issue.

Is this meant to be like that? Shouldn’t the kernel respect the dto configuration?