GPIO8 on Apalis i.MX6

I want to use GPIO8 (Apalis name) / gpio6 (Linux name) for a touchscreen on a custom carrier board. I adjusted the device tree and have a kernel module for touchscreen implementation.

It works fine but only if I unexport gpio6 first. Is gpio6 used in some configuration or driver during linux boot?
On a clean Linux install I get:

root@apalis-imx6:~# cat /sys/kernel/debug/gpio
gpiochip0: GPIOs 0-31, parent: platform/209c000.gpio, 209c000.gpio:
 gpio-0   (                    |usb_host_vbus       ) out hi
 gpio-6   (                    |sysfs               ) in  hi
 gpio-25  (                    |phy-reset           ) out hi

gpiochip1: GPIOs 32-63, parent: platform/20a0000.gpio, 20a0000.gpio:
 gpio-38  (                    |sysfs               ) in  hi
 gpio-39  (                    |sysfs               ) in  hi

gpiochip2: GPIOs 64-95, parent: platform/20a4000.gpio, 20a4000.gpio:
 gpio-77  (                    |enable              ) out hi
 gpio-86  (                    |usb_otg_vbus        ) out lo
 gpio-92  (                    |usb_host_vbus_hub   ) out hi

gpiochip3: GPIOs 96-127, parent: platform/20a8000.gpio, 20a8000.gpio:
 gpio-116 (                    |cd                  ) in  lo

gpiochip4: GPIOs 128-159, parent: platform/20ac000.gpio, 20ac000.gpio:

gpiochip5: GPIOs 160-191, parent: platform/20b0000.gpio, 20b0000.gpio:

gpiochip6: GPIOs 192-223, parent: platform/20b4000.gpio, 20b4000.gpio:

For the kernel module to work I had to add a “gpio_free()” before my “gpio_request()”. I would like to know why the gpio was exported in the first place and if it’s ok to just free the gpio?

Hi

We export all GPIOs which are not assigned internally to our demo images pinout with the package built from this recipe. This is done with a systemd service which executes this script during boot.

If you do not need any exporting remove the package from the image recipe. Alternatively adapt the script to your needs.

Max